diff --git a/build/globals/api-min.js b/build/globals/api-min.js index db0d9e8..41e5e48 100644 --- a/build/globals/api-min.js +++ b/build/globals/api-min.js @@ -1,2 +1,2 @@ -this.launchpad=this.launchpad||{},this.launchpadNamed=this.launchpadNamed||{},function(e){var t=e.babelHelpers={};t.classCallCheck=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},t.createClass=function(){function e(e,t){for(var n=0;n>>0),e.uniqueIdCounter_=1,this.launchpad.core=e}.call(this),function(){var e=function(){function e(){babelHelpers.classCallCheck(this,e)}return babelHelpers.createClass(e,[{key:"send",value:function(){}}]),e}();this.launchpad.Transport=e}.call(this),function(){var e=this.launchpad.core,t=function(){};t.prototype.then=function(){},t.IMPLEMENTED_BY_PROP="$goog_Thenable",t.addImplementation=function(e){e.prototype.then=e.prototype.then,e.prototype.$goog_Thenable=!0},t.isImplementedBy=function(e){if(!e)return!1;try{return!!e.$goog_Thenable}catch(t){return!1}};var n=function(e){var t=Array.prototype.slice.call(arguments,1);return function(){var n=t.slice();return n.push.apply(n,arguments),e.apply(this,n)}},r={};r.throwException=function(e){r.nextTick(function(){throw e})},r.run=function(e,t){r.run.workQueueScheduled_||(r.nextTick(r.run.processWorkQueue),r.run.workQueueScheduled_=!0),r.run.workQueue_.push(new r.run.WorkItem_(e,t))},r.run.workQueueScheduled_=!1,r.run.workQueue_=[],r.run.processWorkQueue=function(){for(;r.run.workQueue_.length;){var e=r.run.workQueue_;r.run.workQueue_=[];for(var t=0;t0?this.unhandledRejectionId_=0:0===i.UNHANDLED_REJECTION_DELAY&&(this.hadUnhandledRejection_=!1);try{var n=this;e.call(t,function(e){n.resolve_(i.State_.FULFILLED,e)},function(e){n.resolve_(i.State_.REJECTED,e)})}catch(r){this.resolve_(i.State_.REJECTED,r)}};a.UNHANDLED_REJECTION_DELAY=0,a.State_={PENDING:0,BLOCKED:1,FULFILLED:2,REJECTED:3},a.CallbackEntry_=null,a.resolve=function(e){return new a(function(t){t(e)})},a.reject=function(e){return new a(function(t,n){n(e)})},a.race=function(e){return new a(function(t,n){e.length||t(void 0);for(var r,a=0;r=e[a];a++)r.then(t,n)})},a.all=function(e){return new a(function(t,r){var a=e.length,i=[];if(!a)return void t(i);for(var s,u=function(e,n){a--,i[e]=n,0===a&&t(i)},o=function(e){r(e)},l=0;s=e[l];l++)s.then(n(u,l),o)})},a.firstFulfilled=function(e){return new a(function(t,r){var a=e.length,i=[];if(!a)return void t(void 0);for(var s,u=function(e){t(e)},o=function(e,t){a--,i[e]=t,0===a&&r(i)},l=0;s=e[l];l++)s.then(u,n(o,l))})},a.prototype.then=function(t,n,r){return this.addChildPromise_(e.isFunction(t)?t:null,e.isFunction(n)?n:null,r)},t.addImplementation(a),a.prototype.thenAlways=function(e,t){var n=function(){try{e.call(t)}catch(n){a.handleRejection_.call(null,n)}};return this.addCallbackEntry_({child:null,onRejected:n,onFulfilled:n}),this},a.prototype.thenCatch=function(e,t){return this.addChildPromise_(null,e,t)},a.prototype["catch"]=a.prototype.thenCatch,a.prototype.cancel=function(e){this.state_===a.State_.PENDING&&r.run(function(){var t=new a.CancellationError(e);this.cancelInternal_(t)},this)},a.prototype.cancelInternal_=function(e){this.state_===a.State_.PENDING&&(this.parent_?this.parent_.cancelChild_(this,e):this.resolve_(a.State_.REJECTED,e))},a.prototype.cancelChild_=function(e,t){if(this.callbackEntries_){for(var n,r=0,i=-1,s=0;n=this.callbackEntries_[s];s++){var u=n.child;if(u&&(r++,u===e&&(i=s),i>=0&&r>1))break}if(i>=0)if(this.state_===a.State_.PENDING&&1===r)this.cancelInternal_(t);else{var o=this.callbackEntries_.splice(i,1)[0];this.executeCallback_(o,a.State_.REJECTED,t)}}},a.prototype.addCallbackEntry_=function(e){this.callbackEntries_&&this.callbackEntries_.length||this.state_!==a.State_.FULFILLED&&this.state_!==a.State_.REJECTED||this.scheduleCallbacks_(),this.callbackEntries_||(this.callbackEntries_=[]),this.callbackEntries_.push(e)},a.prototype.addChildPromise_=function(t,n,r){var i={child:null,onFulfilled:null,onRejected:null};return i.child=new a(function(s,u){i.onFulfilled=t?function(e){try{var n=t.call(r,e);s(n)}catch(a){u(a)}}:s,i.onRejected=n?function(t){try{var i=n.call(r,t);!e.isDef(i)&&t instanceof a.CancellationError?u(t):s(i)}catch(o){u(o)}}:u}),i.child.parent_=this,this.addCallbackEntry_(i),i.child},a.prototype.unblockAndFulfill_=function(e){if(this.state_!==a.State_.BLOCKED)throw new Error("CancellablePromise is not blocked.");this.state_=a.State_.PENDING,this.resolve_(a.State_.FULFILLED,e)},a.prototype.unblockAndReject_=function(e){if(this.state_!==a.State_.BLOCKED)throw new Error("CancellablePromise is not blocked.");this.state_=a.State_.PENDING,this.resolve_(a.State_.REJECTED,e)},a.prototype.resolve_=function(n,r){if(this.state_===a.State_.PENDING){if(this===r)n=a.State_.REJECTED,r=new TypeError("CancellablePromise cannot resolve to itself");else{if(t.isImplementedBy(r))return r=r,this.state_=a.State_.BLOCKED,void r.then(this.unblockAndFulfill_,this.unblockAndReject_,this);if(e.isObject(r))try{var i=r.then;if(e.isFunction(i))return void this.tryThen_(r,i)}catch(s){n=a.State_.REJECTED,r=s}}this.result_=r,this.state_=n,this.scheduleCallbacks_(),n!==a.State_.REJECTED||r instanceof a.CancellationError||a.addUnhandledRejection_(this,r)}},a.prototype.tryThen_=function(e,t){this.state_=a.State_.BLOCKED;var n=this,r=!1,i=function(e){r||(r=!0,n.unblockAndFulfill_(e))},s=function(e){r||(r=!0,n.unblockAndReject_(e))};try{t.call(e,i,s)}catch(u){s(u)}},a.prototype.scheduleCallbacks_=function(){this.executing_||(this.executing_=!0,r.run(this.executeCallbacks_,this))},a.prototype.executeCallbacks_=function(){for(;this.callbackEntries_&&this.callbackEntries_.length;){var e=this.callbackEntries_;this.callbackEntries_=[];for(var t=0;t0)for(e=this;e&&e.unhandledRejectionId_;e=e.parent_)clearTimeout(e.unhandledRejectionId_),e.unhandledRejectionId_=0;else if(0===a.UNHANDLED_REJECTION_DELAY)for(e=this;e&&e.hadUnhandledRejection_;e=e.parent_)e.hadUnhandledRejection_=!1},a.addUnhandledRejection_=function(e,t){a.UNHANDLED_REJECTION_DELAY>0?e.unhandledRejectionId_=setTimeout(function(){a.handleRejection_.call(null,t)},a.UNHANDLED_REJECTION_DELAY):0===a.UNHANDLED_REJECTION_DELAY&&(e.hadUnhandledRejection_=!0,r.run(function(){e.hadUnhandledRejection_&&a.handleRejection_.call(null,t)}))},a.handleRejection_=r.throwException,a.setUnhandledRejectionHandler=function(e){a.handleRejection_=e},a.CancellationError=function(e){function t(e){babelHelpers.classCallCheck(this,t);var n=babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(t).call(this,e));return e&&(n.message=e),n}return babelHelpers.inherits(t,e),t}(Error),a.CancellationError.prototype.name="cancel","undefined"==typeof window.Promise&&(window.Promise=a),this.launchpadNamed.Promise={},this.launchpadNamed.Promise.CancellablePromise=a,this.launchpadNamed.Promise.async=r}.call(this),function(){var e=this.launchpad.core,t=this.launchpadNamed.Promise.CancellablePromise,n=function(){function n(){babelHelpers.classCallCheck(this,n)}return babelHelpers.createClass(n,null,[{key:"addParametersToUrlQueryString",value:function(e,t){var n="";return t.names().forEach(function(e){t.getAll(e).forEach(function(t){n+=e+"="+encodeURIComponent(t)+"&"})}),n=n.slice(0,-1),n&&(e+=e.indexOf("?")>-1?"&":"?",e+=n),e}},{key:"joinPaths",value:function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;t>r;r++)n[r-1]=arguments[r];return"/"===e.charAt(e.length-1)&&(e=e.substring(0,e.length-1)),n=n.map(function(e){return"/"===e.charAt(0)?e.substring(1):e}),[e].concat(n).join("/").replace(/\/$/,"")}},{key:"parseResponseHeaders",value:function(e){var t=[];if(!e)return t;for(var n=e.split("\r\n"),r=0;r0){var i=n[r].substring(0,a),s=n[r].substring(a+2);t.push({name:i,value:s})}}return t}},{key:"parseUrl",value:function(e){var t,n,r,a=e.indexOf("//");a>-1&&(e=e.substring(a+2));var i=e.indexOf("/");-1===i&&(e+="/",i=e.length-1),t=e.substring(0,i),n=e.substring(i);var s=n.indexOf("?");return s>-1?(r=n.substring(s,n.length),n=n.substring(0,s)):r="",[t,n,r]}},{key:"request",value:function r(a,i,s,u,o,l,c){var r=new XMLHttpRequest,h=new t(function(e,t){r.onload=function(){return r.aborted?void r.onerror():void e(r)},r.onerror=function(){var e=new Error("Request error");e.request=r,t(e)}}).thenCatch(function(e){throw r.abort(),e}).thenAlways(function(){clearTimeout(f)});if(o&&(a=n.addParametersToUrlQueryString(a,o)),r.open(i,a,!c),u&&u.names().forEach(function(e){r.setRequestHeader(e,u.getAll(e).join(", "))}),r.send(e.isDef(s)?s:null),e.isDefAndNotNull(l))var f=setTimeout(function(){h.cancel("Request timeout")},l);return h}}]),n}();this.launchpad.Ajax=n}.call(this),function(){var e=function(){function e(){babelHelpers.classCallCheck(this,e),this.disposed_=!1}return babelHelpers.createClass(e,[{key:"dispose",value:function(){this.disposed_||(this.disposeInternal(),this.disposed_=!0)}},{key:"disposeInternal",value:function(){}},{key:"isDisposed",value:function(){return this.disposed_}}]),e}();this.launchpad.Disposable=e}.call(this),function(){var e=this.launchpad.Disposable,t=function(e){function t(){babelHelpers.classCallCheck(this,t);var e=babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(t).call(this));return e.keys={},e.values={},e}return babelHelpers.inherits(t,e),babelHelpers.createClass(t,[{key:"add",value:function(e,t){return this.keys[e.toLowerCase()]=e,this.values[e.toLowerCase()]=this.values[e.toLowerCase()]||[],this.values[e.toLowerCase()].push(t),this}},{key:"clear",value:function(){return this.keys={},this.values={},this}},{key:"contains",value:function(e){return e.toLowerCase()in this.values}},{key:"disposeInternal",value:function(){this.values=null}},{key:"get",value:function(e){var t=this.values[e.toLowerCase()];return t?t[0]:void 0}},{key:"getAll",value:function(e){return this.values[e.toLowerCase()]}},{key:"isEmpty",value:function(){return 0===this.size()}},{key:"names",value:function(){var e=this;return Object.keys(this.values).map(function(t){return e.keys[t]})}},{key:"remove",value:function(e){return delete this.keys[e.toLowerCase()],delete this.values[e.toLowerCase()],this}},{key:"set",value:function(e,t){return this.keys[e.toLowerCase()]=e,this.values[e.toLowerCase()]=[t],this}},{key:"size",value:function(){return this.names().length}},{key:"toString",value:function(){return JSON.stringify(this.values)}}]),t}(e);this.launchpad.MultiMap=t}.call(this),function(){var e=this.launchpad.core,t=this.launchpad.MultiMap,n=function(){function n(){babelHelpers.classCallCheck(this,n),this.headers_=new t}return babelHelpers.createClass(n,[{key:"body",value:function(t){return e.isDef(t)?(this.body_=t,this):this.body_}},{key:"header",value:function(e,t){if(2!==arguments.length)throw new Error("Invalid arguments");return this.headers_.set(e,t),this}},{key:"headers",value:function(n){return e.isDef(n)?(n instanceof t?this.headers_=n:this.headers_.values=n,n):this.headers_}},{key:"removeBody",value:function(){this.body_=void 0}}]),n}();this.launchpad.ClientMessage=n}.call(this),function(){var e=this.launchpad.core,t=this.launchpad.ClientMessage,n=function(t){function n(e){babelHelpers.classCallCheck(this,n);var t=babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(n).call(this));if(!e)throw new Error("Can't create response without request");return t.clientRequest_=e,t}return babelHelpers.inherits(n,t),babelHelpers.createClass(n,[{key:"request",value:function(){return this.clientRequest_}},{key:"statusCode",value:function(t){return e.isDef(t)?(this.statusCode_=t,this):this.statusCode_}},{key:"statusText",value:function(t){return e.isDef(t)?(this.statusText_=t,this):this.statusText_}},{key:"succeeded",value:function(){return this.statusCode()>=200&&this.statusCode()<=399}}]),n}(t);this.launchpad.ClientResponse=n}.call(this),function(){var e=(this.launchpad.core,this.launchpad.Transport),t=this.launchpad.Ajax,n=this.launchpad.ClientResponse,r=(this.launchpadNamed.Promise.CancellablePromise,function(e){function r(){return babelHelpers.classCallCheck(this,r),babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(r).apply(this,arguments))}return babelHelpers.inherits(r,e),babelHelpers.createClass(r,[{key:"send",value:function(e){var r=t.request(e.url(),e.method(),e.body(),e.headers(),e.params(),null,!1);return r.then(function(r){var a=new n(e);return a.body(r.responseText),a.statusCode(r.status),a.statusText(r.statusText),t.parseResponseHeaders(r.getAllResponseHeaders()).forEach(function(e){a.header(e.name,e.value)}),a})}}]),r}(e));this.launchpad.AjaxTransport=r}.call(this),function(){var e=this.launchpad.core,t=function(){function t(n){var r=arguments.length<=1||void 0===arguments[1]?null:arguments[1];babelHelpers.classCallCheck(this,t),this.token_=e.isString(r)?null:n,this.username_=e.isString(r)?n:null,this.password_=r}return babelHelpers.createClass(t,[{key:"hasPassword",value:function(){return null!==this.password_}},{key:"hasToken",value:function(){return null!==this.token_}},{key:"hasUsername",value:function(){return null!==this.username_}},{key:"password",value:function(){return this.password_}},{key:"token",value:function(){return this.token_}},{key:"username",value:function(){return this.username_}}],[{key:"create",value:function(e,n){return new t(e,n)}}]),t}();this.launchpad.Auth=t}.call(this),function(){var e=this.launchpad.core,t=this.launchpad.ClientMessage,n=this.launchpad.MultiMap,r=function(t){function r(){babelHelpers.classCallCheck(this,r);var e=babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(r).call(this));return e.params_=new n,e}return babelHelpers.inherits(r,t),babelHelpers.createClass(r,[{key:"method",value:function(t){return e.isDef(t)?(this.method_=t,this):this.method_||r.DEFAULT_METHOD}},{key:"param",value:function(e,t){if(2!==arguments.length)throw new Error("Invalid arguments");return this.params_.set(e,t),this}},{key:"params",value:function(t){return e.isDef(t)?(t instanceof n?this.params_=t:this.params_.values=t,t):this.params_}},{key:"url",value:function(t){return e.isDef(t)?(this.url_=t,this):this.url_}}]),r}(t);r.DEFAULT_METHOD="GET",this.launchpad.ClientRequest=r}.call(this),function(){var e=function(){function e(){babelHelpers.classCallCheck(this,e),this.body_={}}return babelHelpers.createClass(e,[{key:"body",value:function(){return this.body_}},{key:"toString",value:function(){return JSON.stringify(this.body())}}],[{key:"toBody",value:function(t){return t instanceof e?t.body():t}}]),e}();this.launchpad.Embodied=e}.call(this),function(){var e=this.launchpad.core,t=this.launchpad.Embodied,n=function(){function n(r,a,i){babelHelpers.classCallCheck(this,n);var s={operator:e.isDef(i)?a:"="},u=e.isDef(i)?i:a;e.isDefAndNotNull(u)&&(u instanceof t&&(u=u.body()),s.value=u),this.createBody_(r,s)}return babelHelpers.createClass(n,[{key:"add",value:function(e,t){t?this.addArrayOperator_(e,t):this.createBody_(e,this.body_)}},{key:"addArrayOperator_",value:function(e,t){this.body_[e]instanceof Array||this.createBody_(e,[this.body_]),this.body_[e].push(t.body())}},{key:"addMany",value:function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;t>r;r++)n[r-1]=arguments[r];for(var a=0;ar;r++)n[r]=arguments[r];return new(Function.prototype.bind.apply(e.Line,[null].concat(n)))}},{key:"point",value:function(t,n){return new e.Point(t,n)}},{key:"polygon",value:function(){for(var t=arguments.length,n=Array(t),r=0;t>r;r++)n[r]=arguments[r];return new(Function.prototype.bind.apply(e.Polygon,[null].concat(n)))}}]),e}(),n=function(e){function t(e,n){babelHelpers.classCallCheck(this,t);var r=babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(t).call(this));return r.body_=[e,n],r}return babelHelpers.inherits(t,e),t}(e);t.Point=n;var r=function(t){function n(){babelHelpers.classCallCheck(this,n);for(var t=babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(n).call(this)),r=arguments.length,a=Array(r),i=0;r>i;i++)a[i]=arguments[i];return t.body_={type:"linestring",coordinates:a.map(function(t){return e.toBody(t)})},t}return babelHelpers.inherits(n,t),n}(e);t.Line=r;var a=function(t){function n(t,r){babelHelpers.classCallCheck(this,n);var a=babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(n).call(this));return a.body_={type:"envelope",coordinates:[e.toBody(t),e.toBody(r)]},a}return babelHelpers.inherits(n,t),babelHelpers.createClass(n,[{key:"getPoints",value:function(){return this.body_.coordinates}}]),n}(e);t.BoundingBox=a;var i=function(t){function n(t,r){babelHelpers.classCallCheck(this,n);var a=babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(n).call(this));return a.body_={type:"circle",coordinates:e.toBody(t),radius:r},a}return babelHelpers.inherits(n,t),babelHelpers.createClass(n,[{key:"getCenter",value:function(){return this.body_.coordinates}},{key:"getRadius",value:function(){return this.body_.radius}}]),n}(e);t.Circle=i;var s=function(t){function n(){babelHelpers.classCallCheck(this,n);var e=babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(n).call(this));return e.body_={type:"polygon",coordinates:[]},e.addCoordinates_.apply(e,arguments),e}return babelHelpers.inherits(n,t),babelHelpers.createClass(n,[{key:"addCoordinates_",value:function(){for(var t=arguments.length,n=Array(t),r=0;t>r;r++)n[r]=arguments[r];this.body_.coordinates.push(n.map(function(t){return e.toBody(t)}))}},{key:"hole",value:function(){return this.addCoordinates_.apply(this,arguments),this}}]),n}(e);t.Polygon=s,this.launchpad.Geo=t}.call(this),function(){var e=this.launchpad.core,t=this.launchpad.Embodied,n=function(t){function n(t,r){babelHelpers.classCallCheck(this,n);var a=babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(n).call(this));return e.isDefAndNotNull(t)&&(a.body_.from=t),e.isDefAndNotNull(r)&&(a.body_.to=r),a}return babelHelpers.inherits(n,t),babelHelpers.createClass(n,null,[{key:"from",value:function(e){return new n(e)}},{key:"range",value:function(e,t){return new n(e,t)}},{key:"to",value:function(e){return new n(null,e)}}]),n}(t);this.launchpad.Range=n}.call(this),function(){var e=this.launchpad.core,t=this.launchpad.Embodied,n=this.launchpad.FilterBody,r=this.launchpad.Geo,a=this.launchpad.Range,i=function(i){function s(e,t,r){babelHelpers.classCallCheck(this,s);var a=babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(s).call(this));return a.body_=new n(e,t,r),a}return babelHelpers.inherits(s,i),babelHelpers.createClass(s,[{key:"add",value:function(e,t,n,r){var a=t?s.toFilter(t,n,r):null;return this.body_.add(e,a),this}},{key:"addMany",value:function(e){for(var t,n=arguments.length,r=Array(n>1?n-1:0),a=1;n>a;a++)r[a-1]=arguments[a];return(t=this.body_).addMany.apply(t,[e].concat(r)),this}},{key:"and",value:function(e,t,n){return this.add("and",e,t,n)}},{key:"body",value:function(){return this.body_.getObject()}},{key:"or",value:function(e,t,n){return this.add("or",e,t,n)}}],[{key:"any",value:function(e){var t=Array.prototype.slice.call(arguments,1);return 1===t.length&&t[0]instanceof Array&&(t=t[0]),new s(e,"any",t)}},{key:"boundingBox",value:function(e,t,n){return t instanceof r.BoundingBox?s.polygon.apply(s,[e].concat(babelHelpers.toConsumableArray(t.getPoints()))):s.polygon(e,t,n)}},{key:"distance",value:function(e,t,n){var i=t,u=n;return t instanceof r.Circle?(i=t.getCenter(),u=a.to(t.getRadius())):n instanceof a||(u=a.to(n)),s.distanceInternal_(e,i,u)}},{key:"distanceInternal_",value:function(e,n,r){var a={location:t.toBody(n)};return r=r.body(),r.from&&(a.min=r.from),r.to&&(a.max=r.to),s.field(e,"gd",a)}},{key:"equal",value:function(e,t){return new s(e,"=",t)}},{key:"exists",value:function(e){return s.field(e,"exists",null)}},{key:"fuzzy",value:function(e,t,n){return s.fuzzyInternal_("fuzzy",e,t,n)}},{key:"fuzzyInternal_",value:function(t,n,r,a){var i=e.isString(r),u={query:i?r:n},o=i?a:r;o&&(u.fuzziness=o);var l=i?n:s.ALL;return s.field(l,t,u)}},{key:"gt",value:function(e,t){return new s(e,">",t)}},{key:"gte",value:function(e,t){return new s(e,">=",t)}},{key:"match",value:function(t,n){var r=e.isString(n)?t:s.ALL,a=e.isString(n)?n:t;return s.field(r,"match",a)}},{key:"missing",value:function(e){return s.field(e,"missing",null)}},{key:"phrase",value:function(t,n){var r=e.isString(n)?t:s.ALL,a=e.isString(n)?n:t;return s.field(r,"phrase",a)}},{key:"polygon",value:function(e){for(var n=arguments.length,r=Array(n>1?n-1:0),a=1;n>a;a++)r[a-1]=arguments[a];return r=r.map(function(e){return t.toBody(e)}),s.field(e,"gp",r)}},{key:"prefix",value:function(e,t){var n=t?e:s.ALL,r=t?t:e;return s.field(n,"prefix",r)}},{key:"range",value:function u(e,t,n){var u=t;return u instanceof a||(u=a.range(t,n)),s.field(e,"range",u)}},{key:"regex",value:function(e,t){return new s(e,"~",t)}},{key:"shape",value:function(e){for(var n=arguments.length,r=Array(n>1?n-1:0),a=1;n>a;a++)r[a-1]=arguments[a];r=r.map(function(e){return t.toBody(e)});var i={type:"geometrycollection",geometries:r};return s.field(e,"gs",i)}},{key:"similar",value:function(t,n){var r=e.isString(n)?t:s.ALL,a={query:e.isString(n)?n:t};return s.field(r,"similar",a)}},{key:"lt",value:function(e,t){return new s(e,"<",t)}},{key:"lte",value:function(e,t){return new s(e,"<=",t)}},{key:"none",value:function(e){var t=Array.prototype.slice.call(arguments,1);return 1===t.length&&t[0]instanceof Array&&(t=t[0]),new s(e,"none",t)}},{key:"notEqual",value:function(e,t){return new s(e,"!=",t)}},{key:"not",value:function(e,t,n){return s.toFilter(e,t,n).add("not")}},{key:"field",value:function(e,t,n){return new s(e,t,n)}},{key:"toFilter",value:function(e,t,n){var r=e;return r instanceof s||(r=s.field(e,t,n)),r}}]),s}(t);i.ALL="*",this.launchpad.Filter=i}.call(this),function(){var e=this.launchpad.Embodied,t=this.launchpad.Range,n=function(){function e(t,n,r){babelHelpers.classCallCheck(this,e),this.field_=t,this.operator_=n,this.value_=r}return babelHelpers.createClass(e,[{key:"getField",value:function(){return this.field_}},{key:"getOperator",value:function(){return this.operator_}},{key:"getValue",value:function(){return this.value_}}],[{key:"avg",value:function(t){return e.field(t,"avg")}},{key:"count",value:function(t){return e.field(t,"count")}},{key:"distance",value:function(t,n){for(var r=arguments.length,a=Array(r>2?r-2:0),i=2;r>i;i++)a[i-2]=arguments[i];return new(Function.prototype.bind.apply(e.DistanceAggregation,[null].concat([t,n],a)))}},{key:"extendedStats",value:function(t){return e.field(t,"extendedStats")}},{key:"histogram",value:function(t,n){return new e(t,"histogram",n)}},{key:"max",value:function(t){return e.field(t,"max")}},{key:"min",value:function(t){return e.field(t,"min")}},{key:"missing",value:function(t){return e.field(t,"missing")}},{key:"field",value:function(t,n){return new e(t,n)}},{key:"range",value:function(t){for(var n=arguments.length,r=Array(n>1?n-1:0),a=1;n>a;a++)r[a-1]=arguments[a];return new(Function.prototype.bind.apply(e.RangeAggregation,[null].concat([t],r)))}},{key:"stats",value:function(t){return e.field(t,"stats")}},{key:"sum",value:function(t){return e.field(t,"sum")}},{key:"terms",value:function(t){return e.field(t,"terms")}}]),e}(),r=function(n){function r(t,n){babelHelpers.classCallCheck(this,r);var a=babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(r).call(this,t,"geoDistance",{}));a.value_.location=e.toBody(n);for(var i=arguments.length,s=Array(i>2?i-2:0),u=2;i>u;u++)s[u-2]=arguments[u];return a.value_.ranges=s.map(function(e){return e.body()}),a}return babelHelpers.inherits(r,n),babelHelpers.createClass(r,[{key:"range",value:function a(e,n){var a=e;return a instanceof t||(a=t.range(e,n)),this.value_.ranges.push(a.body()),this}},{key:"unit",value:function(e){return this.value_.unit=e,this}}]),r}(n);n.DistanceAggregation=r;var a=function(e){function n(e){babelHelpers.classCallCheck(this,n);for(var t=babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(n).call(this,e,"range")),r=arguments.length,a=Array(r>1?r-1:0),i=1;r>i;i++)a[i-1]=arguments[i];return t.value_=a.map(function(e){return e.body()}),t}return babelHelpers.inherits(n,e),babelHelpers.createClass(n,[{key:"range",value:function r(e,n){var r=e;return r instanceof t||(r=t.range(e,n)),this.value_.push(r.body()),this}}]),n}(n);n.RangeAggregation=a,this.launchpad.Aggregation=n}.call(this),function(){var e=this.launchpad.core,t=this.launchpad.Embodied,n=this.launchpad.Filter,r=this.launchpad.Aggregation,a=function(t){function a(){return babelHelpers.classCallCheck(this,a),babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(a).apply(this,arguments))}return babelHelpers.inherits(a,t),babelHelpers.createClass(a,[{key:"aggregate",value:function(t,n,a){var i=n;i instanceof r||(i=r.field(n,a));var s=i.getField(),u={};return u[s]={name:t,operator:i.getOperator()},e.isDefAndNotNull(i.getValue())&&(u[s].value=i.getValue()),this.body_.aggregation||(this.body_.aggregation=[]),this.body_.aggregation.push(u),this}},{key:"count",value:function(){return this.type("count")}},{key:"fetch",value:function(){return this.type("fetch")}},{key:"filter",value:function i(e,t,r){var i=n.toFilter(e,t,r);return this.body_.filter||(this.body_.filter=[]),this.body_.filter.push(i.body()),this}},{key:"offset",value:function(e){return this.body_.offset=e,this}},{key:"highlight",value:function(e){return this.body_.highlight||(this.body_.highlight=[]),this.body_.highlight.push(e),this}},{key:"limit",value:function(e){return this.body_.limit=e,this}},{key:"search",value:function(e,t,r){var a=e;return r?a=n.field(e,t,r):t?a=n.match(e,t):a instanceof n||(a=n.match(e)),this.body_.search||(this.body_.search=[]),this.body_.search.push(a.body()),this}},{key:"sort",value:function(e,t){this.body_.sort||(this.body_.sort=[]);var n={};return n[e]=t||"asc",this.body_.sort.push(n),this}},{key:"type",value:function(e){return this.body_.type=e,this}}],[{key:"aggregate",value:function(e,t,n){return(new a).aggregate(e,t,n)}},{key:"count",value:function(){return(new a).type("count")}},{key:"fetch",value:function(){return(new a).type("fetch")}},{key:"filter",value:function(e,t,n){return(new a).filter(e,t,n)}},{key:"offset",value:function(e){return(new a).offset(e)}},{key:"highlight",value:function(e){return(new a).highlight(e)}},{key:"limit",value:function(e){return(new a).limit(e)}},{key:"search",value:function(e,t,n){return(new a).search(e,t,n)}},{key:"sort",value:function(e,t){return(new a).sort(e,t)}},{key:"type",value:function(e){return(new a).type(e)}}]),a}(t);this.launchpad.Query=a}.call(this),function(){var e=this.launchpad.AjaxTransport,t=function(){function t(){babelHelpers.classCallCheck(this,t),this.transports={},this.transports[t.DEFAULT_TRANSPORT_NAME]=e}return babelHelpers.createClass(t,[{key:"get", -value:function(e){var t=this.transports[e];if(!t)throw new Error("Invalid transport name: "+e);try{return new t}catch(n){throw new Error("Can't create transport",n)}}},{key:"getDefault",value:function(){return this.get(t.DEFAULT_TRANSPORT_NAME)}}],[{key:"instance",value:function(){return t.instance_||(t.instance_=new t),t.instance_}}]),t}();t.DEFAULT_TRANSPORT_NAME="default",this.launchpad.TransportFactory=t}.call(this),function(){var e=this.launchpad.core,t=this.launchpad.Auth,n=this.launchpad.Embodied,r=this.launchpad.Filter,a=this.launchpad.Query,i=this.launchpad.TransportFactory,s=this.launchpad.ClientRequest,u=this.launchpad.Ajax,o=this.launchpad.MultiMap,l=function(){function l(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;t>r;r++)n[r-1]=arguments[r];if(babelHelpers.classCallCheck(this,l),0===arguments.length)throw new Error("Invalid arguments, try `new Launchpad(baseUrl, url)`");this.auth_=null,this.body_=null,this.url_=u.joinPaths.apply(u,[e||""].concat(n)),this.headers_=new o,this.params_=new o,this.header("Content-Type","application/json"),this.header("X-PJAX","true"),this.header("X-Requested-With","XMLHttpRequest")}return babelHelpers.createClass(l,[{key:"aggregate",value:function(e,t,n){return this.getOrCreateQuery_().aggregate(e,t,n),this}},{key:"auth",value:function(e,n){return this.auth_=e,this.auth_ instanceof t||(this.auth_=t.create(e,n)),this}},{key:"body",value:function(e){return this.body_=e,this}},{key:"convertBodyToParams_",value:function(t,r){e.isString(r)?r={body:r}:r instanceof n&&(r=r.body()),Object.keys(r||{}).forEach(function(e){return t.param(e,r[e])})}},{key:"count",value:function(){return this.getOrCreateQuery_().type("count"),this}},{key:"createClientRequest_",value:function(t,n){var r=new s;return r.body(n||this.body_),e.isDefAndNotNull(r.body())||(this.query_?r.body(this.query_.body()):this.formData_&&r.body(this.formData_)),r.method(t),r.headers(this.headers()),r.params(this.params()),r.url(this.url()),this.encode(r),r}},{key:"decode",value:function(e){if(l.isContentTypeJson(e))try{e.body(JSON.parse(e.body()))}catch(t){}return e}},{key:"delete",value:function(e){return this.sendAsync("DELETE",e)}},{key:"encode",value:function(t){var r=t.body();return e.isElement(r)&&(r=new FormData(r),t.body(r)),r=this.wrapWithQuery_(r),"GET"===t.method()&&(this.convertBodyToParams_(t,r),t.removeBody(),r=null),r instanceof FormData?t.headers().remove("content-type"):r instanceof n?t.body(r.toString()):l.isContentTypeJson(t)&&t.body(JSON.stringify(t.body())),this.encodeParams_(t),this.resolveAuthentication_(t),t}},{key:"encodeParams_",value:function(t){var r=t.params();r.names().forEach(function(t){var a=r.getAll(t);a.forEach(function(t,r){t instanceof n?t=t.toString():(e.isObject(t)||t instanceof Array)&&(t=JSON.stringify(t)),a[r]=t})})}},{key:"filter",value:function(e,t,n){return this.getOrCreateQuery_().filter(e,t,n),this}},{key:"form",value:function(e,t){return this.formData_||(this.formData_=new FormData),this.formData_.append(e,t),this}},{key:"get",value:function(e){return this.sendAsync("GET",e)}},{key:"getOrCreateQuery_",value:function(){return this.query_||(this.query_=new a),this.query_}},{key:"header",value:function(e,t){if(2!==arguments.length)throw new Error("Invalid arguments");return this.headers_.set(e,t),this}},{key:"headers",value:function(){return this.headers_}},{key:"highlight",value:function(e){return this.getOrCreateQuery_().highlight(e),this}},{key:"limit",value:function(e){return this.getOrCreateQuery_().limit(e),this}},{key:"offset",value:function(e){return this.getOrCreateQuery_().offset(e),this}},{key:"param",value:function(e,t){if(2!==arguments.length)throw new Error("Invalid arguments");return this.params_.set(e,t),this}},{key:"params",value:function(){return this.params_}},{key:"patch",value:function(e){return this.sendAsync("PATCH",e)}},{key:"path",value:function(){for(var e=arguments.length,t=Array(e),n=0;e>n;n++)t[n]=arguments[n];return(new(Function.prototype.bind.apply(l,[null].concat([this.url()],t)))).use(this.customTransport_)}},{key:"post",value:function(e){return this.sendAsync("POST",e)}},{key:"put",value:function(e){return this.sendAsync("PUT",e)}},{key:"resolveAuthentication_",value:function(e){if(this.auth_)if(this.auth_.hasToken())e.header("Authorization","Bearer "+this.auth_.token());else{var t=this.auth_.username()+":"+this.auth_.password();e.header("Authorization","Basic "+btoa(t))}}},{key:"search",value:function(e,t,n){return this.getOrCreateQuery_().search(e,t,n),this}},{key:"sendAsync",value:function(e,t){var n=this.customTransport_||i.instance().getDefault(),r=this.createClientRequest_(e,t);return n.send(r).then(this.decode)}},{key:"sort",value:function(e,t){return this.getOrCreateQuery_().sort(e,t),this}},{key:"url",value:function(){return this.url_}},{key:"use",value:function(e){return this.customTransport_=e,this}},{key:"watch",value:function(e,t){if("undefined"==typeof io)throw new Error("Socket.io client not loaded");var n=this.createClientRequest_("GET",e),r=u.parseUrl(u.addParametersToUrlQueryString(n.url(),n.params()));return t=t||{forceNew:!0},t.path=t.path||r[1],io(r[0]+"?url="+encodeURIComponent(r[1]+r[2]),t)}},{key:"wrapWithQuery_",value:function(e){return e instanceof r&&(e=a.filter(e)),e}}],[{key:"url",value:function(e){return new l(e).use(this.customTransport_)}}]),l}();l.isContentTypeJson=function(e){var t=e.headers().get("content-type")||"";return 0===t.indexOf("application/json")},this.launchpad.Launchpad=l}.call(this),function(){var e=this.launchpad.Launchpad;void 0!==("undefined"==typeof window?"undefined":babelHelpers["typeof"](window))&&(window.Launchpad=e)}.call(this),function(){var e=this.launchpad.Filter,t=this.launchpad.Geo,n=this.launchpad.Query,r=this.launchpad.Range;void 0!==("undefined"==typeof window?"undefined":babelHelpers["typeof"](window))&&(window.Filter=e,window.Geo=t,window.Query=n,window.Range=r)}.call(this); \ No newline at end of file +(function(){this.launchpad=this.launchpad||{},this.launchpadNamed=this.launchpadNamed||{};var t={};t["typeof"]=function(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t},t.classCallCheck=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},t.inherits=function(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)},t.possibleConstructorReturn=function(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},t.toConsumableArray=function(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e>>0),e.uniqueIdCounter_=1,this.launchpad.core=e}.call(this),function(){var e=function(){function e(){t.classCallCheck(this,e)}return e.prototype.send=function(){},e}();this.launchpad.Transport=e}.call(this),function(){var t={};t.throwException=function(e){t.nextTick(function(){throw e})},t.run=function(e,n){t.run.workQueueScheduled_||(t.nextTick(t.run.processWorkQueue),t.run.workQueueScheduled_=!0),t.run.workQueue_.push(new t.run.WorkItem_(e,n))},t.run.workQueueScheduled_=!1,t.run.workQueue_=[],t.run.processWorkQueue=function(){for(;t.run.workQueue_.length;){var e=t.run.workQueue_;t.run.workQueue_=[];for(var n=0;n0?this.unhandledRejectionId_=0:0===a.UNHANDLED_REJECTION_DELAY&&(this.hadUnhandledRejection_=!1);try{var n=this;t.call(e,function(t){n.resolve_(a.State_.FULFILLED,t)},function(t){n.resolve_(a.State_.REJECTED,t)})}catch(r){this.resolve_(a.State_.REJECTED,r)}};i.UNHANDLED_REJECTION_DELAY=0,i.State_={PENDING:0,BLOCKED:1,FULFILLED:2,REJECTED:3},i.CallbackEntry_=null,i.resolve=function(t){return new i(function(e){e(t)})},i.reject=function(t){return new i(function(e,n){n(t)})},i.race=function(t){return new i(function(e,n){t.length||e(void 0);for(var r,o=0;r=t[o];o++)r.then(e,n)})},i.all=function(t){return new i(function(e,n){var r=t.length,i=[];if(!r)return void e(i);for(var a,s=function(t,n){r--,i[t]=n,0===r&&e(i)},u=function(t){n(t)},c=0;a=t[c];c++)a.then(o(s,c),u)})},i.firstFulfilled=function(t){return new i(function(e,n){var r=t.length,i=[];if(!r)return void e(void 0);for(var a,s=function(t){e(t)},u=function(t,e){r--,i[t]=e,0===r&&n(i)},c=0;a=t[c];c++)a.then(s,o(u,c))})},i.prototype.then=function(t,n,r){return this.addChildPromise_(e.isFunction(t)?t:null,e.isFunction(n)?n:null,r)},r.addImplementation(i),i.prototype.thenAlways=function(t,e){var n=function(){try{t.call(e)}catch(n){i.handleRejection_.call(null,n)}};return this.addCallbackEntry_({child:null,onRejected:n,onFulfilled:n}),this},i.prototype.thenCatch=function(t,e){return this.addChildPromise_(null,t,e)},i.prototype["catch"]=i.prototype.thenCatch,i.prototype.cancel=function(t){this.state_===i.State_.PENDING&&n.run(function(){var e=new i.CancellationError(t);e.IS_CANCELLATION_ERROR=!0,this.cancelInternal_(e)},this)},i.prototype.cancelInternal_=function(t){this.state_===i.State_.PENDING&&(this.parent_?this.parent_.cancelChild_(this,t):this.resolve_(i.State_.REJECTED,t))},i.prototype.cancelChild_=function(t,e){if(this.callbackEntries_){for(var n,r=0,o=-1,a=0;n=this.callbackEntries_[a];a++){var s=n.child;if(s&&(r++,s===t&&(o=a),o>=0&&r>1))break}if(o>=0)if(this.state_===i.State_.PENDING&&1===r)this.cancelInternal_(e);else{var u=this.callbackEntries_.splice(o,1)[0];this.executeCallback_(u,i.State_.REJECTED,e)}}},i.prototype.addCallbackEntry_=function(t){this.callbackEntries_&&this.callbackEntries_.length||this.state_!==i.State_.FULFILLED&&this.state_!==i.State_.REJECTED||this.scheduleCallbacks_(),this.callbackEntries_||(this.callbackEntries_=[]),this.callbackEntries_.push(t)},i.prototype.addChildPromise_=function(t,n,r){var o={child:null,onFulfilled:null,onRejected:null};return o.child=new i(function(i,a){o.onFulfilled=t?function(e){try{var n=t.call(r,e);i(n)}catch(o){a(o)}}:i,o.onRejected=n?function(t){try{var o=n.call(r,t);!e.isDef(o)&&t.IS_CANCELLATION_ERROR?a(t):i(o)}catch(s){a(s)}}:a}),o.child.parent_=this,this.addCallbackEntry_(o),o.child},i.prototype.unblockAndFulfill_=function(t){if(this.state_!==i.State_.BLOCKED)throw new Error("CancellablePromise is not blocked.");this.state_=i.State_.PENDING,this.resolve_(i.State_.FULFILLED,t)},i.prototype.unblockAndReject_=function(t){if(this.state_!==i.State_.BLOCKED)throw new Error("CancellablePromise is not blocked.");this.state_=i.State_.PENDING,this.resolve_(i.State_.REJECTED,t)},i.prototype.resolve_=function(t,n){if(this.state_===i.State_.PENDING){if(this===n)t=i.State_.REJECTED,n=new TypeError("CancellablePromise cannot resolve to itself");else{if(r.isImplementedBy(n))return n=n,this.state_=i.State_.BLOCKED,void n.then(this.unblockAndFulfill_,this.unblockAndReject_,this);if(e.isObject(n))try{var o=n.then;if(e.isFunction(o))return void this.tryThen_(n,o)}catch(a){t=i.State_.REJECTED,n=a}}this.result_=n,this.state_=t,this.scheduleCallbacks_(),t!==i.State_.REJECTED||n.IS_CANCELLATION_ERROR||i.addUnhandledRejection_(this,n)}},i.prototype.tryThen_=function(t,e){this.state_=i.State_.BLOCKED;var n=this,r=!1,o=function(t){r||(r=!0,n.unblockAndFulfill_(t))},a=function(t){r||(r=!0,n.unblockAndReject_(t))};try{e.call(t,o,a)}catch(s){a(s)}},i.prototype.scheduleCallbacks_=function(){this.executing_||(this.executing_=!0,n.run(this.executeCallbacks_,this))},i.prototype.executeCallbacks_=function(){for(;this.callbackEntries_&&this.callbackEntries_.length;){var t=this.callbackEntries_;this.callbackEntries_=[];for(var e=0;e0)for(t=this;t&&t.unhandledRejectionId_;t=t.parent_)clearTimeout(t.unhandledRejectionId_),t.unhandledRejectionId_=0;else if(0===i.UNHANDLED_REJECTION_DELAY)for(t=this;t&&t.hadUnhandledRejection_;t=t.parent_)t.hadUnhandledRejection_=!1},i.addUnhandledRejection_=function(t,e){i.UNHANDLED_REJECTION_DELAY>0?t.unhandledRejectionId_=setTimeout(function(){i.handleRejection_.call(null,e)},i.UNHANDLED_REJECTION_DELAY):0===i.UNHANDLED_REJECTION_DELAY&&(t.hadUnhandledRejection_=!0,n.run(function(){t.hadUnhandledRejection_&&i.handleRejection_.call(null,e)}))},i.handleRejection_=n.throwException,i.setUnhandledRejectionHandler=function(t){i.handleRejection_=t},i.CancellationError=function(e){function n(r){t.classCallCheck(this,n);var o=t.possibleConstructorReturn(this,e.call(this,r));return r&&(o.message=r),o}return t.inherits(n,e),n}(Error),i.CancellationError.prototype.name="cancel",this.launchpadNamed.Promise={},this.launchpadNamed.Promise.CancellablePromise=i,this.launchpad.Promise=i}.call(this),function(){var e=this.launchpad.core,n=this.launchpadNamed.Promise.CancellablePromise,r=function(){function r(){t.classCallCheck(this,r)}return r.addParametersToUrlQueryString=function(t,e){var n="";return e.names().forEach(function(t){e.getAll(t).forEach(function(e){n+=t+"="+encodeURIComponent(e)+"&"})}),n=n.slice(0,-1),n&&(t+=t.indexOf("?")>-1?"&":"?",t+=n),t},r.joinPaths=function(t){for(var e=arguments.length,n=Array(e>1?e-1:0),r=1;e>r;r++)n[r-1]=arguments[r];return"/"===t.charAt(t.length-1)&&(t=t.substring(0,t.length-1)),n=n.map(function(t){return"/"===t.charAt(0)?t.substring(1):t}),[t].concat(n).join("/").replace(/\/$/,"")},r.parseResponseHeaders=function(t){var e=[];if(!t)return e;for(var n=t.split("\r\n"),r=0;r0){var i=n[r].substring(0,o),a=n[r].substring(o+2);e.push({name:i,value:a})}}return e},r.parseUrl=function(t){var e,n,r,o=t.indexOf("//");o>-1&&(t=t.substring(o+2));var i=t.indexOf("/");-1===i&&(t+="/",i=t.length-1),e=t.substring(0,i),n=t.substring(i);var a=n.indexOf("?");return a>-1?(r=n.substring(a,n.length),n=n.substring(0,a)):r="",[e,n,r]},r.request=function o(t,i,a,s,u,c,l){var o=new XMLHttpRequest,h=new n(function(t,e){o.onload=function(){return o.aborted?void o.onerror():void t(o)},o.onerror=function(){var t=new Error("Request error");t.request=o,e(t)}}).thenCatch(function(t){throw o.abort(),t}).thenAlways(function(){clearTimeout(p)});if(u&&(t=r.addParametersToUrlQueryString(t,u)),o.open(i,t,!l),s&&s.names().forEach(function(t){o.setRequestHeader(t,s.getAll(t).join(", "))}),o.send(e.isDef(a)?a:null),e.isDefAndNotNull(c))var p=setTimeout(function(){h.cancel("Request timeout")},c);return h},r}();this.launchpad.Ajax=r}.call(this),function(){var e=function(){function e(){t.classCallCheck(this,e),this.disposed_=!1}return e.prototype.dispose=function(){this.disposed_||(this.disposeInternal(),this.disposed_=!0)},e.prototype.disposeInternal=function(){},e.prototype.isDisposed=function(){return this.disposed_},e}();this.launchpad.Disposable=e}.call(this),function(){var e=this.launchpad.Disposable,n=function(e){function n(){t.classCallCheck(this,n);var r=t.possibleConstructorReturn(this,e.call(this));return r.keys={},r.values={},r}return t.inherits(n,e),n.prototype.add=function(t,e){return this.keys[t.toLowerCase()]=t,this.values[t.toLowerCase()]=this.values[t.toLowerCase()]||[],this.values[t.toLowerCase()].push(e),this},n.prototype.clear=function(){return this.keys={},this.values={},this},n.prototype.contains=function(t){return t.toLowerCase()in this.values},n.prototype.disposeInternal=function(){this.values=null},n.prototype.get=function(t){var e=this.values[t.toLowerCase()];return e?e[0]:void 0},n.prototype.getAll=function(t){return this.values[t.toLowerCase()]},n.prototype.isEmpty=function(){return 0===this.size()},n.prototype.names=function(){var t=this;return Object.keys(this.values).map(function(e){return t.keys[e]})},n.prototype.remove=function(t){return delete this.keys[t.toLowerCase()],delete this.values[t.toLowerCase()],this},n.prototype.set=function(t,e){return this.keys[t.toLowerCase()]=t,this.values[t.toLowerCase()]=[e],this},n.prototype.size=function(){return this.names().length},n.prototype.toString=function(){return JSON.stringify(this.values)},n}(e);n.prototype.registerMetalComponent&&n.prototype.registerMetalComponent(n,"MultiMap"),this.launchpad.MultiMap=n}.call(this),function(){var e=this.launchpad.core,n=this.launchpad.MultiMap,r=function(){function r(){t.classCallCheck(this,r),this.headers_=new n}return r.prototype.body=function(t){return e.isDef(t)?(this.body_=t,this):this.body_},r.prototype.header=function(t,e){if(2!==arguments.length)throw new Error("Invalid arguments");return this.headers_.set(t,e),this},r.prototype.headers=function(t){return e.isDef(t)?(t instanceof n?this.headers_=t:this.headers_.values=t,t):this.headers_},r.prototype.removeBody=function(){this.body_=void 0},r}();this.launchpad.ClientMessage=r}.call(this),function(){var e=this.launchpad.core,n=this.launchpad.ClientMessage,r=function(n){function r(e){t.classCallCheck(this,r);var o=t.possibleConstructorReturn(this,n.call(this));if(!e)throw new Error("Can't create response without request");return o.clientRequest_=e,o}return t.inherits(r,n),r.prototype.request=function(){return this.clientRequest_},r.prototype.statusCode=function(t){return e.isDef(t)?(this.statusCode_=t,this):this.statusCode_},r.prototype.statusText=function(t){return e.isDef(t)?(this.statusText_=t,this):this.statusText_},r.prototype.succeeded=function(){return this.statusCode()>=200&&this.statusCode()<=399},r}(n);r.prototype.registerMetalComponent&&r.prototype.registerMetalComponent(r,"ClientResponse"),this.launchpad.ClientResponse=r}.call(this),function(){var e=(this.launchpad.core,this.launchpad.Transport),n=this.launchpad.Ajax,r=this.launchpad.ClientResponse,o=(this.launchpadNamed.Promise.CancellablePromise,function(e){function o(){return t.classCallCheck(this,o),t.possibleConstructorReturn(this,e.apply(this,arguments))}return t.inherits(o,e),o.prototype.send=function(t){var e=n.request(t.url(),t.method(),t.body(),t.headers(),t.params(),null,!1);return e.then(function(e){var o=new r(t);return o.body(e.responseText),o.statusCode(e.status),o.statusText(e.statusText),n.parseResponseHeaders(e.getAllResponseHeaders()).forEach(function(t){o.header(t.name,t.value)}),o})},o}(e));o.prototype.registerMetalComponent&&o.prototype.registerMetalComponent(o,"AjaxTransport"),this.launchpad.AjaxTransport=o}.call(this),function(){var e=this.launchpad.core,n=function(){function n(r){var o=arguments.length<=1||void 0===arguments[1]?null:arguments[1];t.classCallCheck(this,n),this.token_=e.isString(o)?null:r,this.username_=e.isString(o)?r:null,this.password_=o}return n.create=function(t,e){return new n(t,e)},n.prototype.hasPassword=function(){return null!==this.password_},n.prototype.hasToken=function(){return null!==this.token_},n.prototype.hasUsername=function(){return null!==this.username_},n.prototype.password=function(){return this.password_},n.prototype.token=function(){return this.token_},n.prototype.username=function(){return this.username_},n}();this.launchpad.Auth=n}.call(this),function(){var e=this.launchpad.core,n=this.launchpad.ClientMessage,r=this.launchpad.MultiMap,o=function(n){function o(){t.classCallCheck(this,o);var e=t.possibleConstructorReturn(this,n.call(this));return e.params_=new r,e}return t.inherits(o,n),o.prototype.method=function(t){return e.isDef(t)?(this.method_=t,this):this.method_||o.DEFAULT_METHOD},o.prototype.param=function(t,e){if(2!==arguments.length)throw new Error("Invalid arguments");return this.params_.set(t,e),this},o.prototype.params=function(t){return e.isDef(t)?(t instanceof r?this.params_=t:this.params_.values=t,t):this.params_},o.prototype.url=function(t){return e.isDef(t)?(this.url_=t,this):this.url_},o}(n);o.prototype.registerMetalComponent&&o.prototype.registerMetalComponent(o,"ClientRequest"),o.DEFAULT_METHOD="GET",this.launchpad.ClientRequest=o}.call(this),function(){var e=function(){function e(){t.classCallCheck(this,e),this.body_={}}return e.prototype.body=function(){return this.body_},e.toBody=function(t){return t instanceof e?t.body():t},e.prototype.toString=function(){return JSON.stringify(this.body())},e}();this.launchpad.Embodied=e}.call(this),function(){var e=this.launchpad.core,n=this.launchpad.Embodied,r=function(){function r(o,i,a){t.classCallCheck(this,r);var s={operator:e.isDef(a)?i:"="},u=e.isDef(a)?a:i;e.isDefAndNotNull(u)&&(u instanceof n&&(u=u.body()),s.value=u),this.createBody_(o,s)}return r.prototype.add=function(t,e){e?this.addArrayOperator_(t,e):this.createBody_(t,this.body_)},r.prototype.addArrayOperator_=function(t,e){this.body_[t]instanceof Array||this.createBody_(t,[this.body_]),this.body_[t].push(e.body())},r.prototype.addMany=function(t){for(var e=arguments.length,n=Array(e>1?e-1:0),r=1;e>r;r++)n[r-1]=arguments[r];for(var o=0;or;r++)n[r]=arguments[r];return new(Function.prototype.bind.apply(e.Line,[null].concat(n)))},e.point=function(t,n){return new e.Point(t,n)},e.polygon=function(){for(var t=arguments.length,n=Array(t),r=0;t>r;r++)n[r]=arguments[r];return new(Function.prototype.bind.apply(e.Polygon,[null].concat(n)))},e}(),r=function(e){function n(r,o){t.classCallCheck(this,n);var i=t.possibleConstructorReturn(this,e.call(this));return i.body_=[r,o],i}return t.inherits(n,e),n}(e);r.prototype.registerMetalComponent&&r.prototype.registerMetalComponent(r,"Point"),n.Point=r;var o=function(n){function r(){t.classCallCheck(this,r);for(var o=t.possibleConstructorReturn(this,n.call(this)),i=arguments.length,a=Array(i),s=0;i>s;s++)a[s]=arguments[s];return o.body_={type:"linestring",coordinates:a.map(function(t){return e.toBody(t)})},o}return t.inherits(r,n),r}(e);o.prototype.registerMetalComponent&&o.prototype.registerMetalComponent(o,"Line"),n.Line=o;var i=function(n){function r(o,i){t.classCallCheck(this,r);var a=t.possibleConstructorReturn(this,n.call(this));return a.body_={type:"envelope",coordinates:[e.toBody(o),e.toBody(i)]},a}return t.inherits(r,n),r.prototype.getPoints=function(){return this.body_.coordinates},r}(e);i.prototype.registerMetalComponent&&i.prototype.registerMetalComponent(i,"BoundingBox"),n.BoundingBox=i;var a=function(n){function r(o,i){t.classCallCheck(this,r);var a=t.possibleConstructorReturn(this,n.call(this));return a.body_={type:"circle",coordinates:e.toBody(o),radius:i},a}return t.inherits(r,n),r.prototype.getCenter=function(){return this.body_.coordinates},r.prototype.getRadius=function(){return this.body_.radius},r}(e);a.prototype.registerMetalComponent&&a.prototype.registerMetalComponent(a,"Circle"),n.Circle=a;var s=function(n){function r(){t.classCallCheck(this,r);var e=t.possibleConstructorReturn(this,n.call(this));return e.body_={type:"polygon",coordinates:[]},e.addCoordinates_.apply(e,arguments),e}return t.inherits(r,n),r.prototype.addCoordinates_=function(){for(var t=arguments.length,n=Array(t),r=0;t>r;r++)n[r]=arguments[r];this.body_.coordinates.push(n.map(function(t){return e.toBody(t)}))},r.prototype.hole=function(){return this.addCoordinates_.apply(this,arguments),this},r}(e);s.prototype.registerMetalComponent&&s.prototype.registerMetalComponent(s,"Polygon"),n.Polygon=s,this.launchpad.Geo=n}.call(this),function(){var e=this.launchpad.core,n=this.launchpad.Embodied,r=function(n){function r(o,i){t.classCallCheck(this,r);var a=t.possibleConstructorReturn(this,n.call(this));return e.isDefAndNotNull(o)&&(a.body_.from=o),e.isDefAndNotNull(i)&&(a.body_.to=i),a}return t.inherits(r,n),r.from=function(t){return new r(t)},r.range=function(t,e){return new r(t,e)},r.to=function(t){return new r(null,t)},r}(n);r.prototype.registerMetalComponent&&r.prototype.registerMetalComponent(r,"Range"),this.launchpad.Range=r}.call(this),function(){var e=this.launchpad.core,n=this.launchpad.Embodied,r=this.launchpad.FilterBody,o=this.launchpad.Geo,i=this.launchpad.Range,a=function(a){function s(e,n,o){t.classCallCheck(this,s);var i=t.possibleConstructorReturn(this,a.call(this));return i.body_=new r(e,n,o),i}return t.inherits(s,a),s.prototype.add=function(t,e,n,r){var o=e?s.toFilter(e,n,r):null;return this.body_.add(t,o),this},s.prototype.addMany=function(t){for(var e,n=arguments.length,r=Array(n>1?n-1:0),o=1;n>o;o++)r[o-1]=arguments[o];return(e=this.body_).addMany.apply(e,[t].concat(r)),this},s.prototype.and=function(t,e,n){return this.add("and",t,e,n)},s.any=function(t){var e=Array.prototype.slice.call(arguments,1);return 1===e.length&&e[0]instanceof Array&&(e=e[0]),new s(t,"any",e)},s.boundingBox=function(e,n,r){return n instanceof o.BoundingBox?s.polygon.apply(s,[e].concat(t.toConsumableArray(n.getPoints()))):s.polygon(e,n,r)},s.prototype.body=function(){return this.body_.getObject()},s.distance=function(t,e,n){var r=e,a=n;return e instanceof o.Circle?(r=e.getCenter(),a=i.to(e.getRadius())):n instanceof i||(a=i.to(n)),s.distanceInternal_(t,r,a)},s.distanceInternal_=function(t,e,r){var o={location:n.toBody(e)};return r=r.body(),r.from&&(o.min=r.from),r.to&&(o.max=r.to),s.field(t,"gd",o)},s.equal=function(t,e){return new s(t,"=",e)},s.exists=function(t){return s.field(t,"exists",null)},s.fuzzy=function(t,e,n){return s.fuzzyInternal_("fuzzy",t,e,n)},s.fuzzyInternal_=function(t,n,r,o){var i=e.isString(r),a={query:i?r:n},u=i?o:r;u&&(a.fuzziness=u);var c=i?n:s.ALL;return s.field(c,t,a)},s.gt=function(t,e){return new s(t,">",e)},s.gte=function(t,e){return new s(t,">=",e)},s.match=function(t,n){var r=e.isString(n)?t:s.ALL,o=e.isString(n)?n:t;return s.field(r,"match",o)},s.missing=function(t){return s.field(t,"missing",null)},s.phrase=function(t,n){var r=e.isString(n)?t:s.ALL,o=e.isString(n)?n:t;return s.field(r,"phrase",o)},s.polygon=function(t){for(var e=arguments.length,r=Array(e>1?e-1:0),o=1;e>o;o++)r[o-1]=arguments[o];return r=r.map(function(t){return n.toBody(t)}),s.field(t,"gp",r)},s.prefix=function(t,e){var n=e?t:s.ALL,r=e?e:t;return s.field(n,"prefix",r)},s.range=function u(t,e,n){var u=e;return u instanceof i||(u=i.range(e,n)),s.field(t,"range",u)},s.regex=function(t,e){return new s(t,"~",e)},s.shape=function(t){for(var e=arguments.length,r=Array(e>1?e-1:0),o=1;e>o;o++)r[o-1]=arguments[o];r=r.map(function(t){return n.toBody(t)});var i={type:"geometrycollection",geometries:r};return s.field(t,"gs",i)},s.similar=function(t,n){var r=e.isString(n)?t:s.ALL,o={query:e.isString(n)?n:t};return s.field(r,"similar",o)},s.lt=function(t,e){return new s(t,"<",e)},s.lte=function(t,e){return new s(t,"<=",e)},s.none=function(t){var e=Array.prototype.slice.call(arguments,1);return 1===e.length&&e[0]instanceof Array&&(e=e[0]),new s(t,"none",e)},s.notEqual=function(t,e){return new s(t,"!=",e)},s.not=function(t,e,n){return s.toFilter(t,e,n).add("not")},s.field=function(t,e,n){return new s(t,e,n)},s.prototype.or=function(t,e,n){return this.add("or",t,e,n)},s.toFilter=function(t,e,n){var r=t;return r instanceof s||(r=s.field(t,e,n)),r},s}(n);a.prototype.registerMetalComponent&&a.prototype.registerMetalComponent(a,"Filter"),a.ALL="*",this.launchpad.Filter=a}.call(this),function(){var e=this.launchpad.Embodied,n=this.launchpad.Range,r=function(){function e(n,r,o){t.classCallCheck(this,e),this.field_=n,this.operator_=r,this.value_=o}return e.avg=function(t){return e.field(t,"avg")},e.count=function(t){return e.field(t,"count")},e.distance=function(t,n){for(var r=arguments.length,o=Array(r>2?r-2:0),i=2;r>i;i++)o[i-2]=arguments[i];return new(Function.prototype.bind.apply(e.DistanceAggregation,[null].concat([t,n],o)))},e.extendedStats=function(t){return e.field(t,"extendedStats")},e.prototype.getField=function(){return this.field_},e.prototype.getOperator=function(){return this.operator_},e.prototype.getValue=function(){return this.value_},e.histogram=function(t,n){return new e(t,"histogram",n)},e.max=function(t){return e.field(t,"max")},e.min=function(t){return e.field(t,"min")},e.missing=function(t){return e.field(t,"missing")},e.field=function(t,n){return new e(t,n)},e.range=function(t){for(var n=arguments.length,r=Array(n>1?n-1:0),o=1;n>o;o++)r[o-1]=arguments[o];return new(Function.prototype.bind.apply(e.RangeAggregation,[null].concat([t],r)))},e.stats=function(t){return e.field(t,"stats")},e.sum=function(t){return e.field(t,"sum")},e.terms=function(t){return e.field(t,"terms")},e}(),o=function(r){function o(n,i){t.classCallCheck(this,o);var a=t.possibleConstructorReturn(this,r.call(this,n,"geoDistance",{}));a.value_.location=e.toBody(i);for(var s=arguments.length,u=Array(s>2?s-2:0),c=2;s>c;c++)u[c-2]=arguments[c];return a.value_.ranges=u.map(function(t){return t.body()}),a}return t.inherits(o,r),o.prototype.range=function i(t,e){var i=t;return i instanceof n||(i=n.range(t,e)),this.value_.ranges.push(i.body()),this},o.prototype.unit=function(t){return this.value_.unit=t,this},o}(r);o.prototype.registerMetalComponent&&o.prototype.registerMetalComponent(o,"DistanceAggregation"),r.DistanceAggregation=o;var i=function(e){function r(n){t.classCallCheck(this,r);for(var o=t.possibleConstructorReturn(this,e.call(this,n,"range")),i=arguments.length,a=Array(i>1?i-1:0),s=1;i>s;s++)a[s-1]=arguments[s];return o.value_=a.map(function(t){return t.body()}),o}return t.inherits(r,e),r.prototype.range=function o(t,e){var o=t;return o instanceof n||(o=n.range(t,e)),this.value_.push(o.body()),this},r}(r);i.prototype.registerMetalComponent&&i.prototype.registerMetalComponent(i,"RangeAggregation"),r.RangeAggregation=i,this.launchpad.Aggregation=r}.call(this),function(){var e=this.launchpad.core,n=this.launchpad.Embodied,r=this.launchpad.Filter,o=this.launchpad.Aggregation,i=function(n){function i(){return t.classCallCheck(this,i),t.possibleConstructorReturn(this,n.apply(this,arguments))}return t.inherits(i,n),i.aggregate=function(t,e,n){return(new i).aggregate(t,e,n)},i.count=function(){return(new i).type("count")},i.fetch=function(){return(new i).type("fetch")},i.filter=function(t,e,n){return(new i).filter(t,e,n)},i.offset=function(t){return(new i).offset(t)},i.highlight=function(t){return(new i).highlight(t)},i.limit=function(t){return(new i).limit(t)},i.search=function(t,e,n){return(new i).search(t,e,n)},i.sort=function(t,e){return(new i).sort(t,e)},i.type=function(t){return(new i).type(t)},i.prototype.aggregate=function(t,n,r){var i=n;i instanceof o||(i=o.field(n,r));var a=i.getField(),s={};return s[a]={name:t,operator:i.getOperator()},e.isDefAndNotNull(i.getValue())&&(s[a].value=i.getValue()),this.body_.aggregation||(this.body_.aggregation=[]),this.body_.aggregation.push(s),this},i.prototype.count=function(){return this.type("count")},i.prototype.fetch=function(){return this.type("fetch")},i.prototype.filter=function a(t,e,n){var a=r.toFilter(t,e,n);return this.body_.filter||(this.body_.filter=[]),this.body_.filter.push(a.body()),this},i.prototype.offset=function(t){return this.body_.offset=t,this},i.prototype.highlight=function(t){return this.body_.highlight||(this.body_.highlight=[]),this.body_.highlight.push(t),this},i.prototype.limit=function(t){return this.body_.limit=t,this},i.prototype.search=function(t,e,n){var o=t;return n?o=r.field(t,e,n):e?o=r.match(t,e):o instanceof r||(o=r.match(t)),this.body_.search||(this.body_.search=[]),this.body_.search.push(o.body()),this},i.prototype.sort=function(t,e){this.body_.sort||(this.body_.sort=[]);var n={};return n[t]=e||"asc",this.body_.sort.push(n),this},i.prototype.type=function(t){return this.body_.type=t,this},i}(n);i.prototype.registerMetalComponent&&i.prototype.registerMetalComponent(i,"Query"),this.launchpad.Query=i}.call(this),function(){var e=this.launchpad.AjaxTransport,n=function(){function n(){t.classCallCheck(this,n),this.transports={},this.transports[n.DEFAULT_TRANSPORT_NAME]=e}return n.instance=function(){return n.instance_||(n.instance_=new n),n.instance_},n.prototype.get=function(t){var e=this.transports[t];if(!e)throw new Error("Invalid transport name: "+t);try{return new e}catch(n){throw new Error("Can't create transport",n)}},n.prototype.getDefault=function(){return this.get(n.DEFAULT_TRANSPORT_NAME)},n}();n.DEFAULT_TRANSPORT_NAME="default",this.launchpad.TransportFactory=n}.call(this),function(){var e=this.launchpad.core,n=this.launchpad.Auth,r=this.launchpad.Embodied,o=this.launchpad.Filter,i=this.launchpad.Query,a=this.launchpad.TransportFactory,s=this.launchpad.ClientRequest,u=this.launchpad.Ajax,c=this.launchpad.MultiMap,l=function(){function l(e){for(var n=arguments.length,r=Array(n>1?n-1:0),o=1;n>o;o++)r[o-1]=arguments[o];if(t.classCallCheck(this,l),0===arguments.length)throw new Error("Invalid arguments, try `new Launchpad(baseUrl, url)`");this.auth_=null,this.body_=null,this.url_=u.joinPaths.apply(u,[e||""].concat(r)),this.headers_=new c,this.params_=new c,this.header("Content-Type","application/json"),this.header("X-PJAX","true"),this.header("X-Requested-With","XMLHttpRequest")}return l.prototype.aggregate=function(t,e,n){return this.getOrCreateQuery_().aggregate(t,e,n),this},l.prototype.auth=function(t,e){return this.auth_=t,this.auth_ instanceof n||(this.auth_=n.create(t,e)),this},l.prototype.body=function(t){return this.body_=t,this},l.prototype.convertBodyToParams_=function(t,n){e.isString(n)?n={body:n}:n instanceof r&&(n=n.body()),Object.keys(n||{}).forEach(function(e){return t.param(e,n[e])})},l.prototype.count=function(){return this.getOrCreateQuery_().type("count"),this},l.prototype.createClientRequest_=function(t,n){var r=new s;return r.body(n||this.body_),e.isDefAndNotNull(r.body())||(this.query_?r.body(this.query_.body()):this.formData_&&r.body(this.formData_)), +r.method(t),r.headers(this.headers()),r.params(this.params()),r.url(this.url()),this.encode(r),r},l.prototype.decode=function(t){if(l.isContentTypeJson(t))try{t.body(JSON.parse(t.body()))}catch(e){}return t},l.prototype["delete"]=function(t){return this.sendAsync("DELETE",t)},l.prototype.encode=function(t){var n=t.body();return e.isElement(n)&&(n=new FormData(n),t.body(n)),n=this.wrapWithQuery_(n),"GET"===t.method()&&(this.convertBodyToParams_(t,n),t.removeBody(),n=null),n instanceof FormData?t.headers().remove("content-type"):n instanceof r?t.body(n.toString()):l.isContentTypeJson(t)&&t.body(JSON.stringify(t.body())),this.encodeParams_(t),this.resolveAuthentication_(t),t},l.prototype.encodeParams_=function(t){var n=t.params();n.names().forEach(function(t){var o=n.getAll(t);o.forEach(function(t,n){t instanceof r?t=t.toString():(e.isObject(t)||t instanceof Array)&&(t=JSON.stringify(t)),o[n]=t})})},l.prototype.filter=function(t,e,n){return this.getOrCreateQuery_().filter(t,e,n),this},l.prototype.form=function(t,e){return this.formData_||(this.formData_=new FormData),this.formData_.append(t,e),this},l.prototype.get=function(t){return this.sendAsync("GET",t)},l.prototype.getOrCreateQuery_=function(){return this.query_||(this.query_=new i),this.query_},l.prototype.header=function(t,e){if(2!==arguments.length)throw new Error("Invalid arguments");return this.headers_.set(t,e),this},l.prototype.headers=function(){return this.headers_},l.prototype.highlight=function(t){return this.getOrCreateQuery_().highlight(t),this},l.prototype.limit=function(t){return this.getOrCreateQuery_().limit(t),this},l.prototype.offset=function(t){return this.getOrCreateQuery_().offset(t),this},l.prototype.param=function(t,e){if(2!==arguments.length)throw new Error("Invalid arguments");return this.params_.set(t,e),this},l.prototype.params=function(){return this.params_},l.prototype.patch=function(t){return this.sendAsync("PATCH",t)},l.prototype.path=function(){for(var t=arguments.length,e=Array(t),n=0;t>n;n++)e[n]=arguments[n];return(new(Function.prototype.bind.apply(l,[null].concat([this.url()],e)))).use(this.customTransport_)},l.prototype.post=function(t){return this.sendAsync("POST",t)},l.prototype.put=function(t){return this.sendAsync("PUT",t)},l.prototype.resolveAuthentication_=function(t){if(this.auth_)if(this.auth_.hasToken())t.header("Authorization","Bearer "+this.auth_.token());else{var e=this.auth_.username()+":"+this.auth_.password();t.header("Authorization","Basic "+btoa(e))}},l.prototype.search=function(t,e,n){return this.getOrCreateQuery_().search(t,e,n),this},l.prototype.sendAsync=function(t,e){var n=this.customTransport_||a.instance().getDefault(),r=this.createClientRequest_(t,e);return n.send(r).then(this.decode)},l.prototype.sort=function(t,e){return this.getOrCreateQuery_().sort(t,e),this},l.url=function(t){return new l(t).use(this.customTransport_)},l.prototype.url=function(){return this.url_},l.prototype.use=function(t){return this.customTransport_=t,this},l.prototype.watch=function(t,e){if("undefined"==typeof io)throw new Error("Socket.io client not loaded");var n=this.createClientRequest_("GET",t),r=u.parseUrl(u.addParametersToUrlQueryString(n.url(),n.params()));return e=e||{forceNew:!0},e.path=e.path||r[1],io(r[0]+"?url="+encodeURIComponent(r[1]+r[2]),e)},l.prototype.wrapWithQuery_=function(t){return t instanceof o&&(t=i.filter(t)),t},l}();l.isContentTypeJson=function(t){var e=t.headers().get("content-type")||"";return 0===e.indexOf("application/json")},this.launchpad.Launchpad=l}.call(this),function(){var e=this.launchpad.Launchpad;void 0!==("undefined"==typeof window?"undefined":t["typeof"](window))&&(window.Launchpad=e)}.call(this),function(){var e=this.launchpad.Filter,n=this.launchpad.Geo,r=this.launchpad.Query,o=this.launchpad.Range;void 0!==("undefined"==typeof window?"undefined":t["typeof"](window))&&(window.Filter=e,window.Geo=n,window.Query=r,window.Range=o)}.call(this)}).call(this); \ No newline at end of file diff --git a/build/globals/api.js b/build/globals/api.js index a2fc01d..a39a7f2 100644 --- a/build/globals/api.js +++ b/build/globals/api.js @@ -1,338 +1,289 @@ +(function() { this.launchpad = this.launchpad || {}; this.launchpadNamed = this.launchpadNamed || {}; -(function (global) { - var babelHelpers = global.babelHelpers = {}; +var babelHelpers = {}; - babelHelpers.classCallCheck = function (instance, Constructor) { - if (!(instance instanceof Constructor)) { - throw new TypeError("Cannot call a class as a function"); - } - }; +babelHelpers.typeof = function (obj) { + return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; +}; - babelHelpers.createClass = (function () { - function defineProperties(target, props) { - for (var i = 0; i < props.length; i++) { - var descriptor = props[i]; - descriptor.enumerable = descriptor.enumerable || false; - descriptor.configurable = true; - if ("value" in descriptor) descriptor.writable = true; - Object.defineProperty(target, descriptor.key, descriptor); - } - } +babelHelpers.classCallCheck = function (instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } +}; - return function (Constructor, protoProps, staticProps) { - if (protoProps) defineProperties(Constructor.prototype, protoProps); - if (staticProps) defineProperties(Constructor, staticProps); - return Constructor; - }; - })(); +babelHelpers.inherits = function (subClass, superClass) { + if (typeof superClass !== "function" && superClass !== null) { + throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); + } - babelHelpers.inherits = function (subClass, superClass) { - if (typeof superClass !== "function" && superClass !== null) { - throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); + subClass.prototype = Object.create(superClass && superClass.prototype, { + constructor: { + value: subClass, + enumerable: false, + writable: true, + configurable: true } + }); + if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; +}; - subClass.prototype = Object.create(superClass && superClass.prototype, { - constructor: { - value: subClass, - enumerable: false, - writable: true, - configurable: true - } - }); - if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; - }; +babelHelpers.possibleConstructorReturn = function (self, call) { + if (!self) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + } - babelHelpers.possibleConstructorReturn = function (self, call) { - if (!self) { - throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); - } + return call && (typeof call === "object" || typeof call === "function") ? call : self; +}; - return call && (typeof call === "object" || typeof call === "function") ? call : self; - }; +babelHelpers.toConsumableArray = function (arr) { + if (Array.isArray(arr)) { + for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; - babelHelpers.toConsumableArray = function (arr) { - if (Array.isArray(arr)) { - for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; + return arr2; + } else { + return Array.from(arr); + } +}; - return arr2; - } else { - return Array.from(arr); - } - }; -})(typeof global === "undefined" ? self : global); -'use strict' +babelHelpers; +'use strict'; /** * A collection of core utility functions. * @const */ -; + (function () { var core = (function () { function core() { babelHelpers.classCallCheck(this, core); } - babelHelpers.createClass(core, null, [{ - key: 'abstractMethod', + /** + * When defining a class Foo with an abstract method bar(), you can do: + * Foo.prototype.bar = core.abstractMethod + * + * Now if a subclass of Foo fails to override bar(), an error will be thrown + * when bar() is invoked. + * + * @type {!Function} + * @throws {Error} when invoked to indicate the method should be overridden. + */ - /** - * When defining a class Foo with an abstract method bar(), you can do: - * Foo.prototype.bar = core.abstractMethod - * - * Now if a subclass of Foo fails to override bar(), an error will be thrown - * when bar() is invoked. - * - * @type {!Function} - * @throws {Error} when invoked to indicate the method should be overridden. - */ - value: function abstractMethod() { - throw Error('Unimplemented abstract method'); - } + core.abstractMethod = function abstractMethod() { + throw Error('Unimplemented abstract method'); + }; - /** - * Loops constructor super classes collecting its properties values. If - * property is not available on the super class `undefined` will be - * collected as value for the class hierarchy position. - * @param {!function()} constructor Class constructor. - * @param {string} propertyName Property name to be collected. - * @return {Array.<*>} Array of collected values. - * TODO(*): Rethink superclass loop. - */ + /** + * Loops constructor super classes collecting its properties values. If + * property is not available on the super class `undefined` will be + * collected as value for the class hierarchy position. + * @param {!function()} constructor Class constructor. + * @param {string} propertyName Property name to be collected. + * @return {Array.<*>} Array of collected values. + * TODO(*): Rethink superclass loop. + */ - }, { - key: 'collectSuperClassesProperty', - value: function collectSuperClassesProperty(constructor, propertyName) { - var propertyValues = [constructor[propertyName]]; - while (constructor.__proto__ && !constructor.__proto__.isPrototypeOf(Function)) { - constructor = constructor.__proto__; - propertyValues.push(constructor[propertyName]); - } - return propertyValues; + core.collectSuperClassesProperty = function collectSuperClassesProperty(constructor, propertyName) { + var propertyValues = [constructor[propertyName]]; + while (constructor.__proto__ && !constructor.__proto__.isPrototypeOf(Function)) { + constructor = constructor.__proto__; + propertyValues.push(constructor[propertyName]); } + return propertyValues; + }; - /** - * Gets the name of the given function. If the current browser doesn't - * support the `name` property, this will calculate it from the function's - * content string. - * @param {!function()} fn - * @return {string} - */ + /** + * Gets the name of the given function. If the current browser doesn't + * support the `name` property, this will calculate it from the function's + * content string. + * @param {!function()} fn + * @return {string} + */ - }, { - key: 'getFunctionName', - value: function getFunctionName(fn) { - if (!fn.name) { - var str = fn.toString(); - fn.name = str.substring(9, str.indexOf('(')); - } - return fn.name; + core.getFunctionName = function getFunctionName(fn) { + if (!fn.name) { + var str = fn.toString(); + fn.name = str.substring(9, str.indexOf('(')); } + return fn.name; + }; - /** - * Gets an unique id. If `opt_object` argument is passed, the object is - * mutated with an unique id. Consecutive calls with the same object - * reference won't mutate the object again, instead the current object uid - * returns. See {@link core.UID_PROPERTY}. - * @type {opt_object} Optional object to be mutated with the uid. If not - * specified this method only returns the uid. - * @throws {Error} when invoked to indicate the method should be overridden. - */ + /** + * Gets an unique id. If `opt_object` argument is passed, the object is + * mutated with an unique id. Consecutive calls with the same object + * reference won't mutate the object again, instead the current object uid + * returns. See {@link core.UID_PROPERTY}. + * @type {opt_object} Optional object to be mutated with the uid. If not + * specified this method only returns the uid. + * @throws {Error} when invoked to indicate the method should be overridden. + */ - }, { - key: 'getUid', - value: function getUid(opt_object) { - if (opt_object) { - return opt_object[core.UID_PROPERTY] || (opt_object[core.UID_PROPERTY] = core.uniqueIdCounter_++); - } - return core.uniqueIdCounter_++; + core.getUid = function getUid(opt_object) { + if (opt_object) { + return opt_object[core.UID_PROPERTY] || (opt_object[core.UID_PROPERTY] = core.uniqueIdCounter_++); } + return core.uniqueIdCounter_++; + }; - /** - * The identity function. Returns its first argument. - * @param {*=} opt_returnValue The single value that will be returned. - * @return {?} The first argument. - */ + /** + * The identity function. Returns its first argument. + * @param {*=} opt_returnValue The single value that will be returned. + * @return {?} The first argument. + */ - }, { - key: 'identityFunction', - value: function identityFunction(opt_returnValue) { - return opt_returnValue; - } + core.identityFunction = function identityFunction(opt_returnValue) { + return opt_returnValue; + }; - /** - * Returns true if the specified value is a boolean. - * @param {?} val Variable to test. - * @return {boolean} Whether variable is boolean. - */ + /** + * Returns true if the specified value is a boolean. + * @param {?} val Variable to test. + * @return {boolean} Whether variable is boolean. + */ - }, { - key: 'isBoolean', - value: function isBoolean(val) { - return typeof val === 'boolean'; - } + core.isBoolean = function isBoolean(val) { + return typeof val === 'boolean'; + }; - /** - * Returns true if the specified value is not undefined. - * @param {?} val Variable to test. - * @return {boolean} Whether variable is defined. - */ + /** + * Returns true if the specified value is not undefined. + * @param {?} val Variable to test. + * @return {boolean} Whether variable is defined. + */ - }, { - key: 'isDef', - value: function isDef(val) { - return val !== undefined; - } + core.isDef = function isDef(val) { + return val !== undefined; + }; - /** - * Returns true if value is not undefined or null. - * @param {*} val - * @return {Boolean} - */ + /** + * Returns true if value is not undefined or null. + * @param {*} val + * @return {Boolean} + */ - }, { - key: 'isDefAndNotNull', - value: function isDefAndNotNull(val) { - return core.isDef(val) && !core.isNull(val); - } + core.isDefAndNotNull = function isDefAndNotNull(val) { + return core.isDef(val) && !core.isNull(val); + }; - /** - * Returns true if value is a document. - * @param {*} val - * @return {Boolean} - */ + /** + * Returns true if value is a document. + * @param {*} val + * @return {Boolean} + */ - }, { - key: 'isDocument', - value: function isDocument(val) { - return val && (typeof val === 'undefined' ? 'undefined' : babelHelpers.typeof(val)) === 'object' && val.nodeType === 9; - } + core.isDocument = function isDocument(val) { + return val && (typeof val === 'undefined' ? 'undefined' : babelHelpers.typeof(val)) === 'object' && val.nodeType === 9; + }; - /** - * Returns true if value is a dom element. - * @param {*} val - * @return {Boolean} - */ + /** + * Returns true if value is a dom element. + * @param {*} val + * @return {Boolean} + */ - }, { - key: 'isElement', - value: function isElement(val) { - return val && (typeof val === 'undefined' ? 'undefined' : babelHelpers.typeof(val)) === 'object' && val.nodeType === 1; - } + core.isElement = function isElement(val) { + return val && (typeof val === 'undefined' ? 'undefined' : babelHelpers.typeof(val)) === 'object' && val.nodeType === 1; + }; - /** - * Returns true if the specified value is a function. - * @param {?} val Variable to test. - * @return {boolean} Whether variable is a function. - */ + /** + * Returns true if the specified value is a function. + * @param {?} val Variable to test. + * @return {boolean} Whether variable is a function. + */ - }, { - key: 'isFunction', - value: function isFunction(val) { - return typeof val === 'function'; - } + core.isFunction = function isFunction(val) { + return typeof val === 'function'; + }; - /** - * Returns true if value is null. - * @param {*} val - * @return {Boolean} - */ + /** + * Returns true if value is null. + * @param {*} val + * @return {Boolean} + */ - }, { - key: 'isNull', - value: function isNull(val) { - return val === null; - } + core.isNull = function isNull(val) { + return val === null; + }; - /** - * Returns true if the specified value is a number. - * @param {?} val Variable to test. - * @return {boolean} Whether variable is a number. - */ + /** + * Returns true if the specified value is a number. + * @param {?} val Variable to test. + * @return {boolean} Whether variable is a number. + */ - }, { - key: 'isNumber', - value: function isNumber(val) { - return typeof val === 'number'; - } + core.isNumber = function isNumber(val) { + return typeof val === 'number'; + }; - /** - * Returns true if value is a window. - * @param {*} val - * @return {Boolean} - */ + /** + * Returns true if value is a window. + * @param {*} val + * @return {Boolean} + */ - }, { - key: 'isWindow', - value: function isWindow(val) { - return val !== null && val === val.window; - } + core.isWindow = function isWindow(val) { + return val !== null && val === val.window; + }; - /** - * Returns true if the specified value is an object. This includes arrays - * and functions. - * @param {?} val Variable to test. - * @return {boolean} Whether variable is an object. - */ + /** + * Returns true if the specified value is an object. This includes arrays + * and functions. + * @param {?} val Variable to test. + * @return {boolean} Whether variable is an object. + */ - }, { - key: 'isObject', - value: function isObject(val) { - var type = typeof val === 'undefined' ? 'undefined' : babelHelpers.typeof(val); - return type === 'object' && val !== null || type === 'function'; - } + core.isObject = function isObject(val) { + var type = typeof val === 'undefined' ? 'undefined' : babelHelpers.typeof(val); + return type === 'object' && val !== null || type === 'function'; + }; - /** - * Returns true if value is a string. - * @param {*} val - * @return {Boolean} - */ + /** + * Returns true if value is a string. + * @param {*} val + * @return {Boolean} + */ - }, { - key: 'isString', - value: function isString(val) { - return typeof val === 'string'; - } + core.isString = function isString(val) { + return typeof val === 'string'; + }; - /** - * Merges the values of a static property a class with the values of that - * property for all its super classes, and stores it as a new static - * property of that class. If the static property already existed, it won't - * be recalculated. - * @param {!function()} constructor Class constructor. - * @param {string} propertyName Property name to be collected. - * @param {function(*, *):*=} opt_mergeFn Function that receives an array filled - * with the values of the property for the current class and all its super classes. - * Should return the merged value to be stored on the current class. - * @return {boolean} Returns true if merge happens, false otherwise. - */ + /** + * Merges the values of a static property a class with the values of that + * property for all its super classes, and stores it as a new static + * property of that class. If the static property already existed, it won't + * be recalculated. + * @param {!function()} constructor Class constructor. + * @param {string} propertyName Property name to be collected. + * @param {function(*, *):*=} opt_mergeFn Function that receives an array filled + * with the values of the property for the current class and all its super classes. + * Should return the merged value to be stored on the current class. + * @return {boolean} Returns true if merge happens, false otherwise. + */ - }, { - key: 'mergeSuperClassesProperty', - value: function mergeSuperClassesProperty(constructor, propertyName, opt_mergeFn) { - var mergedName = propertyName + '_MERGED'; - if (constructor.hasOwnProperty(mergedName)) { - return false; - } + core.mergeSuperClassesProperty = function mergeSuperClassesProperty(constructor, propertyName, opt_mergeFn) { + var mergedName = propertyName + '_MERGED'; + if (constructor.hasOwnProperty(mergedName)) { + return false; + } - var merged = core.collectSuperClassesProperty(constructor, propertyName); - if (opt_mergeFn) { - merged = opt_mergeFn(merged); - } - constructor[mergedName] = merged; - return true; + var merged = core.collectSuperClassesProperty(constructor, propertyName); + if (opt_mergeFn) { + merged = opt_mergeFn(merged); } + constructor[mergedName] = merged; + return true; + }; - /** - * Null function used for default values of callbacks, etc. - * @return {void} Nothing. - */ + /** + * Null function used for default values of callbacks, etc. + * @return {void} Nothing. + */ + + core.nullFunction = function nullFunction() {}; - }, { - key: 'nullFunction', - value: function nullFunction() {} - }]); return core; })(); @@ -342,7 +293,7 @@ this.launchpadNamed = this.launchpadNamed || {}; * @protected */ - core.UID_PROPERTY = 'core_' + (Math.random() * 1e9 >>> 0); + core.UID_PROPERTY = 'core_' + Date.now() % 1e9 + '' + (Math.random() * 1e9 >>> 0); /** * Counter for unique id. @@ -353,34 +304,269 @@ this.launchpadNamed = this.launchpadNamed || {}; this.launchpad.core = core; }).call(this); -'use strict' +'use strict'; /** * Provides a convenient interface for data transport. * @interface */ -; + (function () { var Transport = (function () { function Transport() { babelHelpers.classCallCheck(this, Transport); } - babelHelpers.createClass(Transport, [{ - key: 'send', + /** + * Sends a message for the specified client. + * @param {!ClientRequest} clientRequest + * @return {!Promise} Deferred request. + */ + + Transport.prototype.send = function send() {}; - /** - * Sends a message for the specified client. - * @param {!ClientRequest} clientRequest - * @return {!Promise} Deferred request. - */ - value: function send() {} - }]); return Transport; })(); this.launchpad.Transport = Transport; }).call(this); +/*! + * Polyfill from Google's Closure Library. + * Copyright 2013 The Closure Library Authors. All Rights Reserved. + */ + +'use strict'; + +(function () { + var async = {}; + + /** + * Throw an item without interrupting the current execution context. For + * example, if processing a group of items in a loop, sometimes it is useful + * to report an error while still allowing the rest of the batch to be + * processed. + * @param {*} exception + */ + async.throwException = function (exception) { + // Each throw needs to be in its own context. + async.nextTick(function () { + throw exception; + }); + }; + + /** + * Fires the provided callback just before the current callstack unwinds, or as + * soon as possible after the current JS execution context. + * @param {function(this:THIS)} callback + * @param {THIS=} opt_context Object to use as the "this value" when calling + * the provided function. + * @template THIS + */ + async.run = function (callback, opt_context) { + if (!async.run.workQueueScheduled_) { + // Nothing is currently scheduled, schedule it now. + async.nextTick(async.run.processWorkQueue); + async.run.workQueueScheduled_ = true; + } + + async.run.workQueue_.push(new async.run.WorkItem_(callback, opt_context)); + }; + + /** @private {boolean} */ + async.run.workQueueScheduled_ = false; + + /** @private {!Array.} */ + async.run.workQueue_ = []; + + /** + * Run any pending async.run work items. This function is not intended + * for general use, but for use by entry point handlers to run items ahead of + * async.nextTick. + */ + async.run.processWorkQueue = function () { + // NOTE: additional work queue items may be pushed while processing. + while (async.run.workQueue_.length) { + // Don't let the work queue grow indefinitely. + var workItems = async.run.workQueue_; + async.run.workQueue_ = []; + for (var i = 0; i < workItems.length; i++) { + var workItem = workItems[i]; + try { + workItem.fn.call(workItem.scope); + } catch (e) { + async.throwException(e); + } + } + } + + // There are no more work items, reset the work queue. + async.run.workQueueScheduled_ = false; + }; + + /** + * @constructor + * @final + * @struct + * @private + * + * @param {function()} fn + * @param {Object|null|undefined} scope + */ + async.run.WorkItem_ = function (fn, scope) { + /** @const */ + this.fn = fn; + /** @const */ + this.scope = scope; + }; + + /** + * Fires the provided callbacks as soon as possible after the current JS + * execution context. setTimeout(…, 0) always takes at least 5ms for legacy + * reasons. + * @param {function(this:SCOPE)} callback Callback function to fire as soon as + * possible. + * @param {SCOPE=} opt_context Object in whose scope to call the listener. + * @template SCOPE + */ + async.nextTick = function (callback, opt_context) { + var cb = callback; + if (opt_context) { + cb = callback.bind(opt_context); + } + cb = async.nextTick.wrapCallback_(cb); + // Introduced and currently only supported by IE10. + // Verify if variable is defined on the current runtime (i.e., node, browser). + // Can't use typeof enclosed in a function (such as core.isFunction) or an + // exception will be thrown when the function is called on an environment + // where the variable is undefined. + if (typeof setImmediate === 'function') { + setImmediate(cb); + return; + } + // Look for and cache the custom fallback version of setImmediate. + if (!async.nextTick.setImmediate_) { + async.nextTick.setImmediate_ = async.nextTick.getSetImmediateEmulator_(); + } + async.nextTick.setImmediate_(cb); + }; + + /** + * Cache for the setImmediate implementation. + * @type {function(function())} + * @private + */ + async.nextTick.setImmediate_ = null; + + /** + * Determines the best possible implementation to run a function as soon as + * the JS event loop is idle. + * @return {function(function())} The "setImmediate" implementation. + * @private + */ + async.nextTick.getSetImmediateEmulator_ = function () { + // Create a private message channel and use it to postMessage empty messages + // to ourselves. + var Channel; + + // Verify if variable is defined on the current runtime (i.e., node, browser). + // Can't use typeof enclosed in a function (such as core.isFunction) or an + // exception will be thrown when the function is called on an environment + // where the variable is undefined. + if (typeof MessageChannel === 'function') { + Channel = MessageChannel; + } + + // If MessageChannel is not available and we are in a browser, implement + // an iframe based polyfill in browsers that have postMessage and + // document.addEventListener. The latter excludes IE8 because it has a + // synchronous postMessage implementation. + if (typeof Channel === 'undefined' && typeof window !== 'undefined' && window.postMessage && window.addEventListener) { + /** @constructor */ + Channel = function () { + // Make an empty, invisible iframe. + var iframe = document.createElement('iframe'); + iframe.style.display = 'none'; + iframe.src = ''; + document.documentElement.appendChild(iframe); + var win = iframe.contentWindow; + var doc = win.document; + doc.open(); + doc.write(''); + doc.close(); + var message = 'callImmediate' + Math.random(); + var origin = win.location.protocol + '//' + win.location.host; + var onmessage = (function (e) { + // Validate origin and message to make sure that this message was + // intended for us. + if (e.origin !== origin && e.data !== message) { + return; + } + this.port1.onmessage(); + }).bind(this); + win.addEventListener('message', onmessage, false); + this.port1 = {}; + this.port2 = { + postMessage: function postMessage() { + win.postMessage(message, origin); + } + }; + }; + } + if (typeof Channel !== 'undefined') { + var channel = new Channel(); + // Use a fifo linked list to call callbacks in the right order. + var head = {}; + var tail = head; + channel.port1.onmessage = function () { + head = head.next; + var cb = head.cb; + head.cb = null; + cb(); + }; + return function (cb) { + tail.next = { + cb: cb + }; + tail = tail.next; + channel.port2.postMessage(0); + }; + } + // Implementation for IE6-8: Script elements fire an asynchronous + // onreadystatechange event when inserted into the DOM. + if (typeof document !== 'undefined' && 'onreadystatechange' in document.createElement('script')) { + return function (cb) { + var script = document.createElement('script'); + script.onreadystatechange = function () { + // Clean up and call the callback. + script.onreadystatechange = null; + script.parentNode.removeChild(script); + script = null; + cb(); + cb = null; + }; + document.documentElement.appendChild(script); + }; + } + // Fall back to setTimeout with 0. In browsers this creates a delay of 5ms + // or more. + return function (cb) { + setTimeout(cb, 0); + }; + }; + + /** + * Helper function that is overrided to protect callbacks with entry point + * monitor if the application monitors entry points. + * @param {function()} callback Callback function to fire as soon as possible. + * @return {function()} The wrapped callback. + * @private + */ + async.nextTick.wrapCallback_ = function (opt_returnValue) { + return opt_returnValue; + }; + + this.launchpad.async = async; +}).call(this); /*! * Promises polyfill from Google's Closure Library. * @@ -395,6 +581,7 @@ this.launchpadNamed = this.launchpadNamed || {}; (function () { var core = this.launchpad.core; + var async = this.launchpad.async; /** * Provides a more strict interface for Thenables in terms of @@ -502,220 +689,6 @@ this.launchpadNamed = this.launchpadNamed || {}; }; }; - var async = {}; - - /** - * Throw an item without interrupting the current execution context. For - * example, if processing a group of items in a loop, sometimes it is useful - * to report an error while still allowing the rest of the batch to be - * processed. - * @param {*} exception - */ - async.throwException = function (exception) { - // Each throw needs to be in its own context. - async.nextTick(function () { - throw exception; - }); - }; - - /** - * Fires the provided callback just before the current callstack unwinds, or as - * soon as possible after the current JS execution context. - * @param {function(this:THIS)} callback - * @param {THIS=} opt_context Object to use as the "this value" when calling - * the provided function. - * @template THIS - */ - async.run = function (callback, opt_context) { - if (!async.run.workQueueScheduled_) { - // Nothing is currently scheduled, schedule it now. - async.nextTick(async.run.processWorkQueue); - async.run.workQueueScheduled_ = true; - } - - async.run.workQueue_.push(new async.run.WorkItem_(callback, opt_context)); - }; - - /** @private {boolean} */ - async.run.workQueueScheduled_ = false; - - /** @private {!Array.} */ - async.run.workQueue_ = []; - - /** - * Run any pending async.run work items. This function is not intended - * for general use, but for use by entry point handlers to run items ahead of - * async.nextTick. - */ - async.run.processWorkQueue = function () { - // NOTE: additional work queue items may be pushed while processing. - while (async.run.workQueue_.length) { - // Don't let the work queue grow indefinitely. - var workItems = async.run.workQueue_; - async.run.workQueue_ = []; - for (var i = 0; i < workItems.length; i++) { - var workItem = workItems[i]; - try { - workItem.fn.call(workItem.scope); - } catch (e) { - async.throwException(e); - } - } - } - - // There are no more work items, reset the work queue. - async.run.workQueueScheduled_ = false; - }; - - /** - * @constructor - * @final - * @struct - * @private - * - * @param {function()} fn - * @param {Object|null|undefined} scope - */ - async.run.WorkItem_ = function (fn, scope) { - /** @const */ - this.fn = fn; - /** @const */ - this.scope = scope; - }; - - /** - * Fires the provided callbacks as soon as possible after the current JS - * execution context. setTimeout(…, 0) always takes at least 5ms for legacy - * reasons. - * @param {function(this:SCOPE)} callback Callback function to fire as soon as - * possible. - * @param {SCOPE=} opt_context Object in whose scope to call the listener. - * @template SCOPE - */ - async.nextTick = function (callback, opt_context) { - var cb = callback; - if (opt_context) { - cb = callback.bind(opt_context); - } - cb = async.nextTick.wrapCallback_(cb); - // Introduced and currently only supported by IE10. - if (core.isFunction(window.setImmediate)) { - window.setImmediate(cb); - return; - } - // Look for and cache the custom fallback version of setImmediate. - if (!async.nextTick.setImmediate_) { - async.nextTick.setImmediate_ = async.nextTick.getSetImmediateEmulator_(); - } - async.nextTick.setImmediate_(cb); - }; - - /** - * Cache for the setImmediate implementation. - * @type {function(function())} - * @private - */ - async.nextTick.setImmediate_ = null; - - /** - * Determines the best possible implementation to run a function as soon as - * the JS event loop is idle. - * @return {function(function())} The "setImmediate" implementation. - * @private - */ - async.nextTick.getSetImmediateEmulator_ = function () { - // Create a private message channel and use it to postMessage empty messages - // to ourselves. - var Channel = window.MessageChannel; - // If MessageChannel is not available and we are in a browser, implement - // an iframe based polyfill in browsers that have postMessage and - // document.addEventListener. The latter excludes IE8 because it has a - // synchronous postMessage implementation. - if (typeof Channel === 'undefined' && typeof window !== 'undefined' && window.postMessage && window.addEventListener) { - /** @constructor */ - Channel = function () { - // Make an empty, invisible iframe. - var iframe = document.createElement('iframe'); - iframe.style.display = 'none'; - iframe.src = ''; - document.documentElement.appendChild(iframe); - var win = iframe.contentWindow; - var doc = win.document; - doc.open(); - doc.write(''); - doc.close(); - var message = 'callImmediate' + Math.random(); - var origin = win.location.protocol + '//' + win.location.host; - var onmessage = (function (e) { - // Validate origin and message to make sure that this message was - // intended for us. - if (e.origin !== origin && e.data !== message) { - return; - } - this.port1.onmessage(); - }).bind(this); - win.addEventListener('message', onmessage, false); - this.port1 = {}; - this.port2 = { - postMessage: function postMessage() { - win.postMessage(message, origin); - } - }; - }; - } - if (typeof Channel !== 'undefined') { - var channel = new Channel(); - // Use a fifo linked list to call callbacks in the right order. - var head = {}; - var tail = head; - channel.port1.onmessage = function () { - head = head.next; - var cb = head.cb; - head.cb = null; - cb(); - }; - return function (cb) { - tail.next = { - cb: cb - }; - tail = tail.next; - channel.port2.postMessage(0); - }; - } - // Implementation for IE6-8: Script elements fire an asynchronous - // onreadystatechange event when inserted into the DOM. - if (typeof document !== 'undefined' && 'onreadystatechange' in document.createElement('script')) { - return function (cb) { - var script = document.createElement('script'); - script.onreadystatechange = function () { - // Clean up and call the callback. - script.onreadystatechange = null; - script.parentNode.removeChild(script); - script = null; - cb(); - cb = null; - }; - document.documentElement.appendChild(script); - }; - } - // Fall back to setTimeout with 0. In browsers this creates a delay of 5ms - // or more. - return function (cb) { - setTimeout(cb, 0); - }; - }; - - /** - * Helper function that is overrided to protect callbacks with entry point - * monitor if the application monitors entry points. - * @param {function()} callback Callback function to fire as soon as possible. - * @return {function()} The wrapped callback. - * @private - */ - async.nextTick.wrapCallback_ = function (opt_returnValue) { - return opt_returnValue; - }; - /** * Promises provide a result that may be resolved asynchronously. A Promise may * be resolved by being fulfilled or rejected with a value, which will be known @@ -1086,6 +1059,7 @@ this.launchpadNamed = this.launchpadNamed || {}; if (this.state_ === CancellablePromise.State_.PENDING) { async.run(function () { var err = new CancellablePromise.CancellationError(opt_message); + err.IS_CANCELLATION_ERROR = true; this.cancelInternal_(err); }, this); } @@ -1213,7 +1187,7 @@ this.launchpadNamed = this.launchpadNamed || {}; callbackEntry.onRejected = onRejected ? function (reason) { try { var result = onRejected.call(opt_context, reason); - if (!core.isDef(result) && reason instanceof CancellablePromise.CancellationError) { + if (!core.isDef(result) && reason.IS_CANCELLATION_ERROR) { // Propagate cancellation to children if no other result is returned. reject(reason); } else { @@ -1306,7 +1280,7 @@ this.launchpadNamed = this.launchpadNamed || {}; this.state_ = state; this.scheduleCallbacks_(); - if (state === CancellablePromise.State_.REJECTED && !(x instanceof CancellablePromise.CancellationError)) { + if (state === CancellablePromise.State_.REJECTED && !x.IS_CANCELLATION_ERROR) { CancellablePromise.addUnhandledRejection_(this, x); } }; @@ -1496,7 +1470,7 @@ this.launchpadNamed = this.launchpadNamed || {}; function _class(opt_message) { babelHelpers.classCallCheck(this, _class); - var _this = babelHelpers.possibleConstructorReturn(this, Object.getPrototypeOf(_class).call(this, opt_message)); + var _this = babelHelpers.possibleConstructorReturn(this, _Error.call(this, opt_message)); if (opt_message) { _this.message = opt_message; @@ -1510,13 +1484,9 @@ this.launchpadNamed = this.launchpadNamed || {}; /** @override */ CancellablePromise.CancellationError.prototype.name = 'cancel'; - if (typeof window.Promise === 'undefined') { - window.Promise = CancellablePromise; - } - this.launchpadNamed.Promise = {}; this.launchpadNamed.Promise.CancellablePromise = CancellablePromise; - this.launchpadNamed.Promise.async = async; + this.launchpad.Promise = CancellablePromise; }).call(this); 'use strict'; @@ -1529,192 +1499,182 @@ this.launchpadNamed = this.launchpadNamed || {}; babelHelpers.classCallCheck(this, Ajax); } - babelHelpers.createClass(Ajax, null, [{ - key: 'addParametersToUrlQueryString', + /** + * Adds parameters into the url querystring. + * @param {string} url + * @param {MultiMap} opt_params + * @return {string} Url containting parameters as querystring. + * @protected + */ - /** - * Adds parameters into the url querystring. - * @param {string} url - * @param {MultiMap} opt_params - * @return {string} Url containting parameters as querystring. - * @protected - */ - value: function addParametersToUrlQueryString(url, opt_params) { - var querystring = ''; - opt_params.names().forEach(function (name) { - opt_params.getAll(name).forEach(function (value) { - querystring += name + '=' + encodeURIComponent(value) + '&'; - }); + Ajax.addParametersToUrlQueryString = function addParametersToUrlQueryString(url, opt_params) { + var querystring = ''; + opt_params.names().forEach(function (name) { + opt_params.getAll(name).forEach(function (value) { + querystring += name + '=' + encodeURIComponent(value) + '&'; }); - querystring = querystring.slice(0, -1); - if (querystring) { - url += url.indexOf('?') > -1 ? '&' : '?'; - url += querystring; - } - - return url; + }); + querystring = querystring.slice(0, -1); + if (querystring) { + url += url.indexOf('?') > -1 ? '&' : '?'; + url += querystring; } - /** - * Joins the given paths. - * @param {string} basePath - * @param {...string} ...paths Any number of paths to be joined with the base url. - */ + return url; + }; - }, { - key: 'joinPaths', - value: function joinPaths(basePath) { - for (var _len = arguments.length, paths = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { - paths[_key - 1] = arguments[_key]; - } + /** + * Joins the given paths. + * @param {string} basePath + * @param {...string} ...paths Any number of paths to be joined with the base url. + */ - if (basePath.charAt(basePath.length - 1) === '/') { - basePath = basePath.substring(0, basePath.length - 1); - } - paths = paths.map(function (path) { - return path.charAt(0) === '/' ? path.substring(1) : path; - }); - return [basePath].concat(paths).join('/').replace(/\/$/, ''); + Ajax.joinPaths = function joinPaths(basePath) { + for (var _len = arguments.length, paths = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + paths[_key - 1] = arguments[_key]; } - /** - * XmlHttpRequest's getAllResponseHeaders() method returns a string of - * response headers according to the format described on the spec: - * {@link http://www.w3.org/TR/XMLHttpRequest/#the-getallresponseheaders-method}. - * This method parses that string into a user-friendly name/value pair - * object. - * @param {string} allHeaders All headers as string. - * @return {!Array.>} - */ + if (basePath.charAt(basePath.length - 1) === '/') { + basePath = basePath.substring(0, basePath.length - 1); + } + paths = paths.map(function (path) { + return path.charAt(0) === '/' ? path.substring(1) : path; + }); + return [basePath].concat(paths).join('/').replace(/\/$/, ''); + }; - }, { - key: 'parseResponseHeaders', - value: function parseResponseHeaders(allHeaders) { - var headers = []; - if (!allHeaders) { - return headers; - } - var pairs = allHeaders.split('\r\n'); - for (var i = 0; i < pairs.length; i++) { - var index = pairs[i].indexOf(': '); - if (index > 0) { - var name = pairs[i].substring(0, index); - var value = pairs[i].substring(index + 2); - headers.push({ - name: name, - value: value - }); - } - } + /** + * XmlHttpRequest's getAllResponseHeaders() method returns a string of + * response headers according to the format described on the spec: + * {@link http://www.w3.org/TR/XMLHttpRequest/#the-getallresponseheaders-method}. + * This method parses that string into a user-friendly name/value pair + * object. + * @param {string} allHeaders All headers as string. + * @return {!Array.>} + */ + + Ajax.parseResponseHeaders = function parseResponseHeaders(allHeaders) { + var headers = []; + if (!allHeaders) { return headers; } + var pairs = allHeaders.split('\r\n'); + for (var i = 0; i < pairs.length; i++) { + var index = pairs[i].indexOf(': '); + if (index > 0) { + var name = pairs[i].substring(0, index); + var value = pairs[i].substring(index + 2); + headers.push({ + name: name, + value: value + }); + } + } + return headers; + }; - /** - * Parses the url separating the domain and port from the path. - * @param {string} url - * @return {array} Array containing the url domain and path. - * @protected - */ - - }, { - key: 'parseUrl', - value: function parseUrl(url) { - var base; - var path; - var qs; + /** + * Parses the url separating the domain and port from the path. + * @param {string} url + * @return {array} Array containing the url domain and path. + * @protected + */ - var domainAt = url.indexOf('//'); - if (domainAt > -1) { - url = url.substring(domainAt + 2); - } + Ajax.parseUrl = function parseUrl(url) { + var base; + var path; + var qs; - var pathAt = url.indexOf('/'); - if (pathAt === -1) { - url += '/'; - pathAt = url.length - 1; - } + var domainAt = url.indexOf('//'); + if (domainAt > -1) { + url = url.substring(domainAt + 2); + } - base = url.substring(0, pathAt); - path = url.substring(pathAt); + var pathAt = url.indexOf('/'); + if (pathAt === -1) { + url += '/'; + pathAt = url.length - 1; + } - var qsAt = path.indexOf('?'); - if (qsAt > -1) { - qs = path.substring(qsAt, path.length); - path = path.substring(0, qsAt); - } else { - qs = ''; - } + base = url.substring(0, pathAt); + path = url.substring(pathAt); - return [base, path, qs]; + var qsAt = path.indexOf('?'); + if (qsAt > -1) { + qs = path.substring(qsAt, path.length); + path = path.substring(0, qsAt); + } else { + qs = ''; } - /** - * Requests the url using XMLHttpRequest. - * @param {!string} url - * @param {!string} method - * @param {?string} body - * @param {MultiMap=} opt_headers - * @param {MultiMap=} opt_params - * @param {number=} opt_timeout - * @param {boolean=} opt_sync - * @return {Promise} Deferred ajax request. - * @protected - */ + return [base, path, qs]; + }; - }, { - key: 'request', - value: function request(url, method, body, opt_headers, opt_params, opt_timeout, opt_sync) { - var request = new XMLHttpRequest(); - - var promise = new Promise(function (resolve, reject) { - request.onload = function () { - if (request.aborted) { - request.onerror(); - return; - } - resolve(request); - }; - request.onerror = function () { - var error = new Error('Request error'); - error.request = request; - reject(error); - }; - }).thenCatch(function (reason) { - request.abort(); - throw reason; - }).thenAlways(function () { - clearTimeout(timeout); - }); + /** + * Requests the url using XMLHttpRequest. + * @param {!string} url + * @param {!string} method + * @param {?string} body + * @param {MultiMap=} opt_headers + * @param {MultiMap=} opt_params + * @param {number=} opt_timeout + * @param {boolean=} opt_sync + * @return {Promise} Deferred ajax request. + * @protected + */ - if (opt_params) { - url = Ajax.addParametersToUrlQueryString(url, opt_params); - } + Ajax.request = function request(url, method, body, opt_headers, opt_params, opt_timeout, opt_sync) { + var request = new XMLHttpRequest(); - request.open(method, url, !opt_sync); + var promise = new Promise(function (resolve, reject) { + request.onload = function () { + if (request.aborted) { + request.onerror(); + return; + } + resolve(request); + }; + request.onerror = function () { + var error = new Error('Request error'); + error.request = request; + reject(error); + }; + }).thenCatch(function (reason) { + request.abort(); + throw reason; + }).thenAlways(function () { + clearTimeout(timeout); + }); - if (opt_headers) { - opt_headers.names().forEach(function (name) { - request.setRequestHeader(name, opt_headers.getAll(name).join(', ')); - }); - } + if (opt_params) { + url = Ajax.addParametersToUrlQueryString(url, opt_params); + } - request.send(core.isDef(body) ? body : null); + request.open(method, url, !opt_sync); - if (core.isDefAndNotNull(opt_timeout)) { - var timeout = setTimeout(function () { - promise.cancel('Request timeout'); - }, opt_timeout); - } + if (opt_headers) { + opt_headers.names().forEach(function (name) { + request.setRequestHeader(name, opt_headers.getAll(name).join(', ')); + }); + } + + request.send(core.isDef(body) ? body : null); - return promise; + if (core.isDefAndNotNull(opt_timeout)) { + var timeout = setTimeout(function () { + promise.cancel('Request timeout'); + }, opt_timeout); } - }]); + + return promise; + }; + return Ajax; })(); this.launchpad.Ajax = Ajax; }).call(this); -'use strict' +'use strict'; /** * Disposable utility. When inherited provides the `dispose` function to its @@ -1723,7 +1683,7 @@ this.launchpadNamed = this.launchpadNamed || {}; * `disposeInternal` to implement any specific disposing logic. * @constructor */ -; + (function () { var Disposable = (function () { function Disposable() { @@ -1741,36 +1701,30 @@ this.launchpadNamed = this.launchpadNamed || {}; * Disposes of this instance's object references. Calls `disposeInternal`. */ - babelHelpers.createClass(Disposable, [{ - key: 'dispose', - value: function dispose() { - if (!this.disposed_) { - this.disposeInternal(); - this.disposed_ = true; - } + Disposable.prototype.dispose = function dispose() { + if (!this.disposed_) { + this.disposeInternal(); + this.disposed_ = true; } + }; - /** - * Subclasses should override this method to implement any specific - * disposing logic (like clearing references and calling `dispose` on other - * disposables). - */ + /** + * Subclasses should override this method to implement any specific + * disposing logic (like clearing references and calling `dispose` on other + * disposables). + */ - }, { - key: 'disposeInternal', - value: function disposeInternal() {} + Disposable.prototype.disposeInternal = function disposeInternal() {}; - /** - * Checks if this instance has already been disposed. - * @return {boolean} - */ + /** + * Checks if this instance has already been disposed. + * @return {boolean} + */ + + Disposable.prototype.isDisposed = function isDisposed() { + return this.disposed_; + }; - }, { - key: 'isDisposed', - value: function isDisposed() { - return this.disposed_; - } - }]); return Disposable; })(); @@ -1793,7 +1747,7 @@ this.launchpadNamed = this.launchpadNamed || {}; function MultiMap() { babelHelpers.classCallCheck(this, MultiMap); - var _this = babelHelpers.possibleConstructorReturn(this, Object.getPrototypeOf(MultiMap).call(this)); + var _this = babelHelpers.possibleConstructorReturn(this, _Disposable.call(this)); _this.keys = {}; _this.values = {}; @@ -1807,160 +1761,137 @@ this.launchpadNamed = this.launchpadNamed || {}; * @chainable */ - babelHelpers.createClass(MultiMap, [{ - key: 'add', - value: function add(name, value) { - this.keys[name.toLowerCase()] = name; - this.values[name.toLowerCase()] = this.values[name.toLowerCase()] || []; - this.values[name.toLowerCase()].push(value); - return this; - } + MultiMap.prototype.add = function add(name, value) { + this.keys[name.toLowerCase()] = name; + this.values[name.toLowerCase()] = this.values[name.toLowerCase()] || []; + this.values[name.toLowerCase()].push(value); + return this; + }; - /** - * Clears map names and values. - * @chainable - */ + /** + * Clears map names and values. + * @chainable + */ - }, { - key: 'clear', - value: function clear() { - this.keys = {}; - this.values = {}; - return this; - } + MultiMap.prototype.clear = function clear() { + this.keys = {}; + this.values = {}; + return this; + }; - /** - * Checks if map contains a value to the key name. - * @param {string} name - * @return {boolean} - * @chainable - */ + /** + * Checks if map contains a value to the key name. + * @param {string} name + * @return {boolean} + * @chainable + */ - }, { - key: 'contains', - value: function contains(name) { - return name.toLowerCase() in this.values; - } + MultiMap.prototype.contains = function contains(name) { + return name.toLowerCase() in this.values; + }; - /** - * @inheritDoc - */ + /** + * @inheritDoc + */ - }, { - key: 'disposeInternal', - value: function disposeInternal() { - this.values = null; - } + MultiMap.prototype.disposeInternal = function disposeInternal() { + this.values = null; + }; - /** - * Gets the first added value from a key name. - * @param {string} name - * @return {*} - * @chainable - */ + /** + * Gets the first added value from a key name. + * @param {string} name + * @return {*} + * @chainable + */ - }, { - key: 'get', - value: function get(name) { - var values = this.values[name.toLowerCase()]; - if (values) { - return values[0]; - } + MultiMap.prototype.get = function get(name) { + var values = this.values[name.toLowerCase()]; + if (values) { + return values[0]; } + }; - /** - * Gets all values from a key name. - * @param {string} name - * @return {Array.<*>} - */ + /** + * Gets all values from a key name. + * @param {string} name + * @return {Array.<*>} + */ - }, { - key: 'getAll', - value: function getAll(name) { - return this.values[name.toLowerCase()]; - } + MultiMap.prototype.getAll = function getAll(name) { + return this.values[name.toLowerCase()]; + }; - /** - * Returns true if the map is empty, false otherwise. - * @return {boolean} - */ + /** + * Returns true if the map is empty, false otherwise. + * @return {boolean} + */ - }, { - key: 'isEmpty', - value: function isEmpty() { - return this.size() === 0; - } + MultiMap.prototype.isEmpty = function isEmpty() { + return this.size() === 0; + }; - /** - * Gets array of key names. - * @return {Array.} - */ + /** + * Gets array of key names. + * @return {Array.} + */ - }, { - key: 'names', - value: function names() { - var _this2 = this; + MultiMap.prototype.names = function names() { + var _this2 = this; - return Object.keys(this.values).map(function (key) { - return _this2.keys[key]; - }); - } + return Object.keys(this.values).map(function (key) { + return _this2.keys[key]; + }); + }; - /** - * Removes all values from a key name. - * @param {string} name - * @chainable - */ + /** + * Removes all values from a key name. + * @param {string} name + * @chainable + */ - }, { - key: 'remove', - value: function remove(name) { - delete this.keys[name.toLowerCase()]; - delete this.values[name.toLowerCase()]; - return this; - } + MultiMap.prototype.remove = function remove(name) { + delete this.keys[name.toLowerCase()]; + delete this.values[name.toLowerCase()]; + return this; + }; - /** - * Sets the value of a key name. Relevant to replace the current values with - * a new one. - * @param {string} name - * @param {*} value - * @chainable - */ + /** + * Sets the value of a key name. Relevant to replace the current values with + * a new one. + * @param {string} name + * @param {*} value + * @chainable + */ - }, { - key: 'set', - value: function set(name, value) { - this.keys[name.toLowerCase()] = name; - this.values[name.toLowerCase()] = [value]; - return this; - } + MultiMap.prototype.set = function set(name, value) { + this.keys[name.toLowerCase()] = name; + this.values[name.toLowerCase()] = [value]; + return this; + }; - /** - * Gets the size of the map key names. - * @return {number} - */ + /** + * Gets the size of the map key names. + * @return {number} + */ - }, { - key: 'size', - value: function size() { - return this.names().length; - } + MultiMap.prototype.size = function size() { + return this.names().length; + }; - /** - * Returns the parsed values as a string. - * @return {string} - */ + /** + * Returns the parsed values as a string. + * @return {string} + */ + + MultiMap.prototype.toString = function toString() { + return JSON.stringify(this.values); + }; - }, { - key: 'toString', - value: function toString() { - return JSON.stringify(this.values); - } - }]); return MultiMap; })(Disposable); + MultiMap.prototype.registerMetalComponent && MultiMap.prototype.registerMetalComponent(MultiMap, 'MultiMap') this.launchpad.MultiMap = MultiMap; }).call(this); 'use strict'; @@ -1989,69 +1920,61 @@ this.launchpadNamed = this.launchpadNamed || {}; * @chainable Chainable when used as setter. */ - babelHelpers.createClass(ClientMessage, [{ - key: 'body', - value: function body(opt_body) { - if (core.isDef(opt_body)) { - this.body_ = opt_body; - return this; - } - return this.body_; + ClientMessage.prototype.body = function body(opt_body) { + if (core.isDef(opt_body)) { + this.body_ = opt_body; + return this; } + return this.body_; + }; - /** - * Adds a header. If a header with the same name already exists, it will not be - * overwritten, but the new value will be stored as well. The order is preserved. - * @param {string} name - * @param {string} value - * @chainable - */ + /** + * Adds a header. If a header with the same name already exists, it will not be + * overwritten, but the new value will be stored as well. The order is preserved. + * @param {string} name + * @param {string} value + * @chainable + */ - }, { - key: 'header', - value: function header(name, value) { - if (arguments.length !== 2) { - throw new Error('Invalid arguments'); - } - this.headers_.set(name, value); - return this; + ClientMessage.prototype.header = function header(name, value) { + if (arguments.length !== 2) { + throw new Error('Invalid arguments'); } + this.headers_.set(name, value); + return this; + }; - /** - * Fluent getter and setter for request headers. - * @param {MultiMap|Object=} opt_headers Request headers list to - * be set. If none is given the current value of the headers will - * be returned. - * @return {!MultiMap|ClientMessage} Returns map of request headers - * if no new value was given. Otherwise returns the {@link ClientMessage} - * object itself, so calls can be chained. - * @chainable Chainable when used as setter. - */ + /** + * Fluent getter and setter for request headers. + * @param {MultiMap|Object=} opt_headers Request headers list to + * be set. If none is given the current value of the headers will + * be returned. + * @return {!MultiMap|ClientMessage} Returns map of request headers + * if no new value was given. Otherwise returns the {@link ClientMessage} + * object itself, so calls can be chained. + * @chainable Chainable when used as setter. + */ - }, { - key: 'headers', - value: function headers(opt_headers) { - if (core.isDef(opt_headers)) { - if (opt_headers instanceof MultiMap) { - this.headers_ = opt_headers; - } else { - this.headers_.values = opt_headers; - } - return opt_headers; + ClientMessage.prototype.headers = function headers(opt_headers) { + if (core.isDef(opt_headers)) { + if (opt_headers instanceof MultiMap) { + this.headers_ = opt_headers; + } else { + this.headers_.values = opt_headers; } - return this.headers_; + return opt_headers; } + return this.headers_; + }; - /** - * Removes the body. - */ + /** + * Removes the body. + */ + + ClientMessage.prototype.removeBody = function removeBody() { + this.body_ = undefined; + }; - }, { - key: 'removeBody', - value: function removeBody() { - this.body_ = undefined; - } - }]); return ClientMessage; })(); @@ -2074,7 +1997,7 @@ this.launchpadNamed = this.launchpadNamed || {}; function ClientResponse(clientRequest) { babelHelpers.classCallCheck(this, ClientResponse); - var _this = babelHelpers.possibleConstructorReturn(this, Object.getPrototypeOf(ClientResponse).call(this)); + var _this = babelHelpers.possibleConstructorReturn(this, _ClientMessage.call(this)); if (!clientRequest) { throw new Error('Can\'t create response without request'); @@ -2088,66 +2011,59 @@ this.launchpadNamed = this.launchpadNamed || {}; * @return {!ClientRequest} */ - babelHelpers.createClass(ClientResponse, [{ - key: 'request', - value: function request() { - return this.clientRequest_; - } + ClientResponse.prototype.request = function request() { + return this.clientRequest_; + }; - /** - * Fluent getter and setter for response status code. - * @param {number=} opt_statusCode Request status code to be set. If none is given, - * the current status code value will be returned. - * @return {!ClientMessage|number} Returns response status code if no new value was - * given. Otherwise returns the {@link ClientMessage} object itself, so calls can - * be chained. - * @chainable Chainable when used as setter. - */ + /** + * Fluent getter and setter for response status code. + * @param {number=} opt_statusCode Request status code to be set. If none is given, + * the current status code value will be returned. + * @return {!ClientMessage|number} Returns response status code if no new value was + * given. Otherwise returns the {@link ClientMessage} object itself, so calls can + * be chained. + * @chainable Chainable when used as setter. + */ - }, { - key: 'statusCode', - value: function statusCode(opt_statusCode) { - if (core.isDef(opt_statusCode)) { - this.statusCode_ = opt_statusCode; - return this; - } - return this.statusCode_; + ClientResponse.prototype.statusCode = function statusCode(opt_statusCode) { + if (core.isDef(opt_statusCode)) { + this.statusCode_ = opt_statusCode; + return this; } + return this.statusCode_; + }; - /** - * Fluent getter and setter for response status text. - * @param {string=} opt_statusText Request status text to be set. If none is given, - * the current status text value will be returned. - * @return {!ClientMessage|number} Returns response status text if no new value was - * given. Otherwise returns the {@link ClientMessage} object itself, so calls can - * be chained. - * @chainable Chainable when used as setter. - */ + /** + * Fluent getter and setter for response status text. + * @param {string=} opt_statusText Request status text to be set. If none is given, + * the current status text value will be returned. + * @return {!ClientMessage|number} Returns response status text if no new value was + * given. Otherwise returns the {@link ClientMessage} object itself, so calls can + * be chained. + * @chainable Chainable when used as setter. + */ - }, { - key: 'statusText', - value: function statusText(opt_statusText) { - if (core.isDef(opt_statusText)) { - this.statusText_ = opt_statusText; - return this; - } - return this.statusText_; + ClientResponse.prototype.statusText = function statusText(opt_statusText) { + if (core.isDef(opt_statusText)) { + this.statusText_ = opt_statusText; + return this; } + return this.statusText_; + }; - /** - * Checks if response succeeded. Any status code 2xx or 3xx is considered valid. - * @return {boolean} - */ + /** + * Checks if response succeeded. Any status code 2xx or 3xx is considered valid. + * @return {boolean} + */ + + ClientResponse.prototype.succeeded = function succeeded() { + return this.statusCode() >= 200 && this.statusCode() <= 399; + }; - }, { - key: 'succeeded', - value: function succeeded() { - return this.statusCode() >= 200 && this.statusCode() <= 399; - } - }]); return ClientResponse; })(ClientMessage); + ClientResponse.prototype.registerMetalComponent && ClientResponse.prototype.registerMetalComponent(ClientResponse, 'ClientResponse') this.launchpad.ClientResponse = ClientResponse; }).call(this); 'use strict'; @@ -2169,33 +2085,32 @@ this.launchpadNamed = this.launchpadNamed || {}; function AjaxTransport() { babelHelpers.classCallCheck(this, AjaxTransport); - return babelHelpers.possibleConstructorReturn(this, Object.getPrototypeOf(AjaxTransport).apply(this, arguments)); + return babelHelpers.possibleConstructorReturn(this, _Transport.apply(this, arguments)); } - babelHelpers.createClass(AjaxTransport, [{ - key: 'send', + /** + * @inheritDoc + */ + + AjaxTransport.prototype.send = function send(clientRequest) { + var deferred = Ajax.request(clientRequest.url(), clientRequest.method(), clientRequest.body(), clientRequest.headers(), clientRequest.params(), null, false); - /** - * @inheritDoc - */ - value: function send(clientRequest) { - var deferred = Ajax.request(clientRequest.url(), clientRequest.method(), clientRequest.body(), clientRequest.headers(), clientRequest.params(), null, false); - - return deferred.then(function (response) { - var clientResponse = new ClientResponse(clientRequest); - clientResponse.body(response.responseText); - clientResponse.statusCode(response.status); - clientResponse.statusText(response.statusText); - Ajax.parseResponseHeaders(response.getAllResponseHeaders()).forEach(function (header) { - clientResponse.header(header.name, header.value); - }); - return clientResponse; + return deferred.then(function (response) { + var clientResponse = new ClientResponse(clientRequest); + clientResponse.body(response.responseText); + clientResponse.statusCode(response.status); + clientResponse.statusText(response.statusText); + Ajax.parseResponseHeaders(response.getAllResponseHeaders()).forEach(function (header) { + clientResponse.header(header.name, header.value); }); - } - }]); + return clientResponse; + }); + }; + return AjaxTransport; })(Transport); + AjaxTransport.prototype.registerMetalComponent && AjaxTransport.prototype.registerMetalComponent(AjaxTransport, 'AjaxTransport') this.launchpad.AjaxTransport = AjaxTransport; }).call(this); 'use strict'; @@ -2235,77 +2150,64 @@ this.launchpadNamed = this.launchpadNamed || {}; * @return {!Auth} */ - babelHelpers.createClass(Auth, [{ - key: 'hasPassword', + Auth.create = function create(tokenOrUsername, opt_password) { + return new Auth(tokenOrUsername, opt_password); + }; - /** - * Checks if the password is set. - * @return {boolean} - */ - value: function hasPassword() { - return this.password_ !== null; - } + /** + * Checks if the password is set. + * @return {boolean} + */ - /** - * Checks if the token is set. - * @return {boolean} - */ + Auth.prototype.hasPassword = function hasPassword() { + return this.password_ !== null; + }; - }, { - key: 'hasToken', - value: function hasToken() { - return this.token_ !== null; - } + /** + * Checks if the token is set. + * @return {boolean} + */ - /** - * Checks if the username is set. - * @return {boolean} - */ + Auth.prototype.hasToken = function hasToken() { + return this.token_ !== null; + }; - }, { - key: 'hasUsername', - value: function hasUsername() { - return this.username_ !== null; - } + /** + * Checks if the username is set. + * @return {boolean} + */ - /** - * Returns the password. - * @return {string} - */ + Auth.prototype.hasUsername = function hasUsername() { + return this.username_ !== null; + }; - }, { - key: 'password', - value: function password() { - return this.password_; - } + /** + * Returns the password. + * @return {string} + */ - /** - * Returns the token. - * @return {string} - */ + Auth.prototype.password = function password() { + return this.password_; + }; - }, { - key: 'token', - value: function token() { - return this.token_; - } + /** + * Returns the token. + * @return {string} + */ - /** - * Returns the username. - * @return {string} - */ + Auth.prototype.token = function token() { + return this.token_; + }; + + /** + * Returns the username. + * @return {string} + */ + + Auth.prototype.username = function username() { + return this.username_; + }; - }, { - key: 'username', - value: function username() { - return this.username_; - } - }], [{ - key: 'create', - value: function create(tokenOrUsername, opt_password) { - return new Auth(tokenOrUsername, opt_password); - } - }]); return Auth; })(); @@ -2329,7 +2231,7 @@ this.launchpadNamed = this.launchpadNamed || {}; function ClientRequest() { babelHelpers.classCallCheck(this, ClientRequest); - var _this = babelHelpers.possibleConstructorReturn(this, Object.getPrototypeOf(ClientRequest).call(this)); + var _this = babelHelpers.possibleConstructorReturn(this, _ClientMessage.call(this)); _this.params_ = new MultiMap(); return _this; @@ -2345,91 +2247,85 @@ this.launchpadNamed = this.launchpadNamed || {}; * @chainable Chainable when used as setter. */ - babelHelpers.createClass(ClientRequest, [{ - key: 'method', - value: function method(opt_method) { - if (core.isDef(opt_method)) { - this.method_ = opt_method; - return this; - } - return this.method_ || ClientRequest.DEFAULT_METHOD; + ClientRequest.prototype.method = function method(opt_method) { + if (core.isDef(opt_method)) { + this.method_ = opt_method; + return this; } + return this.method_ || ClientRequest.DEFAULT_METHOD; + }; - /** - * Adds a query. If a query with the same name already exists, it will not - * be overwritten, but new value will be stored as well. The order is preserved. - * @param {string} name - * @param {string} value - * @chainable - */ + /** + * Adds a query. If a query with the same name already exists, it will not + * be overwritten, but new value will be stored as well. The order is preserved. + * @param {string} name + * @param {string} value + * @chainable + */ - }, { - key: 'param', - value: function param(name, value) { - if (arguments.length !== 2) { - throw new Error('Invalid arguments'); - } - this.params_.set(name, value); - return this; + ClientRequest.prototype.param = function param(name, value) { + if (arguments.length !== 2) { + throw new Error('Invalid arguments'); } + this.params_.set(name, value); + return this; + }; - /** - * Fluent getter and setter for request querystring. - * @param {MultiMap|Object=} opt_params Request querystring map to be set. - * If none is given the current value of the params will be returned. - * @return {!MultiMap|ClientMessage} Returns map of request querystring if - * no new value was given. Otherwise returns the {@link ClientMessage} - * object itself, so calls can be chained. - */ + /** + * Fluent getter and setter for request querystring. + * @param {MultiMap|Object=} opt_params Request querystring map to be set. + * If none is given the current value of the params will be returned. + * @return {!MultiMap|ClientMessage} Returns map of request querystring if + * no new value was given. Otherwise returns the {@link ClientMessage} + * object itself, so calls can be chained. + */ - }, { - key: 'params', - value: function params(opt_params) { - if (core.isDef(opt_params)) { - if (opt_params instanceof MultiMap) { - this.params_ = opt_params; - } else { - this.params_.values = opt_params; - } - return opt_params; + ClientRequest.prototype.params = function params(opt_params) { + if (core.isDef(opt_params)) { + if (opt_params instanceof MultiMap) { + this.params_ = opt_params; + } else { + this.params_.values = opt_params; } - return this.params_; + return opt_params; } + return this.params_; + }; - /** - * Fluent getter and setter for request url. - * @param {string=} opt_url Request url to be set. If none is given, - * the current value of the url will be returned. - * @return {!ClientMessage|string} Returns request url if no new value was given. - * Otherwise returns the {@link ClientMessage} object itself, so calls can be - * chained. - * @chainable Chainable when used as setter. - */ - - }, { - key: 'url', - value: function url(opt_url) { - if (core.isDef(opt_url)) { - this.url_ = opt_url; - return this; - } - return this.url_; + /** + * Fluent getter and setter for request url. + * @param {string=} opt_url Request url to be set. If none is given, + * the current value of the url will be returned. + * @return {!ClientMessage|string} Returns request url if no new value was given. + * Otherwise returns the {@link ClientMessage} object itself, so calls can be + * chained. + * @chainable Chainable when used as setter. + */ + + ClientRequest.prototype.url = function url(opt_url) { + if (core.isDef(opt_url)) { + this.url_ = opt_url; + return this; } - }]); + return this.url_; + }; + return ClientRequest; })(ClientMessage); + ClientRequest.prototype.registerMetalComponent && ClientRequest.prototype.registerMetalComponent(ClientRequest, 'ClientRequest') + ClientRequest.DEFAULT_METHOD = 'GET'; this.launchpad.ClientRequest = ClientRequest; }).call(this); -'use strict' +'use strict'; /** * Class responsible for storing an object that will be printed as JSON * when the `toString` method is called. */ -; + (function () { var Embodied = (function () { /** @@ -2448,37 +2344,32 @@ this.launchpadNamed = this.launchpadNamed || {}; * @return {!Object} */ - babelHelpers.createClass(Embodied, [{ - key: 'body', - value: function body() { - return this.body_; - } + Embodied.prototype.body = function body() { + return this.body_; + }; - /** - * If the given object is an instance of Embodied, this will - * return its body content. Otherwise this will return the - * original object. - * @param {*} obj - * @return {*} - * @static - */ + /** + * If the given object is an instance of Embodied, this will + * return its body content. Otherwise this will return the + * original object. + * @param {*} obj + * @return {*} + * @static + */ - }, { - key: 'toString', + Embodied.toBody = function toBody(obj) { + return obj instanceof Embodied ? obj.body() : obj; + }; + + /** + * Gets the json string that represents this instance. + * @return {string} + */ + + Embodied.prototype.toString = function toString() { + return JSON.stringify(this.body()); + }; - /** - * Gets the json string that represents this instance. - * @return {string} - */ - value: function toString() { - return JSON.stringify(this.body()); - } - }], [{ - key: 'toBody', - value: function toBody(obj) { - return obj instanceof Embodied ? obj.body() : obj; - } - }]); return Embodied; })(); @@ -2529,75 +2420,65 @@ this.launchpadNamed = this.launchpadNamed || {}; * if the operator is not unary. */ - babelHelpers.createClass(FilterBody, [{ - key: 'add', - value: function add(operator, opt_filter) { - if (opt_filter) { - this.addArrayOperator_(operator, opt_filter); - } else { - this.createBody_(operator, this.body_); - } + FilterBody.prototype.add = function add(operator, opt_filter) { + if (opt_filter) { + this.addArrayOperator_(operator, opt_filter); + } else { + this.createBody_(operator, this.body_); } + }; - /** - * Composes the current filter with an operator that stores its values in an array. - * @param {string} operator - * @param {!Filter} filter - * @protected - */ + /** + * Composes the current filter with an operator that stores its values in an array. + * @param {string} operator + * @param {!Filter} filter + * @protected + */ - }, { - key: 'addArrayOperator_', - value: function addArrayOperator_(operator, filter) { - if (!(this.body_[operator] instanceof Array)) { - this.createBody_(operator, [this.body_]); - } - this.body_[operator].push(filter.body()); + FilterBody.prototype.addArrayOperator_ = function addArrayOperator_(operator, filter) { + if (!(this.body_[operator] instanceof Array)) { + this.createBody_(operator, [this.body_]); } + this.body_[operator].push(filter.body()); + }; - /** - * Adds filters to be composed with this filter body using the given operator. - * @param {string} operator - * @param {...*} filters A variable amount of filters to be composed. - */ + /** + * Adds filters to be composed with this filter body using the given operator. + * @param {string} operator + * @param {...*} filters A variable amount of filters to be composed. + */ - }, { - key: 'addMany', - value: function addMany(operator) { - for (var _len = arguments.length, filters = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { - filters[_key - 1] = arguments[_key]; - } + FilterBody.prototype.addMany = function addMany(operator) { + for (var _len = arguments.length, filters = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + filters[_key - 1] = arguments[_key]; + } - for (var i = 0; i < filters.length; i++) { - this.add(operator, filters[i]); - } + for (var i = 0; i < filters.length; i++) { + this.add(operator, filters[i]); } + }; - /** - * Creates a new body object, setting the requestd key to the given value. - * @param {string} key The key to set in the new body object - * @param {*} value The value the requested key should have in the new body object. - * @protected - */ + /** + * Creates a new body object, setting the requestd key to the given value. + * @param {string} key The key to set in the new body object + * @param {*} value The value the requested key should have in the new body object. + * @protected + */ - }, { - key: 'createBody_', - value: function createBody_(key, value) { - this.body_ = {}; - this.body_[key] = value; - } + FilterBody.prototype.createBody_ = function createBody_(key, value) { + this.body_ = {}; + this.body_[key] = value; + }; - /** - * Gets the json object that represents this filter's body. - * @return {!Object} - */ + /** + * Gets the json object that represents this filter's body. + * @return {!Object} + */ + + FilterBody.prototype.getObject = function getObject() { + return this.body_; + }; - }, { - key: 'getObject', - value: function getObject() { - return this.body_; - } - }]); return FilterBody; })(); @@ -2618,82 +2499,72 @@ this.launchpadNamed = this.launchpadNamed || {}; babelHelpers.classCallCheck(this, Geo); } - babelHelpers.createClass(Geo, null, [{ - key: 'boundingBox', - - /** - * Creates a new {@link BoundingBox} instance. - * @param {*} upperLeft The upper left point. - * @param {*} lowerRight The lower right point. - * @return {!BoundingBox} - * @static - */ - value: function boundingBox(upperLeft, lowerRight) { - return new Geo.BoundingBox(upperLeft, lowerRight); - } + /** + * Creates a new {@link BoundingBox} instance. + * @param {*} upperLeft The upper left point. + * @param {*} lowerRight The lower right point. + * @return {!BoundingBox} + * @static + */ - /** - * Creates a new {@link Circle} instance. - * @param {*} center The circle's center coordinate. - * @param {string} radius The circle's radius. - * @return {!Circle} - * @static - */ + Geo.boundingBox = function boundingBox(upperLeft, lowerRight) { + return new Geo.BoundingBox(upperLeft, lowerRight); + }; - }, { - key: 'circle', - value: function circle(center, radius) { - return new Geo.Circle(center, radius); - } + /** + * Creates a new {@link Circle} instance. + * @param {*} center The circle's center coordinate. + * @param {string} radius The circle's radius. + * @return {!Circle} + * @static + */ - /** - * Creates a new {@link Line} instance. - * @param {...*} points This line's points. - * @return {!Line} - * @static - */ + Geo.circle = function circle(center, radius) { + return new Geo.Circle(center, radius); + }; - }, { - key: 'line', - value: function line() { - for (var _len = arguments.length, points = Array(_len), _key = 0; _key < _len; _key++) { - points[_key] = arguments[_key]; - } + /** + * Creates a new {@link Line} instance. + * @param {...*} points This line's points. + * @return {!Line} + * @static + */ - return new (Function.prototype.bind.apply(Geo.Line, [null].concat(points)))(); + Geo.line = function line() { + for (var _len = arguments.length, points = Array(_len), _key = 0; _key < _len; _key++) { + points[_key] = arguments[_key]; } - /** - * Creates a new {@link Point} instance. - * @param {number} lat The latitude coordinate - * @param {number} lon The longitude coordinate - * @return {!Point} - * @static - */ + return new (Function.prototype.bind.apply(Geo.Line, [null].concat(points)))(); + }; - }, { - key: 'point', - value: function point(lat, lon) { - return new Geo.Point(lat, lon); - } + /** + * Creates a new {@link Point} instance. + * @param {number} lat The latitude coordinate + * @param {number} lon The longitude coordinate + * @return {!Point} + * @static + */ - /** - * Creates a new {@link Polygon} instance. - * @param {...*} points This polygon's points. - * @return {!Polygon} - * @static - */ + Geo.point = function point(lat, lon) { + return new Geo.Point(lat, lon); + }; - }, { - key: 'polygon', - value: function polygon() { - for (var _len2 = arguments.length, points = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { - points[_key2] = arguments[_key2]; - } + /** + * Creates a new {@link Polygon} instance. + * @param {...*} points This polygon's points. + * @return {!Polygon} + * @static + */ - return new (Function.prototype.bind.apply(Geo.Polygon, [null].concat(points)))(); + Geo.polygon = function polygon() { + for (var _len2 = arguments.length, points = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { + points[_key2] = arguments[_key2]; } - }]); + + return new (Function.prototype.bind.apply(Geo.Polygon, [null].concat(points)))(); + }; + return Geo; })(); @@ -2715,7 +2586,7 @@ this.launchpadNamed = this.launchpadNamed || {}; function Point(lat, lon) { babelHelpers.classCallCheck(this, Point); - var _this = babelHelpers.possibleConstructorReturn(this, Object.getPrototypeOf(Point).call(this)); + var _this = babelHelpers.possibleConstructorReturn(this, _Embodied.call(this)); _this.body_ = [lat, lon]; return _this; @@ -2724,6 +2595,8 @@ this.launchpadNamed = this.launchpadNamed || {}; return Point; })(Embodied); + Point.prototype.registerMetalComponent && Point.prototype.registerMetalComponent(Point, 'Point') + Geo.Point = Point; /** @@ -2743,7 +2616,7 @@ this.launchpadNamed = this.launchpadNamed || {}; function Line() { babelHelpers.classCallCheck(this, Line); - var _this2 = babelHelpers.possibleConstructorReturn(this, Object.getPrototypeOf(Line).call(this)); + var _this2 = babelHelpers.possibleConstructorReturn(this, _Embodied2.call(this)); for (var _len3 = arguments.length, points = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { points[_key3] = arguments[_key3]; @@ -2761,6 +2634,8 @@ this.launchpadNamed = this.launchpadNamed || {}; return Line; })(Embodied); + Line.prototype.registerMetalComponent && Line.prototype.registerMetalComponent(Line, 'Line') + Geo.Line = Line; /** @@ -2781,7 +2656,7 @@ this.launchpadNamed = this.launchpadNamed || {}; function BoundingBox(upperLeft, lowerRight) { babelHelpers.classCallCheck(this, BoundingBox); - var _this3 = babelHelpers.possibleConstructorReturn(this, Object.getPrototypeOf(BoundingBox).call(this)); + var _this3 = babelHelpers.possibleConstructorReturn(this, _Embodied3.call(this)); _this3.body_ = { type: 'envelope', @@ -2795,15 +2670,15 @@ this.launchpadNamed = this.launchpadNamed || {}; * @return {!Array} */ - babelHelpers.createClass(BoundingBox, [{ - key: 'getPoints', - value: function getPoints() { - return this.body_.coordinates; - } - }]); + BoundingBox.prototype.getPoints = function getPoints() { + return this.body_.coordinates; + }; + return BoundingBox; })(Embodied); + BoundingBox.prototype.registerMetalComponent && BoundingBox.prototype.registerMetalComponent(BoundingBox, 'BoundingBox') + Geo.BoundingBox = BoundingBox; /** @@ -2824,7 +2699,7 @@ this.launchpadNamed = this.launchpadNamed || {}; function Circle(center, radius) { babelHelpers.classCallCheck(this, Circle); - var _this4 = babelHelpers.possibleConstructorReturn(this, Object.getPrototypeOf(Circle).call(this)); + var _this4 = babelHelpers.possibleConstructorReturn(this, _Embodied4.call(this)); _this4.body_ = { type: 'circle', @@ -2839,26 +2714,24 @@ this.launchpadNamed = this.launchpadNamed || {}; * @return {*} */ - babelHelpers.createClass(Circle, [{ - key: 'getCenter', - value: function getCenter() { - return this.body_.coordinates; - } + Circle.prototype.getCenter = function getCenter() { + return this.body_.coordinates; + }; - /** - * Gets this circle's radius. - * @return {string} - */ + /** + * Gets this circle's radius. + * @return {string} + */ + + Circle.prototype.getRadius = function getRadius() { + return this.body_.radius; + }; - }, { - key: 'getRadius', - value: function getRadius() { - return this.body_.radius; - } - }]); return Circle; })(Embodied); + Circle.prototype.registerMetalComponent && Circle.prototype.registerMetalComponent(Circle, 'Circle') + Geo.Circle = Circle; /** @@ -2878,7 +2751,7 @@ this.launchpadNamed = this.launchpadNamed || {}; function Polygon() { babelHelpers.classCallCheck(this, Polygon); - var _this5 = babelHelpers.possibleConstructorReturn(this, Object.getPrototypeOf(Polygon).call(this)); + var _this5 = babelHelpers.possibleConstructorReturn(this, _Embodied5.call(this)); _this5.body_ = { type: 'polygon', @@ -2894,34 +2767,32 @@ this.launchpadNamed = this.launchpadNamed || {}; * @protected */ - babelHelpers.createClass(Polygon, [{ - key: 'addCoordinates_', - value: function addCoordinates_() { - for (var _len4 = arguments.length, points = Array(_len4), _key4 = 0; _key4 < _len4; _key4++) { - points[_key4] = arguments[_key4]; - } - - this.body_.coordinates.push(points.map(function (point) { - return Embodied.toBody(point); - })); + Polygon.prototype.addCoordinates_ = function addCoordinates_() { + for (var _len4 = arguments.length, points = Array(_len4), _key4 = 0; _key4 < _len4; _key4++) { + points[_key4] = arguments[_key4]; } - /** - * Adds the given points as a hole inside this polygon. - * @param {...*} points - * @chainnable - */ + this.body_.coordinates.push(points.map(function (point) { + return Embodied.toBody(point); + })); + }; + + /** + * Adds the given points as a hole inside this polygon. + * @param {...*} points + * @chainnable + */ + + Polygon.prototype.hole = function hole() { + this.addCoordinates_.apply(this, arguments); + return this; + }; - }, { - key: 'hole', - value: function hole() { - this.addCoordinates_.apply(this, arguments); - return this; - } - }]); return Polygon; })(Embodied); + Polygon.prototype.registerMetalComponent && Polygon.prototype.registerMetalComponent(Polygon, 'Polygon') + Geo.Polygon = Polygon; this.launchpad.Geo = Geo; @@ -2950,7 +2821,7 @@ this.launchpadNamed = this.launchpadNamed || {}; function Range(from, opt_to) { babelHelpers.classCallCheck(this, Range); - var _this = babelHelpers.possibleConstructorReturn(this, Object.getPrototypeOf(Range).call(this)); + var _this = babelHelpers.possibleConstructorReturn(this, _Embodied.call(this)); if (core.isDefAndNotNull(from)) { _this.body_.from = from; @@ -2968,42 +2839,37 @@ this.launchpadNamed = this.launchpadNamed || {}; * @static */ - babelHelpers.createClass(Range, null, [{ - key: 'from', - value: function from(_from) { - return new Range(_from); - } + Range.from = function from(_from) { + return new Range(_from); + }; - /** - * Constructs a {@link Range} instance. - * @param {*} from - * @param {*} to - * @return {!Range} - * @static - */ + /** + * Constructs a {@link Range} instance. + * @param {*} from + * @param {*} to + * @return {!Range} + * @static + */ - }, { - key: 'range', - value: function range(from, to) { - return new Range(from, to); - } + Range.range = function range(from, to) { + return new Range(from, to); + }; - /** - * Constructs a {@link Range} instance. - * @param {*} to - * @return {!Range} - * @static - */ + /** + * Constructs a {@link Range} instance. + * @param {*} to + * @return {!Range} + * @static + */ + + Range.to = function to(_to) { + return new Range(null, _to); + }; - }, { - key: 'to', - value: function to(_to) { - return new Range(null, _to); - } - }]); return Range; })(Embodied); + Range.prototype.registerMetalComponent && Range.prototype.registerMetalComponent(Range, 'Range') this.launchpad.Range = Range; }).call(this); 'use strict'; @@ -3036,7 +2902,7 @@ this.launchpadNamed = this.launchpadNamed || {}; function Filter(field, operatorOrValue, opt_value) { babelHelpers.classCallCheck(this, Filter); - var _this = babelHelpers.possibleConstructorReturn(this, Object.getPrototypeOf(Filter).call(this)); + var _this = babelHelpers.possibleConstructorReturn(this, _Embodied.call(this)); _this.body_ = new FilterBody(field, operatorOrValue, opt_value); return _this; @@ -3052,551 +2918,491 @@ this.launchpadNamed = this.launchpadNamed || {}; * @chainnable */ - babelHelpers.createClass(Filter, [{ - key: 'add', - value: function add(operator, fieldOrFilter, opt_operatorOrValue, opt_value) { - var filter = fieldOrFilter ? Filter.toFilter(fieldOrFilter, opt_operatorOrValue, opt_value) : null; - this.body_.add(operator, filter); - return this; - } - - /** - * Adds filters to be composed with this filter using the given operator. - * @param {string} operator - * @param {...*} filters A variable amount of filters to be composed. - * @chainnable - */ + Filter.prototype.add = function add(operator, fieldOrFilter, opt_operatorOrValue, opt_value) { + var filter = fieldOrFilter ? Filter.toFilter(fieldOrFilter, opt_operatorOrValue, opt_value) : null; + this.body_.add(operator, filter); + return this; + }; - }, { - key: 'addMany', - value: function addMany(operator) { - var _body_; + /** + * Adds filters to be composed with this filter using the given operator. + * @param {string} operator + * @param {...*} filters A variable amount of filters to be composed. + * @chainnable + */ - for (var _len = arguments.length, filters = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { - filters[_key - 1] = arguments[_key]; - } + Filter.prototype.addMany = function addMany(operator) { + var _body_; - (_body_ = this.body_).addMany.apply(_body_, [operator].concat(filters)); - return this; + for (var _len = arguments.length, filters = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + filters[_key - 1] = arguments[_key]; } - /** - * Adds a filter to be composed with this filter using the "and" operator. - * @param {!Filter|string} fieldOrFilter Either a {@link Filter} instance or the - * name of the field to filter by. - * @param {*=} opt_operatorOrValue Either the field's operator or its value. - * @param {*=} opt_value The filter's value. - * @chainnable - */ + (_body_ = this.body_).addMany.apply(_body_, [operator].concat(filters)); + return this; + }; - }, { - key: 'and', - value: function and(fieldOrFilter, opt_operatorOrValue, opt_value) { - return this.add('and', fieldOrFilter, opt_operatorOrValue, opt_value); - } + /** + * Adds a filter to be composed with this filter using the "and" operator. + * @param {!Filter|string} fieldOrFilter Either a {@link Filter} instance or the + * name of the field to filter by. + * @param {*=} opt_operatorOrValue Either the field's operator or its value. + * @param {*=} opt_value The filter's value. + * @chainnable + */ - /** - * Returns a {@link Filter} instance that uses the "any" operator. - * @param {string} field The name of the field to filter by. - * @param {!(Array|...*)} values A variable amount of values to be used with - * the "none" operator. Can be passed either as a single array or as - * separate params. - * @return {!Filter} - * @static - */ + Filter.prototype.and = function and(fieldOrFilter, opt_operatorOrValue, opt_value) { + return this.add('and', fieldOrFilter, opt_operatorOrValue, opt_value); + }; - }, { - key: 'body', + /** + * Returns a {@link Filter} instance that uses the "any" operator. + * @param {string} field The name of the field to filter by. + * @param {!(Array|...*)} values A variable amount of values to be used with + * the "none" operator. Can be passed either as a single array or as + * separate params. + * @return {!Filter} + * @static + */ - /** - * Gets the json object that represents this filter. - * @return {!Object} - */ - value: function body() { - return this.body_.getObject(); + Filter.any = function any(field) { + var values = Array.prototype.slice.call(arguments, 1); + if (values.length === 1 && values[0] instanceof Array) { + values = values[0]; } + return new Filter(field, 'any', values); + }; - /** - * Returns a {@link Filter} instance that uses the "gd" operator. - * @param {string} field The field's name. - * @param {*} locationOrCircle Either a `Geo.Circle` instance or a coordinate. - * @param {Range|string=} opt_rangeOrDistance Either a `Range` instance or - * the distance value. - * @return {!Filter} - * @static - */ - - }, { - key: 'or', + /** + * Returns a {@link Filter} instance that uses the "gp" operator. + * This is a special use case of `Filter.polygon` for bounding + * boxes. + * @param {string} field The field's name. + * @param {*} boxOrUpperLeft Either a `Geo.BoundingBox` instance, or + * a bounding box's upper left coordinate. + * @param {*=} opt_lowerRight A bounding box's lower right coordinate. + * @return {!Filter} + * @static + */ - /** - * Adds a filter to be composed with this filter using the "or" operator. - * @param {!Filter|string} fieldOrFilter Either a {@link Filter} instance or the - * name of the field to filter by. - * @param {*=} opt_operatorOrValue Either the field's operator or its value. - * @param {*=} opt_value The filter's value. - * @chainnable - */ - value: function or(fieldOrFilter, opt_operatorOrValue, opt_value) { - return this.add('or', fieldOrFilter, opt_operatorOrValue, opt_value); + Filter.boundingBox = function boundingBox(field, boxOrUpperLeft, opt_lowerRight) { + if (boxOrUpperLeft instanceof Geo.BoundingBox) { + return Filter.polygon.apply(Filter, [field].concat(babelHelpers.toConsumableArray(boxOrUpperLeft.getPoints()))); + } else { + return Filter.polygon(field, boxOrUpperLeft, opt_lowerRight); } + }; - /** - * Converts the given arguments into a {@link Filter} instance. - * @param {!Filter|string} fieldOrFilter Either a {@link Filter} instance or the - * name of the field to filter by. - * @param {*=} opt_operatorOrValue Either the field's operator or its value. - * @param {*=} opt_value The filter's value. - * @return {!Filter} - */ + /** + * Gets the json object that represents this filter. + * @return {!Object} + */ - }], [{ - key: 'any', - value: function any(field) { - var values = Array.prototype.slice.call(arguments, 1); - if (values.length === 1 && values[0] instanceof Array) { - values = values[0]; - } - return new Filter(field, 'any', values); + Filter.prototype.body = function body() { + return this.body_.getObject(); + }; + + /** + * Returns a {@link Filter} instance that uses the "gd" operator. + * @param {string} field The field's name. + * @param {*} locationOrCircle Either a `Geo.Circle` instance or a coordinate. + * @param {Range|string=} opt_rangeOrDistance Either a `Range` instance or + * the distance value. + * @return {!Filter} + * @static + */ + + Filter.distance = function distance(field, locationOrCircle, opt_rangeOrDistance) { + var location = locationOrCircle; + var range = opt_rangeOrDistance; + if (locationOrCircle instanceof Geo.Circle) { + location = locationOrCircle.getCenter(); + range = Range.to(locationOrCircle.getRadius()); + } else if (!(opt_rangeOrDistance instanceof Range)) { + range = Range.to(opt_rangeOrDistance); } + return Filter.distanceInternal_(field, location, range); + }; - /** - * Returns a {@link Filter} instance that uses the "gp" operator. - * This is a special use case of `Filter.polygon` for bounding - * boxes. - * @param {string} field The field's name. - * @param {*} boxOrUpperLeft Either a `Geo.BoundingBox` instance, or - * a bounding box's upper left coordinate. - * @param {*=} opt_lowerRight A bounding box's lower right coordinate. - * @return {!Filter} - * @static - */ + /** + * Returns a {@link Filter} instance that uses the "gd" operator. This + * is just an internal helper used by `Filter.distance`. + * @param {string} field The field's name. + * @param {*} location A location coordinate. + * @param {Range} range A `Range` instance. + * @return {!Filter} + * @protected + * @static + */ - }, { - key: 'boundingBox', - value: function boundingBox(field, boxOrUpperLeft, opt_lowerRight) { - if (boxOrUpperLeft instanceof Geo.BoundingBox) { - return Filter.polygon.apply(Filter, [field].concat(babelHelpers.toConsumableArray(boxOrUpperLeft.getPoints()))); - } else { - return Filter.polygon(field, boxOrUpperLeft, opt_lowerRight); - } + Filter.distanceInternal_ = function distanceInternal_(field, location, range) { + var value = { + location: Embodied.toBody(location) + }; + range = range.body(); + if (range.from) { + value.min = range.from; } - }, { - key: 'distance', - value: function distance(field, locationOrCircle, opt_rangeOrDistance) { - var location = locationOrCircle; - var range = opt_rangeOrDistance; - if (locationOrCircle instanceof Geo.Circle) { - location = locationOrCircle.getCenter(); - range = Range.to(locationOrCircle.getRadius()); - } else if (!(opt_rangeOrDistance instanceof Range)) { - range = Range.to(opt_rangeOrDistance); - } - return Filter.distanceInternal_(field, location, range); + if (range.to) { + value.max = range.to; } + return Filter.field(field, 'gd', value); + }; - /** - * Returns a {@link Filter} instance that uses the "gd" operator. This - * is just an internal helper used by `Filter.distance`. - * @param {string} field The field's name. - * @param {*} location A location coordinate. - * @param {Range} range A `Range` instance. - * @return {!Filter} - * @protected + /** + * Returns a {@link Filter} instance that uses the "=" operator. + * @param {string} field The name of the field to filter by. + * @param {*} value The filter's value. + * @return {!Filter} * @static - */ + */ - }, { - key: 'distanceInternal_', - value: function distanceInternal_(field, location, range) { - var value = { - location: Embodied.toBody(location) - }; - range = range.body(); - if (range.from) { - value.min = range.from; - } - if (range.to) { - value.max = range.to; - } - return Filter.field(field, 'gd', value); - } + Filter.equal = function equal(field, value) { + return new Filter(field, '=', value); + }; - /** - * Returns a {@link Filter} instance that uses the "=" operator. - * @param {string} field The name of the field to filter by. - * @param {*} value The filter's value. - * @return {!Filter} - * @static - */ + /** + * Returns a {@link Filter} instance that uses the "exists" operator. + * @param {string} field The field's name. + * @return {!Filter} + * @static + */ - }, { - key: 'equal', - value: function equal(field, value) { - return new Filter(field, '=', value); - } + Filter.exists = function exists(field) { + return Filter.field(field, 'exists', null); + }; - /** - * Returns a {@link Filter} instance that uses the "exists" operator. - * @param {string} field The field's name. - * @return {!Filter} - * @static - */ + /** + * Returns a {@link Filter} instance that uses the "fuzzy" operator. + * @param {string} fieldOrQuery If no second string argument is given, this + * should be the query string, in which case all fields will be matched. + * Otherwise, this should be the name of the field to match. + * @param {string|number=} opt_queryOrFuzziness If this is a string, it should + * be the query, otherwise it should be the fuzziness value. + * @param {number=} opt_fuzziness The fuzziness value. + * @return {!Filter} + * @static + */ + + Filter.fuzzy = function fuzzy(fieldOrQuery, opt_queryOrFuzziness, opt_fuzziness) { + return Filter.fuzzyInternal_('fuzzy', fieldOrQuery, opt_queryOrFuzziness, opt_fuzziness); + }; + + /** + * Returns a {@link Filter} instance that uses the given fuzzy operator. This + * is an internal implementation used by the `Filter.fuzzy` method. + * @param {string} operator The fuzzy operator. + * @param {string} fieldOrQuery If no second string argument is given, this + * should be the query string, in which case all fields will be matched. + * Otherwise, this should be the name of the field to match. + * @param {string|number=} opt_queryOrFuzziness If this is a string, it should + * be the query, otherwise it should be the fuzziness value. + * @param {number=} opt_fuzziness The fuzziness value. + * @return {!Filter} + * @protected + * @static + */ + + Filter.fuzzyInternal_ = function fuzzyInternal_(operator, fieldOrQuery, opt_queryOrFuzziness, opt_fuzziness) { + var arg2IsString = core.isString(opt_queryOrFuzziness); - }, { - key: 'exists', - value: function exists(field) { - return Filter.field(field, 'exists', null); + var value = { + query: arg2IsString ? opt_queryOrFuzziness : fieldOrQuery + }; + var fuzziness = arg2IsString ? opt_fuzziness : opt_queryOrFuzziness; + if (fuzziness) { + value.fuzziness = fuzziness; } - /** - * Returns a {@link Filter} instance that uses the "fuzzy" operator. - * @param {string} fieldOrQuery If no second string argument is given, this - * should be the query string, in which case all fields will be matched. - * Otherwise, this should be the name of the field to match. - * @param {string|number=} opt_queryOrFuzziness If this is a string, it should - * be the query, otherwise it should be the fuzziness value. - * @param {number=} opt_fuzziness The fuzziness value. - * @return {!Filter} + var field = arg2IsString ? fieldOrQuery : Filter.ALL; + return Filter.field(field, operator, value); + }; + + /** + * Returns a {@link Filter} instance that uses the ">" operator. + * @param {string} field The name of the field to filter by. + * @param {*} value The filter's value. + * @return {!Filter} * @static - */ + */ - }, { - key: 'fuzzy', - value: function fuzzy(fieldOrQuery, opt_queryOrFuzziness, opt_fuzziness) { - return Filter.fuzzyInternal_('fuzzy', fieldOrQuery, opt_queryOrFuzziness, opt_fuzziness); - } + Filter.gt = function gt(field, value) { + return new Filter(field, '>', value); + }; - /** - * Returns a {@link Filter} instance that uses the given fuzzy operator. This - * is an internal implementation used by the `Filter.fuzzy` method. - * @param {string} operator The fuzzy operator. - * @param {string} fieldOrQuery If no second string argument is given, this - * should be the query string, in which case all fields will be matched. - * Otherwise, this should be the name of the field to match. - * @param {string|number=} opt_queryOrFuzziness If this is a string, it should - * be the query, otherwise it should be the fuzziness value. - * @param {number=} opt_fuzziness The fuzziness value. - * @return {!Filter} - * @protected + /** + * Returns a {@link Filter} instance that uses the ">=" operator. + * @param {string} field The name of the field to filter by. + * @param {*} value The filter's value. + * @return {!Filter} * @static - */ + */ - }, { - key: 'fuzzyInternal_', - value: function fuzzyInternal_(operator, fieldOrQuery, opt_queryOrFuzziness, opt_fuzziness) { - var arg2IsString = core.isString(opt_queryOrFuzziness); + Filter.gte = function gte(field, value) { + return new Filter(field, '>=', value); + }; - var value = { - query: arg2IsString ? opt_queryOrFuzziness : fieldOrQuery - }; - var fuzziness = arg2IsString ? opt_fuzziness : opt_queryOrFuzziness; - if (fuzziness) { - value.fuzziness = fuzziness; - } - - var field = arg2IsString ? fieldOrQuery : Filter.ALL; - return Filter.field(field, operator, value); - } - - /** - * Returns a {@link Filter} instance that uses the ">" operator. - * @param {string} field The name of the field to filter by. - * @param {*} value The filter's value. - * @return {!Filter} - * @static - */ + /** + * Returns a {@link Filter} instance that uses the "match" operator. + * @param {string} fieldOrQuery If no second string argument is given, this + * should be the query string, in which case all fields will be matched. + * Otherwise, this should be the name of the field to match. + * @param {string=} opt_query The query string. + * @return {!Filter} + * @static + */ - }, { - key: 'gt', - value: function gt(field, value) { - return new Filter(field, '>', value); - } + Filter.match = function match(fieldOrQuery, opt_query) { + var field = core.isString(opt_query) ? fieldOrQuery : Filter.ALL; + var query = core.isString(opt_query) ? opt_query : fieldOrQuery; + return Filter.field(field, 'match', query); + }; - /** - * Returns a {@link Filter} instance that uses the ">=" operator. - * @param {string} field The name of the field to filter by. - * @param {*} value The filter's value. - * @return {!Filter} - * @static - */ + /** + * Returns a {@link Filter} instance that uses the "missing" operator. + * @param {string} field The field's name. + * @return {!Filter} + * @static + */ - }, { - key: 'gte', - value: function gte(field, value) { - return new Filter(field, '>=', value); - } + Filter.missing = function missing(field) { + return Filter.field(field, 'missing', null); + }; - /** - * Returns a {@link Filter} instance that uses the "match" operator. - * @param {string} fieldOrQuery If no second string argument is given, this - * should be the query string, in which case all fields will be matched. - * Otherwise, this should be the name of the field to match. - * @param {string=} opt_query The query string. - * @return {!Filter} - * @static - */ + /** + * Returns a {@link Filter} instance that uses the "phrase" operator. + * @param {string} fieldOrQuery If no second string argument is given, this + * should be the query string, in which case all fields will be matched. + * Otherwise, this should be the name of the field to match. + * @param {string=} opt_query The query string. + * @return {!Filter} + * @static + */ - }, { - key: 'match', - value: function match(fieldOrQuery, opt_query) { - var field = core.isString(opt_query) ? fieldOrQuery : Filter.ALL; - var query = core.isString(opt_query) ? opt_query : fieldOrQuery; - return Filter.field(field, 'match', query); - } + Filter.phrase = function phrase(fieldOrQuery, opt_query) { + var field = core.isString(opt_query) ? fieldOrQuery : Filter.ALL; + var query = core.isString(opt_query) ? opt_query : fieldOrQuery; + return Filter.field(field, 'phrase', query); + }; - /** - * Returns a {@link Filter} instance that uses the "missing" operator. - * @param {string} field The field's name. - * @return {!Filter} - * @static - */ + /** + * Returns a {@link Filter} instance that uses the "gp" operator. + * @param {string} field The name of the field. + * @param {...!Object} points Objects representing points in the polygon. + * @return {!Filter} + * @static + */ - }, { - key: 'missing', - value: function missing(field) { - return Filter.field(field, 'missing', null); + Filter.polygon = function polygon(field) { + for (var _len2 = arguments.length, points = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { + points[_key2 - 1] = arguments[_key2]; } - /** - * Returns a {@link Filter} instance that uses the "phrase" operator. - * @param {string} fieldOrQuery If no second string argument is given, this - * should be the query string, in which case all fields will be matched. - * Otherwise, this should be the name of the field to match. - * @param {string=} opt_query The query string. - * @return {!Filter} - * @static - */ + points = points.map(function (point) { + return Embodied.toBody(point); + }); + return Filter.field(field, 'gp', points); + }; - }, { - key: 'phrase', - value: function phrase(fieldOrQuery, opt_query) { - var field = core.isString(opt_query) ? fieldOrQuery : Filter.ALL; - var query = core.isString(opt_query) ? opt_query : fieldOrQuery; - return Filter.field(field, 'phrase', query); - } + /** + * Returns a {@link Filter} instance that uses the "prefix" operator. + * @param {string} fieldOrQuery If no second argument is given, this should + * be the query string, in which case all fields will be matched. Otherwise, + * this should be the name of the field to match. + * @param {string=} opt_query The query string. + * @return {!Filter} + * @static + */ - /** - * Returns a {@link Filter} instance that uses the "gp" operator. - * @param {string} field The name of the field. - * @param {...!Object} points Objects representing points in the polygon. - * @return {!Filter} - * @static - */ + Filter.prefix = function prefix(fieldOrQuery, opt_query) { + var field = opt_query ? fieldOrQuery : Filter.ALL; + var query = opt_query ? opt_query : fieldOrQuery; + return Filter.field(field, 'prefix', query); + }; - }, { - key: 'polygon', - value: function polygon(field) { - for (var _len2 = arguments.length, points = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { - points[_key2 - 1] = arguments[_key2]; - } + /** + * Returns a {@link Filter} instance that uses the "range" operator. + * @param {string} field The field's name. + * @param {*} rangeOrMin Either a `Range` instance or a the range's min value. + * @param {*=} opt_max The range's max value. + * @return {!Filter} + * @static + */ - points = points.map(function (point) { - return Embodied.toBody(point); - }); - return Filter.field(field, 'gp', points); + Filter.range = function range(field, rangeOrMin, opt_max) { + var range = rangeOrMin; + if (!(range instanceof Range)) { + range = Range.range(rangeOrMin, opt_max); } + return Filter.field(field, 'range', range); + }; - /** - * Returns a {@link Filter} instance that uses the "prefix" operator. - * @param {string} fieldOrQuery If no second argument is given, this should - * be the query string, in which case all fields will be matched. Otherwise, - * this should be the name of the field to match. - * @param {string=} opt_query The query string. - * @return {!Filter} + /** + * Returns a {@link Filter} instance that uses the "~" operator. + * @param {string} field The name of the field to filter by. + * @param {*} value The filter's value. + * @return {!Filter} * @static - */ + */ - }, { - key: 'prefix', - value: function prefix(fieldOrQuery, opt_query) { - var field = opt_query ? fieldOrQuery : Filter.ALL; - var query = opt_query ? opt_query : fieldOrQuery; - return Filter.field(field, 'prefix', query); - } + Filter.regex = function regex(field, value) { + return new Filter(field, '~', value); + }; - /** - * Returns a {@link Filter} instance that uses the "range" operator. - * @param {string} field The field's name. - * @param {*} rangeOrMin Either a `Range` instance or a the range's min value. - * @param {*=} opt_max The range's max value. - * @return {!Filter} - * @static - */ + /** + * Returns a {@link Filter} instance that uses the "gs" operator. + * @param {string} field The field's name. + * @param {...!Object} shapes Objects representing shapes. + * @return {!Filter} + * @static + */ - }, { - key: 'range', - value: function range(field, rangeOrMin, opt_max) { - var range = rangeOrMin; - if (!(range instanceof Range)) { - range = Range.range(rangeOrMin, opt_max); - } - return Filter.field(field, 'range', range); + Filter.shape = function shape(field) { + for (var _len3 = arguments.length, shapes = Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) { + shapes[_key3 - 1] = arguments[_key3]; } - /** - * Returns a {@link Filter} instance that uses the "~" operator. - * @param {string} field The name of the field to filter by. - * @param {*} value The filter's value. - * @return {!Filter} - * @static - */ + shapes = shapes.map(function (shape) { + return Embodied.toBody(shape); + }); + var value = { + type: 'geometrycollection', + geometries: shapes + }; + return Filter.field(field, 'gs', value); + }; - }, { - key: 'regex', - value: function regex(field, value) { - return new Filter(field, '~', value); - } + /** + * Returns a {@link Filter} instance that uses the "similar" operator. + * @param {string} fieldOrQuery If no second string argument is given, this + * should be the query string, in which case all fields will be matched. + * Otherwise, this should be the name of the field to match. + * @param {?string} query The query string. + * @return {!Filter} + * @static + */ - /** - * Returns a {@link Filter} instance that uses the "gs" operator. - * @param {string} field The field's name. - * @param {...!Object} shapes Objects representing shapes. - * @return {!Filter} - * @static - */ + Filter.similar = function similar(fieldOrQuery, query) { + var field = core.isString(query) ? fieldOrQuery : Filter.ALL; + var value = { + query: core.isString(query) ? query : fieldOrQuery + }; + return Filter.field(field, 'similar', value); + }; - }, { - key: 'shape', - value: function shape(field) { - for (var _len3 = arguments.length, shapes = Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) { - shapes[_key3 - 1] = arguments[_key3]; - } + /** + * Returns a {@link Filter} instance that uses the "<" operator. + * @param {string} field The name of the field to filter by. + * @param {*} value The filter's value. + * @return {!Filter} + * @static + */ - shapes = shapes.map(function (shape) { - return Embodied.toBody(shape); - }); - var value = { - type: 'geometrycollection', - geometries: shapes - }; - return Filter.field(field, 'gs', value); - } + Filter.lt = function lt(field, value) { + return new Filter(field, '<', value); + }; - /** - * Returns a {@link Filter} instance that uses the "similar" operator. - * @param {string} fieldOrQuery If no second string argument is given, this - * should be the query string, in which case all fields will be matched. - * Otherwise, this should be the name of the field to match. - * @param {?string} query The query string. - * @return {!Filter} + /** + * Returns a {@link Filter} instance that uses the "<=" operator. + * @param {string} field The name of the field to filter by. + * @param {*} value The filter's value. + * @return {!Filter} * @static - */ + */ - }, { - key: 'similar', - value: function similar(fieldOrQuery, query) { - var field = core.isString(query) ? fieldOrQuery : Filter.ALL; - var value = { - query: core.isString(query) ? query : fieldOrQuery - }; - return Filter.field(field, 'similar', value); - } + Filter.lte = function lte(field, value) { + return new Filter(field, '<=', value); + }; - /** - * Returns a {@link Filter} instance that uses the "<" operator. - * @param {string} field The name of the field to filter by. - * @param {*} value The filter's value. - * @return {!Filter} - * @static - */ + /** + * Returns a {@link Filter} instance that uses the "none" operator. + * @param {string} field The name of the field to filter by. + * @param {!(Array|...*)} value A variable amount of values to be used with + * the "none" operator. Can be passed either as a single array or as + * separate params. + * @return {!Filter} + * @static + */ - }, { - key: 'lt', - value: function lt(field, value) { - return new Filter(field, '<', value); + Filter.none = function none(field) { + var values = Array.prototype.slice.call(arguments, 1); + if (values.length === 1 && values[0] instanceof Array) { + values = values[0]; } + return new Filter(field, 'none', values); + }; - /** - * Returns a {@link Filter} instance that uses the "<=" operator. - * @param {string} field The name of the field to filter by. - * @param {*} value The filter's value. - * @return {!Filter} - * @static - */ + /** + * Returns a {@link Filter} instance that uses the "!=" operator. + * @param {string} field The name of the field to filter by. + * @param {*} value The filter's value. + * @return {!Filter} + * @static + */ - }, { - key: 'lte', - value: function lte(field, value) { - return new Filter(field, '<=', value); - } + Filter.notEqual = function notEqual(field, value) { + return new Filter(field, '!=', value); + }; - /** - * Returns a {@link Filter} instance that uses the "none" operator. - * @param {string} field The name of the field to filter by. - * @param {!(Array|...*)} value A variable amount of values to be used with - * the "none" operator. Can be passed either as a single array or as - * separate params. - * @return {!Filter} - * @static - */ + /** + * Returns a {@link Filter} instance that uses the "not" operator. + * @param {!Filter|string} fieldOrFilter Either a {@link Filter} instance or the + * name of the field to filter by. + * @param {*=} opt_operatorOrValue Either the field's operator or its value. + * @param {*=} opt_value The filter's value. + * @return {!Filter} + * @static + */ - }, { - key: 'none', - value: function none(field) { - var values = Array.prototype.slice.call(arguments, 1); - if (values.length === 1 && values[0] instanceof Array) { - values = values[0]; - } - return new Filter(field, 'none', values); - } + Filter.not = function not(fieldOrFilter, opt_operatorOrValue, opt_value) { + return Filter.toFilter(fieldOrFilter, opt_operatorOrValue, opt_value).add('not'); + }; - /** - * Returns a {@link Filter} instance that uses the "!=" operator. - * @param {string} field The name of the field to filter by. - * @param {*} value The filter's value. - * @return {!Filter} + /** + * Returns a {@link Filter} instance. + * @param {string} field The name of the field to filter by. + * @param {*} operatorOrValue If a third param is given, this should + * be the filter's operator (like ">="). Otherwise, this will be + * used as the filter's value, and the filter's operator will be "=". + * @param {*=} opt_value The filter's value. + * @return {!Filter} * @static - */ + */ - }, { - key: 'notEqual', - value: function notEqual(field, value) { - return new Filter(field, '!=', value); - } + Filter.field = function field(_field, operatorOrValue, opt_value) { + return new Filter(_field, operatorOrValue, opt_value); + }; - /** - * Returns a {@link Filter} instance that uses the "not" operator. - * @param {!Filter|string} fieldOrFilter Either a {@link Filter} instance or the - * name of the field to filter by. - * @param {*=} opt_operatorOrValue Either the field's operator or its value. - * @param {*=} opt_value The filter's value. - * @return {!Filter} - * @static - */ + /** + * Adds a filter to be composed with this filter using the "or" operator. + * @param {!Filter|string} fieldOrFilter Either a {@link Filter} instance or the + * name of the field to filter by. + * @param {*=} opt_operatorOrValue Either the field's operator or its value. + * @param {*=} opt_value The filter's value. + * @chainnable + */ - }, { - key: 'not', - value: function not(fieldOrFilter, opt_operatorOrValue, opt_value) { - return Filter.toFilter(fieldOrFilter, opt_operatorOrValue, opt_value).add('not'); - } + Filter.prototype.or = function or(fieldOrFilter, opt_operatorOrValue, opt_value) { + return this.add('or', fieldOrFilter, opt_operatorOrValue, opt_value); + }; - /** - * Returns a {@link Filter} instance. - * @param {string} field The name of the field to filter by. - * @param {*} operatorOrValue If a third param is given, this should - * be the filter's operator (like ">="). Otherwise, this will be - * used as the filter's value, and the filter's operator will be "=". - * @param {*=} opt_value The filter's value. - * @return {!Filter} - * @static - */ + /** + * Converts the given arguments into a {@link Filter} instance. + * @param {!Filter|string} fieldOrFilter Either a {@link Filter} instance or the + * name of the field to filter by. + * @param {*=} opt_operatorOrValue Either the field's operator or its value. + * @param {*=} opt_value The filter's value. + * @return {!Filter} + */ - }, { - key: 'field', - value: function field(_field, operatorOrValue, opt_value) { - return new Filter(_field, operatorOrValue, opt_value); + Filter.toFilter = function toFilter(fieldOrFilter, opt_operatorOrValue, opt_value) { + var filter = fieldOrFilter; + if (!(filter instanceof Filter)) { + filter = Filter.field(fieldOrFilter, opt_operatorOrValue, opt_value); } - }, { - key: 'toFilter', - value: function toFilter(fieldOrFilter, opt_operatorOrValue, opt_value) { - var filter = fieldOrFilter; - if (!(filter instanceof Filter)) { - filter = Filter.field(fieldOrFilter, opt_operatorOrValue, opt_value); - } - return filter; - } - }]); + return filter; + }; + return Filter; })(Embodied); @@ -3606,6 +3412,7 @@ this.launchpadNamed = this.launchpadNamed || {}; * @static */ + Filter.prototype.registerMetalComponent && Filter.prototype.registerMetalComponent(Filter, 'Filter') Filter.ALL = '*'; this.launchpad.Filter = Filter; @@ -3644,213 +3451,182 @@ this.launchpadNamed = this.launchpadNamed || {}; * @static */ - babelHelpers.createClass(Aggregation, [{ - key: 'getField', - - /** - * Gets this aggregation's field. - * @return {string} - */ - value: function getField() { - return this.field_; - } + Aggregation.avg = function avg(field) { + return Aggregation.field(field, 'avg'); + }; - /** - * Gets this aggregation's operator. - * @return {string} - */ + /** + * Creates an {@link Aggregation} instance with the "count" operator. + * @param {string} field The aggregation field. + * @return {!Aggregation} + * @static + */ - }, { - key: 'getOperator', - value: function getOperator() { - return this.operator_; - } + Aggregation.count = function count(field) { + return Aggregation.field(field, 'count'); + }; - /** - * Gets this aggregation's value. - * @return {*} - */ + /** + * Creates an {@link DistanceAggregation} instance with the "geoDistance" operator. + * @param {string} field The aggregation field. + * @param {*} location The aggregation location. + * @param {...!Range} ranges The aggregation ranges. + * @return {!DistanceAggregation} + * @static + */ - }, { - key: 'getValue', - value: function getValue() { - return this.value_; + Aggregation.distance = function distance(field, location) { + for (var _len = arguments.length, ranges = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { + ranges[_key - 2] = arguments[_key]; } - /** - * Creates an {@link Aggregation} instance with the "histogram" operator. - * @param {string} field The aggregation field. - * @param {number} interval The histogram's interval. - * @return {!Aggregation} - * @static - */ + return new (Function.prototype.bind.apply(Aggregation.DistanceAggregation, [null].concat([field, location], ranges)))(); + }; - }], [{ - key: 'avg', - value: function avg(field) { - return Aggregation.field(field, 'avg'); - } + /** + * Creates an {@link Aggregation} instance with the "extendedStats" operator. + * @param {string} field The aggregation field. + * @return {!Aggregation} + * @static + */ - /** - * Creates an {@link Aggregation} instance with the "count" operator. - * @param {string} field The aggregation field. - * @return {!Aggregation} - * @static - */ + Aggregation.extendedStats = function extendedStats(field) { + return Aggregation.field(field, 'extendedStats'); + }; - }, { - key: 'count', - value: function count(field) { - return Aggregation.field(field, 'count'); - } + /** + * Gets this aggregation's field. + * @return {string} + */ - /** - * Creates an {@link DistanceAggregation} instance with the "geoDistance" operator. - * @param {string} field The aggregation field. - * @param {*} location The aggregation location. - * @param {...!Range} ranges The aggregation ranges. - * @return {!DistanceAggregation} - * @static - */ + Aggregation.prototype.getField = function getField() { + return this.field_; + }; - }, { - key: 'distance', - value: function distance(field, location) { - for (var _len = arguments.length, ranges = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { - ranges[_key - 2] = arguments[_key]; - } + /** + * Gets this aggregation's operator. + * @return {string} + */ - return new (Function.prototype.bind.apply(Aggregation.DistanceAggregation, [null].concat([field, location], ranges)))(); - } + Aggregation.prototype.getOperator = function getOperator() { + return this.operator_; + }; - /** - * Creates an {@link Aggregation} instance with the "extendedStats" operator. - * @param {string} field The aggregation field. - * @return {!Aggregation} - * @static - */ + /** + * Gets this aggregation's value. + * @return {*} + */ - }, { - key: 'extendedStats', - value: function extendedStats(field) { - return Aggregation.field(field, 'extendedStats'); - } - }, { - key: 'histogram', - value: function histogram(field, interval) { - return new Aggregation(field, 'histogram', interval); - } + Aggregation.prototype.getValue = function getValue() { + return this.value_; + }; - /** - * Creates an {@link Aggregation} instance with the "max" operator. - * @param {string} field The aggregation field. - * @return {!Aggregation} - * @static - */ + /** + * Creates an {@link Aggregation} instance with the "histogram" operator. + * @param {string} field The aggregation field. + * @param {number} interval The histogram's interval. + * @return {!Aggregation} + * @static + */ - }, { - key: 'max', - value: function max(field) { - return Aggregation.field(field, 'max'); - } + Aggregation.histogram = function histogram(field, interval) { + return new Aggregation(field, 'histogram', interval); + }; - /** - * Creates an {@link Aggregation} instance with the "min" operator. - * @param {string} field The aggregation field. - * @return {!Aggregation} - * @static - */ + /** + * Creates an {@link Aggregation} instance with the "max" operator. + * @param {string} field The aggregation field. + * @return {!Aggregation} + * @static + */ - }, { - key: 'min', - value: function min(field) { - return Aggregation.field(field, 'min'); - } + Aggregation.max = function max(field) { + return Aggregation.field(field, 'max'); + }; - /** - * Creates an {@link Aggregation} instance with the "missing" operator. - * @param {string} field The aggregation field. - * @return {!Aggregation} - * @static - */ + /** + * Creates an {@link Aggregation} instance with the "min" operator. + * @param {string} field The aggregation field. + * @return {!Aggregation} + * @static + */ - }, { - key: 'missing', - value: function missing(field) { - return Aggregation.field(field, 'missing'); - } + Aggregation.min = function min(field) { + return Aggregation.field(field, 'min'); + }; - /** - * Creates a new {@link Aggregation} instance. - * @param {string} field The aggregation field. - * @param {string} operator The aggregation operator. - * @return {!Aggregation} - * @static - */ + /** + * Creates an {@link Aggregation} instance with the "missing" operator. + * @param {string} field The aggregation field. + * @return {!Aggregation} + * @static + */ - }, { - key: 'field', - value: function field(_field, operator) { - return new Aggregation(_field, operator); - } + Aggregation.missing = function missing(field) { + return Aggregation.field(field, 'missing'); + }; - /** - * Creates an {@link RangeAggregation} instance with the "range" operator. - * @param {string} field The aggregation field. - * @param {...!Range} ranges The aggregation ranges. - * @return {!RangeAggregation} - * @static - */ + /** + * Creates a new {@link Aggregation} instance. + * @param {string} field The aggregation field. + * @param {string} operator The aggregation operator. + * @return {!Aggregation} + * @static + */ - }, { - key: 'range', - value: function range(field) { - for (var _len2 = arguments.length, ranges = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { - ranges[_key2 - 1] = arguments[_key2]; - } + Aggregation.field = function field(_field, operator) { + return new Aggregation(_field, operator); + }; + + /** + * Creates an {@link RangeAggregation} instance with the "range" operator. + * @param {string} field The aggregation field. + * @param {...!Range} ranges The aggregation ranges. + * @return {!RangeAggregation} + * @static + */ - return new (Function.prototype.bind.apply(Aggregation.RangeAggregation, [null].concat([field], ranges)))(); + Aggregation.range = function range(field) { + for (var _len2 = arguments.length, ranges = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { + ranges[_key2 - 1] = arguments[_key2]; } - /** - * Creates an {@link Aggregation} instance with the "stats" operator. - * @param {string} field The aggregation field. - * @return {!Aggregation} - * @static - */ + return new (Function.prototype.bind.apply(Aggregation.RangeAggregation, [null].concat([field], ranges)))(); + }; - }, { - key: 'stats', - value: function stats(field) { - return Aggregation.field(field, 'stats'); - } + /** + * Creates an {@link Aggregation} instance with the "stats" operator. + * @param {string} field The aggregation field. + * @return {!Aggregation} + * @static + */ - /** - * Creates an {@link Aggregation} instance with the "sum" operator. - * @param {string} field The aggregation field. - * @return {!Aggregation} - * @static - */ + Aggregation.stats = function stats(field) { + return Aggregation.field(field, 'stats'); + }; - }, { - key: 'sum', - value: function sum(field) { - return Aggregation.field(field, 'sum'); - } + /** + * Creates an {@link Aggregation} instance with the "sum" operator. + * @param {string} field The aggregation field. + * @return {!Aggregation} + * @static + */ - /** - * Creates an {@link Aggregation} instance with the "terms" operator. - * @param {string} field The aggregation field. - * @return {!Aggregation} - * @static - */ + Aggregation.sum = function sum(field) { + return Aggregation.field(field, 'sum'); + }; + + /** + * Creates an {@link Aggregation} instance with the "terms" operator. + * @param {string} field The aggregation field. + * @return {!Aggregation} + * @static + */ + + Aggregation.terms = function terms(field) { + return Aggregation.field(field, 'terms'); + }; - }, { - key: 'terms', - value: function terms(field) { - return Aggregation.field(field, 'terms'); - } - }]); return Aggregation; })(); @@ -3873,7 +3649,7 @@ this.launchpadNamed = this.launchpadNamed || {}; function DistanceAggregation(field, location) { babelHelpers.classCallCheck(this, DistanceAggregation); - var _this = babelHelpers.possibleConstructorReturn(this, Object.getPrototypeOf(DistanceAggregation).call(this, field, 'geoDistance', {})); + var _this = babelHelpers.possibleConstructorReturn(this, _Aggregation.call(this, field, 'geoDistance', {})); _this.value_.location = Embodied.toBody(location); @@ -3894,33 +3670,31 @@ this.launchpadNamed = this.launchpadNamed || {}; * @chainnable */ - babelHelpers.createClass(DistanceAggregation, [{ - key: 'range', - value: function range(rangeOrFrom, opt_to) { - var range = rangeOrFrom; - if (!(range instanceof Range)) { - range = Range.range(rangeOrFrom, opt_to); - } - this.value_.ranges.push(range.body()); - return this; + DistanceAggregation.prototype.range = function range(rangeOrFrom, opt_to) { + var range = rangeOrFrom; + if (!(range instanceof Range)) { + range = Range.range(rangeOrFrom, opt_to); } + this.value_.ranges.push(range.body()); + return this; + }; - /** - * Sets this aggregation's unit. - * @param {string} unit - * @chainnable - */ + /** + * Sets this aggregation's unit. + * @param {string} unit + * @chainnable + */ + + DistanceAggregation.prototype.unit = function unit(_unit) { + this.value_.unit = _unit; + return this; + }; - }, { - key: 'unit', - value: function unit(_unit) { - this.value_.unit = _unit; - return this; - } - }]); return DistanceAggregation; })(Aggregation); + DistanceAggregation.prototype.registerMetalComponent && DistanceAggregation.prototype.registerMetalComponent(DistanceAggregation, 'DistanceAggregation') + Aggregation.DistanceAggregation = DistanceAggregation; /** @@ -3941,7 +3715,7 @@ this.launchpadNamed = this.launchpadNamed || {}; function RangeAggregation(field) { babelHelpers.classCallCheck(this, RangeAggregation); - var _this2 = babelHelpers.possibleConstructorReturn(this, Object.getPrototypeOf(RangeAggregation).call(this, field, 'range')); + var _this2 = babelHelpers.possibleConstructorReturn(this, _Aggregation2.call(this, field, 'range')); for (var _len4 = arguments.length, ranges = Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) { ranges[_key4 - 1] = arguments[_key4]; @@ -3960,20 +3734,20 @@ this.launchpadNamed = this.launchpadNamed || {}; * @chainnable */ - babelHelpers.createClass(RangeAggregation, [{ - key: 'range', - value: function range(rangeOrFrom, opt_to) { - var range = rangeOrFrom; - if (!(range instanceof Range)) { - range = Range.range(rangeOrFrom, opt_to); - } - this.value_.push(range.body()); - return this; + RangeAggregation.prototype.range = function range(rangeOrFrom, opt_to) { + var range = rangeOrFrom; + if (!(range instanceof Range)) { + range = Range.range(rangeOrFrom, opt_to); } - }]); + this.value_.push(range.body()); + return this; + }; + return RangeAggregation; })(Aggregation); + RangeAggregation.prototype.registerMetalComponent && RangeAggregation.prototype.registerMetalComponent(RangeAggregation, 'RangeAggregation') + Aggregation.RangeAggregation = RangeAggregation; this.launchpad.Aggregation = Aggregation; @@ -3996,345 +3770,307 @@ this.launchpadNamed = this.launchpadNamed || {}; function Query() { babelHelpers.classCallCheck(this, Query); - return babelHelpers.possibleConstructorReturn(this, Object.getPrototypeOf(Query).apply(this, arguments)); + return babelHelpers.possibleConstructorReturn(this, _Embodied.apply(this, arguments)); } - babelHelpers.createClass(Query, [{ - key: 'aggregate', + /** + * Adds an aggregation to this {@link Query} instance. + * @param {string} name The aggregation name. + * @param {!Aggregation|string} aggregationOrField Either an + * {@link Aggregation} instance or the name of the aggregation field. + * @param {string=} opt_operator The aggregation operator. + * @return {!Query} + * @static + */ - /** - * Adds an aggregation to this {@link Query} instance. - * @param {string} name The aggregation name. - * @param {!Aggregation|string} aggregationOrField Either an - * {@link Aggregation} instance or the name of the aggregation field. - * @param {string=} opt_operator The aggregation operator. - * @chainnable - */ - value: function aggregate(name, aggregationOrField, opt_operator) { - var aggregation = aggregationOrField; - if (!(aggregation instanceof Aggregation)) { - aggregation = Aggregation.field(aggregationOrField, opt_operator); - } + Query.aggregate = function aggregate(name, aggregationOrField, opt_operator) { + return new Query().aggregate(name, aggregationOrField, opt_operator); + }; - var field = aggregation.getField(); - var value = {}; - value[field] = { - name: name, - operator: aggregation.getOperator() - }; - if (core.isDefAndNotNull(aggregation.getValue())) { - value[field].value = aggregation.getValue(); - } + /** + * Sets this query's type to "count". + * @return {!Query} + * @static + */ - if (!this.body_.aggregation) { - this.body_.aggregation = []; - } - this.body_.aggregation.push(value); - return this; - } + Query.count = function count() { + return new Query().type('count'); + }; - /** - * Sets this query's type to "count". - * @chainnable - */ + /** + * Sets this query's type to "fetch". + * @return {!Query} + * @static + */ - }, { - key: 'count', - value: function count() { - return this.type('count'); - } + Query.fetch = function fetch() { + return new Query().type('fetch'); + }; - /** - * Sets this query's type to "fetch". - * @chainnable - */ + /** + * Adds a filter to this Query. + * @param {!Filter|string} fieldOrFilter Either a {@link Filter} or the + * name of the field to filter by. + * @param {*=} opt_operatorOrValue Either the field's operator or its value. + * @param {*=} opt_value The filter's value. + * @return {!Query} + * @static + */ - }, { - key: 'fetch', - value: function fetch() { - return this.type('fetch'); - } + Query.filter = function filter(fieldOrFilter, opt_operatorOrValue, opt_value) { + return new Query().filter(fieldOrFilter, opt_operatorOrValue, opt_value); + }; - /** - * Adds a filter to this Query. - * @param {!Filter|string} fieldOrFilter Either a {@link Filter} or the - * name of the field to filter by. - * @param {*=} opt_operatorOrValue Either the field's operator or its value. - * @param {*=} opt_value The filter's value. - * @chainnable - */ + /** + * Sets the query offset. + * @param {number} offset The index of the first entry that should be returned + * by this query. + * @return {!Query} + * @static + */ - }, { - key: 'filter', - value: function filter(fieldOrFilter, opt_operatorOrValue, opt_value) { - var filter = Filter.toFilter(fieldOrFilter, opt_operatorOrValue, opt_value); - if (!this.body_.filter) { - this.body_.filter = []; - } - this.body_.filter.push(filter.body()); - return this; - } + Query.offset = function offset(_offset) { + return new Query().offset(_offset); + }; - /** - * Sets the query offset. - * @param {number} offset The index of the first entry that should be returned - * by this query. - * @chainnable - */ + /** + * Adds a highlight entry to this {@link Query} instance. + * @param {string} field The field's name. + * @return {!Query} + * @static + */ - }, { - key: 'offset', - value: function offset(_offset2) { - this.body_.offset = _offset2; - return this; - } + Query.highlight = function highlight(field) { + return new Query().highlight(field); + }; - /** - * Adds a highlight entry to this {@link Query} instance. - * @param {string} field The field's name. - * @chainnable - */ + /** + * Sets the query limit. + * @param {number} limit The max amount of entries that this query should return. + * @return {!Query} + * @static + */ - }, { - key: 'highlight', - value: function highlight(field) { - if (!this.body_.highlight) { - this.body_.highlight = []; - } + Query.limit = function limit(_limit) { + return new Query().limit(_limit); + }; - this.body_.highlight.push(field); - return this; - } + /** + * Adds a search to this {@link Query} instance. + * @param {!Filter|string} filterOrTextOrField If no other arguments + * are passed to this function, this should be either a {@link Filter} + * instance or a text to be used in a match filter. In both cases + * the filter will be applied to all fields. Another option is to + * pass this as a field name instead, together with other arguments + * so the filter can be created. + * @param {string=} opt_textOrOperator Either a text to be used in a + * match filter, or the operator that should be used. + * @param {*=} opt_value The value to be used by the filter. Should + * only be passed if an operator was passed as the second argument. + * @return {!Query} + * @static + */ - /** - * Sets the query limit. - * @param {number} limit The max amount of entries that this query should return. - * @chainnable - */ + Query.search = function search(filterOrTextOrField, opt_textOrOperator, opt_value) { + return new Query().search(filterOrTextOrField, opt_textOrOperator, opt_value); + }; - }, { - key: 'limit', - value: function limit(_limit2) { - this.body_.limit = _limit2; - return this; - } + /** + * Adds a sort entry to this query, specifying the field this query should be + * sorted by and, optionally, the sort direction. + * @param {string} field The field that the query should be sorted by. + * @param {string=} opt_direction The direction the sort operation should use. + * If none is given, "asc" is used by default. + * @return {!Query} + * @static + */ - /** - * Adds a search to this {@link Query} instance. - * @param {!Filter|string} filterOrTextOrField If no other arguments - * are passed to this function, this should be either a {@link Filter} - * instance or a text to be used in a match filter. In both cases - * the filter will be applied to all fields. Another option is to - * pass this as a field name instead, together with other arguments - * so the filter can be created. - * @param {string=} opt_textOrOperator Either a text to be used in a - * match filter, or the operator that should be used. - * @param {*=} opt_value The value to be used by the filter. Should - * only be passed if an operator was passed as the second argument. - * @chainnable - */ + Query.sort = function sort(field, opt_direction) { + return new Query().sort(field, opt_direction); + }; - }, { - key: 'search', - value: function search(filterOrTextOrField, opt_textOrOperator, opt_value) { - var filter = filterOrTextOrField; - if (opt_value) { - filter = Filter.field(filterOrTextOrField, opt_textOrOperator, opt_value); - } else if (opt_textOrOperator) { - filter = Filter.match(filterOrTextOrField, opt_textOrOperator); - } else if (!(filter instanceof Filter)) { - filter = Filter.match(filterOrTextOrField); - } - if (!this.body_.search) { - this.body_.search = []; - } - this.body_.search.push(filter.body()); - return this; - } + /** + * Sets the query type. + * @param {string} type The query's type. For example: "count", "fetch". + * @return {!Query} + * @static + */ - /** - * Adds a sort entry to this query, specifying the field this query should be - * sorted by and, optionally, the sort direction. - * @param {string} field The field that the query should be sorted by. - * @param {string=} opt_direction The direction the sort operation should use. - * If none is given, "asc" is used by default. - * @chainnable - */ + Query.type = function type(_type) { + return new Query().type(_type); + }; - }, { - key: 'sort', - value: function sort(field, opt_direction) { - if (!this.body_.sort) { - this.body_.sort = []; - } - var sortEntry = {}; - sortEntry[field] = opt_direction || 'asc'; - this.body_.sort.push(sortEntry); - return this; - } + /** + * Adds an aggregation to this {@link Query} instance. + * @param {string} name The aggregation name. + * @param {!Aggregation|string} aggregationOrField Either an + * {@link Aggregation} instance or the name of the aggregation field. + * @param {string=} opt_operator The aggregation operator. + * @chainnable + */ - /** - * Sets the query type. - * @param {string} type The query's type. For example: "count", "fetch". - * @chainnable - */ + Query.prototype.aggregate = function aggregate(name, aggregationOrField, opt_operator) { + var aggregation = aggregationOrField; + if (!(aggregation instanceof Aggregation)) { + aggregation = Aggregation.field(aggregationOrField, opt_operator); + } - }, { - key: 'type', - value: function type(_type2) { - this.body_.type = _type2; - return this; + var field = aggregation.getField(); + var value = {}; + value[field] = { + name: name, + operator: aggregation.getOperator() + }; + if (core.isDefAndNotNull(aggregation.getValue())) { + value[field].value = aggregation.getValue(); } - }], [{ - key: 'aggregate', - /** - * Adds an aggregation to this {@link Query} instance. - * @param {string} name The aggregation name. - * @param {!Aggregation|string} aggregationOrField Either an - * {@link Aggregation} instance or the name of the aggregation field. - * @param {string=} opt_operator The aggregation operator. - * @return {!Query} - * @static - */ - value: function aggregate(name, aggregationOrField, opt_operator) { - return new Query().aggregate(name, aggregationOrField, opt_operator); + if (!this.body_.aggregation) { + this.body_.aggregation = []; } + this.body_.aggregation.push(value); + return this; + }; - /** - * Sets this query's type to "count". - * @return {!Query} - * @static - */ + /** + * Sets this query's type to "count". + * @chainnable + */ - }, { - key: 'count', - value: function count() { - return new Query().type('count'); - } + Query.prototype.count = function count() { + return this.type('count'); + }; - /** - * Sets this query's type to "fetch". - * @return {!Query} - * @static - */ + /** + * Sets this query's type to "fetch". + * @chainnable + */ - }, { - key: 'fetch', - value: function fetch() { - return new Query().type('fetch'); - } + Query.prototype.fetch = function fetch() { + return this.type('fetch'); + }; - /** - * Adds a filter to this Query. - * @param {!Filter|string} fieldOrFilter Either a {@link Filter} or the - * name of the field to filter by. - * @param {*=} opt_operatorOrValue Either the field's operator or its value. - * @param {*=} opt_value The filter's value. - * @return {!Query} - * @static - */ + /** + * Adds a filter to this Query. + * @param {!Filter|string} fieldOrFilter Either a {@link Filter} or the + * name of the field to filter by. + * @param {*=} opt_operatorOrValue Either the field's operator or its value. + * @param {*=} opt_value The filter's value. + * @chainnable + */ - }, { - key: 'filter', - value: function filter(fieldOrFilter, opt_operatorOrValue, opt_value) { - return new Query().filter(fieldOrFilter, opt_operatorOrValue, opt_value); + Query.prototype.filter = function filter(fieldOrFilter, opt_operatorOrValue, opt_value) { + var filter = Filter.toFilter(fieldOrFilter, opt_operatorOrValue, opt_value); + if (!this.body_.filter) { + this.body_.filter = []; } + this.body_.filter.push(filter.body()); + return this; + }; - /** - * Sets the query offset. - * @param {number} offset The index of the first entry that should be returned - * by this query. - * @return {!Query} - * @static - */ + /** + * Sets the query offset. + * @param {number} offset The index of the first entry that should be returned + * by this query. + * @chainnable + */ - }, { - key: 'offset', - value: function offset(_offset) { - return new Query().offset(_offset); - } + Query.prototype.offset = function offset(_offset2) { + this.body_.offset = _offset2; + return this; + }; - /** - * Adds a highlight entry to this {@link Query} instance. - * @param {string} field The field's name. - * @return {!Query} - * @static - */ + /** + * Adds a highlight entry to this {@link Query} instance. + * @param {string} field The field's name. + * @chainnable + */ - }, { - key: 'highlight', - value: function highlight(field) { - return new Query().highlight(field); + Query.prototype.highlight = function highlight(field) { + if (!this.body_.highlight) { + this.body_.highlight = []; } - /** - * Sets the query limit. - * @param {number} limit The max amount of entries that this query should return. - * @return {!Query} - * @static - */ + this.body_.highlight.push(field); + return this; + }; - }, { - key: 'limit', - value: function limit(_limit) { - return new Query().limit(_limit); - } + /** + * Sets the query limit. + * @param {number} limit The max amount of entries that this query should return. + * @chainnable + */ - /** - * Adds a search to this {@link Query} instance. - * @param {!Filter|string} filterOrTextOrField If no other arguments - * are passed to this function, this should be either a {@link Filter} - * instance or a text to be used in a match filter. In both cases - * the filter will be applied to all fields. Another option is to - * pass this as a field name instead, together with other arguments - * so the filter can be created. - * @param {string=} opt_textOrOperator Either a text to be used in a - * match filter, or the operator that should be used. - * @param {*=} opt_value The value to be used by the filter. Should - * only be passed if an operator was passed as the second argument. - * @return {!Query} - * @static - */ + Query.prototype.limit = function limit(_limit2) { + this.body_.limit = _limit2; + return this; + }; - }, { - key: 'search', - value: function search(filterOrTextOrField, opt_textOrOperator, opt_value) { - return new Query().search(filterOrTextOrField, opt_textOrOperator, opt_value); + /** + * Adds a search to this {@link Query} instance. + * @param {!Filter|string} filterOrTextOrField If no other arguments + * are passed to this function, this should be either a {@link Filter} + * instance or a text to be used in a match filter. In both cases + * the filter will be applied to all fields. Another option is to + * pass this as a field name instead, together with other arguments + * so the filter can be created. + * @param {string=} opt_textOrOperator Either a text to be used in a + * match filter, or the operator that should be used. + * @param {*=} opt_value The value to be used by the filter. Should + * only be passed if an operator was passed as the second argument. + * @chainnable + */ + + Query.prototype.search = function search(filterOrTextOrField, opt_textOrOperator, opt_value) { + var filter = filterOrTextOrField; + if (opt_value) { + filter = Filter.field(filterOrTextOrField, opt_textOrOperator, opt_value); + } else if (opt_textOrOperator) { + filter = Filter.match(filterOrTextOrField, opt_textOrOperator); + } else if (!(filter instanceof Filter)) { + filter = Filter.match(filterOrTextOrField); } + if (!this.body_.search) { + this.body_.search = []; + } + this.body_.search.push(filter.body()); + return this; + }; - /** - * Adds a sort entry to this query, specifying the field this query should be - * sorted by and, optionally, the sort direction. - * @param {string} field The field that the query should be sorted by. - * @param {string=} opt_direction The direction the sort operation should use. - * If none is given, "asc" is used by default. - * @return {!Query} - * @static - */ + /** + * Adds a sort entry to this query, specifying the field this query should be + * sorted by and, optionally, the sort direction. + * @param {string} field The field that the query should be sorted by. + * @param {string=} opt_direction The direction the sort operation should use. + * If none is given, "asc" is used by default. + * @chainnable + */ - }, { - key: 'sort', - value: function sort(field, opt_direction) { - return new Query().sort(field, opt_direction); + Query.prototype.sort = function sort(field, opt_direction) { + if (!this.body_.sort) { + this.body_.sort = []; } + var sortEntry = {}; + sortEntry[field] = opt_direction || 'asc'; + this.body_.sort.push(sortEntry); + return this; + }; - /** - * Sets the query type. - * @param {string} type The query's type. For example: "count", "fetch". - * @return {!Query} - * @static - */ + /** + * Sets the query type. + * @param {string} type The query's type. For example: "count", "fetch". + * @chainnable + */ + + Query.prototype.type = function type(_type2) { + this.body_.type = _type2; + return this; + }; - }, { - key: 'type', - value: function type(_type) { - return new Query().type(_type); - } - }]); return Query; })(Embodied); + Query.prototype.registerMetalComponent && Query.prototype.registerMetalComponent(Query, 'Query') this.launchpad.Query = Query; }).call(this); 'use strict'; @@ -4357,48 +4093,43 @@ this.launchpadNamed = this.launchpadNamed || {}; /** * Returns {@link TransportFactory} instance. */ - - babelHelpers.createClass(TransportFactory, [{ - key: 'get', - - /** - * Gets an instance of the transport implementation with the given name. - * @param {string} implementationName - * @return {!Transport} - */ - value: function get(implementationName) { - var TransportClass = this.transports[implementationName]; - - if (!TransportClass) { - throw new Error('Invalid transport name: ' + implementationName); - } - - try { - return new TransportClass(); - } catch (err) { - throw new Error('Can\'t create transport', err); - } + + TransportFactory.instance = function instance() { + if (!TransportFactory.instance_) { + TransportFactory.instance_ = new TransportFactory(); } + return TransportFactory.instance_; + }; - /** - * Returns the default transport implementation. - * @return {!Transport} - */ + /** + * Gets an instance of the transport implementation with the given name. + * @param {string} implementationName + * @return {!Transport} + */ + + TransportFactory.prototype.get = function get(implementationName) { + var TransportClass = this.transports[implementationName]; - }, { - key: 'getDefault', - value: function getDefault() { - return this.get(TransportFactory.DEFAULT_TRANSPORT_NAME); + if (!TransportClass) { + throw new Error('Invalid transport name: ' + implementationName); } - }], [{ - key: 'instance', - value: function instance() { - if (!TransportFactory.instance_) { - TransportFactory.instance_ = new TransportFactory(); - } - return TransportFactory.instance_; + + try { + return new TransportClass(); + } catch (err) { + throw new Error('Can\'t create transport', err); } - }]); + }; + + /** + * Returns the default transport implementation. + * @return {!Transport} + */ + + TransportFactory.prototype.getDefault = function getDefault() { + return this.get(TransportFactory.DEFAULT_TRANSPORT_NAME); + }; + return TransportFactory; })(); @@ -4472,573 +4203,506 @@ this.launchpadNamed = this.launchpadNamed || {}; * @chainable */ - babelHelpers.createClass(Launchpad, [{ - key: 'aggregate', - value: function aggregate(name, aggregationOrField, opt_operator) { - this.getOrCreateQuery_().aggregate(name, aggregationOrField, opt_operator); - return this; - } + Launchpad.prototype.aggregate = function aggregate(name, aggregationOrField, opt_operator) { + this.getOrCreateQuery_().aggregate(name, aggregationOrField, opt_operator); + return this; + }; - /** - * Adds authorization information to this request. - * @param {!Auth|string} authOrTokenOrUsername Either an {@link Auth} instance, - * an authorization token, or the username. - * @param {string=} opt_password If a username is given as the first param, - * this should be the password. - * @chainable - */ + /** + * Adds authorization information to this request. + * @param {!Auth|string} authOrTokenOrUsername Either an {@link Auth} instance, + * an authorization token, or the username. + * @param {string=} opt_password If a username is given as the first param, + * this should be the password. + * @chainable + */ - }, { - key: 'auth', - value: function auth(authOrTokenOrUsername, opt_password) { - this.auth_ = authOrTokenOrUsername; - if (!(this.auth_ instanceof Auth)) { - this.auth_ = Auth.create(authOrTokenOrUsername, opt_password); - } - return this; + Launchpad.prototype.auth = function auth(authOrTokenOrUsername, opt_password) { + this.auth_ = authOrTokenOrUsername; + if (!(this.auth_ instanceof Auth)) { + this.auth_ = Auth.create(authOrTokenOrUsername, opt_password); } + return this; + }; - /** - * Sets the body that will be sent with this request. - * @param {*} body - * @chainable - */ + /** + * Sets the body that will be sent with this request. + * @param {*} body + * @chainable + */ - }, { - key: 'body', - value: function body(_body) { - this.body_ = _body; - return this; - } + Launchpad.prototype.body = function body(_body) { + this.body_ = _body; + return this; + }; - /** - * Converts the given body object to query params. - * @param {!ClientRequest} clientRequest - * @param {*} body - * @protected - */ + /** + * Converts the given body object to query params. + * @param {!ClientRequest} clientRequest + * @param {*} body + * @protected + */ - }, { - key: 'convertBodyToParams_', - value: function convertBodyToParams_(clientRequest, body) { - if (core.isString(body)) { - body = { - body: body - }; - } else if (body instanceof Embodied) { - body = body.body(); - } - Object.keys(body || {}).forEach(function (name) { - return clientRequest.param(name, body[name]); - }); + Launchpad.prototype.convertBodyToParams_ = function convertBodyToParams_(clientRequest, body) { + if (core.isString(body)) { + body = { + body: body + }; + } else if (body instanceof Embodied) { + body = body.body(); } + Object.keys(body || {}).forEach(function (name) { + return clientRequest.param(name, body[name]); + }); + }; - /** - * Sets this request's query type to "count". - * @chainnable - */ + /** + * Sets this request's query type to "count". + * @chainnable + */ - }, { - key: 'count', - value: function count() { - this.getOrCreateQuery_().type('count'); - return this; - } + Launchpad.prototype.count = function count() { + this.getOrCreateQuery_().type('count'); + return this; + }; - /** - * Creates client request and encode. - * @param {string} method - * @param {*} body - * @return {!ClientRequest} clientRequest - * @protected - */ + /** + * Creates client request and encode. + * @param {string} method + * @param {*} body + * @return {!ClientRequest} clientRequest + * @protected + */ - }, { - key: 'createClientRequest_', - value: function createClientRequest_(method, body) { - var clientRequest = new ClientRequest(); + Launchpad.prototype.createClientRequest_ = function createClientRequest_(method, body) { + var clientRequest = new ClientRequest(); - clientRequest.body(body || this.body_); + clientRequest.body(body || this.body_); - if (!core.isDefAndNotNull(clientRequest.body())) { - if (this.query_) { - clientRequest.body(this.query_.body()); - } else if (this.formData_) { - clientRequest.body(this.formData_); - } + if (!core.isDefAndNotNull(clientRequest.body())) { + if (this.query_) { + clientRequest.body(this.query_.body()); + } else if (this.formData_) { + clientRequest.body(this.formData_); } + } - clientRequest.method(method); - clientRequest.headers(this.headers()); - clientRequest.params(this.params()); - clientRequest.url(this.url()); + clientRequest.method(method); + clientRequest.headers(this.headers()); + clientRequest.params(this.params()); + clientRequest.url(this.url()); - this.encode(clientRequest); + this.encode(clientRequest); - return clientRequest; - } + return clientRequest; + }; - /** - * Decodes clientResponse body, parsing the body for example. - * @param {!ClientResponse} clientResponse The response object to be decoded. - * @return {!ClientResponse} The decoded response. - */ + /** + * Decodes clientResponse body, parsing the body for example. + * @param {!ClientResponse} clientResponse The response object to be decoded. + * @return {!ClientResponse} The decoded response. + */ - }, { - key: 'decode', - value: function decode(clientResponse) { - if (Launchpad.isContentTypeJson(clientResponse)) { - try { - clientResponse.body(JSON.parse(clientResponse.body())); - } catch (err) {} - } - return clientResponse; + Launchpad.prototype.decode = function decode(clientResponse) { + if (Launchpad.isContentTypeJson(clientResponse)) { + try { + clientResponse.body(JSON.parse(clientResponse.body())); + } catch (err) {} } + return clientResponse; + }; - /** - * Sends message with the DELETE http verb. - * @param {string=} opt_body Content to be sent as the request's body. - * @return {!Promise} - */ + /** + * Sends message with the DELETE http verb. + * @param {string=} opt_body Content to be sent as the request's body. + * @return {!Promise} + */ - }, { - key: 'delete', - value: function _delete(opt_body) { - return this.sendAsync('DELETE', opt_body); - } + Launchpad.prototype.delete = function _delete(opt_body) { + return this.sendAsync('DELETE', opt_body); + }; - /** - * Encodes the given {@link ClientRequest}, converting its body to an appropriate - * format for example. - * @param {!ClientRequest} clientRequest The request object to encode. - * @return {!ClientRequest} The encoded request. - */ + /** + * Encodes the given {@link ClientRequest}, converting its body to an appropriate + * format for example. + * @param {!ClientRequest} clientRequest The request object to encode. + * @return {!ClientRequest} The encoded request. + */ - }, { - key: 'encode', - value: function encode(clientRequest) { - var body = clientRequest.body(); + Launchpad.prototype.encode = function encode(clientRequest) { + var body = clientRequest.body(); - if (core.isElement(body)) { - body = new FormData(body); - clientRequest.body(body); - } + if (core.isElement(body)) { + body = new FormData(body); + clientRequest.body(body); + } - body = this.wrapWithQuery_(body); - if (clientRequest.method() === 'GET') { - this.convertBodyToParams_(clientRequest, body); - clientRequest.removeBody(); - body = null; - } + body = this.wrapWithQuery_(body); + if (clientRequest.method() === 'GET') { + this.convertBodyToParams_(clientRequest, body); + clientRequest.removeBody(); + body = null; + } - if (body instanceof FormData) { - clientRequest.headers().remove('content-type'); - } else if (body instanceof Embodied) { - clientRequest.body(body.toString()); - } else if (Launchpad.isContentTypeJson(clientRequest)) { - clientRequest.body(JSON.stringify(clientRequest.body())); - } + if (body instanceof FormData) { + clientRequest.headers().remove('content-type'); + } else if (body instanceof Embodied) { + clientRequest.body(body.toString()); + } else if (Launchpad.isContentTypeJson(clientRequest)) { + clientRequest.body(JSON.stringify(clientRequest.body())); + } - this.encodeParams_(clientRequest); - this.resolveAuthentication_(clientRequest); + this.encodeParams_(clientRequest); + this.resolveAuthentication_(clientRequest); - return clientRequest; - } + return clientRequest; + }; - /** - * Encodes the params for the given request, according to their types. - * @param {!ClientRequest} clientRequest - * @protected - */ + /** + * Encodes the params for the given request, according to their types. + * @param {!ClientRequest} clientRequest + * @protected + */ - }, { - key: 'encodeParams_', - value: function encodeParams_(clientRequest) { - var params = clientRequest.params(); - params.names().forEach(function (name) { - var values = params.getAll(name); - values.forEach(function (value, index) { - if (value instanceof Embodied) { - value = value.toString(); - } else if (core.isObject(value) || value instanceof Array) { - value = JSON.stringify(value); - } - values[index] = value; - }); + Launchpad.prototype.encodeParams_ = function encodeParams_(clientRequest) { + var params = clientRequest.params(); + params.names().forEach(function (name) { + var values = params.getAll(name); + values.forEach(function (value, index) { + if (value instanceof Embodied) { + value = value.toString(); + } else if (core.isObject(value) || value instanceof Array) { + value = JSON.stringify(value); + } + values[index] = value; }); - } + }); + }; - /** - * Adds a filter to this request's {@link Query}. - * @param {!Filter|string} fieldOrFilter Either a Filter instance or the - * name of the field to filter by. - * @param {*=} opt_operatorOrValue Either the field's operator or its value. - * @param {*=} opt_value The filter's value. - * @chainable - */ + /** + * Adds a filter to this request's {@link Query}. + * @param {!Filter|string} fieldOrFilter Either a Filter instance or the + * name of the field to filter by. + * @param {*=} opt_operatorOrValue Either the field's operator or its value. + * @param {*=} opt_value The filter's value. + * @chainable + */ - }, { - key: 'filter', - value: function filter(fieldOrFilter, opt_operatorOrValue, opt_value) { - this.getOrCreateQuery_().filter(fieldOrFilter, opt_operatorOrValue, opt_value); - return this; - } + Launchpad.prototype.filter = function filter(fieldOrFilter, opt_operatorOrValue, opt_value) { + this.getOrCreateQuery_().filter(fieldOrFilter, opt_operatorOrValue, opt_value); + return this; + }; - /** - * Adds a key/value pair to be sent via the body in a `multipart/form-data` format. - * If the body is set by other means (for example, through the `body` method), this - * will be ignored. - * @param {string} name - * @param {*} value - * @chainable - */ + /** + * Adds a key/value pair to be sent via the body in a `multipart/form-data` format. + * If the body is set by other means (for example, through the `body` method), this + * will be ignored. + * @param {string} name + * @param {*} value + * @chainable + */ - }, { - key: 'form', - value: function form(name, value) { - if (!this.formData_) { - this.formData_ = new FormData(); - } - this.formData_.append(name, value); - return this; + Launchpad.prototype.form = function form(name, value) { + if (!this.formData_) { + this.formData_ = new FormData(); } + this.formData_.append(name, value); + return this; + }; - /** - * Sends message with the GET http verb. - * @param {*=} opt_params Params to be added to the request url. - * @return {!Promise} - */ + /** + * Sends message with the GET http verb. + * @param {*=} opt_params Params to be added to the request url. + * @return {!Promise} + */ - }, { - key: 'get', - value: function get(opt_params) { - return this.sendAsync('GET', opt_params); - } + Launchpad.prototype.get = function get(opt_params) { + return this.sendAsync('GET', opt_params); + }; - /** - * Gets the currently used {@link Query} object. If none exists yet, - * a new one is created. - * @return {!Query} - * @protected - */ + /** + * Gets the currently used {@link Query} object. If none exists yet, + * a new one is created. + * @return {!Query} + * @protected + */ - }, { - key: 'getOrCreateQuery_', - value: function getOrCreateQuery_() { - if (!this.query_) { - this.query_ = new Query(); - } - return this.query_; + Launchpad.prototype.getOrCreateQuery_ = function getOrCreateQuery_() { + if (!this.query_) { + this.query_ = new Query(); } + return this.query_; + }; - /** - * Adds a header. If the header with the same name already exists, it will - * not be overwritten, but new value will be stored. The order is preserved. - * @param {string} name - * @param {*} value - * @chainable - */ + /** + * Adds a header. If the header with the same name already exists, it will + * not be overwritten, but new value will be stored. The order is preserved. + * @param {string} name + * @param {*} value + * @chainable + */ - }, { - key: 'header', - value: function header(name, value) { - if (arguments.length !== 2) { - throw new Error('Invalid arguments'); - } - this.headers_.set(name, value); - return this; + Launchpad.prototype.header = function header(name, value) { + if (arguments.length !== 2) { + throw new Error('Invalid arguments'); } + this.headers_.set(name, value); + return this; + }; - /** - * Gets the headers. - * @return {!MultiMap} - */ + /** + * Gets the headers. + * @return {!MultiMap} + */ - }, { - key: 'headers', - value: function headers() { - return this.headers_; - } + Launchpad.prototype.headers = function headers() { + return this.headers_; + }; - /** - * Adds a highlight entry to this request's {@link Query} instance. - * @param {string} field The field's name. - * @chainable - */ + /** + * Adds a highlight entry to this request's {@link Query} instance. + * @param {string} field The field's name. + * @chainable + */ - }, { - key: 'highlight', - value: function highlight(field) { - this.getOrCreateQuery_().highlight(field); - return this; - } + Launchpad.prototype.highlight = function highlight(field) { + this.getOrCreateQuery_().highlight(field); + return this; + }; - /** - * Sets the limit for this request's {@link Query}. - * @param {number} limit The max amount of entries that this request should return. - * @chainable - */ + /** + * Sets the limit for this request's {@link Query}. + * @param {number} limit The max amount of entries that this request should return. + * @chainable + */ - }, { - key: 'limit', - value: function limit(_limit) { - this.getOrCreateQuery_().limit(_limit); - return this; - } + Launchpad.prototype.limit = function limit(_limit) { + this.getOrCreateQuery_().limit(_limit); + return this; + }; - /** - * Sets the offset for this request's {@link Query}. - * @param {number} offset The index of the first entry that should be returned - * by this query. - * @chainable - */ + /** + * Sets the offset for this request's {@link Query}. + * @param {number} offset The index of the first entry that should be returned + * by this query. + * @chainable + */ - }, { - key: 'offset', - value: function offset(_offset) { - this.getOrCreateQuery_().offset(_offset); - return this; - } + Launchpad.prototype.offset = function offset(_offset) { + this.getOrCreateQuery_().offset(_offset); + return this; + }; - /** - * Adds a query. If the query with the same name already exists, it will not - * be overwritten, but new value will be stored. The order is preserved. - * @param {string} name - * @param {*} value - * @chainable - */ + /** + * Adds a query. If the query with the same name already exists, it will not + * be overwritten, but new value will be stored. The order is preserved. + * @param {string} name + * @param {*} value + * @chainable + */ - }, { - key: 'param', - value: function param(name, value) { - if (arguments.length !== 2) { - throw new Error('Invalid arguments'); - } - this.params_.set(name, value); - return this; + Launchpad.prototype.param = function param(name, value) { + if (arguments.length !== 2) { + throw new Error('Invalid arguments'); } + this.params_.set(name, value); + return this; + }; - /** - * Gets the query strings map. - * @return {!MultiMap} - */ + /** + * Gets the query strings map. + * @return {!MultiMap} + */ - }, { - key: 'params', - value: function params() { - return this.params_; - } + Launchpad.prototype.params = function params() { + return this.params_; + }; - /** - * Sends message with the PATCH http verb. - * @param {string=} opt_body Content to be sent as the request's body. - * @return {!Promise} - */ + /** + * Sends message with the PATCH http verb. + * @param {string=} opt_body Content to be sent as the request's body. + * @return {!Promise} + */ + + Launchpad.prototype.patch = function patch(opt_body) { + return this.sendAsync('PATCH', opt_body); + }; + + /** + * Creates a new {@link Launchpad} instance for handling the url resulting in the + * union of the current url with the given paths. + * @param {...string} paths Any number of paths. + * @return {!Launchpad} A new {@link Launchpad} instance for handling the given paths. + */ - }, { - key: 'patch', - value: function patch(opt_body) { - return this.sendAsync('PATCH', opt_body); + Launchpad.prototype.path = function path() { + for (var _len2 = arguments.length, paths = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { + paths[_key2] = arguments[_key2]; } - /** - * Creates a new {@link Launchpad} instance for handling the url resulting in the - * union of the current url with the given paths. - * @param {...string} paths Any number of paths. - * @return {!Launchpad} A new {@link Launchpad} instance for handling the given paths. - */ + return new (Function.prototype.bind.apply(Launchpad, [null].concat([this.url()], paths)))().use(this.customTransport_); + }; - }, { - key: 'path', - value: function path() { - for (var _len2 = arguments.length, paths = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { - paths[_key2] = arguments[_key2]; - } + /** + * Sends message with the POST http verb. + * @param {string=} opt_body Content to be sent as the request's body. + * @return {!Promise} + */ - return new (Function.prototype.bind.apply(Launchpad, [null].concat([this.url()], paths)))().use(this.customTransport_); - } + Launchpad.prototype.post = function post(opt_body) { + return this.sendAsync('POST', opt_body); + }; - /** - * Sends message with the POST http verb. - * @param {string=} opt_body Content to be sent as the request's body. - * @return {!Promise} - */ + /** + * Sends message with the PUT http verb. + * @param {string=} opt_body Content to be sent as the request's body. + * @return {!Promise} + */ - }, { - key: 'post', - value: function post(opt_body) { - return this.sendAsync('POST', opt_body); - } + Launchpad.prototype.put = function put(opt_body) { + return this.sendAsync('PUT', opt_body); + }; - /** - * Sends message with the PUT http verb. - * @param {string=} opt_body Content to be sent as the request's body. - * @return {!Promise} - */ + /** + * Adds the authentication information to the request. + * @param {!ClientRequest} clientRequest + * @protected + */ - }, { - key: 'put', - value: function put(opt_body) { - return this.sendAsync('PUT', opt_body); + Launchpad.prototype.resolveAuthentication_ = function resolveAuthentication_(clientRequest) { + if (!this.auth_) { + return; } + if (this.auth_.hasToken()) { + clientRequest.header('Authorization', 'Bearer ' + this.auth_.token()); + } else { + var credentials = this.auth_.username() + ':' + this.auth_.password(); + clientRequest.header('Authorization', 'Basic ' + btoa(credentials)); + } + }; - /** - * Adds the authentication information to the request. - * @param {!ClientRequest} clientRequest - * @protected - */ + /** + * Adds a search to this request's {@link Query} instance. + * @param {!Filter|string} filterOrTextOrField If no other arguments + * are passed to this function, this should be either a `Filter` + * instance or a text to be used in a match filter. In both cases + * the filter will be applied to all fields. Another option is to + * pass this as a field name instead, together with other arguments + * so the filter can be created. + * @param {string=} opt_textOrOperator Either a text to be used in a + * match filter, or the operator that should be used. + * @param {*=} opt_value The value to be used by the filter. Should + * only be passed if an operator was passed as the second argument. + * @chainable + */ - }, { - key: 'resolveAuthentication_', - value: function resolveAuthentication_(clientRequest) { - if (!this.auth_) { - return; - } - if (this.auth_.hasToken()) { - clientRequest.header('Authorization', 'Bearer ' + this.auth_.token()); - } else { - var credentials = this.auth_.username() + ':' + this.auth_.password(); - clientRequest.header('Authorization', 'Basic ' + btoa(credentials)); - } - } + Launchpad.prototype.search = function search(filterOrTextOrField, opt_textOrOperator, opt_value) { + this.getOrCreateQuery_().search(filterOrTextOrField, opt_textOrOperator, opt_value); + return this; + }; - /** - * Adds a search to this request's {@link Query} instance. - * @param {!Filter|string} filterOrTextOrField If no other arguments - * are passed to this function, this should be either a `Filter` - * instance or a text to be used in a match filter. In both cases - * the filter will be applied to all fields. Another option is to - * pass this as a field name instead, together with other arguments - * so the filter can be created. - * @param {string=} opt_textOrOperator Either a text to be used in a - * match filter, or the operator that should be used. - * @param {*=} opt_value The value to be used by the filter. Should - * only be passed if an operator was passed as the second argument. - * @chainable - */ + /** + * Uses transport to send request with given method name and body + * asynchronously. + * @param {string} method The HTTP method to be used when sending data. + * @param {string} body Content to be sent as the request's body. + * @return {!Promise} Deferred request. + */ - }, { - key: 'search', - value: function search(filterOrTextOrField, opt_textOrOperator, opt_value) { - this.getOrCreateQuery_().search(filterOrTextOrField, opt_textOrOperator, opt_value); - return this; - } + Launchpad.prototype.sendAsync = function sendAsync(method, body) { + var transport = this.customTransport_ || TransportFactory.instance().getDefault(); - /** - * Uses transport to send request with given method name and body - * asynchronously. - * @param {string} method The HTTP method to be used when sending data. - * @param {string} body Content to be sent as the request's body. - * @return {!Promise} Deferred request. - */ + var clientRequest = this.createClientRequest_(method, body); - }, { - key: 'sendAsync', - value: function sendAsync(method, body) { - var transport = this.customTransport_ || TransportFactory.instance().getDefault(); + return transport.send(clientRequest).then(this.decode); + }; - var clientRequest = this.createClientRequest_(method, body); + /** + * Adds a sort query to this request's body. + * @param {string} field The field that the query should be sorted by. + * @param {string=} opt_direction The direction the sort operation should use. + * If none is given, "asc" is used by default. + * @chainnable + */ - return transport.send(clientRequest).then(this.decode); - } + Launchpad.prototype.sort = function sort(field, opt_direction) { + this.getOrCreateQuery_().sort(field, opt_direction); + return this; + }; - /** - * Adds a sort query to this request's body. - * @param {string} field The field that the query should be sorted by. - * @param {string=} opt_direction The direction the sort operation should use. - * If none is given, "asc" is used by default. - * @chainnable - */ + /** + * Static factory for creating launchpad client for the given url. + * @param {string} url The url that the client should use for sending requests. + */ - }, { - key: 'sort', - value: function sort(field, opt_direction) { - this.getOrCreateQuery_().sort(field, opt_direction); - return this; - } + Launchpad.url = function url(_url) { + return new Launchpad(_url).use(this.customTransport_); + }; - /** - * Static factory for creating launchpad client for the given url. - * @param {string} url The url that the client should use for sending requests. - */ + /** + * Returns the URL used by this client. + */ - }, { - key: 'url', + Launchpad.prototype.url = function url() { + return this.url_; + }; - /** - * Returns the URL used by this client. - */ - value: function url() { - return this.url_; - } + /** + * Specifies {@link Transport} implementation. + * @param {!Transport} transport The transport implementation that should be used. + */ - /** - * Specifies {@link Transport} implementation. - * @param {!Transport} transport The transport implementation that should be used. - */ + Launchpad.prototype.use = function use(transport) { + this.customTransport_ = transport; + return this; + }; - }, { - key: 'use', - value: function use(transport) { - this.customTransport_ = transport; - return this; + /** + * Creates new socket.io instance. The parameters passed to socket.io + * constructor will be provided: + * + * ```javascript + * Launchpad.url('http://domain:8080/path/a').watch({id: 'myId'}, {foo: true}); + * // Equals: + * io('domain:8080/?url=path%2Fa%3Fid%3DmyId', {foo: true}); + * ``` + * + * @param {Object=} opt_params Params to be sent with the Socket IO request. + * @param {Object=} opt_options Object with Socket IO options. + * @return {!io} Socket IO reference. Server events can be listened on it. + */ + + Launchpad.prototype.watch = function watch(opt_params, opt_options) { + if (typeof io === 'undefined') { + throw new Error('Socket.io client not loaded'); } - /** - * Creates new socket.io instance. The parameters passed to socket.io - * constructor will be provided: - * - * ```javascript - * Launchpad.url('http://domain:8080/path/a').watch({id: 'myId'}, {foo: true}); - * // Equals: - * io('domain:8080/?url=path%2Fa%3Fid%3DmyId', {foo: true}); - * ``` - * - * @param {Object=} opt_params Params to be sent with the Socket IO request. - * @param {Object=} opt_options Object with Socket IO options. - * @return {!io} Socket IO reference. Server events can be listened on it. - */ + var clientRequest = this.createClientRequest_('GET', opt_params); - }, { - key: 'watch', - value: function watch(opt_params, opt_options) { - if (typeof io === 'undefined') { - throw new Error('Socket.io client not loaded'); - } + var url = Ajax.parseUrl(Ajax.addParametersToUrlQueryString(clientRequest.url(), clientRequest.params())); - var clientRequest = this.createClientRequest_('GET', opt_params); + opt_options = opt_options || { + forceNew: true + }; + opt_options.path = opt_options.path || url[1]; - var url = Ajax.parseUrl(Ajax.addParametersToUrlQueryString(clientRequest.url(), clientRequest.params())); + return io(url[0] + '?url=' + encodeURIComponent(url[1] + url[2]), opt_options); + }; - opt_options = opt_options || { - forceNew: true - }; - opt_options.path = opt_options.path || url[1]; + /** + * Wraps the given `Embodied` instance with a {@link Query} instance if needed. + * @param {Embodied} embodied + * @return {Embodied} + * @protected + */ - return io(url[0] + '?url=' + encodeURIComponent(url[1] + url[2]), opt_options); + Launchpad.prototype.wrapWithQuery_ = function wrapWithQuery_(embodied) { + if (embodied instanceof Filter) { + embodied = Query.filter(embodied); } + return embodied; + }; - /** - * Wraps the given `Embodied` instance with a {@link Query} instance if needed. - * @param {Embodied} embodied - * @return {Embodied} - * @protected - */ - - }, { - key: 'wrapWithQuery_', - value: function wrapWithQuery_(embodied) { - if (embodied instanceof Filter) { - embodied = Query.filter(embodied); - } - return embodied; - } - }], [{ - key: 'url', - value: function url(_url) { - return new Launchpad(_url).use(this.customTransport_); - } - }]); return Launchpad; })(); @@ -5073,4 +4737,5 @@ this.launchpadNamed = this.launchpadNamed || {}; window.Range = Range; } }).call(this); +}).call(this); //# sourceMappingURL=api.js.map diff --git a/build/globals/api.js.map b/build/globals/api.js.map index 91d6c30..fc2ba40 100644 --- a/build/globals/api.js.map +++ b/build/globals/api.js.map @@ -1 +1 @@ -{"version":3,"sources":["init.js","initNamed.js","helpers.js","core.js","Transport.js","Promise.js","Ajax.js","Disposable.js","MultiMap.js","ClientMessage.js","ClientResponse.js","AjaxTransport.js","Auth.js","ClientRequest.js","Embodied.js","FilterBody.js","Geo.js","Range.js","Filter.js","Aggregation.js","Query.js","TransportFactory.js","Launchpad.js","globals.js"],"names":[],"mappings":"AAAA;ACAA;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC5DA;;;;;;AAAY,CAAC;;KAMP,IAAI;WAAJ,IAAI;qCAAJ,IAAI;;;2BAAJ,IAAI;;;;;;;;;;;;;oCAWe;AACvB,UAAM,KAAK,CAAC,+BAA+B,CAAC,CAAC;IAC7C;;;;;;;;;;;;;;+CAWkC,WAAW,EAAE,YAAY,EAAE;AAC7D,QAAI,cAAc,GAAG,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC,CAAC;AACjD,WAAO,WAAW,CAAC,SAAS,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,aAAa,CAAC,QAAQ,CAAC,EAAE;AAC/E,gBAAW,GAAG,WAAW,CAAC,SAAS,CAAC;AACpC,mBAAc,CAAC,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC,CAAC;KAC/C;AACD,WAAO,cAAc,CAAC;IACtB;;;;;;;;;;;;mCASsB,EAAE,EAAE;AAC1B,QAAI,CAAC,EAAE,CAAC,IAAI,EAAE;AACb,SAAI,GAAG,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC;AACxB,OAAE,CAAC,IAAI,GAAG,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;KAC7C;AACD,WAAO,EAAE,CAAC,IAAI,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K,SAAS,EAAE;AAChC,QAAM,CAAC,MAAM,GAAG,MAAM,CAAC;AACvB,QAAM,CAAC,GAAG,GAAG,GAAG,CAAC;AACjB,QAAM,CAAC,KAAK,GAAG,KAAK,CAAC;AACrB,QAAM,CAAC,KAAK,GAAG,KAAK,CAAC;EACrB","file":"api.js","sourcesContent":[null,null,null,"'use strict';\n\n/**\n * A collection of core utility functions.\n * @const\n */\nclass core {\n\t/**\n\t * When defining a class Foo with an abstract method bar(), you can do:\n\t * Foo.prototype.bar = core.abstractMethod\n\t *\n\t * Now if a subclass of Foo fails to override bar(), an error will be thrown\n\t * when bar() is invoked.\n\t *\n\t * @type {!Function}\n\t * @throws {Error} when invoked to indicate the method should be overridden.\n\t */\n\tstatic abstractMethod() {\n\t\tthrow Error('Unimplemented abstract method');\n\t}\n\n\t/**\n\t * Loops constructor super classes collecting its properties values. If\n\t * property is not available on the super class `undefined` will be\n\t * collected as value for the class hierarchy position.\n\t * @param {!function()} constructor Class constructor.\n\t * @param {string} propertyName Property name to be collected.\n\t * @return {Array.<*>} Array of collected values.\n\t * TODO(*): Rethink superclass loop.\n\t */\n\tstatic collectSuperClassesProperty(constructor, propertyName) {\n\t\tvar propertyValues = [constructor[propertyName]];\n\t\twhile (constructor.__proto__ && !constructor.__proto__.isPrototypeOf(Function)) {\n\t\t\tconstructor = constructor.__proto__;\n\t\t\tpropertyValues.push(constructor[propertyName]);\n\t\t}\n\t\treturn propertyValues;\n\t}\n\n\t/**\n\t * Gets the name of the given function. If the current browser doesn't\n\t * support the `name` property, this will calculate it from the function's\n\t * content string.\n\t * @param {!function()} fn\n\t * @return {string}\n\t */\n\tstatic getFunctionName(fn) {\n\t\tif (!fn.name) {\n\t\t\tvar str = fn.toString();\n\t\t\tfn.name = str.substring(9, str.indexOf('('));\n\t\t}\n\t\treturn fn.name;\n\t}\n\n\t/**\n\t * Gets an unique id. If `opt_object` argument is passed, the object is\n\t * mutated with an unique id. Consecutive calls with the same object\n\t * reference won't mutate the object again, instead the current object uid\n\t * returns. See {@link core.UID_PROPERTY}.\n\t * @type {opt_object} Optional object to be mutated with the uid. If not\n\t * specified this method only returns the uid.\n\t * @throws {Error} when invoked to indicate the method should be overridden.\n\t */\n\tstatic getUid(opt_object) {\n\t\tif (opt_object) {\n\t\t\treturn opt_object[core.UID_PROPERTY] ||\n\t\t\t\t(opt_object[core.UID_PROPERTY] = core.uniqueIdCounter_++);\n\t\t}\n\t\treturn core.uniqueIdCounter_++;\n\t}\n\n\t/**\n\t * The identity function. Returns its first argument.\n\t * @param {*=} opt_returnValue The single value that will be returned.\n\t * @return {?} The first argument.\n\t */\n\tstatic identityFunction(opt_returnValue) {\n\t\treturn opt_returnValue;\n\t}\n\n\t/**\n\t * Returns true if the specified value is a boolean.\n\t * @param {?} val Variable to test.\n\t * @return {boolean} Whether variable is boolean.\n\t */\n\tstatic isBoolean(val) {\n\t\treturn typeof val === 'boolean';\n\t}\n\n\t/**\n\t * Returns true if the specified value is not undefined.\n\t * @param {?} val Variable to test.\n\t * @return {boolean} Whether variable is defined.\n\t */\n\tstatic isDef(val) {\n\t\treturn val !== undefined;\n\t}\n\n\t/**\n\t * Returns true if value is not undefined or null.\n\t * @param {*} val\n\t * @return {Boolean}\n\t */\n\tstatic isDefAndNotNull(val) {\n\t\treturn core.isDef(val) && !core.isNull(val);\n\t}\n\n\t/**\n\t * Returns true if value is a document.\n\t * @param {*} val\n\t * @return {Boolean}\n\t */\n\tstatic isDocument(val) {\n\t\treturn val && typeof val === 'object' && val.nodeType === 9;\n\t}\n\n\t/**\n\t * Returns true if value is a dom element.\n\t * @param {*} val\n\t * @return {Boolean}\n\t */\n\tstatic isElement(val) {\n\t\treturn val && typeof val === 'object' && val.nodeType === 1;\n\t}\n\n\t/**\n\t * Returns true if the specified value is a function.\n\t * @param {?} val Variable to test.\n\t * @return {boolean} Whether variable is a function.\n\t */\n\tstatic isFunction(val) {\n\t\treturn typeof val === 'function';\n\t}\n\n\t/**\n\t * Returns true if value is null.\n\t * @param {*} val\n\t * @return {Boolean}\n\t */\n\tstatic isNull(val) {\n\t\treturn val === null;\n\t}\n\n\t/**\n\t * Returns true if the specified value is a number.\n\t * @param {?} val Variable to test.\n\t * @return {boolean} Whether variable is a number.\n\t */\n\tstatic isNumber(val) {\n\t\treturn typeof val === 'number';\n\t}\n\n\t/**\n\t * Returns true if value is a window.\n\t * @param {*} val\n\t * @return {Boolean}\n\t */\n\tstatic isWindow(val) {\n\t\treturn val !== null && val === val.window;\n\t}\n\n\t/**\n\t * Returns true if the specified value is an object. This includes arrays\n\t * and functions.\n\t * @param {?} val Variable to test.\n\t * @return {boolean} Whether variable is an object.\n\t */\n\tstatic isObject(val) {\n\t\tvar type = typeof val;\n\t\treturn type === 'object' && val !== null || type === 'function';\n\t}\n\n\t/**\n\t * Returns true if value is a string.\n\t * @param {*} val\n\t * @return {Boolean}\n\t */\n\tstatic isString(val) {\n\t\treturn typeof val === 'string';\n\t}\n\n\t/**\n\t * Merges the values of a static property a class with the values of that\n\t * property for all its super classes, and stores it as a new static\n\t * property of that class. If the static property already existed, it won't\n\t * be recalculated.\n\t * @param {!function()} constructor Class constructor.\n\t * @param {string} propertyName Property name to be collected.\n\t * @param {function(*, *):*=} opt_mergeFn Function that receives an array filled\n\t * with the values of the property for the current class and all its super classes.\n\t * Should return the merged value to be stored on the current class.\n\t * @return {boolean} Returns true if merge happens, false otherwise.\n\t */\n\tstatic mergeSuperClassesProperty(constructor, propertyName, opt_mergeFn) {\n\t\tvar mergedName = propertyName + '_MERGED';\n\t\tif (constructor.hasOwnProperty(mergedName)) {\n\t\t\treturn false;\n\t\t}\n\n\t\tvar merged = core.collectSuperClassesProperty(constructor, propertyName);\n\t\tif (opt_mergeFn) {\n\t\t\tmerged = opt_mergeFn(merged);\n\t\t}\n\t\tconstructor[mergedName] = merged;\n\t\treturn true;\n\t}\n\n\t/**\n\t * Null function used for default values of callbacks, etc.\n\t * @return {void} Nothing.\n\t */\n\tstatic nullFunction() {}\n}\n\n/**\n * Unique id property prefix.\n * @type {String}\n * @protected\n */\ncore.UID_PROPERTY = 'core_' + ((Math.random() * 1e9) >>> 0);\n\n/**\n * Counter for unique id.\n * @type {Number}\n * @private\n */\ncore.uniqueIdCounter_ = 1;\n\nexport default core;\n","'use strict';\n\n/**\n * Provides a convenient interface for data transport.\n * @interface\n */\nclass Transport {\n\n\t/**\n\t * Sends a message for the specified client.\n\t * @param {!ClientRequest} clientRequest\n\t * @return {!Promise} Deferred request.\n\t */\n\tsend() {}\n\n}\n\nexport default Transport;\n","/*!\n * Promises polyfill from Google's Closure Library.\n *\n * Copyright 2013 The Closure Library Authors. All Rights Reserved.\n *\n * NOTE(eduardo): Promise support is not ready on all supported browsers,\n * therefore core.js is temporarily using Google's promises as polyfill. It\n * supports cancellable promises and has clean and fast implementation.\n */\n\n'use strict';\n\nimport core from 'bower:metal/src/core';\n\n/**\n * Provides a more strict interface for Thenables in terms of\n * http://promisesaplus.com for interop with {@see CancellablePromise}.\n *\n * @interface\n * @extends {IThenable.}\n * @template TYPE\n */\nvar Thenable = function() {};\n\n/**\n * Adds callbacks that will operate on the result of the Thenable, returning a\n * new child Promise.\n *\n * If the Thenable is fulfilled, the {@code onFulfilled} callback will be\n * invoked with the fulfillment value as argument, and the child Promise will\n * be fulfilled with the return value of the callback. If the callback throws\n * an exception, the child Promise will be rejected with the thrown value\n * instead.\n *\n * If the Thenable is rejected, the {@code onRejected} callback will be invoked\n * with the rejection reason as argument, and the child Promise will be rejected\n * with the return value of the callback or thrown value.\n *\n * @param {?(function(this:THIS, TYPE):\n * (RESULT|IThenable.|Thenable))=} opt_onFulfilled A\n * function that will be invoked with the fulfillment value if the Promise\n * is fullfilled.\n * @param {?(function(*): *)=} opt_onRejected A function that will be invoked\n * with the rejection reason if the Promise is rejected.\n * @param {THIS=} opt_context An optional context object that will be the\n * execution context for the callbacks. By default, functions are executed\n * with the default this.\n * @return {!CancellablePromise.} A new Promise that will receive the\n * result of the fulfillment or rejection callback.\n * @template RESULT,THIS\n */\nThenable.prototype.then = function() {};\n\n\n/**\n * An expando property to indicate that an object implements\n * {@code Thenable}.\n *\n * {@see addImplementation}.\n *\n * @const\n */\nThenable.IMPLEMENTED_BY_PROP = '$goog_Thenable';\n\n\n/**\n * Marks a given class (constructor) as an implementation of Thenable, so\n * that we can query that fact at runtime. The class must have already\n * implemented the interface.\n * Exports a 'then' method on the constructor prototype, so that the objects\n * also implement the extern {@see Thenable} interface for interop with\n * other Promise implementations.\n * @param {function(new:Thenable,...[?])} ctor The class constructor. The\n * corresponding class must have already implemented the interface.\n */\nThenable.addImplementation = function(ctor) {\n ctor.prototype.then = ctor.prototype.then;\n ctor.prototype.$goog_Thenable = true;\n};\n\n\n/**\n * @param {*} object\n * @return {boolean} Whether a given instance implements {@code Thenable}.\n * The class/superclass of the instance must call {@code addImplementation}.\n */\nThenable.isImplementedBy = function(object) {\n if (!object) {\n return false;\n }\n try {\n return !!object.$goog_Thenable;\n } catch (e) {\n // Property access seems to be forbidden.\n return false;\n }\n};\n\n\n/**\n * Like bind(), except that a 'this object' is not required. Useful when the\n * target function is already bound.\n *\n * Usage:\n * var g = partial(f, arg1, arg2);\n * g(arg3, arg4);\n *\n * @param {Function} fn A function to partially apply.\n * @param {...*} var_args Additional arguments that are partially applied to fn.\n * @return {!Function} A partially-applied form of the function bind() was\n * invoked as a method of.\n */\nvar partial = function(fn) {\n var args = Array.prototype.slice.call(arguments, 1);\n return function() {\n // Clone the array (with slice()) and append additional arguments\n // to the existing arguments.\n var newArgs = args.slice();\n newArgs.push.apply(newArgs, arguments);\n return fn.apply(this, newArgs);\n };\n};\n\n\nvar async = {};\n\n\n/**\n * Throw an item without interrupting the current execution context. For\n * example, if processing a group of items in a loop, sometimes it is useful\n * to report an error while still allowing the rest of the batch to be\n * processed.\n * @param {*} exception\n */\nasync.throwException = function(exception) {\n // Each throw needs to be in its own context.\n async.nextTick(function() {\n throw exception;\n });\n};\n\n\n/**\n * Fires the provided callback just before the current callstack unwinds, or as\n * soon as possible after the current JS execution context.\n * @param {function(this:THIS)} callback\n * @param {THIS=} opt_context Object to use as the \"this value\" when calling\n * the provided function.\n * @template THIS\n */\nasync.run = function(callback, opt_context) {\n if (!async.run.workQueueScheduled_) {\n // Nothing is currently scheduled, schedule it now.\n async.nextTick(async.run.processWorkQueue);\n async.run.workQueueScheduled_ = true;\n }\n\n async.run.workQueue_.push(\n new async.run.WorkItem_(callback, opt_context));\n};\n\n\n/** @private {boolean} */\nasync.run.workQueueScheduled_ = false;\n\n\n/** @private {!Array.} */\nasync.run.workQueue_ = [];\n\n/**\n * Run any pending async.run work items. This function is not intended\n * for general use, but for use by entry point handlers to run items ahead of\n * async.nextTick.\n */\nasync.run.processWorkQueue = function() {\n // NOTE: additional work queue items may be pushed while processing.\n while (async.run.workQueue_.length) {\n // Don't let the work queue grow indefinitely.\n var workItems = async.run.workQueue_;\n async.run.workQueue_ = [];\n for (var i = 0; i < workItems.length; i++) {\n var workItem = workItems[i];\n try {\n workItem.fn.call(workItem.scope);\n } catch (e) {\n async.throwException(e);\n }\n }\n }\n\n // There are no more work items, reset the work queue.\n async.run.workQueueScheduled_ = false;\n};\n\n\n/**\n * @constructor\n * @final\n * @struct\n * @private\n *\n * @param {function()} fn\n * @param {Object|null|undefined} scope\n */\nasync.run.WorkItem_ = function(fn, scope) {\n /** @const */\n this.fn = fn;\n /** @const */\n this.scope = scope;\n};\n\n\n/**\n * Fires the provided callbacks as soon as possible after the current JS\n * execution context. setTimeout(…, 0) always takes at least 5ms for legacy\n * reasons.\n * @param {function(this:SCOPE)} callback Callback function to fire as soon as\n * possible.\n * @param {SCOPE=} opt_context Object in whose scope to call the listener.\n * @template SCOPE\n */\nasync.nextTick = function(callback, opt_context) {\n var cb = callback;\n if (opt_context) {\n cb = callback.bind(opt_context);\n }\n cb = async.nextTick.wrapCallback_(cb);\n // Introduced and currently only supported by IE10.\n if (core.isFunction(window.setImmediate)) {\n window.setImmediate(cb);\n return;\n }\n // Look for and cache the custom fallback version of setImmediate.\n if (!async.nextTick.setImmediate_) {\n async.nextTick.setImmediate_ = async.nextTick.getSetImmediateEmulator_();\n }\n async.nextTick.setImmediate_(cb);\n};\n\n\n/**\n * Cache for the setImmediate implementation.\n * @type {function(function())}\n * @private\n */\nasync.nextTick.setImmediate_ = null;\n\n\n/**\n * Determines the best possible implementation to run a function as soon as\n * the JS event loop is idle.\n * @return {function(function())} The \"setImmediate\" implementation.\n * @private\n */\nasync.nextTick.getSetImmediateEmulator_ = function() {\n // Create a private message channel and use it to postMessage empty messages\n // to ourselves.\n var Channel = window.MessageChannel;\n // If MessageChannel is not available and we are in a browser, implement\n // an iframe based polyfill in browsers that have postMessage and\n // document.addEventListener. The latter excludes IE8 because it has a\n // synchronous postMessage implementation.\n if (typeof Channel === 'undefined' && typeof window !== 'undefined' &&\n window.postMessage && window.addEventListener) {\n /** @constructor */\n Channel = function() {\n // Make an empty, invisible iframe.\n var iframe = document.createElement('iframe');\n iframe.style.display = 'none';\n iframe.src = '';\n document.documentElement.appendChild(iframe);\n var win = iframe.contentWindow;\n var doc = win.document;\n doc.open();\n doc.write('');\n doc.close();\n var message = 'callImmediate' + Math.random();\n var origin = win.location.protocol + '//' + win.location.host;\n var onmessage = function(e) {\n // Validate origin and message to make sure that this message was\n // intended for us.\n if (e.origin !== origin && e.data !== message) {\n return;\n }\n this.port1.onmessage();\n }.bind(this);\n win.addEventListener('message', onmessage, false);\n this.port1 = {};\n this.port2 = {\n postMessage: function() {\n win.postMessage(message, origin);\n }\n };\n };\n }\n if (typeof Channel !== 'undefined') {\n var channel = new Channel();\n // Use a fifo linked list to call callbacks in the right order.\n var head = {};\n var tail = head;\n channel.port1.onmessage = function() {\n head = head.next;\n var cb = head.cb;\n head.cb = null;\n cb();\n };\n return function(cb) {\n tail.next = {\n cb: cb\n };\n tail = tail.next;\n channel.port2.postMessage(0);\n };\n }\n // Implementation for IE6-8: Script elements fire an asynchronous\n // onreadystatechange event when inserted into the DOM.\n if (typeof document !== 'undefined' && 'onreadystatechange' in\n document.createElement('script')) {\n return function(cb) {\n var script = document.createElement('script');\n script.onreadystatechange = function() {\n // Clean up and call the callback.\n script.onreadystatechange = null;\n script.parentNode.removeChild(script);\n script = null;\n cb();\n cb = null;\n };\n document.documentElement.appendChild(script);\n };\n }\n // Fall back to setTimeout with 0. In browsers this creates a delay of 5ms\n // or more.\n return function(cb) {\n setTimeout(cb, 0);\n };\n};\n\n\n/**\n * Helper function that is overrided to protect callbacks with entry point\n * monitor if the application monitors entry points.\n * @param {function()} callback Callback function to fire as soon as possible.\n * @return {function()} The wrapped callback.\n * @private\n */\nasync.nextTick.wrapCallback_ = function(opt_returnValue) {\n return opt_returnValue;\n};\n\n\n/**\n * Promises provide a result that may be resolved asynchronously. A Promise may\n * be resolved by being fulfilled or rejected with a value, which will be known\n * as the fulfillment value or the rejection reason. Whether fulfilled or\n * rejected, the Promise result is immutable once it is set.\n *\n * Promises may represent results of any type, including undefined. Rejection\n * reasons are typically Errors, but may also be of any type. Closure Promises\n * allow for optional type annotations that enforce that fulfillment values are\n * of the appropriate types at compile time.\n *\n * The result of a Promise is accessible by calling {@code then} and registering\n * {@code onFulfilled} and {@code onRejected} callbacks. Once the Promise\n * resolves, the relevant callbacks are invoked with the fulfillment value or\n * rejection reason as argument. Callbacks are always invoked in the order they\n * were registered, even when additional {@code then} calls are made from inside\n * another callback. A callback is always run asynchronously sometime after the\n * scope containing the registering {@code then} invocation has returned.\n *\n * If a Promise is resolved with another Promise, the first Promise will block\n * until the second is resolved, and then assumes the same result as the second\n * Promise. This allows Promises to depend on the results of other Promises,\n * linking together multiple asynchronous operations.\n *\n * This implementation is compatible with the Promises/A+ specification and\n * passes that specification's conformance test suite. A Closure Promise may be\n * resolved with a Promise instance (or sufficiently compatible Promise-like\n * object) created by other Promise implementations. From the specification,\n * Promise-like objects are known as \"Thenables\".\n *\n * @see http://promisesaplus.com/\n *\n * @param {function(\n * this:RESOLVER_CONTEXT,\n * function((TYPE|IThenable.|Thenable)),\n * function(*)): void} resolver\n * Initialization function that is invoked immediately with {@code resolve}\n * and {@code reject} functions as arguments. The Promise is resolved or\n * rejected with the first argument passed to either function.\n * @param {RESOLVER_CONTEXT=} opt_context An optional context for executing the\n * resolver function. If unspecified, the resolver function will be executed\n * in the default scope.\n * @constructor\n * @struct\n * @final\n * @implements {Thenable.}\n * @template TYPE,RESOLVER_CONTEXT\n */\nvar CancellablePromise = function(resolver, opt_context) {\n /**\n * The internal state of this Promise. Either PENDING, FULFILLED, REJECTED, or\n * BLOCKED.\n * @private {CancellablePromise.State_}\n */\n this.state_ = CancellablePromise.State_.PENDING;\n\n /**\n * The resolved result of the Promise. Immutable once set with either a\n * fulfillment value or rejection reason.\n * @private {*}\n */\n this.result_ = undefined;\n\n /**\n * For Promises created by calling {@code then()}, the originating parent.\n * @private {CancellablePromise}\n */\n this.parent_ = null;\n\n /**\n * The list of {@code onFulfilled} and {@code onRejected} callbacks added to\n * this Promise by calls to {@code then()}.\n * @private {Array.}\n */\n this.callbackEntries_ = null;\n\n /**\n * Whether the Promise is in the queue of Promises to execute.\n * @private {boolean}\n */\n this.executing_ = false;\n\n if (CancellablePromise.UNHANDLED_REJECTION_DELAY > 0) {\n /**\n * A timeout ID used when the {@code UNHANDLED_REJECTION_DELAY} is greater\n * than 0 milliseconds. The ID is set when the Promise is rejected, and\n * cleared only if an {@code onRejected} callback is invoked for the\n * Promise (or one of its descendants) before the delay is exceeded.\n *\n * If the rejection is not handled before the timeout completes, the\n * rejection reason is passed to the unhandled rejection handler.\n * @private {number}\n */\n this.unhandledRejectionId_ = 0;\n } else if (CancellablePromise.UNHANDLED_REJECTION_DELAY === 0) {\n /**\n * When the {@code UNHANDLED_REJECTION_DELAY} is set to 0 milliseconds, a\n * boolean that is set if the Promise is rejected, and reset to false if an\n * {@code onRejected} callback is invoked for the Promise (or one of its\n * descendants). If the rejection is not handled before the next timestep,\n * the rejection reason is passed to the unhandled rejection handler.\n * @private {boolean}\n */\n this.hadUnhandledRejection_ = false;\n }\n\n try {\n var self = this;\n resolver.call(\n opt_context, function(value) {\n self.resolve_(CancellablePromise.State_.FULFILLED, value);\n }, function(reason) {\n self.resolve_(CancellablePromise.State_.REJECTED, reason);\n });\n } catch (e) {\n this.resolve_(CancellablePromise.State_.REJECTED, e);\n }\n};\n\n/**\n * @define {number} The delay in milliseconds before a rejected Promise's reason\n * is passed to the rejection handler. By default, the rejection handler\n * rethrows the rejection reason so that it appears in the developer console or\n * {@code window.onerror} handler.\n *\n * Rejections are rethrown as quickly as possible by default. A negative value\n * disables rejection handling entirely.\n */\nCancellablePromise.UNHANDLED_REJECTION_DELAY = 0;\n\n\n/**\n * The possible internal states for a Promise. These states are not directly\n * observable to external callers.\n * @enum {number}\n * @private\n */\nCancellablePromise.State_ = {\n /** The Promise is waiting for resolution. */\n PENDING: 0,\n\n /** The Promise is blocked waiting for the result of another Thenable. */\n BLOCKED: 1,\n\n /** The Promise has been resolved with a fulfillment value. */\n FULFILLED: 2,\n\n /** The Promise has been resolved with a rejection reason. */\n REJECTED: 3\n};\n\n\n/**\n * Typedef for entries in the callback chain. Each call to {@code then},\n * {@code thenCatch}, or {@code thenAlways} creates an entry containing the\n * functions that may be invoked once the Promise is resolved.\n *\n * @typedef {{\n * child: CancellablePromise,\n * onFulfilled: function(*),\n * onRejected: function(*)\n * }}\n * @private\n */\nCancellablePromise.CallbackEntry_ = null;\n\n\n/**\n * @param {(TYPE|Thenable.|Thenable)=} opt_value\n * @return {!CancellablePromise.} A new Promise that is immediately resolved\n * with the given value.\n * @template TYPE\n */\nCancellablePromise.resolve = function(opt_value) {\n return new CancellablePromise(function(resolve) {\n resolve(opt_value);\n });\n};\n\n\n/**\n * @param {*=} opt_reason\n * @return {!CancellablePromise} A new Promise that is immediately rejected with the\n * given reason.\n */\nCancellablePromise.reject = function(opt_reason) {\n return new CancellablePromise(function(resolve, reject) {\n reject(opt_reason);\n });\n};\n\n\n/**\n * @param {!Array.|Thenable)>} promises\n * @return {!CancellablePromise.} A Promise that receives the result of the\n * first Promise (or Promise-like) input to complete.\n * @template TYPE\n */\nCancellablePromise.race = function(promises) {\n return new CancellablePromise(function(resolve, reject) {\n if (!promises.length) {\n resolve(undefined);\n }\n for (var i = 0, promise; (promise = promises[i]); i++) {\n promise.then(resolve, reject);\n }\n });\n};\n\n\n/**\n * @param {!Array.|Thenable)>} promises\n * @return {!CancellablePromise.>} A Promise that receives a list of\n * every fulfilled value once every input Promise (or Promise-like) is\n * successfully fulfilled, or is rejected by the first rejection result.\n * @template TYPE\n */\nCancellablePromise.all = function(promises) {\n return new CancellablePromise(function(resolve, reject) {\n var toFulfill = promises.length;\n var values = [];\n\n if (!toFulfill) {\n resolve(values);\n return;\n }\n\n var onFulfill = function(index, value) {\n toFulfill--;\n values[index] = value;\n if (toFulfill === 0) {\n resolve(values);\n }\n };\n\n var onReject = function(reason) {\n reject(reason);\n };\n\n for (var i = 0, promise; (promise = promises[i]); i++) {\n promise.then(partial(onFulfill, i), onReject);\n }\n });\n};\n\n\n/**\n * @param {!Array.|Thenable)>} promises\n * @return {!CancellablePromise.} A Promise that receives the value of\n * the first input to be fulfilled, or is rejected with a list of every\n * rejection reason if all inputs are rejected.\n * @template TYPE\n */\nCancellablePromise.firstFulfilled = function(promises) {\n return new CancellablePromise(function(resolve, reject) {\n var toReject = promises.length;\n var reasons = [];\n\n if (!toReject) {\n resolve(undefined);\n return;\n }\n\n var onFulfill = function(value) {\n resolve(value);\n };\n\n var onReject = function(index, reason) {\n toReject--;\n reasons[index] = reason;\n if (toReject === 0) {\n reject(reasons);\n }\n };\n\n for (var i = 0, promise; (promise = promises[i]); i++) {\n promise.then(onFulfill, partial(onReject, i));\n }\n });\n};\n\n\n/**\n * Adds callbacks that will operate on the result of the Promise, returning a\n * new child Promise.\n *\n * If the Promise is fulfilled, the {@code onFulfilled} callback will be invoked\n * with the fulfillment value as argument, and the child Promise will be\n * fulfilled with the return value of the callback. If the callback throws an\n * exception, the child Promise will be rejected with the thrown value instead.\n *\n * If the Promise is rejected, the {@code onRejected} callback will be invoked\n * with the rejection reason as argument, and the child Promise will be rejected\n * with the return value (or thrown value) of the callback.\n *\n * @override\n */\nCancellablePromise.prototype.then = function(opt_onFulfilled, opt_onRejected, opt_context) {\n return this.addChildPromise_(\n core.isFunction(opt_onFulfilled) ? opt_onFulfilled : null,\n core.isFunction(opt_onRejected) ? opt_onRejected : null,\n opt_context);\n};\nThenable.addImplementation(CancellablePromise);\n\n\n/**\n * Adds a callback that will be invoked whether the Promise is fulfilled or\n * rejected. The callback receives no argument, and no new child Promise is\n * created. This is useful for ensuring that cleanup takes place after certain\n * asynchronous operations. Callbacks added with {@code thenAlways} will be\n * executed in the same order with other calls to {@code then},\n * {@code thenAlways}, or {@code thenCatch}.\n *\n * Since it does not produce a new child Promise, cancellation propagation is\n * not prevented by adding callbacks with {@code thenAlways}. A Promise that has\n * a cleanup handler added with {@code thenAlways} will be canceled if all of\n * its children created by {@code then} (or {@code thenCatch}) are canceled.\n *\n * @param {function(this:THIS): void} onResolved A function that will be invoked\n * when the Promise is resolved.\n * @param {THIS=} opt_context An optional context object that will be the\n * execution context for the callbacks. By default, functions are executed\n * in the global scope.\n * @return {!CancellablePromise.} This Promise, for chaining additional calls.\n * @template THIS\n */\nCancellablePromise.prototype.thenAlways = function(onResolved, opt_context) {\n var callback = function() {\n try {\n // Ensure that no arguments are passed to onResolved.\n onResolved.call(opt_context);\n } catch (err) {\n CancellablePromise.handleRejection_.call(null, err);\n }\n };\n\n this.addCallbackEntry_({\n child: null,\n onRejected: callback,\n onFulfilled: callback\n });\n return this;\n};\n\n\n/**\n * Adds a callback that will be invoked only if the Promise is rejected. This\n * is equivalent to {@code then(null, onRejected)}.\n *\n * @param {!function(this:THIS, *): *} onRejected A function that will be\n * invoked with the rejection reason if the Promise is rejected.\n * @param {THIS=} opt_context An optional context object that will be the\n * execution context for the callbacks. By default, functions are executed\n * in the global scope.\n * @return {!CancellablePromise} A new Promise that will receive the result of the\n * callback.\n * @template THIS\n */\nCancellablePromise.prototype.thenCatch = function(onRejected, opt_context) {\n return this.addChildPromise_(null, onRejected, opt_context);\n};\n\n/**\n * Alias of {@link CancellablePromise.prototype.thenCatch}\n */\nCancellablePromise.prototype.catch = CancellablePromise.prototype.thenCatch;\n\n\n/**\n * Cancels the Promise if it is still pending by rejecting it with a cancel\n * Error. No action is performed if the Promise is already resolved.\n *\n * All child Promises of the canceled Promise will be rejected with the same\n * cancel error, as with normal Promise rejection. If the Promise to be canceled\n * is the only child of a pending Promise, the parent Promise will also be\n * canceled. Cancellation may propagate upward through multiple generations.\n *\n * @param {string=} opt_message An optional debugging message for describing the\n * cancellation reason.\n */\nCancellablePromise.prototype.cancel = function(opt_message) {\n if (this.state_ === CancellablePromise.State_.PENDING) {\n async.run(function() {\n var err = new CancellablePromise.CancellationError(opt_message);\n this.cancelInternal_(err);\n }, this);\n }\n};\n\n\n/**\n * Cancels this Promise with the given error.\n *\n * @param {!Error} err The cancellation error.\n * @private\n */\nCancellablePromise.prototype.cancelInternal_ = function(err) {\n if (this.state_ === CancellablePromise.State_.PENDING) {\n if (this.parent_) {\n // Cancel the Promise and remove it from the parent's child list.\n this.parent_.cancelChild_(this, err);\n } else {\n this.resolve_(CancellablePromise.State_.REJECTED, err);\n }\n }\n};\n\n\n/**\n * Cancels a child Promise from the list of callback entries. If the Promise has\n * not already been resolved, reject it with a cancel error. If there are no\n * other children in the list of callback entries, propagate the cancellation\n * by canceling this Promise as well.\n *\n * @param {!CancellablePromise} childPromise The Promise to cancel.\n * @param {!Error} err The cancel error to use for rejecting the Promise.\n * @private\n */\nCancellablePromise.prototype.cancelChild_ = function(childPromise, err) {\n if (!this.callbackEntries_) {\n return;\n }\n var childCount = 0;\n var childIndex = -1;\n\n // Find the callback entry for the childPromise, and count whether there are\n // additional child Promises.\n for (var i = 0, entry; (entry = this.callbackEntries_[i]); i++) {\n var child = entry.child;\n if (child) {\n childCount++;\n if (child === childPromise) {\n childIndex = i;\n }\n if (childIndex >= 0 && childCount > 1) {\n break;\n }\n }\n }\n\n // If the child Promise was the only child, cancel this Promise as well.\n // Otherwise, reject only the child Promise with the cancel error.\n if (childIndex >= 0) {\n if (this.state_ === CancellablePromise.State_.PENDING && childCount === 1) {\n this.cancelInternal_(err);\n } else {\n var callbackEntry = this.callbackEntries_.splice(childIndex, 1)[0];\n this.executeCallback_(\n callbackEntry, CancellablePromise.State_.REJECTED, err);\n }\n }\n};\n\n\n/**\n * Adds a callback entry to the current Promise, and schedules callback\n * execution if the Promise has already been resolved.\n *\n * @param {CancellablePromise.CallbackEntry_} callbackEntry Record containing\n * {@code onFulfilled} and {@code onRejected} callbacks to execute after\n * the Promise is resolved.\n * @private\n */\nCancellablePromise.prototype.addCallbackEntry_ = function(callbackEntry) {\n if ((!this.callbackEntries_ || !this.callbackEntries_.length) &&\n (this.state_ === CancellablePromise.State_.FULFILLED ||\n this.state_ === CancellablePromise.State_.REJECTED)) {\n this.scheduleCallbacks_();\n }\n if (!this.callbackEntries_) {\n this.callbackEntries_ = [];\n }\n this.callbackEntries_.push(callbackEntry);\n};\n\n\n/**\n * Creates a child Promise and adds it to the callback entry list. The result of\n * the child Promise is determined by the state of the parent Promise and the\n * result of the {@code onFulfilled} or {@code onRejected} callbacks as\n * specified in the Promise resolution procedure.\n *\n * @see http://promisesaplus.com/#the__method\n *\n * @param {?function(this:THIS, TYPE):\n * (RESULT|CancellablePromise.|Thenable)} onFulfilled A callback that\n * will be invoked if the Promise is fullfilled, or null.\n * @param {?function(this:THIS, *): *} onRejected A callback that will be\n * invoked if the Promise is rejected, or null.\n * @param {THIS=} opt_context An optional execution context for the callbacks.\n * in the default calling context.\n * @return {!CancellablePromise} The child Promise.\n * @template RESULT,THIS\n * @private\n */\nCancellablePromise.prototype.addChildPromise_ = function(\nonFulfilled, onRejected, opt_context) {\n\n var callbackEntry = {\n child: null,\n onFulfilled: null,\n onRejected: null\n };\n\n callbackEntry.child = new CancellablePromise(function(resolve, reject) {\n // Invoke onFulfilled, or resolve with the parent's value if absent.\n callbackEntry.onFulfilled = onFulfilled ? function(value) {\n try {\n var result = onFulfilled.call(opt_context, value);\n resolve(result);\n } catch (err) {\n reject(err);\n }\n } : resolve;\n\n // Invoke onRejected, or reject with the parent's reason if absent.\n callbackEntry.onRejected = onRejected ? function(reason) {\n try {\n var result = onRejected.call(opt_context, reason);\n if (!core.isDef(result) &&\n reason instanceof CancellablePromise.CancellationError) {\n // Propagate cancellation to children if no other result is returned.\n reject(reason);\n } else {\n resolve(result);\n }\n } catch (err) {\n reject(err);\n }\n } : reject;\n });\n\n callbackEntry.child.parent_ = this;\n this.addCallbackEntry_(\n /** @type {CancellablePromise.CallbackEntry_} */ (callbackEntry));\n return callbackEntry.child;\n};\n\n\n/**\n * Unblocks the Promise and fulfills it with the given value.\n *\n * @param {TYPE} value\n * @private\n */\nCancellablePromise.prototype.unblockAndFulfill_ = function(value) {\n if (this.state_ !== CancellablePromise.State_.BLOCKED) {\n throw new Error('CancellablePromise is not blocked.');\n }\n this.state_ = CancellablePromise.State_.PENDING;\n this.resolve_(CancellablePromise.State_.FULFILLED, value);\n};\n\n\n/**\n * Unblocks the Promise and rejects it with the given rejection reason.\n *\n * @param {*} reason\n * @private\n */\nCancellablePromise.prototype.unblockAndReject_ = function(reason) {\n if (this.state_ !== CancellablePromise.State_.BLOCKED) {\n throw new Error('CancellablePromise is not blocked.');\n }\n this.state_ = CancellablePromise.State_.PENDING;\n this.resolve_(CancellablePromise.State_.REJECTED, reason);\n};\n\n\n/**\n * Attempts to resolve a Promise with a given resolution state and value. This\n * is a no-op if the given Promise has already been resolved.\n *\n * If the given result is a Thenable (such as another Promise), the Promise will\n * be resolved with the same state and result as the Thenable once it is itself\n * resolved.\n *\n * If the given result is not a Thenable, the Promise will be fulfilled or\n * rejected with that result based on the given state.\n *\n * @see http://promisesaplus.com/#the_promise_resolution_procedure\n *\n * @param {CancellablePromise.State_} state\n * @param {*} x The result to apply to the Promise.\n * @private\n */\nCancellablePromise.prototype.resolve_ = function(state, x) {\n if (this.state_ !== CancellablePromise.State_.PENDING) {\n return;\n }\n\n if (this === x) {\n state = CancellablePromise.State_.REJECTED;\n x = new TypeError('CancellablePromise cannot resolve to itself');\n\n } else if (Thenable.isImplementedBy(x)) {\n x = /** @type {!Thenable} */ (x);\n this.state_ = CancellablePromise.State_.BLOCKED;\n x.then(this.unblockAndFulfill_, this.unblockAndReject_, this);\n return;\n\n } else if (core.isObject(x)) {\n try {\n var then = x.then;\n if (core.isFunction(then)) {\n this.tryThen_(x, then);\n return;\n }\n } catch (e) {\n state = CancellablePromise.State_.REJECTED;\n x = e;\n }\n }\n\n this.result_ = x;\n this.state_ = state;\n this.scheduleCallbacks_();\n\n if (state === CancellablePromise.State_.REJECTED &&\n !(x instanceof CancellablePromise.CancellationError)) {\n CancellablePromise.addUnhandledRejection_(this, x);\n }\n};\n\n\n/**\n * Attempts to call the {@code then} method on an object in the hopes that it is\n * a Promise-compatible instance. This allows interoperation between different\n * Promise implementations, however a non-compliant object may cause a Promise\n * to hang indefinitely. If the {@code then} method throws an exception, the\n * dependent Promise will be rejected with the thrown value.\n *\n * @see http://promisesaplus.com/#point-70\n *\n * @param {Thenable} thenable An object with a {@code then} method that may be\n * compatible with the Promise/A+ specification.\n * @param {!Function} then The {@code then} method of the Thenable object.\n * @private\n */\nCancellablePromise.prototype.tryThen_ = function(thenable, then) {\n this.state_ = CancellablePromise.State_.BLOCKED;\n var promise = this;\n var called = false;\n\n var resolve = function(value) {\n if (!called) {\n called = true;\n promise.unblockAndFulfill_(value);\n }\n };\n\n var reject = function(reason) {\n if (!called) {\n called = true;\n promise.unblockAndReject_(reason);\n }\n };\n\n try {\n then.call(thenable, resolve, reject);\n } catch (e) {\n reject(e);\n }\n};\n\n\n/**\n * Executes the pending callbacks of a resolved Promise after a timeout.\n *\n * Section 2.2.4 of the Promises/A+ specification requires that Promise\n * callbacks must only be invoked from a call stack that only contains Promise\n * implementation code, which we accomplish by invoking callback execution after\n * a timeout. If {@code startExecution_} is called multiple times for the same\n * Promise, the callback chain will be evaluated only once. Additional callbacks\n * may be added during the evaluation phase, and will be executed in the same\n * event loop.\n *\n * All Promises added to the waiting list during the same browser event loop\n * will be executed in one batch to avoid using a separate timeout per Promise.\n *\n * @private\n */\nCancellablePromise.prototype.scheduleCallbacks_ = function() {\n if (!this.executing_) {\n this.executing_ = true;\n async.run(this.executeCallbacks_, this);\n }\n};\n\n\n/**\n * Executes all pending callbacks for this Promise.\n *\n * @private\n */\nCancellablePromise.prototype.executeCallbacks_ = function() {\n while (this.callbackEntries_ && this.callbackEntries_.length) {\n var entries = this.callbackEntries_;\n this.callbackEntries_ = [];\n\n for (var i = 0; i < entries.length; i++) {\n this.executeCallback_(entries[i], this.state_, this.result_);\n }\n }\n this.executing_ = false;\n};\n\n\n/**\n * Executes a pending callback for this Promise. Invokes an {@code onFulfilled}\n * or {@code onRejected} callback based on the resolved state of the Promise.\n *\n * @param {!CancellablePromise.CallbackEntry_} callbackEntry An entry containing the\n * onFulfilled and/or onRejected callbacks for this step.\n * @param {CancellablePromise.State_} state The resolution status of the Promise,\n * either FULFILLED or REJECTED.\n * @param {*} result The resolved result of the Promise.\n * @private\n */\nCancellablePromise.prototype.executeCallback_ = function(\ncallbackEntry, state, result) {\n if (state === CancellablePromise.State_.FULFILLED) {\n callbackEntry.onFulfilled(result);\n } else {\n this.removeUnhandledRejection_();\n callbackEntry.onRejected(result);\n }\n};\n\n\n/**\n * Marks this rejected Promise as having being handled. Also marks any parent\n * Promises in the rejected state as handled. The rejection handler will no\n * longer be invoked for this Promise (if it has not been called already).\n *\n * @private\n */\nCancellablePromise.prototype.removeUnhandledRejection_ = function() {\n var p;\n if (CancellablePromise.UNHANDLED_REJECTION_DELAY > 0) {\n for (p = this; p && p.unhandledRejectionId_; p = p.parent_) {\n clearTimeout(p.unhandledRejectionId_);\n p.unhandledRejectionId_ = 0;\n }\n } else if (CancellablePromise.UNHANDLED_REJECTION_DELAY === 0) {\n for (p = this; p && p.hadUnhandledRejection_; p = p.parent_) {\n p.hadUnhandledRejection_ = false;\n }\n }\n};\n\n\n/**\n * Marks this rejected Promise as unhandled. If no {@code onRejected} callback\n * is called for this Promise before the {@code UNHANDLED_REJECTION_DELAY}\n * expires, the reason will be passed to the unhandled rejection handler. The\n * handler typically rethrows the rejection reason so that it becomes visible in\n * the developer console.\n *\n * @param {!CancellablePromise} promise The rejected Promise.\n * @param {*} reason The Promise rejection reason.\n * @private\n */\nCancellablePromise.addUnhandledRejection_ = function(promise, reason) {\n if (CancellablePromise.UNHANDLED_REJECTION_DELAY > 0) {\n promise.unhandledRejectionId_ = setTimeout(function() {\n CancellablePromise.handleRejection_.call(null, reason);\n }, CancellablePromise.UNHANDLED_REJECTION_DELAY);\n\n } else if (CancellablePromise.UNHANDLED_REJECTION_DELAY === 0) {\n promise.hadUnhandledRejection_ = true;\n async.run(function() {\n if (promise.hadUnhandledRejection_) {\n CancellablePromise.handleRejection_.call(null, reason);\n }\n });\n }\n};\n\n\n/**\n * A method that is invoked with the rejection reasons for Promises that are\n * rejected but have no {@code onRejected} callbacks registered yet.\n * @type {function(*)}\n * @private\n */\nCancellablePromise.handleRejection_ = async.throwException;\n\n\n/**\n * Sets a handler that will be called with reasons from unhandled rejected\n * Promises. If the rejected Promise (or one of its descendants) has an\n * {@code onRejected} callback registered, the rejection will be considered\n * handled, and the rejection handler will not be called.\n *\n * By default, unhandled rejections are rethrown so that the error may be\n * captured by the developer console or a {@code window.onerror} handler.\n *\n * @param {function(*)} handler A function that will be called with reasons from\n * rejected Promises. Defaults to {@code async.throwException}.\n */\nCancellablePromise.setUnhandledRejectionHandler = function(handler) {\n CancellablePromise.handleRejection_ = handler;\n};\n\n\n\n/**\n * Error used as a rejection reason for canceled Promises.\n *\n * @param {string=} opt_message\n * @constructor\n * @extends {Error}\n * @final\n */\nCancellablePromise.CancellationError = class extends Error {\n constructor(opt_message) {\n super(opt_message);\n\n if (opt_message) {\n this.message = opt_message;\n }\n }\n};\n\n/** @override */\nCancellablePromise.CancellationError.prototype.name = 'cancel';\n\nif (typeof window.Promise === 'undefined') {\n window.Promise = CancellablePromise;\n}\n\nexport {CancellablePromise, async};\n","'use strict';\n\nimport core from 'bower:metal/src/core';\nimport { CancellablePromise as Promise } from 'bower:metal-promise/src/promise/Promise';\n\nclass Ajax {\n\n\t/**\n\t * Adds parameters into the url querystring.\n\t * @param {string} url\n\t * @param {MultiMap} opt_params\n\t * @return {string} Url containting parameters as querystring.\n\t * @protected\n\t */\n\tstatic addParametersToUrlQueryString(url, opt_params) {\n\t\tvar querystring = '';\n\t\topt_params.names().forEach(function(name) {\n\t\t\topt_params.getAll(name).forEach(function(value) {\n\t\t\t\tquerystring += name + '=' + encodeURIComponent(value) + '&';\n\t\t\t});\n\t\t});\n\t\tquerystring = querystring.slice(0, -1);\n\t\tif (querystring) {\n\t\t\turl += (url.indexOf('?') > -1) ? '&' : '?';\n\t\t\turl += querystring;\n\t\t}\n\n\t\treturn url;\n\t}\n\n\t/**\n\t * Joins the given paths.\n\t * @param {string} basePath\n\t * @param {...string} ...paths Any number of paths to be joined with the base url.\n\t */\n\tstatic joinPaths(basePath, ...paths) {\n\t\tif (basePath.charAt(basePath.length - 1) === '/') {\n\t\t\tbasePath = basePath.substring(0, basePath.length - 1);\n\t\t}\n\t\tpaths = paths.map(path => path.charAt(0) === '/' ? path.substring(1) : path);\n\t\treturn [basePath].concat(paths).join('/').replace(/\\/$/, '');\n\t}\n\n\t/**\n\t * XmlHttpRequest's getAllResponseHeaders() method returns a string of\n\t * response headers according to the format described on the spec:\n\t * {@link http://www.w3.org/TR/XMLHttpRequest/#the-getallresponseheaders-method}.\n\t * This method parses that string into a user-friendly name/value pair\n\t * object.\n\t * @param {string} allHeaders All headers as string.\n\t * @return {!Array.>}\n\t */\n\tstatic parseResponseHeaders(allHeaders) {\n\t\tvar headers = [];\n\t\tif (!allHeaders) {\n\t\t\treturn headers;\n\t\t}\n\t\tvar pairs = allHeaders.split('\\u000d\\u000a');\n\t\tfor (var i = 0; i < pairs.length; i++) {\n\t\t\tvar index = pairs[i].indexOf('\\u003a\\u0020');\n\t\t\tif (index > 0) {\n\t\t\t\tvar name = pairs[i].substring(0, index);\n\t\t\t\tvar value = pairs[i].substring(index + 2);\n\t\t\t\theaders.push({\n\t\t\t\t\tname: name,\n\t\t\t\t\tvalue: value\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\treturn headers;\n\t}\n\n\t/**\n\t * Parses the url separating the domain and port from the path.\n\t * @param {string} url\n\t * @return {array} Array containing the url domain and path.\n\t * @protected\n\t */\n\tstatic parseUrl(url) {\n\t\tvar base;\n\t\tvar path;\n\t\tvar qs;\n\n\t\tvar domainAt = url.indexOf('//');\n\t\tif (domainAt > -1) {\n\t\t\turl = url.substring(domainAt + 2);\n\t\t}\n\n\t\tvar pathAt = url.indexOf('/');\n\t\tif (pathAt === -1) {\n\t\t\turl += '/';\n\t\t\tpathAt = url.length - 1;\n\t\t}\n\n\t\tbase = url.substring(0, pathAt);\n\t\tpath = url.substring(pathAt);\n\n\t\tvar qsAt = path.indexOf('?');\n\t\tif (qsAt > -1) {\n\t\t\tqs = path.substring(qsAt, path.length);\n\t\t\tpath = path.substring(0, qsAt);\n\t\t} else {\n\t\t\tqs = '';\n\t\t}\n\n\t\treturn [base, path, qs];\n\t}\n\n\t/**\n\t * Requests the url using XMLHttpRequest.\n\t * @param {!string} url\n\t * @param {!string} method\n\t * @param {?string} body\n\t * @param {MultiMap=} opt_headers\n\t * @param {MultiMap=} opt_params\n\t * @param {number=} opt_timeout\n\t * @param {boolean=} opt_sync\n\t * @return {Promise} Deferred ajax request.\n\t * @protected\n\t */\n\tstatic request(url, method, body, opt_headers, opt_params, opt_timeout, opt_sync) {\n\t\tvar request = new XMLHttpRequest();\n\n\t\tvar promise = new Promise(function(resolve, reject) {\n\t\t\trequest.onload = function() {\n\t\t\t\tif (request.aborted) {\n\t\t\t\t\trequest.onerror();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tresolve(request);\n\t\t\t};\n\t\t\trequest.onerror = function() {\n\t\t\t\tvar error = new Error('Request error');\n\t\t\t\terror.request = request;\n\t\t\t\treject(error);\n\t\t\t};\n\t\t}).thenCatch(function(reason) {\n\t\t\trequest.abort();\n\t\t\tthrow reason;\n\t\t}).thenAlways(function() {\n\t\t\tclearTimeout(timeout);\n\t\t});\n\n\t\tif (opt_params) {\n\t\t\turl = Ajax.addParametersToUrlQueryString(url, opt_params);\n\t\t}\n\n\t\trequest.open(method, url, !opt_sync);\n\n\t\tif (opt_headers) {\n\t\t\topt_headers.names().forEach(function(name) {\n\t\t\t\trequest.setRequestHeader(name, opt_headers.getAll(name).join(', '));\n\t\t\t});\n\t\t}\n\n\t\trequest.send(core.isDef(body) ? body : null);\n\n\t\tif (core.isDefAndNotNull(opt_timeout)) {\n\t\t\tvar timeout = setTimeout(function() {\n\t\t\t\tpromise.cancel('Request timeout');\n\t\t\t}, opt_timeout);\n\t\t}\n\n\t\treturn promise;\n\t}\n\n}\n\nexport default Ajax;","'use strict';\n\n/**\n * Disposable utility. When inherited provides the `dispose` function to its\n * subclass, which is responsible for disposing of any object references\n * when an instance won't be used anymore. Subclasses should override\n * `disposeInternal` to implement any specific disposing logic.\n * @constructor\n */\nclass Disposable {\n\tconstructor() {\n\t\t/**\n\t\t * Flag indicating if this instance has already been disposed.\n\t\t * @type {boolean}\n\t\t * @protected\n\t\t */\n\t\tthis.disposed_ = false;\n\t}\n\n\t/**\n\t * Disposes of this instance's object references. Calls `disposeInternal`.\n\t */\n\tdispose() {\n\t\tif (!this.disposed_) {\n\t\t\tthis.disposeInternal();\n\t\t\tthis.disposed_ = true;\n\t\t}\n\t}\n\n\t/**\n\t * Subclasses should override this method to implement any specific\n\t * disposing logic (like clearing references and calling `dispose` on other\n\t * disposables).\n\t */\n\tdisposeInternal() {}\n\n\t/**\n\t * Checks if this instance has already been disposed.\n\t * @return {boolean}\n\t */\n\tisDisposed() {\n\t\treturn this.disposed_;\n\t}\n}\n\nexport default Disposable;\n","'use strict';\n\nimport Disposable from 'bower:metal/src/disposable/Disposable';\n\n/**\n * Case insensitive string Multimap implementation. Allows multiple values for\n * the same key name.\n * @extends {Disposable}\n */\nclass MultiMap extends Disposable {\n\tconstructor() {\n\t\tsuper();\n\t\tthis.keys = {};\n\t\tthis.values = {};\n\t}\n\n\t/**\n\t * Adds value to a key name.\n\t * @param {string} name\n\t * @param {*} value\n\t * @chainable\n\t */\n\tadd(name, value) {\n\t\tthis.keys[name.toLowerCase()] = name;\n\t\tthis.values[name.toLowerCase()] = this.values[name.toLowerCase()] || [];\n\t\tthis.values[name.toLowerCase()].push(value);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Clears map names and values.\n\t * @chainable\n\t */\n\tclear() {\n\t\tthis.keys = {};\n\t\tthis.values = {};\n\t\treturn this;\n\t}\n\n\t/**\n\t * Checks if map contains a value to the key name.\n\t * @param {string} name\n\t * @return {boolean}\n\t * @chainable\n\t */\n\tcontains(name) {\n\t\treturn name.toLowerCase() in this.values;\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\tdisposeInternal() {\n\t\tthis.values = null;\n\t}\n\n\t/**\n\t * Gets the first added value from a key name.\n\t * @param {string} name\n\t * @return {*}\n\t * @chainable\n\t */\n\tget(name) {\n\t\tvar values = this.values[name.toLowerCase()];\n\t\tif (values) {\n\t\t\treturn values[0];\n\t\t}\n\t}\n\n\t/**\n\t * Gets all values from a key name.\n\t * @param {string} name\n\t * @return {Array.<*>}\n\t */\n\tgetAll(name) {\n\t\treturn this.values[name.toLowerCase()];\n\t}\n\n\t/**\n\t * Returns true if the map is empty, false otherwise.\n\t * @return {boolean}\n\t */\n\tisEmpty() {\n\t\treturn this.size() === 0;\n\t}\n\n\t/**\n\t * Gets array of key names.\n\t * @return {Array.}\n\t */\n\tnames() {\n\t\treturn Object.keys(this.values).map((key) => this.keys[key]);\n\t}\n\n\t/**\n\t * Removes all values from a key name.\n\t * @param {string} name\n\t * @chainable\n\t */\n\tremove(name) {\n\t\tdelete this.keys[name.toLowerCase()];\n\t\tdelete this.values[name.toLowerCase()];\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the value of a key name. Relevant to replace the current values with\n\t * a new one.\n\t * @param {string} name\n\t * @param {*} value\n\t * @chainable\n\t */\n\tset(name, value) {\n\t\tthis.keys[name.toLowerCase()] = name;\n\t\tthis.values[name.toLowerCase()] = [value];\n\t\treturn this;\n\t}\n\n\t/**\n\t * Gets the size of the map key names.\n\t * @return {number}\n\t */\n\tsize() {\n\t\treturn this.names().length;\n\t}\n\n\t/**\n\t * Returns the parsed values as a string.\n\t * @return {string}\n\t */\n\ttoString() {\n\t\treturn JSON.stringify(this.values);\n\t}\n}\n\nexport default MultiMap;\n","'use strict';\n\nimport core from 'bower:metal/src/core';\nimport MultiMap from 'bower:metal-multimap/src/MultiMap';\n\n/**\n * Represents a client message (e.g. a request or a response).\n */\nclass ClientMessage {\n\tconstructor() {\n\t\tthis.headers_ = new MultiMap();\n\t}\n\n\t/**\n\t * Fluent getter and setter for request body.\n\t * @param {*=} opt_body Request body to be set. If none is given,\n\t * the current value of the body will be returned.\n\t * @return {*} Returns request body if no body value was given. Otherwise\n\t * returns the {@link ClientMessage} object itself, so calls can be chained.\n\t * @chainable Chainable when used as setter.\n\t */\n\tbody(opt_body) {\n\t\tif (core.isDef(opt_body)) {\n\t\t\tthis.body_ = opt_body;\n\t\t\treturn this;\n\t\t}\n\t\treturn this.body_;\n\t}\n\n\t/**\n\t * Adds a header. If a header with the same name already exists, it will not be\n\t * overwritten, but the new value will be stored as well. The order is preserved.\n\t * @param {string} name\n\t * @param {string} value\n\t * @chainable\n\t */\n\theader(name, value) {\n\t\tif (arguments.length !== 2) {\n\t\t\tthrow new Error('Invalid arguments');\n\t\t}\n\t\tthis.headers_.set(name, value);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Fluent getter and setter for request headers.\n\t * @param {MultiMap|Object=} opt_headers Request headers list to\n\t * be set. If none is given the current value of the headers will\n\t * be returned.\n\t * @return {!MultiMap|ClientMessage} Returns map of request headers\n\t * if no new value was given. Otherwise returns the {@link ClientMessage}\n\t * object itself, so calls can be chained.\n\t * @chainable Chainable when used as setter.\n\t */\n\theaders(opt_headers) {\n\t\tif (core.isDef(opt_headers)) {\n\t\t\tif (opt_headers instanceof MultiMap) {\n\t\t\t\tthis.headers_ = opt_headers;\n\t\t\t} else {\n\t\t\t\tthis.headers_.values = opt_headers;\n\t\t\t}\n\t\t\treturn opt_headers;\n\t\t}\n\t\treturn this.headers_;\n\t}\n\n\t/**\n\t * Removes the body.\n\t */\n\tremoveBody() {\n\t\tthis.body_ = undefined;\n\t}\n}\n\nexport default ClientMessage;\n","'use strict';\n\nimport core from 'bower:metal/src/core';\nimport ClientMessage from './ClientMessage';\n\n/**\n * Represents a client response object.\n * @extends {ClientMessage}\n */\nclass ClientResponse extends ClientMessage {\n\tconstructor(clientRequest) {\n\t\tsuper();\n\t\tif (!clientRequest) {\n\t\t\tthrow new Error('Can\\'t create response without request');\n\t\t}\n\t\tthis.clientRequest_ = clientRequest;\n\t}\n\n\t/**\n\t * Returns request that created this response.\n\t * @return {!ClientRequest}\n\t */\n\trequest() {\n\t\treturn this.clientRequest_;\n\t}\n\n\t/**\n\t * Fluent getter and setter for response status code.\n\t * @param {number=} opt_statusCode Request status code to be set. If none is given,\n\t * the current status code value will be returned.\n\t * @return {!ClientMessage|number} Returns response status code if no new value was\n\t * given. Otherwise returns the {@link ClientMessage} object itself, so calls can\n\t * be chained.\n\t * @chainable Chainable when used as setter.\n\t */\n\tstatusCode(opt_statusCode) {\n\t\tif (core.isDef(opt_statusCode)) {\n\t\t\tthis.statusCode_ = opt_statusCode;\n\t\t\treturn this;\n\t\t}\n\t\treturn this.statusCode_;\n\t}\n\n\t/**\n\t * Fluent getter and setter for response status text.\n\t * @param {string=} opt_statusText Request status text to be set. If none is given,\n\t * the current status text value will be returned.\n\t * @return {!ClientMessage|number} Returns response status text if no new value was\n\t * given. Otherwise returns the {@link ClientMessage} object itself, so calls can\n\t * be chained.\n\t * @chainable Chainable when used as setter.\n\t */\n\tstatusText(opt_statusText) {\n\t\tif (core.isDef(opt_statusText)) {\n\t\t\tthis.statusText_ = opt_statusText;\n\t\t\treturn this;\n\t\t}\n\t\treturn this.statusText_;\n\t}\n\n\t/**\n\t * Checks if response succeeded. Any status code 2xx or 3xx is considered valid.\n\t * @return {boolean}\n\t */\n\tsucceeded() {\n\t\treturn this.statusCode() >= 200 && this.statusCode() <= 399;\n\t}\n\n}\n\nexport default ClientResponse;\n","'use strict';\n\nimport core from 'bower:metal/src/core';\nimport Transport from './Transport';\nimport Ajax from 'bower:metal-ajax/src/Ajax';\nimport ClientResponse from './ClientResponse';\nimport { CancellablePromise as Promise } from 'bower:metal-promise/src/promise/Promise';\n\n/**\n * The implementation of an ajax transport to be used with {@link Launchpad}.\n * @extends {Transport}\n */\nclass AjaxTransport extends Transport {\n\t/**\n\t * @inheritDoc\n\t */\n\tsend(clientRequest) {\n\t\tvar deferred = Ajax.request(\n\t\t\tclientRequest.url(), clientRequest.method(), clientRequest.body(),\n\t\t\tclientRequest.headers(), clientRequest.params(), null, false);\n\n\t\treturn deferred.then(function(response) {\n\t\t\tvar clientResponse = new ClientResponse(clientRequest);\n\t\t\tclientResponse.body(response.responseText);\n\t\t\tclientResponse.statusCode(response.status);\n\t\t\tclientResponse.statusText(response.statusText);\n\t\t\tAjax.parseResponseHeaders(response.getAllResponseHeaders()).forEach(function(header) {\n\t\t\t\tclientResponse.header(header.name, header.value);\n\t\t\t});\n\t\t\treturn clientResponse;\n\t\t});\n\t}\n\n}\n\nexport default AjaxTransport;\n","'use strict';\n\nimport core from 'bower:metal/src/core';\n\n/**\n * Class responsible for storing authorization information.\n */\nclass Auth {\n\t/**\n\t * Constructs an {@link Auth} instance.\n\t * @param {string} tokenOrUsername Either the authorization token, or\n\t * the username.\n\t * @param {string=} opt_password If a username is given as the first param,\n\t * this should be the password.\n\t * @constructor\n\t */\n\tconstructor(tokenOrUsername, opt_password = null) {\n\t\tthis.token_ = core.isString(opt_password) ? null : tokenOrUsername;\n\t\tthis.username_ = core.isString(opt_password) ? tokenOrUsername : null;\n\t\tthis.password_ = opt_password;\n\t}\n\n\t/**\n\t * Constructs an {@link Auth} instance.\n\t * @param {string} tokenOrUsername Either the authorization token, or\n\t * the username.\n\t * @param {string=} opt_password If a username is given as the first param,\n\t * this should be the password.\n\t * @return {!Auth}\n\t */\n\tstatic create(tokenOrUsername, opt_password) {\n\t\treturn new Auth(tokenOrUsername, opt_password);\n\t}\n\n\t/**\n\t * Checks if the password is set.\n\t * @return {boolean}\n\t */\n\thasPassword() {\n\t\treturn this.password_ !== null;\n\t}\n\n\t/**\n\t * Checks if the token is set.\n\t * @return {boolean}\n\t */\n\thasToken() {\n\t\treturn this.token_ !== null;\n\t}\n\n\t/**\n\t * Checks if the username is set.\n\t * @return {boolean}\n\t */\n\thasUsername() {\n\t\treturn this.username_ !== null;\n\t}\n\n\t/**\n\t * Returns the password.\n\t * @return {string}\n\t */\n\tpassword() {\n\t\treturn this.password_;\n\t}\n\n\t/**\n\t * Returns the token.\n\t * @return {string}\n\t */\n\ttoken() {\n\t\treturn this.token_;\n\t}\n\n\t/**\n\t * Returns the username.\n\t * @return {string}\n\t */\n\tusername() {\n\t\treturn this.username_;\n\t}\n}\n\nexport default Auth;\n","'use strict';\n\nimport core from 'bower:metal/src/core';\nimport ClientMessage from './ClientMessage';\nimport MultiMap from 'bower:metal-multimap/src/MultiMap';\n\n/**\n * Represents a client request object.\n * @extends {ClientMessage}\n */\nclass ClientRequest extends ClientMessage {\n\tconstructor() {\n\t\tsuper();\n\t\tthis.params_ = new MultiMap();\n\t}\n\n\t/**\n\t * Fluent getter and setter for request method.\n\t * @param {string=} opt_method Request method to be set. If none is given,\n\t * the current method value will be returned.\n\t * @return {!ClientMessage|string} Returns request method if no new value was\n\t * given. Otherwise returns the {@link ClientMessage} object itself, so\n\t * calls can be chained.\n\t * @chainable Chainable when used as setter.\n\t */\n\tmethod(opt_method) {\n\t\tif (core.isDef(opt_method)) {\n\t\t\tthis.method_ = opt_method;\n\t\t\treturn this;\n\t\t}\n\t\treturn this.method_ || ClientRequest.DEFAULT_METHOD;\n\t}\n\n\t/**\n\t * Adds a query. If a query with the same name already exists, it will not\n\t * be overwritten, but new value will be stored as well. The order is preserved.\n\t * @param {string} name\n\t * @param {string} value\n\t * @chainable\n\t */\n\tparam(name, value) {\n\t\tif (arguments.length !== 2) {\n\t\t\tthrow new Error('Invalid arguments');\n\t\t}\n\t\tthis.params_.set(name, value);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Fluent getter and setter for request querystring.\n\t * @param {MultiMap|Object=} opt_params Request querystring map to be set.\n\t * If none is given the current value of the params will be returned.\n\t * @return {!MultiMap|ClientMessage} Returns map of request querystring if\n\t * no new value was given. Otherwise returns the {@link ClientMessage}\n\t * object itself, so calls can be chained.\n\t */\n\tparams(opt_params) {\n\t\tif (core.isDef(opt_params)) {\n\t\t\tif (opt_params instanceof MultiMap) {\n\t\t\t\tthis.params_ = opt_params;\n\t\t\t} else {\n\t\t\t\tthis.params_.values = opt_params;\n\t\t\t}\n\t\t\treturn opt_params;\n\t\t}\n\t\treturn this.params_;\n\t}\n\n\t/**\n\t * Fluent getter and setter for request url.\n\t * @param {string=} opt_url Request url to be set. If none is given,\n\t * the current value of the url will be returned.\n\t * @return {!ClientMessage|string} Returns request url if no new value was given.\n\t * Otherwise returns the {@link ClientMessage} object itself, so calls can be\n\t * chained.\n\t * @chainable Chainable when used as setter.\n\t */\n\turl(opt_url) {\n\t\tif (core.isDef(opt_url)) {\n\t\t\tthis.url_ = opt_url;\n\t\t\treturn this;\n\t\t}\n\t\treturn this.url_;\n\t}\n\n}\n\nClientRequest.DEFAULT_METHOD = 'GET';\n\nexport default ClientRequest;\n","'use strict';\n\n/**\n * Class responsible for storing an object that will be printed as JSON\n * when the `toString` method is called.\n */\nclass Embodied {\n\t/**\n\t * Constructs a Embodied instance.\n\t * @constructor\n\t */\n\tconstructor() {\n\t\tthis.body_ = {};\n\t}\n\n\t/**\n\t * Gets the json object that represents this instance.\n\t * @return {!Object}\n\t */\n\tbody() {\n\t\treturn this.body_;\n\t}\n\n\t/**\n\t * If the given object is an instance of Embodied, this will\n\t * return its body content. Otherwise this will return the\n\t * original object.\n\t * @param {*} obj\n\t * @return {*}\n\t * @static\n\t */\n\tstatic toBody(obj) {\n\t\treturn (obj instanceof Embodied) ? obj.body() : obj;\n\t}\n\n\t/**\n\t * Gets the json string that represents this instance.\n\t * @return {string}\n\t */\n\ttoString() {\n\t\treturn JSON.stringify(this.body());\n\t}\n}\n\nexport default Embodied;\n","'use strict';\n\nimport core from 'bower:metal/src/core';\nimport Embodied from './Embodied';\n\n/**\n * Class responsible for storing and handling the body contents\n * of a Filter instance.\n */\nclass FilterBody {\n\t/**\n\t * Constructs a {@link FilterBody} instance.\n\t * @param {string} field The name of the field to filter by.\n\t * @param {*} operatorOrValue If a third param is given, this should\n\t * be the filter's operator (like \">=\"). Otherwise, this will be\n\t * used as the filter's value, and the filter's operator will be \"=\".\n\t * @param {*=} opt_value The filter's value.\n\t * @constructor\n\t */\n\tconstructor(field, operatorOrValue, opt_value) {\n\t\tvar obj = {\n\t\t\toperator: core.isDef(opt_value) ? operatorOrValue : '='\n\t\t};\n\t\tvar value = core.isDef(opt_value) ? opt_value : operatorOrValue;\n\t\tif (core.isDefAndNotNull(value)) {\n\t\t\tif (value instanceof Embodied) {\n\t\t\t\tvalue = value.body();\n\t\t\t}\n\t\t\tobj.value = value;\n\t\t}\n\t\tthis.createBody_(field, obj);\n\t}\n\n\t/**\n\t * Composes the current filter with the given operator.\n\t * @param {string} operator\n\t * @param {Filter=} opt_filter Another filter to compose this filter with,\n\t * if the operator is not unary.\n\t */\n\tadd(operator, opt_filter) {\n\t\tif (opt_filter) {\n\t\t\tthis.addArrayOperator_(operator, opt_filter);\n\t\t} else {\n\t\t\tthis.createBody_(operator, this.body_);\n\t\t}\n\t}\n\n\t/**\n\t * Composes the current filter with an operator that stores its values in an array.\n\t * @param {string} operator\n\t * @param {!Filter} filter\n\t * @protected\n\t */\n\taddArrayOperator_(operator, filter) {\n\t\tif (!(this.body_[operator] instanceof Array)) {\n\t\t\tthis.createBody_(operator, [this.body_]);\n\t\t}\n\t\tthis.body_[operator].push(filter.body());\n\t}\n\n\t/**\n\t * Adds filters to be composed with this filter body using the given operator.\n\t * @param {string} operator\n\t * @param {...*} filters A variable amount of filters to be composed.\n\t */\n\taddMany(operator, ...filters) {\n\t\tfor (var i = 0; i < filters.length; i++) {\n\t\t\tthis.add(operator, filters[i]);\n\t\t}\n\t}\n\n\t/**\n\t * Creates a new body object, setting the requestd key to the given value.\n\t * @param {string} key The key to set in the new body object\n\t * @param {*} value The value the requested key should have in the new body object.\n\t * @protected\n\t */\n\tcreateBody_(key, value) {\n\t\tthis.body_ = {};\n\t\tthis.body_[key] = value;\n\t}\n\n\t/**\n\t * Gets the json object that represents this filter's body.\n\t * @return {!Object}\n\t */\n\tgetObject() {\n\t\treturn this.body_;\n\t}\n}\n\nexport default FilterBody;\n","'use strict';\n\nimport Embodied from './Embodied';\n\n/**\n * Class responsible for building different types of geometric\n * shapes.\n */\nclass Geo {\n\t/**\n\t * Creates a new {@link BoundingBox} instance.\n\t * @param {*} upperLeft The upper left point.\n\t * @param {*} lowerRight The lower right point.\n\t * @return {!BoundingBox}\n\t * @static\n\t */\n\tstatic boundingBox(upperLeft, lowerRight) {\n\t\treturn new Geo.BoundingBox(upperLeft, lowerRight);\n\t}\n\n\t/**\n\t * Creates a new {@link Circle} instance.\n\t * @param {*} center The circle's center coordinate.\n\t * @param {string} radius The circle's radius.\n\t * @return {!Circle}\n\t * @static\n\t */\n\tstatic circle(center, radius) {\n\t\treturn new Geo.Circle(center, radius);\n\t}\n\n\t/**\n\t * Creates a new {@link Line} instance.\n\t * @param {...*} points This line's points.\n\t * @return {!Line}\n\t * @static\n\t */\n\tstatic line(...points) {\n\t\treturn new Geo.Line(...points);\n\t}\n\n\t/**\n\t * Creates a new {@link Point} instance.\n\t * @param {number} lat The latitude coordinate\n\t * @param {number} lon The longitude coordinate\n\t * @return {!Point}\n\t * @static\n\t */\n\tstatic point(lat, lon) {\n\t\treturn new Geo.Point(lat, lon);\n\t}\n\n\t/**\n\t * Creates a new {@link Polygon} instance.\n\t * @param {...*} points This polygon's points.\n\t * @return {!Polygon}\n\t * @static\n\t */\n\tstatic polygon(...points) {\n\t\treturn new Geo.Polygon(...points);\n\t}\n}\n\n/**\n * Class that represents a point coordinate.\n * @extends {Embodied}\n */\nclass Point extends Embodied {\n\t/**\n\t * Constructs a {@link Point} instance.\n\t * @param {number} lat The latitude coordinate\n\t * @param {number} lon The longitude coordinate\n\t * @constructor\n\t */\n\tconstructor(lat, lon) {\n\t\tsuper();\n\t\tthis.body_ = [lat, lon];\n\t}\n}\nGeo.Point = Point;\n\n/**\n * Class that represents a line.\n * @extends {Embodied}\n */\nclass Line extends Embodied {\n\t/**\n\t * Constructs a {@link Line} instance.\n\t * @param {...*} points This line's points.\n\t * @constructor\n\t */\n\tconstructor(...points) {\n\t\tsuper();\n\t\tthis.body_ = {\n\t\t\ttype: 'linestring',\n\t\t\tcoordinates: points.map(point => Embodied.toBody(point))\n\t\t};\n\t}\n}\nGeo.Line = Line;\n\n/**\n * Class that represents a bounding box.\n * @extends {Embodied}\n */\nclass BoundingBox extends Embodied {\n\t/**\n\t * Constructs a {@link BoundingBox} instance.\n\t * @param {*} upperLeft The upper left point.\n\t * @param {*} lowerRight The lower right point.\n\t * @constructor\n\t */\n\tconstructor(upperLeft, lowerRight) {\n\t\tsuper();\n\t\tthis.body_ = {\n\t\t\ttype: 'envelope',\n\t\t\tcoordinates: [Embodied.toBody(upperLeft), Embodied.toBody(lowerRight)]\n\t\t};\n\t}\n\n\t/**\n\t * Gets this bounding box's points.\n\t * @return {!Array}\n\t */\n\tgetPoints() {\n\t\treturn this.body_.coordinates;\n\t}\n}\nGeo.BoundingBox = BoundingBox;\n\n/**\n * Class that represents a circle.\n * @extends {Embodied}\n */\nclass Circle extends Embodied {\n\t/**\n\t * Constructs a {@link Circle} instance.\n\t * @param {*} center The circle's center coordinate.\n\t * @param {string} radius The circle's radius.\n\t * @constructor\n\t */\n\tconstructor(center, radius) {\n\t\tsuper();\n\t\tthis.body_ = {\n\t\t\ttype: 'circle',\n\t\t\tcoordinates: Embodied.toBody(center),\n\t\t\tradius: radius\n\t\t};\n\t}\n\n\t/**\n\t * Gets this circle's center coordinate.\n\t * @return {*}\n\t */\n\tgetCenter() {\n\t\treturn this.body_.coordinates;\n\t}\n\n\t/**\n\t * Gets this circle's radius.\n\t * @return {string}\n\t */\n\tgetRadius() {\n\t\treturn this.body_.radius;\n\t}\n}\nGeo.Circle = Circle;\n\n/**\n * Class that represents a polygon.\n * @extends {Embodied}\n */\nclass Polygon extends Embodied {\n\t/**\n\t * Constructs a {@link Polygon} instance.\n\t * @param {...*} points This polygon's points.\n\t * @constructor\n\t */\n\tconstructor(...points) {\n\t\tsuper();\n\t\tthis.body_ = {\n\t\t\ttype: 'polygon',\n\t\t\tcoordinates: []\n\t\t};\n\t\tthis.addCoordinates_(...points);\n\t}\n\n\t/**\n\t * Adds the given points as coordinates for this polygon.\n\t * @param {...*} points\n\t * @protected\n\t */\n\taddCoordinates_(...points) {\n\t\tthis.body_.coordinates.push(points.map(point => Embodied.toBody(point)));\n\t}\n\n\t/**\n\t * Adds the given points as a hole inside this polygon.\n\t * @param {...*} points\n\t * @chainnable\n\t */\n\thole(...points) {\n\t\tthis.addCoordinates_(...points);\n\t\treturn this;\n\t}\n}\nGeo.Polygon = Polygon;\n\nexport default Geo;\n","'use strict';\n\nimport core from 'bower:metal/src/core';\nimport Embodied from './Embodied';\n\n/**\n * Class responsible for building range objects to be used by `Filter`.\n * @extends {Embodied}\n */\nclass Range extends Embodied {\n\t/**\n\t * Constructs a {@link Range} instance.\n\t * @param {*} from\n\t * @param {*} opt_to\n\t * @constructor\n\t */\n\tconstructor(from, opt_to) {\n\t\tsuper();\n\t\tif (core.isDefAndNotNull(from)) {\n\t\t\tthis.body_.from = from;\n\t\t}\n\t\tif (core.isDefAndNotNull(opt_to)) {\n\t\t\tthis.body_.to = opt_to;\n\t\t}\n\t}\n\n\t/**\n\t * Constructs a {@link Range} instance.\n\t * @param {*} from\n\t * @return {!Range}\n\t * @static\n\t */\n\tstatic from(from) {\n\t\treturn new Range(from);\n\t}\n\n\t/**\n\t * Constructs a {@link Range} instance.\n\t * @param {*} from\n\t * @param {*} to\n\t * @return {!Range}\n\t * @static\n\t */\n\tstatic range(from, to) {\n\t\treturn new Range(from, to);\n\t}\n\n\t/**\n\t * Constructs a {@link Range} instance.\n\t * @param {*} to\n\t * @return {!Range}\n\t * @static\n\t */\n\tstatic to(to) {\n\t\treturn new Range(null, to);\n\t}\n}\n\nexport default Range;\n","'use strict';\n\nimport core from 'bower:metal/src/core';\nimport Embodied from './Embodied';\nimport FilterBody from './FilterBody';\nimport Geo from './Geo';\nimport Range from './Range';\n\n/**\n * Class responsible for building filters.\n * @extends {Embodied}\n */\nclass Filter extends Embodied {\n\t/**\n\t * Constructs a {@link Filter} instance.\n\t * @param {string} field The name of the field to filter by.\n\t * @param {*} operatorOrValue If a third param is given, this should\n\t * be the filter's operator (like \">=\"). Otherwise, this will be\n\t * used as the filter's value, and the filter's operator will be \"=\".\n\t * @param {*=} opt_value The filter's value.\n\t * @constructor\n\t */\n\tconstructor(field, operatorOrValue, opt_value) {\n\t\tsuper();\n\t\tthis.body_ = new FilterBody(field, operatorOrValue, opt_value);\n\t}\n\n\t/**\n\t * Adds a filter to be composed with this filter using the given operator.\n\t * @param {string} operator\n\t * @param {!Filter|string} fieldOrFilter Either a {@link Filter} instance or the\n\t * name of the field to filter by.\n\t * @param {*=} opt_operatorOrValue Either the field's operator or its value.\n\t * @param {*=} opt_value The filter's value.\n\t * @chainnable\n\t */\n\tadd(operator, fieldOrFilter, opt_operatorOrValue, opt_value) {\n\t\tvar filter = fieldOrFilter ? Filter.toFilter(fieldOrFilter, opt_operatorOrValue, opt_value) : null;\n\t\tthis.body_.add(operator, filter);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Adds filters to be composed with this filter using the given operator.\n\t * @param {string} operator\n\t * @param {...*} filters A variable amount of filters to be composed.\n\t * @chainnable\n\t */\n\taddMany(operator, ...filters) {\n\t\tthis.body_.addMany(operator, ...filters);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Adds a filter to be composed with this filter using the \"and\" operator.\n\t * @param {!Filter|string} fieldOrFilter Either a {@link Filter} instance or the\n\t * name of the field to filter by.\n\t * @param {*=} opt_operatorOrValue Either the field's operator or its value.\n\t * @param {*=} opt_value The filter's value.\n\t * @chainnable\n\t */\n\tand(fieldOrFilter, opt_operatorOrValue, opt_value) {\n\t\treturn this.add('and', fieldOrFilter, opt_operatorOrValue, opt_value);\n\t}\n\n\t/**\n\t * Returns a {@link Filter} instance that uses the \"any\" operator.\n\t * @param {string} field The name of the field to filter by.\n\t * @param {!(Array|...*)} values A variable amount of values to be used with\n\t * the \"none\" operator. Can be passed either as a single array or as\n\t * separate params.\n\t * @return {!Filter}\n\t * @static\n\t */\n\tstatic any(field) {\n\t\tvar values = Array.prototype.slice.call(arguments, 1);\n\t\tif (values.length === 1 && values[0] instanceof Array) {\n\t\t\tvalues = values[0];\n\t\t}\n\t\treturn new Filter(field, 'any', values);\n\t}\n\n\t/**\n\t * Returns a {@link Filter} instance that uses the \"gp\" operator.\n\t * This is a special use case of `Filter.polygon` for bounding\n\t * boxes.\n\t * @param {string} field The field's name.\n\t * @param {*} boxOrUpperLeft Either a `Geo.BoundingBox` instance, or\n\t * a bounding box's upper left coordinate.\n\t * @param {*=} opt_lowerRight A bounding box's lower right coordinate.\n\t * @return {!Filter}\n\t * @static\n\t */\n\tstatic boundingBox(field, boxOrUpperLeft, opt_lowerRight) {\n\t\tif (boxOrUpperLeft instanceof Geo.BoundingBox) {\n\t\t\treturn Filter.polygon(field, ...boxOrUpperLeft.getPoints());\n\t\t} else {\n\t\t\treturn Filter.polygon(field, boxOrUpperLeft, opt_lowerRight);\n\t\t}\n\t}\n\n\t/**\n\t * Gets the json object that represents this filter.\n\t * @return {!Object}\n\t */\n\tbody() {\n\t\treturn this.body_.getObject();\n\t}\n\n\t/**\n\t * Returns a {@link Filter} instance that uses the \"gd\" operator.\n\t * @param {string} field The field's name.\n\t * @param {*} locationOrCircle Either a `Geo.Circle` instance or a coordinate.\n\t * @param {Range|string=} opt_rangeOrDistance Either a `Range` instance or\n\t * the distance value.\n\t * @return {!Filter}\n\t * @static\n\t */\n\tstatic distance(field, locationOrCircle, opt_rangeOrDistance) {\n\t\tvar location = locationOrCircle;\n\t\tvar range = opt_rangeOrDistance;\n\t\tif (locationOrCircle instanceof Geo.Circle) {\n\t\t\tlocation = locationOrCircle.getCenter();\n\t\t\trange = Range.to(locationOrCircle.getRadius());\n\t\t} else if (!(opt_rangeOrDistance instanceof Range)) {\n\t\t\trange = Range.to(opt_rangeOrDistance);\n\t\t}\n\t\treturn Filter.distanceInternal_(field, location, range);\n\t}\n\n\t/**\n\t * Returns a {@link Filter} instance that uses the \"gd\" operator. This\n\t * is just an internal helper used by `Filter.distance`.\n\t * @param {string} field The field's name.\n\t * @param {*} location A location coordinate.\n\t * @param {Range} range A `Range` instance.\n\t * @return {!Filter}\n\t * @protected\n\t * @static\n\t */\n\tstatic distanceInternal_(field, location, range) {\n\t\tvar value = {\n\t\t\tlocation: Embodied.toBody(location)\n\t\t};\n\t\trange = range.body();\n\t\tif (range.from) {\n\t\t\tvalue.min = range.from;\n\t\t}\n\t\tif (range.to) {\n\t\t\tvalue.max = range.to;\n\t\t}\n\t\treturn Filter.field(field, 'gd', value);\n\t}\n\n\t/**\n\t * Returns a {@link Filter} instance that uses the \"=\" operator.\n\t * @param {string} field The name of the field to filter by.\n\t * @param {*} value The filter's value.\n\t * @return {!Filter}\n * @static\n\t */\n\tstatic equal(field, value) {\n\t\treturn new Filter(field, '=', value);\n\t}\n\n\t/**\n\t * Returns a {@link Filter} instance that uses the \"exists\" operator.\n\t * @param {string} field The field's name.\n\t * @return {!Filter}\n\t * @static\n\t */\n\tstatic exists(field) {\n\t\treturn Filter.field(field, 'exists', null);\n\t}\n\n\t/**\n\t * Returns a {@link Filter} instance that uses the \"fuzzy\" operator.\n\t * @param {string} fieldOrQuery If no second string argument is given, this\n\t * should be the query string, in which case all fields will be matched.\n\t * Otherwise, this should be the name of the field to match.\n\t * @param {string|number=} opt_queryOrFuzziness If this is a string, it should\n\t * be the query, otherwise it should be the fuzziness value.\n\t * @param {number=} opt_fuzziness The fuzziness value.\n\t * @return {!Filter}\n\t * @static\n\t */\n\tstatic fuzzy(fieldOrQuery, opt_queryOrFuzziness, opt_fuzziness) {\n\t\treturn Filter.fuzzyInternal_('fuzzy', fieldOrQuery, opt_queryOrFuzziness, opt_fuzziness);\n\t}\n\n\t/**\n\t * Returns a {@link Filter} instance that uses the given fuzzy operator. This\n\t * is an internal implementation used by the `Filter.fuzzy` method.\n\t * @param {string} operator The fuzzy operator.\n\t * @param {string} fieldOrQuery If no second string argument is given, this\n\t * should be the query string, in which case all fields will be matched.\n\t * Otherwise, this should be the name of the field to match.\n\t * @param {string|number=} opt_queryOrFuzziness If this is a string, it should\n\t * be the query, otherwise it should be the fuzziness value.\n\t * @param {number=} opt_fuzziness The fuzziness value.\n\t * @return {!Filter}\n\t * @protected\n\t * @static\n\t */\n\tstatic fuzzyInternal_(operator, fieldOrQuery, opt_queryOrFuzziness, opt_fuzziness) {\n\t\tvar arg2IsString = core.isString(opt_queryOrFuzziness);\n\n\t\tvar value = {\n\t\t\tquery: arg2IsString ? opt_queryOrFuzziness : fieldOrQuery\n\t\t};\n\t\tvar fuzziness = arg2IsString ? opt_fuzziness : opt_queryOrFuzziness;\n\t\tif (fuzziness) {\n\t\t\tvalue.fuzziness = fuzziness;\n\t\t}\n\n\t\tvar field = arg2IsString ? fieldOrQuery : Filter.ALL;\n\t\treturn Filter.field(field, operator, value);\n\t}\n\n\t/**\n\t * Returns a {@link Filter} instance that uses the \">\" operator.\n\t * @param {string} field The name of the field to filter by.\n\t * @param {*} value The filter's value.\n\t * @return {!Filter}\n * @static\n\t */\n\tstatic gt(field, value) {\n\t\treturn new Filter(field, '>', value);\n\t}\n\n\t/**\n\t * Returns a {@link Filter} instance that uses the \">=\" operator.\n\t * @param {string} field The name of the field to filter by.\n\t * @param {*} value The filter's value.\n\t * @return {!Filter}\n * @static\n\t */\n\tstatic gte(field, value) {\n\t\treturn new Filter(field, '>=', value);\n\t}\n\n\t/**\n\t * Returns a {@link Filter} instance that uses the \"match\" operator.\n\t * @param {string} fieldOrQuery If no second string argument is given, this\n\t * should be the query string, in which case all fields will be matched.\n\t * Otherwise, this should be the name of the field to match.\n\t * @param {string=} opt_query The query string.\n\t * @return {!Filter}\n\t * @static\n\t */\n\tstatic match(fieldOrQuery, opt_query) {\n\t\tvar field = core.isString(opt_query) ? fieldOrQuery : Filter.ALL;\n\t\tvar query = core.isString(opt_query) ? opt_query : fieldOrQuery;\n\t\treturn Filter.field(field, 'match', query);\n\t}\n\n\t/**\n\t * Returns a {@link Filter} instance that uses the \"missing\" operator.\n\t * @param {string} field The field's name.\n\t * @return {!Filter}\n\t * @static\n\t */\n\tstatic missing(field) {\n\t\treturn Filter.field(field, 'missing', null);\n\t}\n\n\t/**\n\t * Returns a {@link Filter} instance that uses the \"phrase\" operator.\n\t * @param {string} fieldOrQuery If no second string argument is given, this\n\t * should be the query string, in which case all fields will be matched.\n\t * Otherwise, this should be the name of the field to match.\n\t * @param {string=} opt_query The query string.\n\t * @return {!Filter}\n\t * @static\n\t */\n\tstatic phrase(fieldOrQuery, opt_query) {\n\t\tvar field = core.isString(opt_query) ? fieldOrQuery : Filter.ALL;\n\t\tvar query = core.isString(opt_query) ? opt_query : fieldOrQuery;\n\t\treturn Filter.field(field, 'phrase', query);\n\t}\n\n\t/**\n\t * Returns a {@link Filter} instance that uses the \"gp\" operator.\n\t * @param {string} field The name of the field.\n\t * @param {...!Object} points Objects representing points in the polygon.\n\t * @return {!Filter}\n\t * @static\n\t */\n\tstatic polygon(field, ...points) {\n\t\tpoints = points.map(point => Embodied.toBody(point));\n\t\treturn Filter.field(field, 'gp', points);\n\t}\n\n\t/**\n\t * Returns a {@link Filter} instance that uses the \"prefix\" operator.\n\t * @param {string} fieldOrQuery If no second argument is given, this should\n\t * be the query string, in which case all fields will be matched. Otherwise,\n\t * this should be the name of the field to match.\n\t * @param {string=} opt_query The query string.\n\t * @return {!Filter}\n\t * @static\n\t */\n\tstatic prefix(fieldOrQuery, opt_query) {\n\t\tvar field = opt_query ? fieldOrQuery : Filter.ALL;\n\t\tvar query = opt_query ? opt_query : fieldOrQuery;\n\t\treturn Filter.field(field, 'prefix', query);\n\t}\n\n\t/**\n\t * Returns a {@link Filter} instance that uses the \"range\" operator.\n\t * @param {string} field The field's name.\n\t * @param {*} rangeOrMin Either a `Range` instance or a the range's min value.\n\t * @param {*=} opt_max The range's max value.\n\t * @return {!Filter}\n\t * @static\n\t */\n\tstatic range(field, rangeOrMin, opt_max) {\n\t\tvar range = rangeOrMin;\n\t\tif (!(range instanceof Range)) {\n\t\t\trange = Range.range(rangeOrMin, opt_max);\n\t\t}\n\t\treturn Filter.field(field, 'range', range);\n\t}\n\n\t/**\n\t * Returns a {@link Filter} instance that uses the \"~\" operator.\n\t * @param {string} field The name of the field to filter by.\n\t * @param {*} value The filter's value.\n\t * @return {!Filter}\n * @static\n\t */\n\tstatic regex(field, value) {\n\t\treturn new Filter(field, '~', value);\n\t}\n\n\t/**\n\t * Returns a {@link Filter} instance that uses the \"gs\" operator.\n\t * @param {string} field The field's name.\n\t * @param {...!Object} shapes Objects representing shapes.\n\t * @return {!Filter}\n\t * @static\n\t */\n\tstatic shape(field, ...shapes) {\n\t\tshapes = shapes.map(shape => Embodied.toBody(shape));\n\t\tvar value = {\n\t\t\ttype: 'geometrycollection',\n\t\t\tgeometries: shapes\n\t\t};\n\t\treturn Filter.field(field, 'gs', value);\n\t}\n\n\t/**\n\t * Returns a {@link Filter} instance that uses the \"similar\" operator.\n\t * @param {string} fieldOrQuery If no second string argument is given, this\n\t * should be the query string, in which case all fields will be matched.\n\t * Otherwise, this should be the name of the field to match.\n\t * @param {?string} query The query string.\n\t * @return {!Filter}\n\t * @static\n\t */\n\tstatic similar(fieldOrQuery, query) {\n\t\tvar field = core.isString(query) ? fieldOrQuery : Filter.ALL;\n\t\tvar value = {\n\t\t\tquery: core.isString(query) ? query : fieldOrQuery\n\t\t};\n\t\treturn Filter.field(field, 'similar', value);\n\t}\n\n\t/**\n\t * Returns a {@link Filter} instance that uses the \"<\" operator.\n\t * @param {string} field The name of the field to filter by.\n\t * @param {*} value The filter's value.\n\t * @return {!Filter}\n * @static\n\t */\n\tstatic lt(field, value) {\n\t\treturn new Filter(field, '<', value);\n\t}\n\n\t/**\n\t * Returns a {@link Filter} instance that uses the \"<=\" operator.\n\t * @param {string} field The name of the field to filter by.\n\t * @param {*} value The filter's value.\n\t * @return {!Filter}\n * @static\n\t */\n\tstatic lte(field, value) {\n\t\treturn new Filter(field, '<=', value);\n\t}\n\n\t/**\n\t * Returns a {@link Filter} instance that uses the \"none\" operator.\n\t * @param {string} field The name of the field to filter by.\n\t * @param {!(Array|...*)} value A variable amount of values to be used with\n\t * the \"none\" operator. Can be passed either as a single array or as\n\t * separate params.\n\t * @return {!Filter}\n\t * @static\n\t */\n\tstatic none(field) {\n\t\tvar values = Array.prototype.slice.call(arguments, 1);\n\t\tif (values.length === 1 && values[0] instanceof Array) {\n\t\t\tvalues = values[0];\n\t\t}\n\t\treturn new Filter(field, 'none', values);\n\t}\n\n\t/**\n\t * Returns a {@link Filter} instance that uses the \"!=\" operator.\n\t * @param {string} field The name of the field to filter by.\n\t * @param {*} value The filter's value.\n\t * @return {!Filter}\n\t * @static\n\t */\n\tstatic notEqual(field, value) {\n\t\treturn new Filter(field, '!=', value);\n\t}\n\n\t/**\n\t * Returns a {@link Filter} instance that uses the \"not\" operator.\n\t * @param {!Filter|string} fieldOrFilter Either a {@link Filter} instance or the\n\t * name of the field to filter by.\n\t * @param {*=} opt_operatorOrValue Either the field's operator or its value.\n\t * @param {*=} opt_value The filter's value.\n\t * @return {!Filter}\n\t * @static\n\t */\n\tstatic not(fieldOrFilter, opt_operatorOrValue, opt_value) {\n\t\treturn Filter.toFilter(fieldOrFilter, opt_operatorOrValue, opt_value).add('not');\n\t}\n\n\t/**\n\t * Returns a {@link Filter} instance.\n\t * @param {string} field The name of the field to filter by.\n\t * @param {*} operatorOrValue If a third param is given, this should\n\t * be the filter's operator (like \">=\"). Otherwise, this will be\n\t * used as the filter's value, and the filter's operator will be \"=\".\n\t * @param {*=} opt_value The filter's value.\n\t * @return {!Filter}\n * @static\n\t */\n\tstatic field(field, operatorOrValue, opt_value) {\n\t\treturn new Filter(field, operatorOrValue, opt_value);\n\t}\n\n\t/**\n\t * Adds a filter to be composed with this filter using the \"or\" operator.\n\t * @param {!Filter|string} fieldOrFilter Either a {@link Filter} instance or the\n\t * name of the field to filter by.\n\t * @param {*=} opt_operatorOrValue Either the field's operator or its value.\n\t * @param {*=} opt_value The filter's value.\n\t * @chainnable\n\t */\n\tor(fieldOrFilter, opt_operatorOrValue, opt_value) {\n\t\treturn this.add('or', fieldOrFilter, opt_operatorOrValue, opt_value);\n\t}\n\n\t/**\n\t * Converts the given arguments into a {@link Filter} instance.\n\t * @param {!Filter|string} fieldOrFilter Either a {@link Filter} instance or the\n\t * name of the field to filter by.\n\t * @param {*=} opt_operatorOrValue Either the field's operator or its value.\n\t * @param {*=} opt_value The filter's value.\n\t * @return {!Filter}\n\t */\n\tstatic toFilter(fieldOrFilter, opt_operatorOrValue, opt_value) {\n\t\tvar filter = fieldOrFilter;\n\t\tif (!(filter instanceof Filter)) {\n\t\t\tfilter = Filter.field(fieldOrFilter, opt_operatorOrValue, opt_value);\n\t\t}\n\t\treturn filter;\n\t}\n}\n\n/**\n * String constant that represents all fields.\n * @type {string}\n * @static\n */\nFilter.ALL = '*';\n\nexport default Filter;\n","'use strict';\n\nimport Embodied from './Embodied';\nimport Range from './Range';\n\n/**\n * Class that represents a search aggregation.\n */\nclass Aggregation {\n\t/**\n\t * Constructs an {@link Aggregation} instance.\n\t * @param {string} field The aggregation field.\n\t * @param {string} operator The aggregation operator.\n\t * @param {*=} opt_value The aggregation value.\n\t * @constructor\n\t */\n\tconstructor(field, operator, opt_value) {\n\t\tthis.field_ = field;\n\t\tthis.operator_ = operator;\n\t\tthis.value_ = opt_value;\n\t}\n\n\t/**\n\t * Creates an {@link Aggregation} instance with the \"avg\" operator.\n\t * @param {string} field The aggregation field.\n\t * @return {!Aggregation}\n\t * @static\n\t */\n\tstatic avg(field) {\n\t\treturn Aggregation.field(field, 'avg');\n\t}\n\n\t/**\n\t * Creates an {@link Aggregation} instance with the \"count\" operator.\n\t * @param {string} field The aggregation field.\n\t * @return {!Aggregation}\n\t * @static\n\t */\n\tstatic count(field) {\n\t\treturn Aggregation.field(field, 'count');\n\t}\n\n\t/**\n\t * Creates an {@link DistanceAggregation} instance with the \"geoDistance\" operator.\n\t * @param {string} field The aggregation field.\n\t * @param {*} location The aggregation location.\n\t * @param {...!Range} ranges The aggregation ranges.\n\t * @return {!DistanceAggregation}\n\t * @static\n\t */\n\tstatic distance(field, location, ...ranges) {\n\t\treturn new Aggregation.DistanceAggregation(field, location, ...ranges);\n\t}\n\n\t/**\n\t * Creates an {@link Aggregation} instance with the \"extendedStats\" operator.\n\t * @param {string} field The aggregation field.\n\t * @return {!Aggregation}\n\t * @static\n\t */\n\tstatic extendedStats(field) {\n\t\treturn Aggregation.field(field, 'extendedStats');\n\t}\n\n\t/**\n\t * Gets this aggregation's field.\n\t * @return {string}\n\t */\n\tgetField() {\n\t\treturn this.field_;\n\t}\n\n\t/**\n\t * Gets this aggregation's operator.\n\t * @return {string}\n\t */\n\tgetOperator() {\n\t\treturn this.operator_;\n\t}\n\n\t/**\n\t * Gets this aggregation's value.\n\t * @return {*}\n\t */\n\tgetValue() {\n\t\treturn this.value_;\n\t}\n\n\t/**\n\t * Creates an {@link Aggregation} instance with the \"histogram\" operator.\n\t * @param {string} field The aggregation field.\n\t * @param {number} interval The histogram's interval.\n\t * @return {!Aggregation}\n\t * @static\n\t */\n\tstatic histogram(field, interval) {\n\t\treturn new Aggregation(field, 'histogram', interval);\n\t}\n\n\t/**\n\t * Creates an {@link Aggregation} instance with the \"max\" operator.\n\t * @param {string} field The aggregation field.\n\t * @return {!Aggregation}\n\t * @static\n\t */\n\tstatic max(field) {\n\t\treturn Aggregation.field(field, 'max');\n\t}\n\n\t/**\n\t * Creates an {@link Aggregation} instance with the \"min\" operator.\n\t * @param {string} field The aggregation field.\n\t * @return {!Aggregation}\n\t * @static\n\t */\n\tstatic min(field) {\n\t\treturn Aggregation.field(field, 'min');\n\t}\n\n\t/**\n\t * Creates an {@link Aggregation} instance with the \"missing\" operator.\n\t * @param {string} field The aggregation field.\n\t * @return {!Aggregation}\n\t * @static\n\t */\n\tstatic missing(field) {\n\t\treturn Aggregation.field(field, 'missing');\n\t}\n\n\t/**\n\t * Creates a new {@link Aggregation} instance.\n\t * @param {string} field The aggregation field.\n\t * @param {string} operator The aggregation operator.\n\t * @return {!Aggregation}\n\t * @static\n\t */\n\tstatic field(field, operator) {\n\t\treturn new Aggregation(field, operator);\n\t}\n\n\t/**\n\t * Creates an {@link RangeAggregation} instance with the \"range\" operator.\n\t * @param {string} field The aggregation field.\n\t * @param {...!Range} ranges The aggregation ranges.\n\t * @return {!RangeAggregation}\n\t * @static\n\t */\n\tstatic range(field, ...ranges) {\n\t\treturn new Aggregation.RangeAggregation(field, ...ranges);\n\t}\n\n\t/**\n\t * Creates an {@link Aggregation} instance with the \"stats\" operator.\n\t * @param {string} field The aggregation field.\n\t * @return {!Aggregation}\n\t * @static\n\t */\n\tstatic stats(field) {\n\t\treturn Aggregation.field(field, 'stats');\n\t}\n\n\t/**\n\t * Creates an {@link Aggregation} instance with the \"sum\" operator.\n\t * @param {string} field The aggregation field.\n\t * @return {!Aggregation}\n\t * @static\n\t */\n\tstatic sum(field) {\n\t\treturn Aggregation.field(field, 'sum');\n\t}\n\n\t/**\n\t * Creates an {@link Aggregation} instance with the \"terms\" operator.\n\t * @param {string} field The aggregation field.\n\t * @return {!Aggregation}\n\t * @static\n\t */\n\tstatic terms(field) {\n\t\treturn Aggregation.field(field, 'terms');\n\t}\n}\n\n/**\n * Class that represents a distance aggregation.\n * @extends {Aggregation}\n */\nclass DistanceAggregation extends Aggregation {\n\t/**\n\t * Constructs an {@link DistanceAggregation} instance.\n\t * @param {string} field The aggregation field.\n\t * @param {*} location The aggregation location.\n\t * @param {...!Range} ranges The aggregation ranges.\n\t * @constructor\n\t */\n\tconstructor(field, location, ...ranges) {\n\t\tsuper(field, 'geoDistance', {});\n\t\tthis.value_.location = Embodied.toBody(location);\n\t\tthis.value_.ranges = ranges.map(range => range.body());\n\t}\n\n\t/**\n\t * Adds a range to this aggregation.\n\t * @param {*} rangeOrFrom\n\t * @param {*=} opt_to\n\t * @chainnable\n\t */\n\trange(rangeOrFrom, opt_to) {\n\t\tvar range = rangeOrFrom;\n\t\tif (!(range instanceof Range)) {\n\t\t\trange = Range.range(rangeOrFrom, opt_to);\n\t\t}\n\t\tthis.value_.ranges.push(range.body());\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets this aggregation's unit.\n\t * @param {string} unit\n\t * @chainnable\n\t */\n\tunit(unit) {\n\t\tthis.value_.unit = unit;\n\t\treturn this;\n\t}\n}\nAggregation.DistanceAggregation = DistanceAggregation;\n\n/**\n * Class that represents a range aggregation.\n * @extends {Aggregation}\n */\nclass RangeAggregation extends Aggregation {\n\t/**\n\t * Constructs an {@link RangeAggregation} instance.\n\t * @param {string} field The aggregation field.\n\t * @param {...!Range} ranges The aggregation ranges.\n\t * @constructor\n\t */\n\tconstructor(field, ...ranges) {\n\t\tsuper(field, 'range');\n\t\tthis.value_ = ranges.map(range => range.body());\n\t}\n\n\t/**\n\t * Adds a range to this aggregation.\n\t * @param {*} rangeOrFrom\n\t * @param {*=} opt_to\n\t * @chainnable\n\t */\n\trange(rangeOrFrom, opt_to) {\n\t\tvar range = rangeOrFrom;\n\t\tif (!(range instanceof Range)) {\n\t\t\trange = Range.range(rangeOrFrom, opt_to);\n\t\t}\n\t\tthis.value_.push(range.body());\n\t\treturn this;\n\t}\n}\nAggregation.RangeAggregation = RangeAggregation;\n\nexport default Aggregation;\n","'use strict';\n\nimport core from 'bower:metal/src/core';\nimport Embodied from './Embodied';\nimport Filter from './Filter';\nimport Aggregation from './Aggregation';\n\n/**\n * Class responsible for building queries.\n * @extends {Embodied}\n */\nclass Query extends Embodied {\n\t/**\n\t * Adds an aggregation to this {@link Query} instance.\n\t * @param {string} name The aggregation name.\n\t * @param {!Aggregation|string} aggregationOrField Either an\n\t * {@link Aggregation} instance or the name of the aggregation field.\n\t * @param {string=} opt_operator The aggregation operator.\n\t * @return {!Query}\n\t * @static\n\t */\n\tstatic aggregate(name, aggregationOrField, opt_operator) {\n\t\treturn new Query().aggregate(name, aggregationOrField, opt_operator);\n\t}\n\n\t/**\n\t * Sets this query's type to \"count\".\n\t * @return {!Query}\n\t * @static\n\t */\n\tstatic count() {\n\t\treturn new Query().type('count');\n\t}\n\n\t/**\n\t * Sets this query's type to \"fetch\".\n\t * @return {!Query}\n\t * @static\n\t */\n\tstatic fetch() {\n\t\treturn new Query().type('fetch');\n\t}\n\n\t/**\n\t * Adds a filter to this Query.\n\t * @param {!Filter|string} fieldOrFilter Either a {@link Filter} or the\n\t * name of the field to filter by.\n\t * @param {*=} opt_operatorOrValue Either the field's operator or its value.\n\t * @param {*=} opt_value The filter's value.\n\t * @return {!Query}\n\t * @static\n\t */\n\tstatic filter(fieldOrFilter, opt_operatorOrValue, opt_value) {\n\t\treturn new Query().filter(fieldOrFilter, opt_operatorOrValue, opt_value);\n\t}\n\n\t/**\n\t * Sets the query offset.\n\t * @param {number} offset The index of the first entry that should be returned\n\t * by this query.\n\t * @return {!Query}\n\t * @static\n\t */\n\tstatic offset(offset) {\n\t\treturn new Query().offset(offset);\n\t}\n\n\t/**\n\t * Adds a highlight entry to this {@link Query} instance.\n\t * @param {string} field The field's name.\n\t * @return {!Query}\n\t * @static\n\t */\n\tstatic highlight(field) {\n\t\treturn new Query().highlight(field);\n\t}\n\n\t/**\n\t * Sets the query limit.\n\t * @param {number} limit The max amount of entries that this query should return.\n\t * @return {!Query}\n\t * @static\n\t */\n\tstatic limit(limit) {\n\t\treturn new Query().limit(limit);\n\t}\n\n\t/**\n\t * Adds a search to this {@link Query} instance.\n\t * @param {!Filter|string} filterOrTextOrField If no other arguments\n\t * are passed to this function, this should be either a {@link Filter}\n\t * instance or a text to be used in a match filter. In both cases\n\t * the filter will be applied to all fields. Another option is to\n\t * pass this as a field name instead, together with other arguments\n\t * so the filter can be created.\n\t * @param {string=} opt_textOrOperator Either a text to be used in a\n\t * match filter, or the operator that should be used.\n\t * @param {*=} opt_value The value to be used by the filter. Should\n\t * only be passed if an operator was passed as the second argument.\n\t * @return {!Query}\n\t * @static\n\t */\n\tstatic search(filterOrTextOrField, opt_textOrOperator, opt_value) {\n\t\treturn new Query().search(filterOrTextOrField, opt_textOrOperator, opt_value);\n\t}\n\n\t/**\n\t * Adds a sort entry to this query, specifying the field this query should be\n\t * sorted by and, optionally, the sort direction.\n\t * @param {string} field The field that the query should be sorted by.\n\t * @param {string=} opt_direction The direction the sort operation should use.\n\t * If none is given, \"asc\" is used by default.\n\t * @return {!Query}\n\t * @static\n\t */\n\tstatic sort(field, opt_direction) {\n\t\treturn new Query().sort(field, opt_direction);\n\t}\n\n\t/**\n\t * Sets the query type.\n\t * @param {string} type The query's type. For example: \"count\", \"fetch\".\n\t * @return {!Query}\n\t * @static\n\t */\n\tstatic type(type) {\n\t\treturn new Query().type(type);\n\t}\n\n\t/**\n\t * Adds an aggregation to this {@link Query} instance.\n\t * @param {string} name The aggregation name.\n\t * @param {!Aggregation|string} aggregationOrField Either an\n\t * {@link Aggregation} instance or the name of the aggregation field.\n\t * @param {string=} opt_operator The aggregation operator.\n\t * @chainnable\n\t */\n\taggregate(name, aggregationOrField, opt_operator) {\n\t\tvar aggregation = aggregationOrField;\n\t\tif (!(aggregation instanceof Aggregation)) {\n\t\t\taggregation = Aggregation.field(aggregationOrField, opt_operator);\n\t\t}\n\n\t\tvar field = aggregation.getField();\n\t\tvar value = {};\n\t\tvalue[field] = {\n\t\t\tname: name,\n\t\t\toperator: aggregation.getOperator()\n\t\t};\n\t\tif (core.isDefAndNotNull(aggregation.getValue())) {\n\t\t\tvalue[field].value = aggregation.getValue();\n\t\t}\n\n\t\tif (!this.body_.aggregation) {\n\t\t\tthis.body_.aggregation = [];\n\t\t}\n\t\tthis.body_.aggregation.push(value);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets this query's type to \"count\".\n\t * @chainnable\n\t */\n\tcount() {\n\t\treturn this.type('count');\n\t}\n\n\t/**\n\t * Sets this query's type to \"fetch\".\n\t * @chainnable\n\t */\n\tfetch() {\n\t\treturn this.type('fetch');\n\t}\n\n\t/**\n\t * Adds a filter to this Query.\n\t * @param {!Filter|string} fieldOrFilter Either a {@link Filter} or the\n\t * name of the field to filter by.\n\t * @param {*=} opt_operatorOrValue Either the field's operator or its value.\n\t * @param {*=} opt_value The filter's value.\n\t * @chainnable\n\t */\n\tfilter(fieldOrFilter, opt_operatorOrValue, opt_value) {\n\t\tvar filter = Filter.toFilter(fieldOrFilter, opt_operatorOrValue, opt_value);\n\t\tif (!this.body_.filter) {\n\t\t\tthis.body_.filter = [];\n\t\t}\n\t\tthis.body_.filter.push(filter.body());\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the query offset.\n\t * @param {number} offset The index of the first entry that should be returned\n\t * by this query.\n\t * @chainnable\n\t */\n\toffset(offset) {\n\t\tthis.body_.offset = offset;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Adds a highlight entry to this {@link Query} instance.\n\t * @param {string} field The field's name.\n\t * @chainnable\n\t */\n\thighlight(field) {\n\t\tif (!this.body_.highlight) {\n\t\t\tthis.body_.highlight = [];\n\t\t}\n\n\t\tthis.body_.highlight.push(field);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the query limit.\n\t * @param {number} limit The max amount of entries that this query should return.\n\t * @chainnable\n\t */\n\tlimit(limit) {\n\t\tthis.body_.limit = limit;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Adds a search to this {@link Query} instance.\n\t * @param {!Filter|string} filterOrTextOrField If no other arguments\n\t * are passed to this function, this should be either a {@link Filter}\n\t * instance or a text to be used in a match filter. In both cases\n\t * the filter will be applied to all fields. Another option is to\n\t * pass this as a field name instead, together with other arguments\n\t * so the filter can be created.\n\t * @param {string=} opt_textOrOperator Either a text to be used in a\n\t * match filter, or the operator that should be used.\n\t * @param {*=} opt_value The value to be used by the filter. Should\n\t * only be passed if an operator was passed as the second argument.\n\t * @chainnable\n\t */\n\tsearch(filterOrTextOrField, opt_textOrOperator, opt_value) {\n\t\tvar filter = filterOrTextOrField;\n\t\tif (opt_value) {\n\t\t\tfilter = Filter.field(filterOrTextOrField, opt_textOrOperator, opt_value);\n\t\t} else if (opt_textOrOperator) {\n\t\t\tfilter = Filter.match(filterOrTextOrField, opt_textOrOperator);\n\t\t} else if (!(filter instanceof Filter)) {\n\t\t\tfilter = Filter.match(filterOrTextOrField);\n\t\t}\n\t\tif (!this.body_.search) {\n\t\t\tthis.body_.search = [];\n\t\t}\n\t\tthis.body_.search.push(filter.body());\n\t\treturn this;\n\t}\n\n\t/**\n\t * Adds a sort entry to this query, specifying the field this query should be\n\t * sorted by and, optionally, the sort direction.\n\t * @param {string} field The field that the query should be sorted by.\n\t * @param {string=} opt_direction The direction the sort operation should use.\n\t * If none is given, \"asc\" is used by default.\n\t * @chainnable\n\t */\n\tsort(field, opt_direction) {\n\t\tif (!this.body_.sort) {\n\t\t\tthis.body_.sort = [];\n\t\t}\n\t\tvar sortEntry = {};\n\t\tsortEntry[field] = opt_direction || 'asc';\n\t\tthis.body_.sort.push(sortEntry);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the query type.\n\t * @param {string} type The query's type. For example: \"count\", \"fetch\".\n\t * @chainnable\n\t */\n\ttype(type) {\n\t\tthis.body_.type = type;\n\t\treturn this;\n\t}\n}\n\nexport default Query;\n","'use strict';\n\nimport AjaxTransport from './AjaxTransport';\n\n/**\n * Provides a factory for data transport.\n */\nclass TransportFactory {\n\tconstructor() {\n\t\tthis.transports = {};\n\t\tthis.transports[TransportFactory.DEFAULT_TRANSPORT_NAME] = AjaxTransport;\n\t}\n\n\t/**\n\t * Returns {@link TransportFactory} instance.\n\t */\n\tstatic instance() {\n\t\tif (!TransportFactory.instance_) {\n\t\t\tTransportFactory.instance_ = new TransportFactory();\n\t\t}\n\t\treturn TransportFactory.instance_;\n\t}\n\n\t/**\n\t * Gets an instance of the transport implementation with the given name.\n\t * @param {string} implementationName\n\t * @return {!Transport}\n\t */\n\tget(implementationName) {\n\t\tvar TransportClass = this.transports[implementationName];\n\n\t\tif (!TransportClass) {\n\t\t\tthrow new Error('Invalid transport name: ' + implementationName);\n\t\t}\n\n\t\ttry {\n\t\t\treturn new (TransportClass)();\n\t\t} catch (err) {\n\t\t\tthrow new Error('Can\\'t create transport', err);\n\t\t}\n\t}\n\n\t/**\n\t * Returns the default transport implementation.\n\t * @return {!Transport}\n\t */\n\tgetDefault() {\n\t\treturn this.get(TransportFactory.DEFAULT_TRANSPORT_NAME);\n\t}\n}\n\nTransportFactory.DEFAULT_TRANSPORT_NAME = 'default';\n\nexport default TransportFactory;\n","'use strict';\n\nimport core from 'bower:metal/src/core';\nimport Auth from '../api/Auth';\nimport Embodied from '../api-query/Embodied';\nimport Filter from '../api-query/Filter';\nimport Query from '../api-query/Query';\nimport TransportFactory from './TransportFactory';\nimport ClientRequest from './ClientRequest';\nimport Ajax from 'bower:metal-ajax/src/Ajax';\nimport MultiMap from 'bower:metal-multimap/src/MultiMap';\n\n/**\n * The main class for making api requests. Sending requests returns a promise that is\n * resolved when the response arrives. Usage example:\n * ```javascript\n * Launchpad\n * .url('/data/tasks')\n * .post({desc: 'Buy milkl'})\n * .then(function(response) {\n * // Handle response here.\n * console.log(response.body())\n * });\n * ```\n */\nclass Launchpad {\n\t/**\n\t * Launchpad constructor function.\n\t * @param {string} url The base url.\n\t * @param {...string} paths Any amount of paths to be appended to the base url.\n\t * @constructor\n\t */\n\tconstructor(url, ...paths) {\n\t\tif (arguments.length === 0) {\n\t\t\tthrow new Error('Invalid arguments, try `new Launchpad(baseUrl, url)`');\n\t\t}\n\n\t\tthis.auth_ = null;\n\t\tthis.body_ = null;\n\t\tthis.url_ = Ajax.joinPaths(url || '', ...paths);\n\t\tthis.headers_ = new MultiMap();\n\t\tthis.params_ = new MultiMap();\n\n\t\tthis.header('Content-Type', 'application/json');\n\t\tthis.header('X-PJAX', 'true');\n\t\tthis.header('X-Requested-With', 'XMLHttpRequest');\n\t}\n\n\t/**\n\t * Adds an aggregation to this {@link Query} instance.\n\t * @param {string} name The aggregation name.\n\t * @param {!Aggregation|string} aggregationOrField Either an\n\t * {@link Aggregation} instance or the name of the aggregation field.\n\t * @param {string=} opt_operator The aggregation operator.\n\t * @chainable\n\t */\n\taggregate(name, aggregationOrField, opt_operator) {\n\t\tthis.getOrCreateQuery_().aggregate(name, aggregationOrField, opt_operator);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Adds authorization information to this request.\n\t * @param {!Auth|string} authOrTokenOrUsername Either an {@link Auth} instance,\n\t * an authorization token, or the username.\n\t * @param {string=} opt_password If a username is given as the first param,\n\t * this should be the password.\n\t * @chainable\n\t */\n\tauth(authOrTokenOrUsername, opt_password) {\n\t\tthis.auth_ = authOrTokenOrUsername;\n\t\tif (!(this.auth_ instanceof Auth)) {\n\t\t\tthis.auth_ = Auth.create(authOrTokenOrUsername, opt_password);\n\t\t}\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the body that will be sent with this request.\n\t * @param {*} body\n\t * @chainable\n\t */\n\tbody(body) {\n\t\tthis.body_ = body;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Converts the given body object to query params.\n\t * @param {!ClientRequest} clientRequest\n\t * @param {*} body\n\t * @protected\n\t */\n\tconvertBodyToParams_(clientRequest, body) {\n\t\tif (core.isString(body)) {\n\t\t\tbody = {\n\t\t\t\tbody: body\n\t\t\t};\n\t\t} else if (body instanceof Embodied) {\n\t\t\tbody = body.body();\n\t\t}\n\t\tObject.keys(body || {}).forEach(name => clientRequest.param(name, body[name]));\n\t}\n\n\t/**\n\t * Sets this request's query type to \"count\".\n\t * @chainnable\n\t */\n\tcount() {\n\t\tthis.getOrCreateQuery_().type('count');\n\t\treturn this;\n\t}\n\n\t/**\n\t * Creates client request and encode.\n\t * @param {string} method\n\t * @param {*} body\n\t * @return {!ClientRequest} clientRequest\n\t * @protected\n\t */\n\tcreateClientRequest_(method, body) {\n\t\tvar clientRequest = new ClientRequest();\n\n\t\tclientRequest.body(body || this.body_);\n\n\t\tif (!core.isDefAndNotNull(clientRequest.body())) {\n\t\t\tif (this.query_) {\n\t\t\t\tclientRequest.body(this.query_.body());\n\t\t\t} else if (this.formData_) {\n\t\t\t\tclientRequest.body(this.formData_);\n\t\t\t}\n\t\t}\n\n\t\tclientRequest.method(method);\n\t\tclientRequest.headers(this.headers());\n\t\tclientRequest.params(this.params());\n\t\tclientRequest.url(this.url());\n\n\t\tthis.encode(clientRequest);\n\n\t\treturn clientRequest;\n\t}\n\n\t/**\n\t * Decodes clientResponse body, parsing the body for example.\n\t * @param {!ClientResponse} clientResponse The response object to be decoded.\n\t * @return {!ClientResponse} The decoded response.\n\t */\n\tdecode(clientResponse) {\n\t\tif (Launchpad.isContentTypeJson(clientResponse)) {\n\t\t\ttry {\n\t\t\t\tclientResponse.body(JSON.parse(clientResponse.body()));\n\t\t\t} catch (err) {}\n\t\t}\n\t\treturn clientResponse;\n\t}\n\n\t/**\n\t * Sends message with the DELETE http verb.\n\t * @param {string=} opt_body Content to be sent as the request's body.\n\t * @return {!Promise}\n\t */\n\tdelete(opt_body) {\n\t\treturn this.sendAsync('DELETE', opt_body);\n\t}\n\n\t/**\n\t * Encodes the given {@link ClientRequest}, converting its body to an appropriate\n\t * format for example.\n\t * @param {!ClientRequest} clientRequest The request object to encode.\n\t * @return {!ClientRequest} The encoded request.\n\t */\n\tencode(clientRequest) {\n\t\tvar body = clientRequest.body();\n\n\t\tif (core.isElement(body)) {\n\t\t\tbody = new FormData(body);\n\t\t\tclientRequest.body(body);\n\t\t}\n\n\t\tbody = this.wrapWithQuery_(body);\n\t\tif (clientRequest.method() === 'GET') {\n\t\t\tthis.convertBodyToParams_(clientRequest, body);\n\t\t\tclientRequest.removeBody();\n\t\t\tbody = null;\n\t\t}\n\n\t\tif (body instanceof FormData) {\n\t\t\tclientRequest.headers().remove('content-type');\n\t\t} else if (body instanceof Embodied) {\n\t\t\tclientRequest.body(body.toString());\n\t\t} else if (Launchpad.isContentTypeJson(clientRequest)) {\n\t\t\tclientRequest.body(JSON.stringify(clientRequest.body()));\n\t\t}\n\n\t\tthis.encodeParams_(clientRequest);\n\t\tthis.resolveAuthentication_(clientRequest);\n\n\t\treturn clientRequest;\n\t}\n\n\t/**\n\t * Encodes the params for the given request, according to their types.\n\t * @param {!ClientRequest} clientRequest\n\t * @protected\n\t */\n\tencodeParams_(clientRequest) {\n\t\tvar params = clientRequest.params();\n\t\tparams.names().forEach(function(name) {\n\t\t\tvar values = params.getAll(name);\n\t\t\tvalues.forEach(function(value, index) {\n\t\t\t\tif (value instanceof Embodied) {\n\t\t\t\t\tvalue = value.toString();\n\t\t\t\t} else if (core.isObject(value) || (value instanceof Array)) {\n\t\t\t\t\tvalue = JSON.stringify(value);\n\t\t\t\t}\n\t\t\t\tvalues[index] = value;\n\t\t\t});\n\t\t});\n\t}\n\n\t/**\n\t * Adds a filter to this request's {@link Query}.\n\t * @param {!Filter|string} fieldOrFilter Either a Filter instance or the\n\t * name of the field to filter by.\n\t * @param {*=} opt_operatorOrValue Either the field's operator or its value.\n\t * @param {*=} opt_value The filter's value.\n\t * @chainable\n\t */\n\tfilter(fieldOrFilter, opt_operatorOrValue, opt_value) {\n\t\tthis.getOrCreateQuery_().filter(fieldOrFilter, opt_operatorOrValue, opt_value);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Adds a key/value pair to be sent via the body in a `multipart/form-data` format.\n\t * If the body is set by other means (for example, through the `body` method), this\n\t * will be ignored.\n\t * @param {string} name\n\t * @param {*} value\n\t * @chainable\n\t */\n\tform(name, value) {\n\t\tif (!this.formData_) {\n\t\t\tthis.formData_ = new FormData();\n\t\t}\n\t\tthis.formData_.append(name, value);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sends message with the GET http verb.\n\t * @param {*=} opt_params Params to be added to the request url.\n\t * @return {!Promise}\n\t */\n\tget(opt_params) {\n\t\treturn this.sendAsync('GET', opt_params);\n\t}\n\n\t/**\n\t * Gets the currently used {@link Query} object. If none exists yet,\n\t * a new one is created.\n\t * @return {!Query}\n\t * @protected\n\t */\n\tgetOrCreateQuery_() {\n\t\tif (!this.query_) {\n\t\t\tthis.query_ = new Query();\n\t\t}\n\t\treturn this.query_;\n\t}\n\n\t/**\n\t * Adds a header. If the header with the same name already exists, it will\n\t * not be overwritten, but new value will be stored. The order is preserved.\n\t * @param {string} name\n\t * @param {*} value\n\t * @chainable\n\t */\n\theader(name, value) {\n\t\tif (arguments.length !== 2) {\n\t\t\tthrow new Error('Invalid arguments');\n\t\t}\n\t\tthis.headers_.set(name, value);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Gets the headers.\n\t * @return {!MultiMap}\n\t */\n\theaders() {\n\t\treturn this.headers_;\n\t}\n\n\t/**\n\t * Adds a highlight entry to this request's {@link Query} instance.\n\t * @param {string} field The field's name.\n\t * @chainable\n\t */\n\thighlight(field) {\n\t\tthis.getOrCreateQuery_().highlight(field);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the limit for this request's {@link Query}.\n\t * @param {number} limit The max amount of entries that this request should return.\n\t * @chainable\n\t */\n\tlimit(limit) {\n\t\tthis.getOrCreateQuery_().limit(limit);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the offset for this request's {@link Query}.\n\t * @param {number} offset The index of the first entry that should be returned\n\t * by this query.\n\t * @chainable\n\t */\n\toffset(offset) {\n\t\tthis.getOrCreateQuery_().offset(offset);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Adds a query. If the query with the same name already exists, it will not\n\t * be overwritten, but new value will be stored. The order is preserved.\n\t * @param {string} name\n\t * @param {*} value\n\t * @chainable\n\t */\n\tparam(name, value) {\n\t\tif (arguments.length !== 2) {\n\t\t\tthrow new Error('Invalid arguments');\n\t\t}\n\t\tthis.params_.set(name, value);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Gets the query strings map.\n\t * @return {!MultiMap}\n\t */\n\tparams() {\n\t\treturn this.params_;\n\t}\n\n\t/**\n\t * Sends message with the PATCH http verb.\n\t * @param {string=} opt_body Content to be sent as the request's body.\n\t * @return {!Promise}\n\t */\n\tpatch(opt_body) {\n\t\treturn this.sendAsync('PATCH', opt_body);\n\t}\n\n\t/**\n\t * Creates a new {@link Launchpad} instance for handling the url resulting in the\n\t * union of the current url with the given paths.\n\t * @param {...string} paths Any number of paths.\n\t * @return {!Launchpad} A new {@link Launchpad} instance for handling the given paths.\n\t */\n\tpath(...paths) {\n\t\treturn new Launchpad(this.url(), ...paths).use(this.customTransport_);\n\t}\n\n\t/**\n\t * Sends message with the POST http verb.\n\t * @param {string=} opt_body Content to be sent as the request's body.\n\t * @return {!Promise}\n\t */\n\tpost(opt_body) {\n\t\treturn this.sendAsync('POST', opt_body);\n\t}\n\n\t/**\n\t * Sends message with the PUT http verb.\n\t * @param {string=} opt_body Content to be sent as the request's body.\n\t * @return {!Promise}\n\t */\n\tput(opt_body) {\n\t\treturn this.sendAsync('PUT', opt_body);\n\t}\n\n\t/**\n\t * Adds the authentication information to the request.\n\t * @param {!ClientRequest} clientRequest\n\t * @protected\n\t */\n\tresolveAuthentication_(clientRequest) {\n\t\tif (!this.auth_) {\n\t\t\treturn;\n\t\t}\n\t\tif (this.auth_.hasToken()) {\n\t\t\tclientRequest.header('Authorization', 'Bearer ' + this.auth_.token());\n\t\t} else {\n\t\t\tvar credentials = this.auth_.username() + ':' + this.auth_.password();\n\t\t\tclientRequest.header('Authorization', 'Basic ' + btoa(credentials));\n\t\t}\n\t}\n\n\t/**\n\t * Adds a search to this request's {@link Query} instance.\n\t * @param {!Filter|string} filterOrTextOrField If no other arguments\n\t * are passed to this function, this should be either a `Filter`\n\t * instance or a text to be used in a match filter. In both cases\n\t * the filter will be applied to all fields. Another option is to\n\t * pass this as a field name instead, together with other arguments\n\t * so the filter can be created.\n\t * @param {string=} opt_textOrOperator Either a text to be used in a\n\t * match filter, or the operator that should be used.\n\t * @param {*=} opt_value The value to be used by the filter. Should\n\t * only be passed if an operator was passed as the second argument.\n\t * @chainable\n\t */\n\tsearch(filterOrTextOrField, opt_textOrOperator, opt_value) {\n\t\tthis.getOrCreateQuery_().search(filterOrTextOrField, opt_textOrOperator, opt_value);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Uses transport to send request with given method name and body\n\t * asynchronously.\n\t * @param {string} method The HTTP method to be used when sending data.\n\t * @param {string} body Content to be sent as the request's body.\n\t * @return {!Promise} Deferred request.\n\t */\n\tsendAsync(method, body) {\n\t\tvar transport = this.customTransport_ || TransportFactory.instance().getDefault();\n\n\t\tvar clientRequest = this.createClientRequest_(method, body);\n\n\t\treturn transport.send(clientRequest).then(this.decode);\n\t}\n\n\t/**\n\t * Adds a sort query to this request's body.\n\t * @param {string} field The field that the query should be sorted by.\n\t * @param {string=} opt_direction The direction the sort operation should use.\n\t * If none is given, \"asc\" is used by default.\n\t * @chainnable\n\t */\n\tsort(field, opt_direction) {\n\t\tthis.getOrCreateQuery_().sort(field, opt_direction);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Static factory for creating launchpad client for the given url.\n\t * @param {string} url The url that the client should use for sending requests.\n\t */\n\tstatic url(url) {\n\t\treturn new Launchpad(url).use(this.customTransport_);\n\t}\n\n\t/**\n\t * Returns the URL used by this client.\n\t */\n\turl() {\n\t\treturn this.url_;\n\t}\n\n\t/**\n\t * Specifies {@link Transport} implementation.\n\t * @param {!Transport} transport The transport implementation that should be used.\n\t */\n\tuse(transport) {\n\t\tthis.customTransport_ = transport;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Creates new socket.io instance. The parameters passed to socket.io\n\t * constructor will be provided:\n\t *\n\t * ```javascript\n\t * Launchpad.url('http://domain:8080/path/a').watch({id: 'myId'}, {foo: true});\n\t * // Equals:\n\t * io('domain:8080/?url=path%2Fa%3Fid%3DmyId', {foo: true});\n\t * ```\n\t *\n\t * @param {Object=} opt_params Params to be sent with the Socket IO request.\n\t * @param {Object=} opt_options Object with Socket IO options.\n\t * @return {!io} Socket IO reference. Server events can be listened on it.\n\t */\n\twatch(opt_params, opt_options) {\n\t\tif (typeof io === 'undefined') {\n\t\t\tthrow new Error('Socket.io client not loaded');\n\t\t}\n\n\t\tvar clientRequest = this.createClientRequest_('GET', opt_params);\n\n\t\tvar url = Ajax.parseUrl(\n\t\t\tAjax.addParametersToUrlQueryString(clientRequest.url(), clientRequest.params()));\n\n\t\topt_options = opt_options || {\n\t\t\t\tforceNew: true\n\t\t};\n\t\topt_options.path = opt_options.path || url[1];\n\n\t\treturn io(url[0] + '?url=' + encodeURIComponent(url[1] + url[2]), opt_options);\n\t}\n\n\t/**\n\t * Wraps the given `Embodied` instance with a {@link Query} instance if needed.\n\t * @param {Embodied} embodied\n\t * @return {Embodied}\n\t * @protected\n\t */\n\twrapWithQuery_(embodied) {\n\t\tif (embodied instanceof Filter) {\n\t\t\tembodied = Query.filter(embodied);\n\t\t}\n\t\treturn embodied;\n\t}\n}\n\nLaunchpad.isContentTypeJson = function(clientMessage) {\n\tvar contentType = clientMessage.headers().get('content-type') || '';\n\treturn contentType.indexOf('application/json') === 0;\n};\n\nexport default Launchpad;\n","import Filter from './Filter';\nimport Geo from './Geo';\nimport Query from './Query';\nimport Range from './Range';\n\nif (typeof window !== undefined) {\n\twindow.Filter = Filter;\n\twindow.Geo = Geo;\n\twindow.Query = Query;\n\twindow.Range = Range;\n}\n"],"sourceRoot":"/source/"} \ No newline at end of file +{"version":3,"sources":["core.js","Transport.js","async.js","Promise.js","Ajax.js","Disposable.js","MultiMap.js","ClientMessage.js","ClientResponse.js","AjaxTransport.js","Auth.js","ClientRequest.js","Embodied.js","FilterBody.js","Geo.js","Range.js","Filter.js","Aggregation.js","Query.js","TransportFactory.js","Launchpad.js","globals.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,YAAY;;;;;;AAAC;;KAMP,IAAI;WAAJ,IAAI;qCAAJ,IAAI;;;;;;;;;;;;;;AAAJ,MAAI,CAWF,cAAc,6BAAG;AACvB,SAAM,KAAK,CAAC,+BAA+B,CAAC,CAAC;GAC7C;;;;;;;;;;;;AAbI,MAAI,CAwBF,2BAA2B,wCAAC,WAAW,EAAE,YAAY,EAAE;AAC7D,OAAI,cAAc,GAAG,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC,CAAC;AACjD,UAAO,WAAW,CAAC,SAAS,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,aAAa,CAAC,QAAQ,CAAC,EAAE;AAC/E,eAAW,GAAG,WAAW,CAAC,SAAS,CAAC;AACpC,kBAAc,CAAC,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC,CAAC;IAC/C;AACD,UAAO,cAAc,CAAC;GACtB;;;;;;;;;;AA/BI,MAAI,CAwCF,eAAe,4BAAC,EAAE,EAAE;AAC1B,OAAI,CAAC,EAAE,CAAC,IAAI,EAAE;AACb,QAAI,GAAG,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC;AACxB,MAAE,CAAC,IAAI,GAAG,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAA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,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC;GAC/E;;;;;;;;;AA9dI,WAAS,WAsed,cAAc,2BAAC,QAAQ,EAAE;AACxB,OAAI,QAAQ,YAAY,MAAM,EAAE;AAC/B,YAAQ,GAAG,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAClC;AACD,UAAO,QAAQ,CAAC;GAChB;;SA3eI,SAAS;;;AA8ef,UAAS,CAAC,iBAAiB,GAAG,UAAS,aAAa,EAAE;AACrD,MAAI,WAAW,GAAG,aAAa,CAAC,OAAO,EAAE,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC;AACpE,SAAO,WAAW,CAAC,OAAO,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC;EACrD,CAAC;;4BAEa,SAAS;;;;;KC5gBjB,SAAS;;AAEhB,KAAI,QAAO,MAAM,qDAAN,MAAM,OAAK,SAAS,EAAE;AAChC,QAAM,CAAC,SAAS,GAAG,SAAS,CAAC;EAC7B;;;;;KAJM,MAAM;KACN,GAAG;KACH,KAAK;KACL,KAAK;;AAEZ,KAAI,QAAO,MAAM,qDAAN,MAAM,OAAK,SAAS,EAAE;AAChC,QAAM,CAAC,MAAM,GAAG,MAAM,CAAC;AACvB,QAAM,CAAC,GAAG,GAAG,GAAG,CAAC;AACjB,QAAM,CAAC,KAAK,GAAG,KAAK,CAAC;AACrB,QAAM,CAAC,KAAK,GAAG,KAAK,CAAC;EACrB","file":"api.js","sourcesContent":["'use strict';\n\n/**\n * A collection of core utility functions.\n * @const\n */\nclass core {\n\t/**\n\t * When defining a class Foo with an abstract method bar(), you can do:\n\t * Foo.prototype.bar = core.abstractMethod\n\t *\n\t * Now if a subclass of Foo fails to override bar(), an error will be thrown\n\t * when bar() is invoked.\n\t *\n\t * @type {!Function}\n\t * @throws {Error} when invoked to indicate the method should be overridden.\n\t */\n\tstatic abstractMethod() {\n\t\tthrow Error('Unimplemented abstract method');\n\t}\n\n\t/**\n\t * Loops constructor super classes collecting its properties values. If\n\t * property is not available on the super class `undefined` will be\n\t * collected as value for the class hierarchy position.\n\t * @param {!function()} constructor Class constructor.\n\t * @param {string} propertyName Property name to be collected.\n\t * @return {Array.<*>} Array of collected values.\n\t * TODO(*): Rethink superclass loop.\n\t */\n\tstatic collectSuperClassesProperty(constructor, propertyName) {\n\t\tvar propertyValues = [constructor[propertyName]];\n\t\twhile (constructor.__proto__ && !constructor.__proto__.isPrototypeOf(Function)) {\n\t\t\tconstructor = constructor.__proto__;\n\t\t\tpropertyValues.push(constructor[propertyName]);\n\t\t}\n\t\treturn propertyValues;\n\t}\n\n\t/**\n\t * Gets the name of the given function. If the current browser doesn't\n\t * support the `name` property, this will calculate it from the function's\n\t * content string.\n\t * @param {!function()} fn\n\t * @return {string}\n\t */\n\tstatic getFunctionName(fn) {\n\t\tif (!fn.name) {\n\t\t\tvar str = fn.toString();\n\t\t\tfn.name = str.substring(9, str.indexOf('('));\n\t\t}\n\t\treturn fn.name;\n\t}\n\n\t/**\n\t * Gets an unique id. If `opt_object` argument is passed, the object is\n\t * mutated with an unique id. Consecutive calls with the same object\n\t * reference won't mutate the object again, instead the current object uid\n\t * returns. See {@link core.UID_PROPERTY}.\n\t * @type {opt_object} Optional object to be mutated with the uid. If not\n\t * specified this method only returns the uid.\n\t * @throws {Error} when invoked to indicate the method should be overridden.\n\t */\n\tstatic getUid(opt_object) {\n\t\tif (opt_object) {\n\t\t\treturn opt_object[core.UID_PROPERTY] ||\n\t\t\t\t(opt_object[core.UID_PROPERTY] = core.uniqueIdCounter_++);\n\t\t}\n\t\treturn core.uniqueIdCounter_++;\n\t}\n\n\t/**\n\t * The identity function. Returns its first argument.\n\t * @param {*=} opt_returnValue The single value that will be returned.\n\t * @return {?} The first argument.\n\t */\n\tstatic identityFunction(opt_returnValue) {\n\t\treturn opt_returnValue;\n\t}\n\n\t/**\n\t * Returns true if the specified value is a boolean.\n\t * @param {?} val Variable to test.\n\t * @return {boolean} Whether variable is boolean.\n\t */\n\tstatic isBoolean(val) {\n\t\treturn typeof val === 'boolean';\n\t}\n\n\t/**\n\t * Returns true if the specified value is not undefined.\n\t * @param {?} val Variable to test.\n\t * @return {boolean} Whether variable is defined.\n\t */\n\tstatic isDef(val) {\n\t\treturn val !== undefined;\n\t}\n\n\t/**\n\t * Returns true if value is not undefined or null.\n\t * @param {*} val\n\t * @return {Boolean}\n\t */\n\tstatic isDefAndNotNull(val) {\n\t\treturn core.isDef(val) && !core.isNull(val);\n\t}\n\n\t/**\n\t * Returns true if value is a document.\n\t * @param {*} val\n\t * @return {Boolean}\n\t */\n\tstatic isDocument(val) {\n\t\treturn val && typeof val === 'object' && val.nodeType === 9;\n\t}\n\n\t/**\n\t * Returns true if value is a dom element.\n\t * @param {*} val\n\t * @return {Boolean}\n\t */\n\tstatic isElement(val) {\n\t\treturn val && typeof val === 'object' && val.nodeType === 1;\n\t}\n\n\t/**\n\t * Returns true if the specified value is a function.\n\t * @param {?} val Variable to test.\n\t * @return {boolean} Whether variable is a function.\n\t */\n\tstatic isFunction(val) {\n\t\treturn typeof val === 'function';\n\t}\n\n\t/**\n\t * Returns true if value is null.\n\t * @param {*} val\n\t * @return {Boolean}\n\t */\n\tstatic isNull(val) {\n\t\treturn val === null;\n\t}\n\n\t/**\n\t * Returns true if the specified value is a number.\n\t * @param {?} val Variable to test.\n\t * @return {boolean} Whether variable is a number.\n\t */\n\tstatic isNumber(val) {\n\t\treturn typeof val === 'number';\n\t}\n\n\t/**\n\t * Returns true if value is a window.\n\t * @param {*} val\n\t * @return {Boolean}\n\t */\n\tstatic isWindow(val) {\n\t\treturn val !== null && val === val.window;\n\t}\n\n\t/**\n\t * Returns true if the specified value is an object. This includes arrays\n\t * and functions.\n\t * @param {?} val Variable to test.\n\t * @return {boolean} Whether variable is an object.\n\t */\n\tstatic isObject(val) {\n\t\tvar type = typeof val;\n\t\treturn type === 'object' && val !== null || type === 'function';\n\t}\n\n\t/**\n\t * Returns true if value is a string.\n\t * @param {*} val\n\t * @return {Boolean}\n\t */\n\tstatic isString(val) {\n\t\treturn typeof val === 'string';\n\t}\n\n\t/**\n\t * Merges the values of a static property a class with the values of that\n\t * property for all its super classes, and stores it as a new static\n\t * property of that class. If the static property already existed, it won't\n\t * be recalculated.\n\t * @param {!function()} constructor Class constructor.\n\t * @param {string} propertyName Property name to be collected.\n\t * @param {function(*, *):*=} opt_mergeFn Function that receives an array filled\n\t * with the values of the property for the current class and all its super classes.\n\t * Should return the merged value to be stored on the current class.\n\t * @return {boolean} Returns true if merge happens, false otherwise.\n\t */\n\tstatic mergeSuperClassesProperty(constructor, propertyName, opt_mergeFn) {\n\t\tvar mergedName = propertyName + '_MERGED';\n\t\tif (constructor.hasOwnProperty(mergedName)) {\n\t\t\treturn false;\n\t\t}\n\n\t\tvar merged = core.collectSuperClassesProperty(constructor, propertyName);\n\t\tif (opt_mergeFn) {\n\t\t\tmerged = opt_mergeFn(merged);\n\t\t}\n\t\tconstructor[mergedName] = merged;\n\t\treturn true;\n\t}\n\n\t/**\n\t * Null function used for default values of callbacks, etc.\n\t * @return {void} Nothing.\n\t */\n\tstatic nullFunction() {}\n}\n\n/**\n * Unique id property prefix.\n * @type {String}\n * @protected\n */\ncore.UID_PROPERTY = 'core_' + (Date.now() % 1e9) + '' + ((Math.random() * 1e9) >>> 0);\n\n/**\n * Counter for unique id.\n * @type {Number}\n * @private\n */\ncore.uniqueIdCounter_ = 1;\n\nexport default core;\n","'use strict';\n\n/**\n * Provides a convenient interface for data transport.\n * @interface\n */\nclass Transport {\n\n\t/**\n\t * Sends a message for the specified client.\n\t * @param {!ClientRequest} clientRequest\n\t * @return {!Promise} Deferred request.\n\t */\n\tsend() {}\n\n}\n\nexport default Transport;\n","/*!\n * Polyfill from Google's Closure Library.\n * Copyright 2013 The Closure Library Authors. All Rights Reserved.\n */\n\n'use strict';\n\nvar async = {};\n\n\n/**\n * Throw an item without interrupting the current execution context. For\n * example, if processing a group of items in a loop, sometimes it is useful\n * to report an error while still allowing the rest of the batch to be\n * processed.\n * @param {*} exception\n */\nasync.throwException = function(exception) {\n\t// Each throw needs to be in its own context.\n\tasync.nextTick(function() {\n\t\tthrow exception;\n\t});\n};\n\n\n/**\n * Fires the provided callback just before the current callstack unwinds, or as\n * soon as possible after the current JS execution context.\n * @param {function(this:THIS)} callback\n * @param {THIS=} opt_context Object to use as the \"this value\" when calling\n * the provided function.\n * @template THIS\n */\nasync.run = function(callback, opt_context) {\n\tif (!async.run.workQueueScheduled_) {\n\t\t// Nothing is currently scheduled, schedule it now.\n\t\tasync.nextTick(async.run.processWorkQueue);\n\t\tasync.run.workQueueScheduled_ = true;\n\t}\n\n\tasync.run.workQueue_.push(\n\t\tnew async.run.WorkItem_(callback, opt_context));\n};\n\n\n/** @private {boolean} */\nasync.run.workQueueScheduled_ = false;\n\n\n/** @private {!Array.} */\nasync.run.workQueue_ = [];\n\n/**\n * Run any pending async.run work items. This function is not intended\n * for general use, but for use by entry point handlers to run items ahead of\n * async.nextTick.\n */\nasync.run.processWorkQueue = function() {\n\t// NOTE: additional work queue items may be pushed while processing.\n\twhile (async.run.workQueue_.length) {\n\t\t// Don't let the work queue grow indefinitely.\n\t\tvar workItems = async.run.workQueue_;\n\t\tasync.run.workQueue_ = [];\n\t\tfor (var i = 0; i < workItems.length; i++) {\n\t\t\tvar workItem = workItems[i];\n\t\t\ttry {\n\t\t\t\tworkItem.fn.call(workItem.scope);\n\t\t\t} catch (e) {\n\t\t\t\tasync.throwException(e);\n\t\t\t}\n\t\t}\n\t}\n\n\t// There are no more work items, reset the work queue.\n\tasync.run.workQueueScheduled_ = false;\n};\n\n\n/**\n * @constructor\n * @final\n * @struct\n * @private\n *\n * @param {function()} fn\n * @param {Object|null|undefined} scope\n */\nasync.run.WorkItem_ = function(fn, scope) {\n\t/** @const */\n\tthis.fn = fn;\n\t/** @const */\n\tthis.scope = scope;\n};\n\n\n/**\n * Fires the provided callbacks as soon as possible after the current JS\n * execution context. setTimeout(…, 0) always takes at least 5ms for legacy\n * reasons.\n * @param {function(this:SCOPE)} callback Callback function to fire as soon as\n * possible.\n * @param {SCOPE=} opt_context Object in whose scope to call the listener.\n * @template SCOPE\n */\nasync.nextTick = function(callback, opt_context) {\n\tvar cb = callback;\n\tif (opt_context) {\n\t\tcb = callback.bind(opt_context);\n\t}\n\tcb = async.nextTick.wrapCallback_(cb);\n\t// Introduced and currently only supported by IE10.\n\t// Verify if variable is defined on the current runtime (i.e., node, browser).\n\t// Can't use typeof enclosed in a function (such as core.isFunction) or an\n\t// exception will be thrown when the function is called on an environment\n\t// where the variable is undefined.\n\tif (typeof setImmediate === 'function') {\n\t\tsetImmediate(cb);\n\t\treturn;\n\t}\n\t// Look for and cache the custom fallback version of setImmediate.\n\tif (!async.nextTick.setImmediate_) {\n\t\tasync.nextTick.setImmediate_ = async.nextTick.getSetImmediateEmulator_();\n\t}\n\tasync.nextTick.setImmediate_(cb);\n};\n\n\n/**\n * Cache for the setImmediate implementation.\n * @type {function(function())}\n * @private\n */\nasync.nextTick.setImmediate_ = null;\n\n\n/**\n * Determines the best possible implementation to run a function as soon as\n * the JS event loop is idle.\n * @return {function(function())} The \"setImmediate\" implementation.\n * @private\n */\nasync.nextTick.getSetImmediateEmulator_ = function() {\n\t// Create a private message channel and use it to postMessage empty messages\n\t// to ourselves.\n\tvar Channel;\n\n\t// Verify if variable is defined on the current runtime (i.e., node, browser).\n\t// Can't use typeof enclosed in a function (such as core.isFunction) or an\n\t// exception will be thrown when the function is called on an environment\n\t// where the variable is undefined.\n\tif (typeof MessageChannel === 'function') {\n\t\tChannel = MessageChannel;\n\t}\n\n\t// If MessageChannel is not available and we are in a browser, implement\n\t// an iframe based polyfill in browsers that have postMessage and\n\t// document.addEventListener. The latter excludes IE8 because it has a\n\t// synchronous postMessage implementation.\n\tif (typeof Channel === 'undefined' && typeof window !== 'undefined' &&\n\t\twindow.postMessage && window.addEventListener) {\n\t\t/** @constructor */\n\t\tChannel = function() {\n\t\t\t// Make an empty, invisible iframe.\n\t\t\tvar iframe = document.createElement('iframe');\n\t\t\tiframe.style.display = 'none';\n\t\t\tiframe.src = '';\n\t\t\tdocument.documentElement.appendChild(iframe);\n\t\t\tvar win = iframe.contentWindow;\n\t\t\tvar doc = win.document;\n\t\t\tdoc.open();\n\t\t\tdoc.write('');\n\t\t\tdoc.close();\n\t\t\tvar message = 'callImmediate' + Math.random();\n\t\t\tvar origin = win.location.protocol + '//' + win.location.host;\n\t\t\tvar onmessage = function(e) {\n\t\t\t\t// Validate origin and message to make sure that this message was\n\t\t\t\t// intended for us.\n\t\t\t\tif (e.origin !== origin && e.data !== message) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tthis.port1.onmessage();\n\t\t\t}.bind(this);\n\t\t\twin.addEventListener('message', onmessage, false);\n\t\t\tthis.port1 = {};\n\t\t\tthis.port2 = {\n\t\t\t\tpostMessage: function() {\n\t\t\t\t\twin.postMessage(message, origin);\n\t\t\t\t}\n\t\t\t};\n\t\t};\n\t}\n\tif (typeof Channel !== 'undefined') {\n\t\tvar channel = new Channel();\n\t\t// Use a fifo linked list to call callbacks in the right order.\n\t\tvar head = {};\n\t\tvar tail = head;\n\t\tchannel.port1.onmessage = function() {\n\t\t\thead = head.next;\n\t\t\tvar cb = head.cb;\n\t\t\thead.cb = null;\n\t\t\tcb();\n\t\t};\n\t\treturn function(cb) {\n\t\t\ttail.next = {\n\t\t\t\tcb: cb\n\t\t\t};\n\t\t\ttail = tail.next;\n\t\t\tchannel.port2.postMessage(0);\n\t\t};\n\t}\n\t// Implementation for IE6-8: Script elements fire an asynchronous\n\t// onreadystatechange event when inserted into the DOM.\n\tif (typeof document !== 'undefined' && 'onreadystatechange' in\n\t\tdocument.createElement('script')) {\n\t\treturn function(cb) {\n\t\t\tvar script = document.createElement('script');\n\t\t\tscript.onreadystatechange = function() {\n\t\t\t\t// Clean up and call the callback.\n\t\t\t\tscript.onreadystatechange = null;\n\t\t\t\tscript.parentNode.removeChild(script);\n\t\t\t\tscript = null;\n\t\t\t\tcb();\n\t\t\t\tcb = null;\n\t\t\t};\n\t\t\tdocument.documentElement.appendChild(script);\n\t\t};\n\t}\n\t// Fall back to setTimeout with 0. In browsers this creates a delay of 5ms\n\t// or more.\n\treturn function(cb) {\n\t\tsetTimeout(cb, 0);\n\t};\n};\n\n\n/**\n * Helper function that is overrided to protect callbacks with entry point\n * monitor if the application monitors entry points.\n * @param {function()} callback Callback function to fire as soon as possible.\n * @return {function()} The wrapped callback.\n * @private\n */\nasync.nextTick.wrapCallback_ = function(opt_returnValue) {\n\treturn opt_returnValue;\n};\n\nexport default async;\n","/*!\n * Promises polyfill from Google's Closure Library.\n *\n * Copyright 2013 The Closure Library Authors. All Rights Reserved.\n *\n * NOTE(eduardo): Promise support is not ready on all supported browsers,\n * therefore core.js is temporarily using Google's promises as polyfill. It\n * supports cancellable promises and has clean and fast implementation.\n */\n\n'use strict';\n\nimport core from 'bower:metal/src/core';\nimport async from 'bower:metal/src/async/async';\n\n/**\n * Provides a more strict interface for Thenables in terms of\n * http://promisesaplus.com for interop with {@see CancellablePromise}.\n *\n * @interface\n * @extends {IThenable.}\n * @template TYPE\n */\nvar Thenable = function() {};\n\n/**\n * Adds callbacks that will operate on the result of the Thenable, returning a\n * new child Promise.\n *\n * If the Thenable is fulfilled, the {@code onFulfilled} callback will be\n * invoked with the fulfillment value as argument, and the child Promise will\n * be fulfilled with the return value of the callback. If the callback throws\n * an exception, the child Promise will be rejected with the thrown value\n * instead.\n *\n * If the Thenable is rejected, the {@code onRejected} callback will be invoked\n * with the rejection reason as argument, and the child Promise will be rejected\n * with the return value of the callback or thrown value.\n *\n * @param {?(function(this:THIS, TYPE):\n * (RESULT|IThenable.|Thenable))=} opt_onFulfilled A\n * function that will be invoked with the fulfillment value if the Promise\n * is fullfilled.\n * @param {?(function(*): *)=} opt_onRejected A function that will be invoked\n * with the rejection reason if the Promise is rejected.\n * @param {THIS=} opt_context An optional context object that will be the\n * execution context for the callbacks. By default, functions are executed\n * with the default this.\n * @return {!CancellablePromise.} A new Promise that will receive the\n * result of the fulfillment or rejection callback.\n * @template RESULT,THIS\n */\nThenable.prototype.then = function() {};\n\n\n/**\n * An expando property to indicate that an object implements\n * {@code Thenable}.\n *\n * {@see addImplementation}.\n *\n * @const\n */\nThenable.IMPLEMENTED_BY_PROP = '$goog_Thenable';\n\n\n/**\n * Marks a given class (constructor) as an implementation of Thenable, so\n * that we can query that fact at runtime. The class must have already\n * implemented the interface.\n * Exports a 'then' method on the constructor prototype, so that the objects\n * also implement the extern {@see Thenable} interface for interop with\n * other Promise implementations.\n * @param {function(new:Thenable,...[?])} ctor The class constructor. The\n * corresponding class must have already implemented the interface.\n */\nThenable.addImplementation = function(ctor) {\n ctor.prototype.then = ctor.prototype.then;\n ctor.prototype.$goog_Thenable = true;\n};\n\n\n/**\n * @param {*} object\n * @return {boolean} Whether a given instance implements {@code Thenable}.\n * The class/superclass of the instance must call {@code addImplementation}.\n */\nThenable.isImplementedBy = function(object) {\n if (!object) {\n return false;\n }\n try {\n return !!object.$goog_Thenable;\n } catch (e) {\n // Property access seems to be forbidden.\n return false;\n }\n};\n\n\n/**\n * Like bind(), except that a 'this object' is not required. Useful when the\n * target function is already bound.\n *\n * Usage:\n * var g = partial(f, arg1, arg2);\n * g(arg3, arg4);\n *\n * @param {Function} fn A function to partially apply.\n * @param {...*} var_args Additional arguments that are partially applied to fn.\n * @return {!Function} A partially-applied form of the function bind() was\n * invoked as a method of.\n */\nvar partial = function(fn) {\n var args = Array.prototype.slice.call(arguments, 1);\n return function() {\n // Clone the array (with slice()) and append additional arguments\n // to the existing arguments.\n var newArgs = args.slice();\n newArgs.push.apply(newArgs, arguments);\n return fn.apply(this, newArgs);\n };\n};\n\n/**\n * Promises provide a result that may be resolved asynchronously. A Promise may\n * be resolved by being fulfilled or rejected with a value, which will be known\n * as the fulfillment value or the rejection reason. Whether fulfilled or\n * rejected, the Promise result is immutable once it is set.\n *\n * Promises may represent results of any type, including undefined. Rejection\n * reasons are typically Errors, but may also be of any type. Closure Promises\n * allow for optional type annotations that enforce that fulfillment values are\n * of the appropriate types at compile time.\n *\n * The result of a Promise is accessible by calling {@code then} and registering\n * {@code onFulfilled} and {@code onRejected} callbacks. Once the Promise\n * resolves, the relevant callbacks are invoked with the fulfillment value or\n * rejection reason as argument. Callbacks are always invoked in the order they\n * were registered, even when additional {@code then} calls are made from inside\n * another callback. A callback is always run asynchronously sometime after the\n * scope containing the registering {@code then} invocation has returned.\n *\n * If a Promise is resolved with another Promise, the first Promise will block\n * until the second is resolved, and then assumes the same result as the second\n * Promise. This allows Promises to depend on the results of other Promises,\n * linking together multiple asynchronous operations.\n *\n * This implementation is compatible with the Promises/A+ specification and\n * passes that specification's conformance test suite. A Closure Promise may be\n * resolved with a Promise instance (or sufficiently compatible Promise-like\n * object) created by other Promise implementations. From the specification,\n * Promise-like objects are known as \"Thenables\".\n *\n * @see http://promisesaplus.com/\n *\n * @param {function(\n * this:RESOLVER_CONTEXT,\n * function((TYPE|IThenable.|Thenable)),\n * function(*)): void} resolver\n * Initialization function that is invoked immediately with {@code resolve}\n * and {@code reject} functions as arguments. The Promise is resolved or\n * rejected with the first argument passed to either function.\n * @param {RESOLVER_CONTEXT=} opt_context An optional context for executing the\n * resolver function. If unspecified, the resolver function will be executed\n * in the default scope.\n * @constructor\n * @struct\n * @final\n * @implements {Thenable.}\n * @template TYPE,RESOLVER_CONTEXT\n */\nvar CancellablePromise = function(resolver, opt_context) {\n /**\n * The internal state of this Promise. Either PENDING, FULFILLED, REJECTED, or\n * BLOCKED.\n * @private {CancellablePromise.State_}\n */\n this.state_ = CancellablePromise.State_.PENDING;\n\n /**\n * The resolved result of the Promise. Immutable once set with either a\n * fulfillment value or rejection reason.\n * @private {*}\n */\n this.result_ = undefined;\n\n /**\n * For Promises created by calling {@code then()}, the originating parent.\n * @private {CancellablePromise}\n */\n this.parent_ = null;\n\n /**\n * The list of {@code onFulfilled} and {@code onRejected} callbacks added to\n * this Promise by calls to {@code then()}.\n * @private {Array.}\n */\n this.callbackEntries_ = null;\n\n /**\n * Whether the Promise is in the queue of Promises to execute.\n * @private {boolean}\n */\n this.executing_ = false;\n\n if (CancellablePromise.UNHANDLED_REJECTION_DELAY > 0) {\n /**\n * A timeout ID used when the {@code UNHANDLED_REJECTION_DELAY} is greater\n * than 0 milliseconds. The ID is set when the Promise is rejected, and\n * cleared only if an {@code onRejected} callback is invoked for the\n * Promise (or one of its descendants) before the delay is exceeded.\n *\n * If the rejection is not handled before the timeout completes, the\n * rejection reason is passed to the unhandled rejection handler.\n * @private {number}\n */\n this.unhandledRejectionId_ = 0;\n } else if (CancellablePromise.UNHANDLED_REJECTION_DELAY === 0) {\n /**\n * When the {@code UNHANDLED_REJECTION_DELAY} is set to 0 milliseconds, a\n * boolean that is set if the Promise is rejected, and reset to false if an\n * {@code onRejected} callback is invoked for the Promise (or one of its\n * descendants). If the rejection is not handled before the next timestep,\n * the rejection reason is passed to the unhandled rejection handler.\n * @private {boolean}\n */\n this.hadUnhandledRejection_ = false;\n }\n\n try {\n var self = this;\n resolver.call(\n opt_context, function(value) {\n self.resolve_(CancellablePromise.State_.FULFILLED, value);\n }, function(reason) {\n self.resolve_(CancellablePromise.State_.REJECTED, reason);\n });\n } catch (e) {\n this.resolve_(CancellablePromise.State_.REJECTED, e);\n }\n};\n\n/**\n * @define {number} The delay in milliseconds before a rejected Promise's reason\n * is passed to the rejection handler. By default, the rejection handler\n * rethrows the rejection reason so that it appears in the developer console or\n * {@code window.onerror} handler.\n *\n * Rejections are rethrown as quickly as possible by default. A negative value\n * disables rejection handling entirely.\n */\nCancellablePromise.UNHANDLED_REJECTION_DELAY = 0;\n\n\n/**\n * The possible internal states for a Promise. These states are not directly\n * observable to external callers.\n * @enum {number}\n * @private\n */\nCancellablePromise.State_ = {\n /** The Promise is waiting for resolution. */\n PENDING: 0,\n\n /** The Promise is blocked waiting for the result of another Thenable. */\n BLOCKED: 1,\n\n /** The Promise has been resolved with a fulfillment value. */\n FULFILLED: 2,\n\n /** The Promise has been resolved with a rejection reason. */\n REJECTED: 3\n};\n\n\n/**\n * Typedef for entries in the callback chain. Each call to {@code then},\n * {@code thenCatch}, or {@code thenAlways} creates an entry containing the\n * functions that may be invoked once the Promise is resolved.\n *\n * @typedef {{\n * child: CancellablePromise,\n * onFulfilled: function(*),\n * onRejected: function(*)\n * }}\n * @private\n */\nCancellablePromise.CallbackEntry_ = null;\n\n\n/**\n * @param {(TYPE|Thenable.|Thenable)=} opt_value\n * @return {!CancellablePromise.} A new Promise that is immediately resolved\n * with the given value.\n * @template TYPE\n */\nCancellablePromise.resolve = function(opt_value) {\n return new CancellablePromise(function(resolve) {\n resolve(opt_value);\n });\n};\n\n\n/**\n * @param {*=} opt_reason\n * @return {!CancellablePromise} A new Promise that is immediately rejected with the\n * given reason.\n */\nCancellablePromise.reject = function(opt_reason) {\n return new CancellablePromise(function(resolve, reject) {\n reject(opt_reason);\n });\n};\n\n\n/**\n * @param {!Array.|Thenable)>} promises\n * @return {!CancellablePromise.} A Promise that receives the result of the\n * first Promise (or Promise-like) input to complete.\n * @template TYPE\n */\nCancellablePromise.race = function(promises) {\n return new CancellablePromise(function(resolve, reject) {\n if (!promises.length) {\n resolve(undefined);\n }\n for (var i = 0, promise; (promise = promises[i]); i++) {\n promise.then(resolve, reject);\n }\n });\n};\n\n\n/**\n * @param {!Array.|Thenable)>} promises\n * @return {!CancellablePromise.>} A Promise that receives a list of\n * every fulfilled value once every input Promise (or Promise-like) is\n * successfully fulfilled, or is rejected by the first rejection result.\n * @template TYPE\n */\nCancellablePromise.all = function(promises) {\n return new CancellablePromise(function(resolve, reject) {\n var toFulfill = promises.length;\n var values = [];\n\n if (!toFulfill) {\n resolve(values);\n return;\n }\n\n var onFulfill = function(index, value) {\n toFulfill--;\n values[index] = value;\n if (toFulfill === 0) {\n resolve(values);\n }\n };\n\n var onReject = function(reason) {\n reject(reason);\n };\n\n for (var i = 0, promise; (promise = promises[i]); i++) {\n promise.then(partial(onFulfill, i), onReject);\n }\n });\n};\n\n\n/**\n * @param {!Array.|Thenable)>} promises\n * @return {!CancellablePromise.} A Promise that receives the value of\n * the first input to be fulfilled, or is rejected with a list of every\n * rejection reason if all inputs are rejected.\n * @template TYPE\n */\nCancellablePromise.firstFulfilled = function(promises) {\n return new CancellablePromise(function(resolve, reject) {\n var toReject = promises.length;\n var reasons = [];\n\n if (!toReject) {\n resolve(undefined);\n return;\n }\n\n var onFulfill = function(value) {\n resolve(value);\n };\n\n var onReject = function(index, reason) {\n toReject--;\n reasons[index] = reason;\n if (toReject === 0) {\n reject(reasons);\n }\n };\n\n for (var i = 0, promise; (promise = promises[i]); i++) {\n promise.then(onFulfill, partial(onReject, i));\n }\n });\n};\n\n\n/**\n * Adds callbacks that will operate on the result of the Promise, returning a\n * new child Promise.\n *\n * If the Promise is fulfilled, the {@code onFulfilled} callback will be invoked\n * with the fulfillment value as argument, and the child Promise will be\n * fulfilled with the return value of the callback. If the callback throws an\n * exception, the child Promise will be rejected with the thrown value instead.\n *\n * If the Promise is rejected, the {@code onRejected} callback will be invoked\n * with the rejection reason as argument, and the child Promise will be rejected\n * with the return value (or thrown value) of the callback.\n *\n * @override\n */\nCancellablePromise.prototype.then = function(opt_onFulfilled, opt_onRejected, opt_context) {\n return this.addChildPromise_(\n core.isFunction(opt_onFulfilled) ? opt_onFulfilled : null,\n core.isFunction(opt_onRejected) ? opt_onRejected : null,\n opt_context);\n};\nThenable.addImplementation(CancellablePromise);\n\n\n/**\n * Adds a callback that will be invoked whether the Promise is fulfilled or\n * rejected. The callback receives no argument, and no new child Promise is\n * created. This is useful for ensuring that cleanup takes place after certain\n * asynchronous operations. Callbacks added with {@code thenAlways} will be\n * executed in the same order with other calls to {@code then},\n * {@code thenAlways}, or {@code thenCatch}.\n *\n * Since it does not produce a new child Promise, cancellation propagation is\n * not prevented by adding callbacks with {@code thenAlways}. A Promise that has\n * a cleanup handler added with {@code thenAlways} will be canceled if all of\n * its children created by {@code then} (or {@code thenCatch}) are canceled.\n *\n * @param {function(this:THIS): void} onResolved A function that will be invoked\n * when the Promise is resolved.\n * @param {THIS=} opt_context An optional context object that will be the\n * execution context for the callbacks. By default, functions are executed\n * in the global scope.\n * @return {!CancellablePromise.} This Promise, for chaining additional calls.\n * @template THIS\n */\nCancellablePromise.prototype.thenAlways = function(onResolved, opt_context) {\n var callback = function() {\n try {\n // Ensure that no arguments are passed to onResolved.\n onResolved.call(opt_context);\n } catch (err) {\n CancellablePromise.handleRejection_.call(null, err);\n }\n };\n\n this.addCallbackEntry_({\n child: null,\n onRejected: callback,\n onFulfilled: callback\n });\n return this;\n};\n\n\n/**\n * Adds a callback that will be invoked only if the Promise is rejected. This\n * is equivalent to {@code then(null, onRejected)}.\n *\n * @param {!function(this:THIS, *): *} onRejected A function that will be\n * invoked with the rejection reason if the Promise is rejected.\n * @param {THIS=} opt_context An optional context object that will be the\n * execution context for the callbacks. By default, functions are executed\n * in the global scope.\n * @return {!CancellablePromise} A new Promise that will receive the result of the\n * callback.\n * @template THIS\n */\nCancellablePromise.prototype.thenCatch = function(onRejected, opt_context) {\n return this.addChildPromise_(null, onRejected, opt_context);\n};\n\n/**\n * Alias of {@link CancellablePromise.prototype.thenCatch}\n */\nCancellablePromise.prototype.catch = CancellablePromise.prototype.thenCatch;\n\n\n/**\n * Cancels the Promise if it is still pending by rejecting it with a cancel\n * Error. No action is performed if the Promise is already resolved.\n *\n * All child Promises of the canceled Promise will be rejected with the same\n * cancel error, as with normal Promise rejection. If the Promise to be canceled\n * is the only child of a pending Promise, the parent Promise will also be\n * canceled. Cancellation may propagate upward through multiple generations.\n *\n * @param {string=} opt_message An optional debugging message for describing the\n * cancellation reason.\n */\nCancellablePromise.prototype.cancel = function(opt_message) {\n if (this.state_ === CancellablePromise.State_.PENDING) {\n async.run(function() {\n var err = new CancellablePromise.CancellationError(opt_message);\n err.IS_CANCELLATION_ERROR = true;\n this.cancelInternal_(err);\n }, this);\n }\n};\n\n\n/**\n * Cancels this Promise with the given error.\n *\n * @param {!Error} err The cancellation error.\n * @private\n */\nCancellablePromise.prototype.cancelInternal_ = function(err) {\n if (this.state_ === CancellablePromise.State_.PENDING) {\n if (this.parent_) {\n // Cancel the Promise and remove it from the parent's child list.\n this.parent_.cancelChild_(this, err);\n } else {\n this.resolve_(CancellablePromise.State_.REJECTED, err);\n }\n }\n};\n\n\n/**\n * Cancels a child Promise from the list of callback entries. If the Promise has\n * not already been resolved, reject it with a cancel error. If there are no\n * other children in the list of callback entries, propagate the cancellation\n * by canceling this Promise as well.\n *\n * @param {!CancellablePromise} childPromise The Promise to cancel.\n * @param {!Error} err The cancel error to use for rejecting the Promise.\n * @private\n */\nCancellablePromise.prototype.cancelChild_ = function(childPromise, err) {\n if (!this.callbackEntries_) {\n return;\n }\n var childCount = 0;\n var childIndex = -1;\n\n // Find the callback entry for the childPromise, and count whether there are\n // additional child Promises.\n for (var i = 0, entry; (entry = this.callbackEntries_[i]); i++) {\n var child = entry.child;\n if (child) {\n childCount++;\n if (child === childPromise) {\n childIndex = i;\n }\n if (childIndex >= 0 && childCount > 1) {\n break;\n }\n }\n }\n\n // If the child Promise was the only child, cancel this Promise as well.\n // Otherwise, reject only the child Promise with the cancel error.\n if (childIndex >= 0) {\n if (this.state_ === CancellablePromise.State_.PENDING && childCount === 1) {\n this.cancelInternal_(err);\n } else {\n var callbackEntry = this.callbackEntries_.splice(childIndex, 1)[0];\n this.executeCallback_(\n callbackEntry, CancellablePromise.State_.REJECTED, err);\n }\n }\n};\n\n\n/**\n * Adds a callback entry to the current Promise, and schedules callback\n * execution if the Promise has already been resolved.\n *\n * @param {CancellablePromise.CallbackEntry_} callbackEntry Record containing\n * {@code onFulfilled} and {@code onRejected} callbacks to execute after\n * the Promise is resolved.\n * @private\n */\nCancellablePromise.prototype.addCallbackEntry_ = function(callbackEntry) {\n if ((!this.callbackEntries_ || !this.callbackEntries_.length) &&\n (this.state_ === CancellablePromise.State_.FULFILLED ||\n this.state_ === CancellablePromise.State_.REJECTED)) {\n this.scheduleCallbacks_();\n }\n if (!this.callbackEntries_) {\n this.callbackEntries_ = [];\n }\n this.callbackEntries_.push(callbackEntry);\n};\n\n\n/**\n * Creates a child Promise and adds it to the callback entry list. The result of\n * the child Promise is determined by the state of the parent Promise and the\n * result of the {@code onFulfilled} or {@code onRejected} callbacks as\n * specified in the Promise resolution procedure.\n *\n * @see http://promisesaplus.com/#the__method\n *\n * @param {?function(this:THIS, TYPE):\n * (RESULT|CancellablePromise.|Thenable)} onFulfilled A callback that\n * will be invoked if the Promise is fullfilled, or null.\n * @param {?function(this:THIS, *): *} onRejected A callback that will be\n * invoked if the Promise is rejected, or null.\n * @param {THIS=} opt_context An optional execution context for the callbacks.\n * in the default calling context.\n * @return {!CancellablePromise} The child Promise.\n * @template RESULT,THIS\n * @private\n */\nCancellablePromise.prototype.addChildPromise_ = function(\nonFulfilled, onRejected, opt_context) {\n\n var callbackEntry = {\n child: null,\n onFulfilled: null,\n onRejected: null\n };\n\n callbackEntry.child = new CancellablePromise(function(resolve, reject) {\n // Invoke onFulfilled, or resolve with the parent's value if absent.\n callbackEntry.onFulfilled = onFulfilled ? function(value) {\n try {\n var result = onFulfilled.call(opt_context, value);\n resolve(result);\n } catch (err) {\n reject(err);\n }\n } : resolve;\n\n // Invoke onRejected, or reject with the parent's reason if absent.\n callbackEntry.onRejected = onRejected ? function(reason) {\n try {\n var result = onRejected.call(opt_context, reason);\n if (!core.isDef(result) && reason.IS_CANCELLATION_ERROR) {\n // Propagate cancellation to children if no other result is returned.\n reject(reason);\n } else {\n resolve(result);\n }\n } catch (err) {\n reject(err);\n }\n } : reject;\n });\n\n callbackEntry.child.parent_ = this;\n this.addCallbackEntry_(\n /** @type {CancellablePromise.CallbackEntry_} */ (callbackEntry));\n return callbackEntry.child;\n};\n\n\n/**\n * Unblocks the Promise and fulfills it with the given value.\n *\n * @param {TYPE} value\n * @private\n */\nCancellablePromise.prototype.unblockAndFulfill_ = function(value) {\n if (this.state_ !== CancellablePromise.State_.BLOCKED) {\n throw new Error('CancellablePromise is not blocked.');\n }\n this.state_ = CancellablePromise.State_.PENDING;\n this.resolve_(CancellablePromise.State_.FULFILLED, value);\n};\n\n\n/**\n * Unblocks the Promise and rejects it with the given rejection reason.\n *\n * @param {*} reason\n * @private\n */\nCancellablePromise.prototype.unblockAndReject_ = function(reason) {\n if (this.state_ !== CancellablePromise.State_.BLOCKED) {\n throw new Error('CancellablePromise is not blocked.');\n }\n this.state_ = CancellablePromise.State_.PENDING;\n this.resolve_(CancellablePromise.State_.REJECTED, reason);\n};\n\n\n/**\n * Attempts to resolve a Promise with a given resolution state and value. This\n * is a no-op if the given Promise has already been resolved.\n *\n * If the given result is a Thenable (such as another Promise), the Promise will\n * be resolved with the same state and result as the Thenable once it is itself\n * resolved.\n *\n * If the given result is not a Thenable, the Promise will be fulfilled or\n * rejected with that result based on the given state.\n *\n * @see http://promisesaplus.com/#the_promise_resolution_procedure\n *\n * @param {CancellablePromise.State_} state\n * @param {*} x The result to apply to the Promise.\n * @private\n */\nCancellablePromise.prototype.resolve_ = function(state, x) {\n if (this.state_ !== CancellablePromise.State_.PENDING) {\n return;\n }\n\n if (this === x) {\n state = CancellablePromise.State_.REJECTED;\n x = new TypeError('CancellablePromise cannot resolve to itself');\n\n } else if (Thenable.isImplementedBy(x)) {\n x = /** @type {!Thenable} */ (x);\n this.state_ = CancellablePromise.State_.BLOCKED;\n x.then(this.unblockAndFulfill_, this.unblockAndReject_, this);\n return;\n\n } else if (core.isObject(x)) {\n try {\n var then = x.then;\n if (core.isFunction(then)) {\n this.tryThen_(x, then);\n return;\n }\n } catch (e) {\n state = CancellablePromise.State_.REJECTED;\n x = e;\n }\n }\n\n this.result_ = x;\n this.state_ = state;\n this.scheduleCallbacks_();\n\n if (state === CancellablePromise.State_.REJECTED && !x.IS_CANCELLATION_ERROR) {\n CancellablePromise.addUnhandledRejection_(this, x);\n }\n};\n\n\n/**\n * Attempts to call the {@code then} method on an object in the hopes that it is\n * a Promise-compatible instance. This allows interoperation between different\n * Promise implementations, however a non-compliant object may cause a Promise\n * to hang indefinitely. If the {@code then} method throws an exception, the\n * dependent Promise will be rejected with the thrown value.\n *\n * @see http://promisesaplus.com/#point-70\n *\n * @param {Thenable} thenable An object with a {@code then} method that may be\n * compatible with the Promise/A+ specification.\n * @param {!Function} then The {@code then} method of the Thenable object.\n * @private\n */\nCancellablePromise.prototype.tryThen_ = function(thenable, then) {\n this.state_ = CancellablePromise.State_.BLOCKED;\n var promise = this;\n var called = false;\n\n var resolve = function(value) {\n if (!called) {\n called = true;\n promise.unblockAndFulfill_(value);\n }\n };\n\n var reject = function(reason) {\n if (!called) {\n called = true;\n promise.unblockAndReject_(reason);\n }\n };\n\n try {\n then.call(thenable, resolve, reject);\n } catch (e) {\n reject(e);\n }\n};\n\n\n/**\n * Executes the pending callbacks of a resolved Promise after a timeout.\n *\n * Section 2.2.4 of the Promises/A+ specification requires that Promise\n * callbacks must only be invoked from a call stack that only contains Promise\n * implementation code, which we accomplish by invoking callback execution after\n * a timeout. If {@code startExecution_} is called multiple times for the same\n * Promise, the callback chain will be evaluated only once. Additional callbacks\n * may be added during the evaluation phase, and will be executed in the same\n * event loop.\n *\n * All Promises added to the waiting list during the same browser event loop\n * will be executed in one batch to avoid using a separate timeout per Promise.\n *\n * @private\n */\nCancellablePromise.prototype.scheduleCallbacks_ = function() {\n if (!this.executing_) {\n this.executing_ = true;\n async.run(this.executeCallbacks_, this);\n }\n};\n\n\n/**\n * Executes all pending callbacks for this Promise.\n *\n * @private\n */\nCancellablePromise.prototype.executeCallbacks_ = function() {\n while (this.callbackEntries_ && this.callbackEntries_.length) {\n var entries = this.callbackEntries_;\n this.callbackEntries_ = [];\n\n for (var i = 0; i < entries.length; i++) {\n this.executeCallback_(entries[i], this.state_, this.result_);\n }\n }\n this.executing_ = false;\n};\n\n\n/**\n * Executes a pending callback for this Promise. Invokes an {@code onFulfilled}\n * or {@code onRejected} callback based on the resolved state of the Promise.\n *\n * @param {!CancellablePromise.CallbackEntry_} callbackEntry An entry containing the\n * onFulfilled and/or onRejected callbacks for this step.\n * @param {CancellablePromise.State_} state The resolution status of the Promise,\n * either FULFILLED or REJECTED.\n * @param {*} result The resolved result of the Promise.\n * @private\n */\nCancellablePromise.prototype.executeCallback_ = function(\ncallbackEntry, state, result) {\n if (state === CancellablePromise.State_.FULFILLED) {\n callbackEntry.onFulfilled(result);\n } else {\n this.removeUnhandledRejection_();\n callbackEntry.onRejected(result);\n }\n};\n\n\n/**\n * Marks this rejected Promise as having being handled. Also marks any parent\n * Promises in the rejected state as handled. The rejection handler will no\n * longer be invoked for this Promise (if it has not been called already).\n *\n * @private\n */\nCancellablePromise.prototype.removeUnhandledRejection_ = function() {\n var p;\n if (CancellablePromise.UNHANDLED_REJECTION_DELAY > 0) {\n for (p = this; p && p.unhandledRejectionId_; p = p.parent_) {\n clearTimeout(p.unhandledRejectionId_);\n p.unhandledRejectionId_ = 0;\n }\n } else if (CancellablePromise.UNHANDLED_REJECTION_DELAY === 0) {\n for (p = this; p && p.hadUnhandledRejection_; p = p.parent_) {\n p.hadUnhandledRejection_ = false;\n }\n }\n};\n\n\n/**\n * Marks this rejected Promise as unhandled. If no {@code onRejected} callback\n * is called for this Promise before the {@code UNHANDLED_REJECTION_DELAY}\n * expires, the reason will be passed to the unhandled rejection handler. The\n * handler typically rethrows the rejection reason so that it becomes visible in\n * the developer console.\n *\n * @param {!CancellablePromise} promise The rejected Promise.\n * @param {*} reason The Promise rejection reason.\n * @private\n */\nCancellablePromise.addUnhandledRejection_ = function(promise, reason) {\n if (CancellablePromise.UNHANDLED_REJECTION_DELAY > 0) {\n promise.unhandledRejectionId_ = setTimeout(function() {\n CancellablePromise.handleRejection_.call(null, reason);\n }, CancellablePromise.UNHANDLED_REJECTION_DELAY);\n\n } else if (CancellablePromise.UNHANDLED_REJECTION_DELAY === 0) {\n promise.hadUnhandledRejection_ = true;\n async.run(function() {\n if (promise.hadUnhandledRejection_) {\n CancellablePromise.handleRejection_.call(null, reason);\n }\n });\n }\n};\n\n\n/**\n * A method that is invoked with the rejection reasons for Promises that are\n * rejected but have no {@code onRejected} callbacks registered yet.\n * @type {function(*)}\n * @private\n */\nCancellablePromise.handleRejection_ = async.throwException;\n\n\n/**\n * Sets a handler that will be called with reasons from unhandled rejected\n * Promises. If the rejected Promise (or one of its descendants) has an\n * {@code onRejected} callback registered, the rejection will be considered\n * handled, and the rejection handler will not be called.\n *\n * By default, unhandled rejections are rethrown so that the error may be\n * captured by the developer console or a {@code window.onerror} handler.\n *\n * @param {function(*)} handler A function that will be called with reasons from\n * rejected Promises. Defaults to {@code async.throwException}.\n */\nCancellablePromise.setUnhandledRejectionHandler = function(handler) {\n CancellablePromise.handleRejection_ = handler;\n};\n\n\n\n/**\n * Error used as a rejection reason for canceled Promises.\n *\n * @param {string=} opt_message\n * @constructor\n * @extends {Error}\n * @final\n */\nCancellablePromise.CancellationError = class extends Error {\n constructor(opt_message) {\n super(opt_message);\n\n if (opt_message) {\n this.message = opt_message;\n }\n }\n};\n\n/** @override */\nCancellablePromise.CancellationError.prototype.name = 'cancel';\n\nexport {CancellablePromise};\nexport default CancellablePromise;\n","'use strict';\n\nimport core from 'bower:metal/src/core';\nimport { CancellablePromise as Promise } from 'bower:metal-promise/src/promise/Promise';\n\nclass Ajax {\n\n\t/**\n\t * Adds parameters into the url querystring.\n\t * @param {string} url\n\t * @param {MultiMap} opt_params\n\t * @return {string} Url containting parameters as querystring.\n\t * @protected\n\t */\n\tstatic addParametersToUrlQueryString(url, opt_params) {\n\t\tvar querystring = '';\n\t\topt_params.names().forEach(function(name) {\n\t\t\topt_params.getAll(name).forEach(function(value) {\n\t\t\t\tquerystring += name + '=' + encodeURIComponent(value) + '&';\n\t\t\t});\n\t\t});\n\t\tquerystring = querystring.slice(0, -1);\n\t\tif (querystring) {\n\t\t\turl += (url.indexOf('?') > -1) ? '&' : '?';\n\t\t\turl += querystring;\n\t\t}\n\n\t\treturn url;\n\t}\n\n\t/**\n\t * Joins the given paths.\n\t * @param {string} basePath\n\t * @param {...string} ...paths Any number of paths to be joined with the base url.\n\t */\n\tstatic joinPaths(basePath, ...paths) {\n\t\tif (basePath.charAt(basePath.length - 1) === '/') {\n\t\t\tbasePath = basePath.substring(0, basePath.length - 1);\n\t\t}\n\t\tpaths = paths.map(path => path.charAt(0) === '/' ? path.substring(1) : path);\n\t\treturn [basePath].concat(paths).join('/').replace(/\\/$/, '');\n\t}\n\n\t/**\n\t * XmlHttpRequest's getAllResponseHeaders() method returns a string of\n\t * response headers according to the format described on the spec:\n\t * {@link http://www.w3.org/TR/XMLHttpRequest/#the-getallresponseheaders-method}.\n\t * This method parses that string into a user-friendly name/value pair\n\t * object.\n\t * @param {string} allHeaders All headers as string.\n\t * @return {!Array.>}\n\t */\n\tstatic parseResponseHeaders(allHeaders) {\n\t\tvar headers = [];\n\t\tif (!allHeaders) {\n\t\t\treturn headers;\n\t\t}\n\t\tvar pairs = allHeaders.split('\\u000d\\u000a');\n\t\tfor (var i = 0; i < pairs.length; i++) {\n\t\t\tvar index = pairs[i].indexOf('\\u003a\\u0020');\n\t\t\tif (index > 0) {\n\t\t\t\tvar name = pairs[i].substring(0, index);\n\t\t\t\tvar value = pairs[i].substring(index + 2);\n\t\t\t\theaders.push({\n\t\t\t\t\tname: name,\n\t\t\t\t\tvalue: value\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\treturn headers;\n\t}\n\n\t/**\n\t * Parses the url separating the domain and port from the path.\n\t * @param {string} url\n\t * @return {array} Array containing the url domain and path.\n\t * @protected\n\t */\n\tstatic parseUrl(url) {\n\t\tvar base;\n\t\tvar path;\n\t\tvar qs;\n\n\t\tvar domainAt = url.indexOf('//');\n\t\tif (domainAt > -1) {\n\t\t\turl = url.substring(domainAt + 2);\n\t\t}\n\n\t\tvar pathAt = url.indexOf('/');\n\t\tif (pathAt === -1) {\n\t\t\turl += '/';\n\t\t\tpathAt = url.length - 1;\n\t\t}\n\n\t\tbase = url.substring(0, pathAt);\n\t\tpath = url.substring(pathAt);\n\n\t\tvar qsAt = path.indexOf('?');\n\t\tif (qsAt > -1) {\n\t\t\tqs = path.substring(qsAt, path.length);\n\t\t\tpath = path.substring(0, qsAt);\n\t\t} else {\n\t\t\tqs = '';\n\t\t}\n\n\t\treturn [base, path, qs];\n\t}\n\n\t/**\n\t * Requests the url using XMLHttpRequest.\n\t * @param {!string} url\n\t * @param {!string} method\n\t * @param {?string} body\n\t * @param {MultiMap=} opt_headers\n\t * @param {MultiMap=} opt_params\n\t * @param {number=} opt_timeout\n\t * @param {boolean=} opt_sync\n\t * @return {Promise} Deferred ajax request.\n\t * @protected\n\t */\n\tstatic request(url, method, body, opt_headers, opt_params, opt_timeout, opt_sync) {\n\t\tvar request = new XMLHttpRequest();\n\n\t\tvar promise = new Promise(function(resolve, reject) {\n\t\t\trequest.onload = function() {\n\t\t\t\tif (request.aborted) {\n\t\t\t\t\trequest.onerror();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tresolve(request);\n\t\t\t};\n\t\t\trequest.onerror = function() {\n\t\t\t\tvar error = new Error('Request error');\n\t\t\t\terror.request = request;\n\t\t\t\treject(error);\n\t\t\t};\n\t\t}).thenCatch(function(reason) {\n\t\t\trequest.abort();\n\t\t\tthrow reason;\n\t\t}).thenAlways(function() {\n\t\t\tclearTimeout(timeout);\n\t\t});\n\n\t\tif (opt_params) {\n\t\t\turl = Ajax.addParametersToUrlQueryString(url, opt_params);\n\t\t}\n\n\t\trequest.open(method, url, !opt_sync);\n\n\t\tif (opt_headers) {\n\t\t\topt_headers.names().forEach(function(name) {\n\t\t\t\trequest.setRequestHeader(name, opt_headers.getAll(name).join(', '));\n\t\t\t});\n\t\t}\n\n\t\trequest.send(core.isDef(body) ? body : null);\n\n\t\tif (core.isDefAndNotNull(opt_timeout)) {\n\t\t\tvar timeout = setTimeout(function() {\n\t\t\t\tpromise.cancel('Request timeout');\n\t\t\t}, opt_timeout);\n\t\t}\n\n\t\treturn promise;\n\t}\n\n}\n\nexport default Ajax;","'use strict';\n\n/**\n * Disposable utility. When inherited provides the `dispose` function to its\n * subclass, which is responsible for disposing of any object references\n * when an instance won't be used anymore. Subclasses should override\n * `disposeInternal` to implement any specific disposing logic.\n * @constructor\n */\nclass Disposable {\n\tconstructor() {\n\t\t/**\n\t\t * Flag indicating if this instance has already been disposed.\n\t\t * @type {boolean}\n\t\t * @protected\n\t\t */\n\t\tthis.disposed_ = false;\n\t}\n\n\t/**\n\t * Disposes of this instance's object references. Calls `disposeInternal`.\n\t */\n\tdispose() {\n\t\tif (!this.disposed_) {\n\t\t\tthis.disposeInternal();\n\t\t\tthis.disposed_ = true;\n\t\t}\n\t}\n\n\t/**\n\t * Subclasses should override this method to implement any specific\n\t * disposing logic (like clearing references and calling `dispose` on other\n\t * disposables).\n\t */\n\tdisposeInternal() {}\n\n\t/**\n\t * Checks if this instance has already been disposed.\n\t * @return {boolean}\n\t */\n\tisDisposed() {\n\t\treturn this.disposed_;\n\t}\n}\n\nexport default Disposable;\n","'use strict';\n\nimport Disposable from 'bower:metal/src/disposable/Disposable';\n\n/**\n * Case insensitive string Multimap implementation. Allows multiple values for\n * the same key name.\n * @extends {Disposable}\n */\nclass MultiMap extends Disposable {\n\tconstructor() {\n\t\tsuper();\n\t\tthis.keys = {};\n\t\tthis.values = {};\n\t}\n\n\t/**\n\t * Adds value to a key name.\n\t * @param {string} name\n\t * @param {*} value\n\t * @chainable\n\t */\n\tadd(name, value) {\n\t\tthis.keys[name.toLowerCase()] = name;\n\t\tthis.values[name.toLowerCase()] = this.values[name.toLowerCase()] || [];\n\t\tthis.values[name.toLowerCase()].push(value);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Clears map names and values.\n\t * @chainable\n\t */\n\tclear() {\n\t\tthis.keys = {};\n\t\tthis.values = {};\n\t\treturn this;\n\t}\n\n\t/**\n\t * Checks if map contains a value to the key name.\n\t * @param {string} name\n\t * @return {boolean}\n\t * @chainable\n\t */\n\tcontains(name) {\n\t\treturn name.toLowerCase() in this.values;\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\tdisposeInternal() {\n\t\tthis.values = null;\n\t}\n\n\t/**\n\t * Gets the first added value from a key name.\n\t * @param {string} name\n\t * @return {*}\n\t * @chainable\n\t */\n\tget(name) {\n\t\tvar values = this.values[name.toLowerCase()];\n\t\tif (values) {\n\t\t\treturn values[0];\n\t\t}\n\t}\n\n\t/**\n\t * Gets all values from a key name.\n\t * @param {string} name\n\t * @return {Array.<*>}\n\t */\n\tgetAll(name) {\n\t\treturn this.values[name.toLowerCase()];\n\t}\n\n\t/**\n\t * Returns true if the map is empty, false otherwise.\n\t * @return {boolean}\n\t */\n\tisEmpty() {\n\t\treturn this.size() === 0;\n\t}\n\n\t/**\n\t * Gets array of key names.\n\t * @return {Array.}\n\t */\n\tnames() {\n\t\treturn Object.keys(this.values).map((key) => this.keys[key]);\n\t}\n\n\t/**\n\t * Removes all values from a key name.\n\t * @param {string} name\n\t * @chainable\n\t */\n\tremove(name) {\n\t\tdelete this.keys[name.toLowerCase()];\n\t\tdelete this.values[name.toLowerCase()];\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the value of a key name. Relevant to replace the current values with\n\t * a new one.\n\t * @param {string} name\n\t * @param {*} value\n\t * @chainable\n\t */\n\tset(name, value) {\n\t\tthis.keys[name.toLowerCase()] = name;\n\t\tthis.values[name.toLowerCase()] = [value];\n\t\treturn this;\n\t}\n\n\t/**\n\t * Gets the size of the map key names.\n\t * @return {number}\n\t */\n\tsize() {\n\t\treturn this.names().length;\n\t}\n\n\t/**\n\t * Returns the parsed values as a string.\n\t * @return {string}\n\t */\n\ttoString() {\n\t\treturn JSON.stringify(this.values);\n\t}\n}\n\nexport default MultiMap;\n","'use strict';\n\nimport core from 'bower:metal/src/core';\nimport MultiMap from 'bower:metal-multimap/src/MultiMap';\n\n/**\n * Represents a client message (e.g. a request or a response).\n */\nclass ClientMessage {\n\tconstructor() {\n\t\tthis.headers_ = new MultiMap();\n\t}\n\n\t/**\n\t * Fluent getter and setter for request body.\n\t * @param {*=} opt_body Request body to be set. If none is given,\n\t * the current value of the body will be returned.\n\t * @return {*} Returns request body if no body value was given. Otherwise\n\t * returns the {@link ClientMessage} object itself, so calls can be chained.\n\t * @chainable Chainable when used as setter.\n\t */\n\tbody(opt_body) {\n\t\tif (core.isDef(opt_body)) {\n\t\t\tthis.body_ = opt_body;\n\t\t\treturn this;\n\t\t}\n\t\treturn this.body_;\n\t}\n\n\t/**\n\t * Adds a header. If a header with the same name already exists, it will not be\n\t * overwritten, but the new value will be stored as well. The order is preserved.\n\t * @param {string} name\n\t * @param {string} value\n\t * @chainable\n\t */\n\theader(name, value) {\n\t\tif (arguments.length !== 2) {\n\t\t\tthrow new Error('Invalid arguments');\n\t\t}\n\t\tthis.headers_.set(name, value);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Fluent getter and setter for request headers.\n\t * @param {MultiMap|Object=} opt_headers Request headers list to\n\t * be set. If none is given the current value of the headers will\n\t * be returned.\n\t * @return {!MultiMap|ClientMessage} Returns map of request headers\n\t * if no new value was given. Otherwise returns the {@link ClientMessage}\n\t * object itself, so calls can be chained.\n\t * @chainable Chainable when used as setter.\n\t */\n\theaders(opt_headers) {\n\t\tif (core.isDef(opt_headers)) {\n\t\t\tif (opt_headers instanceof MultiMap) {\n\t\t\t\tthis.headers_ = opt_headers;\n\t\t\t} else {\n\t\t\t\tthis.headers_.values = opt_headers;\n\t\t\t}\n\t\t\treturn opt_headers;\n\t\t}\n\t\treturn this.headers_;\n\t}\n\n\t/**\n\t * Removes the body.\n\t */\n\tremoveBody() {\n\t\tthis.body_ = undefined;\n\t}\n}\n\nexport default ClientMessage;\n","'use strict';\n\nimport core from 'bower:metal/src/core';\nimport ClientMessage from './ClientMessage';\n\n/**\n * Represents a client response object.\n * @extends {ClientMessage}\n */\nclass ClientResponse extends ClientMessage {\n\tconstructor(clientRequest) {\n\t\tsuper();\n\t\tif (!clientRequest) {\n\t\t\tthrow new Error('Can\\'t create response without request');\n\t\t}\n\t\tthis.clientRequest_ = clientRequest;\n\t}\n\n\t/**\n\t * Returns request that created this response.\n\t * @return {!ClientRequest}\n\t */\n\trequest() {\n\t\treturn this.clientRequest_;\n\t}\n\n\t/**\n\t * Fluent getter and setter for response status code.\n\t * @param {number=} opt_statusCode Request status code to be set. If none is given,\n\t * the current status code value will be returned.\n\t * @return {!ClientMessage|number} Returns response status code if no new value was\n\t * given. Otherwise returns the {@link ClientMessage} object itself, so calls can\n\t * be chained.\n\t * @chainable Chainable when used as setter.\n\t */\n\tstatusCode(opt_statusCode) {\n\t\tif (core.isDef(opt_statusCode)) {\n\t\t\tthis.statusCode_ = opt_statusCode;\n\t\t\treturn this;\n\t\t}\n\t\treturn this.statusCode_;\n\t}\n\n\t/**\n\t * Fluent getter and setter for response status text.\n\t * @param {string=} opt_statusText Request status text to be set. If none is given,\n\t * the current status text value will be returned.\n\t * @return {!ClientMessage|number} Returns response status text if no new value was\n\t * given. Otherwise returns the {@link ClientMessage} object itself, so calls can\n\t * be chained.\n\t * @chainable Chainable when used as setter.\n\t */\n\tstatusText(opt_statusText) {\n\t\tif (core.isDef(opt_statusText)) {\n\t\t\tthis.statusText_ = opt_statusText;\n\t\t\treturn this;\n\t\t}\n\t\treturn this.statusText_;\n\t}\n\n\t/**\n\t * Checks if response succeeded. Any status code 2xx or 3xx is considered valid.\n\t * @return {boolean}\n\t */\n\tsucceeded() {\n\t\treturn this.statusCode() >= 200 && this.statusCode() <= 399;\n\t}\n\n}\n\nexport default ClientResponse;\n","'use strict';\n\nimport core from 'bower:metal/src/core';\nimport Transport from './Transport';\nimport Ajax from 'bower:metal-ajax/src/Ajax';\nimport ClientResponse from './ClientResponse';\nimport { CancellablePromise as Promise } from 'bower:metal-promise/src/promise/Promise';\n\n/**\n * The implementation of an ajax transport to be used with {@link Launchpad}.\n * @extends {Transport}\n */\nclass AjaxTransport extends Transport {\n\t/**\n\t * @inheritDoc\n\t */\n\tsend(clientRequest) {\n\t\tvar deferred = Ajax.request(\n\t\t\tclientRequest.url(), clientRequest.method(), clientRequest.body(),\n\t\t\tclientRequest.headers(), clientRequest.params(), null, false);\n\n\t\treturn deferred.then(function(response) {\n\t\t\tvar clientResponse = new ClientResponse(clientRequest);\n\t\t\tclientResponse.body(response.responseText);\n\t\t\tclientResponse.statusCode(response.status);\n\t\t\tclientResponse.statusText(response.statusText);\n\t\t\tAjax.parseResponseHeaders(response.getAllResponseHeaders()).forEach(function(header) {\n\t\t\t\tclientResponse.header(header.name, header.value);\n\t\t\t});\n\t\t\treturn clientResponse;\n\t\t});\n\t}\n\n}\n\nexport default AjaxTransport;\n","'use strict';\n\nimport core from 'bower:metal/src/core';\n\n/**\n * Class responsible for storing authorization information.\n */\nclass Auth {\n\t/**\n\t * Constructs an {@link Auth} instance.\n\t * @param {string} tokenOrUsername Either the authorization token, or\n\t * the username.\n\t * @param {string=} opt_password If a username is given as the first param,\n\t * this should be the password.\n\t * @constructor\n\t */\n\tconstructor(tokenOrUsername, opt_password = null) {\n\t\tthis.token_ = core.isString(opt_password) ? null : tokenOrUsername;\n\t\tthis.username_ = core.isString(opt_password) ? tokenOrUsername : null;\n\t\tthis.password_ = opt_password;\n\t}\n\n\t/**\n\t * Constructs an {@link Auth} instance.\n\t * @param {string} tokenOrUsername Either the authorization token, or\n\t * the username.\n\t * @param {string=} opt_password If a username is given as the first param,\n\t * this should be the password.\n\t * @return {!Auth}\n\t */\n\tstatic create(tokenOrUsername, opt_password) {\n\t\treturn new Auth(tokenOrUsername, opt_password);\n\t}\n\n\t/**\n\t * Checks if the password is set.\n\t * @return {boolean}\n\t */\n\thasPassword() {\n\t\treturn this.password_ !== null;\n\t}\n\n\t/**\n\t * Checks if the token is set.\n\t * @return {boolean}\n\t */\n\thasToken() {\n\t\treturn this.token_ !== null;\n\t}\n\n\t/**\n\t * Checks if the username is set.\n\t * @return {boolean}\n\t */\n\thasUsername() {\n\t\treturn this.username_ !== null;\n\t}\n\n\t/**\n\t * Returns the password.\n\t * @return {string}\n\t */\n\tpassword() {\n\t\treturn this.password_;\n\t}\n\n\t/**\n\t * Returns the token.\n\t * @return {string}\n\t */\n\ttoken() {\n\t\treturn this.token_;\n\t}\n\n\t/**\n\t * Returns the username.\n\t * @return {string}\n\t */\n\tusername() {\n\t\treturn this.username_;\n\t}\n}\n\nexport default Auth;\n","'use strict';\n\nimport core from 'bower:metal/src/core';\nimport ClientMessage from './ClientMessage';\nimport MultiMap from 'bower:metal-multimap/src/MultiMap';\n\n/**\n * Represents a client request object.\n * @extends {ClientMessage}\n */\nclass ClientRequest extends ClientMessage {\n\tconstructor() {\n\t\tsuper();\n\t\tthis.params_ = new MultiMap();\n\t}\n\n\t/**\n\t * Fluent getter and setter for request method.\n\t * @param {string=} opt_method Request method to be set. If none is given,\n\t * the current method value will be returned.\n\t * @return {!ClientMessage|string} Returns request method if no new value was\n\t * given. Otherwise returns the {@link ClientMessage} object itself, so\n\t * calls can be chained.\n\t * @chainable Chainable when used as setter.\n\t */\n\tmethod(opt_method) {\n\t\tif (core.isDef(opt_method)) {\n\t\t\tthis.method_ = opt_method;\n\t\t\treturn this;\n\t\t}\n\t\treturn this.method_ || ClientRequest.DEFAULT_METHOD;\n\t}\n\n\t/**\n\t * Adds a query. If a query with the same name already exists, it will not\n\t * be overwritten, but new value will be stored as well. The order is preserved.\n\t * @param {string} name\n\t * @param {string} value\n\t * @chainable\n\t */\n\tparam(name, value) {\n\t\tif (arguments.length !== 2) {\n\t\t\tthrow new Error('Invalid arguments');\n\t\t}\n\t\tthis.params_.set(name, value);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Fluent getter and setter for request querystring.\n\t * @param {MultiMap|Object=} opt_params Request querystring map to be set.\n\t * If none is given the current value of the params will be returned.\n\t * @return {!MultiMap|ClientMessage} Returns map of request querystring if\n\t * no new value was given. Otherwise returns the {@link ClientMessage}\n\t * object itself, so calls can be chained.\n\t */\n\tparams(opt_params) {\n\t\tif (core.isDef(opt_params)) {\n\t\t\tif (opt_params instanceof MultiMap) {\n\t\t\t\tthis.params_ = opt_params;\n\t\t\t} else {\n\t\t\t\tthis.params_.values = opt_params;\n\t\t\t}\n\t\t\treturn opt_params;\n\t\t}\n\t\treturn this.params_;\n\t}\n\n\t/**\n\t * Fluent getter and setter for request url.\n\t * @param {string=} opt_url Request url to be set. If none is given,\n\t * the current value of the url will be returned.\n\t * @return {!ClientMessage|string} Returns request url if no new value was given.\n\t * Otherwise returns the {@link ClientMessage} object itself, so calls can be\n\t * chained.\n\t * @chainable Chainable when used as setter.\n\t */\n\turl(opt_url) {\n\t\tif (core.isDef(opt_url)) {\n\t\t\tthis.url_ = opt_url;\n\t\t\treturn this;\n\t\t}\n\t\treturn this.url_;\n\t}\n\n}\n\nClientRequest.DEFAULT_METHOD = 'GET';\n\nexport default ClientRequest;\n","'use strict';\n\n/**\n * Class responsible for storing an object that will be printed as JSON\n * when the `toString` method is called.\n */\nclass Embodied {\n\t/**\n\t * Constructs a Embodied instance.\n\t * @constructor\n\t */\n\tconstructor() {\n\t\tthis.body_ = {};\n\t}\n\n\t/**\n\t * Gets the json object that represents this instance.\n\t * @return {!Object}\n\t */\n\tbody() {\n\t\treturn this.body_;\n\t}\n\n\t/**\n\t * If the given object is an instance of Embodied, this will\n\t * return its body content. Otherwise this will return the\n\t * original object.\n\t * @param {*} obj\n\t * @return {*}\n\t * @static\n\t */\n\tstatic toBody(obj) {\n\t\treturn (obj instanceof Embodied) ? obj.body() : obj;\n\t}\n\n\t/**\n\t * Gets the json string that represents this instance.\n\t * @return {string}\n\t */\n\ttoString() {\n\t\treturn JSON.stringify(this.body());\n\t}\n}\n\nexport default Embodied;\n","'use strict';\n\nimport core from 'bower:metal/src/core';\nimport Embodied from './Embodied';\n\n/**\n * Class responsible for storing and handling the body contents\n * of a Filter instance.\n */\nclass FilterBody {\n\t/**\n\t * Constructs a {@link FilterBody} instance.\n\t * @param {string} field The name of the field to filter by.\n\t * @param {*} operatorOrValue If a third param is given, this should\n\t * be the filter's operator (like \">=\"). Otherwise, this will be\n\t * used as the filter's value, and the filter's operator will be \"=\".\n\t * @param {*=} opt_value The filter's value.\n\t * @constructor\n\t */\n\tconstructor(field, operatorOrValue, opt_value) {\n\t\tvar obj = {\n\t\t\toperator: core.isDef(opt_value) ? operatorOrValue : '='\n\t\t};\n\t\tvar value = core.isDef(opt_value) ? opt_value : operatorOrValue;\n\t\tif (core.isDefAndNotNull(value)) {\n\t\t\tif (value instanceof Embodied) {\n\t\t\t\tvalue = value.body();\n\t\t\t}\n\t\t\tobj.value = value;\n\t\t}\n\t\tthis.createBody_(field, obj);\n\t}\n\n\t/**\n\t * Composes the current filter with the given operator.\n\t * @param {string} operator\n\t * @param {Filter=} opt_filter Another filter to compose this filter with,\n\t * if the operator is not unary.\n\t */\n\tadd(operator, opt_filter) {\n\t\tif (opt_filter) {\n\t\t\tthis.addArrayOperator_(operator, opt_filter);\n\t\t} else {\n\t\t\tthis.createBody_(operator, this.body_);\n\t\t}\n\t}\n\n\t/**\n\t * Composes the current filter with an operator that stores its values in an array.\n\t * @param {string} operator\n\t * @param {!Filter} filter\n\t * @protected\n\t */\n\taddArrayOperator_(operator, filter) {\n\t\tif (!(this.body_[operator] instanceof Array)) {\n\t\t\tthis.createBody_(operator, [this.body_]);\n\t\t}\n\t\tthis.body_[operator].push(filter.body());\n\t}\n\n\t/**\n\t * Adds filters to be composed with this filter body using the given operator.\n\t * @param {string} operator\n\t * @param {...*} filters A variable amount of filters to be composed.\n\t */\n\taddMany(operator, ...filters) {\n\t\tfor (var i = 0; i < filters.length; i++) {\n\t\t\tthis.add(operator, filters[i]);\n\t\t}\n\t}\n\n\t/**\n\t * Creates a new body object, setting the requestd key to the given value.\n\t * @param {string} key The key to set in the new body object\n\t * @param {*} value The value the requested key should have in the new body object.\n\t * @protected\n\t */\n\tcreateBody_(key, value) {\n\t\tthis.body_ = {};\n\t\tthis.body_[key] = value;\n\t}\n\n\t/**\n\t * Gets the json object that represents this filter's body.\n\t * @return {!Object}\n\t */\n\tgetObject() {\n\t\treturn this.body_;\n\t}\n}\n\nexport default FilterBody;\n","'use strict';\n\nimport Embodied from './Embodied';\n\n/**\n * Class responsible for building different types of geometric\n * shapes.\n */\nclass Geo {\n\t/**\n\t * Creates a new {@link BoundingBox} instance.\n\t * @param {*} upperLeft The upper left point.\n\t * @param {*} lowerRight The lower right point.\n\t * @return {!BoundingBox}\n\t * @static\n\t */\n\tstatic boundingBox(upperLeft, lowerRight) {\n\t\treturn new Geo.BoundingBox(upperLeft, lowerRight);\n\t}\n\n\t/**\n\t * Creates a new {@link Circle} instance.\n\t * @param {*} center The circle's center coordinate.\n\t * @param {string} radius The circle's radius.\n\t * @return {!Circle}\n\t * @static\n\t */\n\tstatic circle(center, radius) {\n\t\treturn new Geo.Circle(center, radius);\n\t}\n\n\t/**\n\t * Creates a new {@link Line} instance.\n\t * @param {...*} points This line's points.\n\t * @return {!Line}\n\t * @static\n\t */\n\tstatic line(...points) {\n\t\treturn new Geo.Line(...points);\n\t}\n\n\t/**\n\t * Creates a new {@link Point} instance.\n\t * @param {number} lat The latitude coordinate\n\t * @param {number} lon The longitude coordinate\n\t * @return {!Point}\n\t * @static\n\t */\n\tstatic point(lat, lon) {\n\t\treturn new Geo.Point(lat, lon);\n\t}\n\n\t/**\n\t * Creates a new {@link Polygon} instance.\n\t * @param {...*} points This polygon's points.\n\t * @return {!Polygon}\n\t * @static\n\t */\n\tstatic polygon(...points) {\n\t\treturn new Geo.Polygon(...points);\n\t}\n}\n\n/**\n * Class that represents a point coordinate.\n * @extends {Embodied}\n */\nclass Point extends Embodied {\n\t/**\n\t * Constructs a {@link Point} instance.\n\t * @param {number} lat The latitude coordinate\n\t * @param {number} lon The longitude coordinate\n\t * @constructor\n\t */\n\tconstructor(lat, lon) {\n\t\tsuper();\n\t\tthis.body_ = [lat, lon];\n\t}\n}\nGeo.Point = Point;\n\n/**\n * Class that represents a line.\n * @extends {Embodied}\n */\nclass Line extends Embodied {\n\t/**\n\t * Constructs a {@link Line} instance.\n\t * @param {...*} points This line's points.\n\t * @constructor\n\t */\n\tconstructor(...points) {\n\t\tsuper();\n\t\tthis.body_ = {\n\t\t\ttype: 'linestring',\n\t\t\tcoordinates: points.map(point => Embodied.toBody(point))\n\t\t};\n\t}\n}\nGeo.Line = Line;\n\n/**\n * Class that represents a bounding box.\n * @extends {Embodied}\n */\nclass BoundingBox extends Embodied {\n\t/**\n\t * Constructs a {@link BoundingBox} instance.\n\t * @param {*} upperLeft The upper left point.\n\t * @param {*} lowerRight The lower right point.\n\t * @constructor\n\t */\n\tconstructor(upperLeft, lowerRight) {\n\t\tsuper();\n\t\tthis.body_ = {\n\t\t\ttype: 'envelope',\n\t\t\tcoordinates: [Embodied.toBody(upperLeft), Embodied.toBody(lowerRight)]\n\t\t};\n\t}\n\n\t/**\n\t * Gets this bounding box's points.\n\t * @return {!Array}\n\t */\n\tgetPoints() {\n\t\treturn this.body_.coordinates;\n\t}\n}\nGeo.BoundingBox = BoundingBox;\n\n/**\n * Class that represents a circle.\n * @extends {Embodied}\n */\nclass Circle extends Embodied {\n\t/**\n\t * Constructs a {@link Circle} instance.\n\t * @param {*} center The circle's center coordinate.\n\t * @param {string} radius The circle's radius.\n\t * @constructor\n\t */\n\tconstructor(center, radius) {\n\t\tsuper();\n\t\tthis.body_ = {\n\t\t\ttype: 'circle',\n\t\t\tcoordinates: Embodied.toBody(center),\n\t\t\tradius: radius\n\t\t};\n\t}\n\n\t/**\n\t * Gets this circle's center coordinate.\n\t * @return {*}\n\t */\n\tgetCenter() {\n\t\treturn this.body_.coordinates;\n\t}\n\n\t/**\n\t * Gets this circle's radius.\n\t * @return {string}\n\t */\n\tgetRadius() {\n\t\treturn this.body_.radius;\n\t}\n}\nGeo.Circle = Circle;\n\n/**\n * Class that represents a polygon.\n * @extends {Embodied}\n */\nclass Polygon extends Embodied {\n\t/**\n\t * Constructs a {@link Polygon} instance.\n\t * @param {...*} points This polygon's points.\n\t * @constructor\n\t */\n\tconstructor(...points) {\n\t\tsuper();\n\t\tthis.body_ = {\n\t\t\ttype: 'polygon',\n\t\t\tcoordinates: []\n\t\t};\n\t\tthis.addCoordinates_(...points);\n\t}\n\n\t/**\n\t * Adds the given points as coordinates for this polygon.\n\t * @param {...*} points\n\t * @protected\n\t */\n\taddCoordinates_(...points) {\n\t\tthis.body_.coordinates.push(points.map(point => Embodied.toBody(point)));\n\t}\n\n\t/**\n\t * Adds the given points as a hole inside this polygon.\n\t * @param {...*} points\n\t * @chainnable\n\t */\n\thole(...points) {\n\t\tthis.addCoordinates_(...points);\n\t\treturn this;\n\t}\n}\nGeo.Polygon = Polygon;\n\nexport default Geo;\n","'use strict';\n\nimport core from 'bower:metal/src/core';\nimport Embodied from './Embodied';\n\n/**\n * Class responsible for building range objects to be used by `Filter`.\n * @extends {Embodied}\n */\nclass Range extends Embodied {\n\t/**\n\t * Constructs a {@link Range} instance.\n\t * @param {*} from\n\t * @param {*} opt_to\n\t * @constructor\n\t */\n\tconstructor(from, opt_to) {\n\t\tsuper();\n\t\tif (core.isDefAndNotNull(from)) {\n\t\t\tthis.body_.from = from;\n\t\t}\n\t\tif (core.isDefAndNotNull(opt_to)) {\n\t\t\tthis.body_.to = opt_to;\n\t\t}\n\t}\n\n\t/**\n\t * Constructs a {@link Range} instance.\n\t * @param {*} from\n\t * @return {!Range}\n\t * @static\n\t */\n\tstatic from(from) {\n\t\treturn new Range(from);\n\t}\n\n\t/**\n\t * Constructs a {@link Range} instance.\n\t * @param {*} from\n\t * @param {*} to\n\t * @return {!Range}\n\t * @static\n\t */\n\tstatic range(from, to) {\n\t\treturn new Range(from, to);\n\t}\n\n\t/**\n\t * Constructs a {@link Range} instance.\n\t * @param {*} to\n\t * @return {!Range}\n\t * @static\n\t */\n\tstatic to(to) {\n\t\treturn new Range(null, to);\n\t}\n}\n\nexport default Range;\n","'use strict';\n\nimport core from 'bower:metal/src/core';\nimport Embodied from './Embodied';\nimport FilterBody from './FilterBody';\nimport Geo from './Geo';\nimport Range from './Range';\n\n/**\n * Class responsible for building filters.\n * @extends {Embodied}\n */\nclass Filter extends Embodied {\n\t/**\n\t * Constructs a {@link Filter} instance.\n\t * @param {string} field The name of the field to filter by.\n\t * @param {*} operatorOrValue If a third param is given, this should\n\t * be the filter's operator (like \">=\"). Otherwise, this will be\n\t * used as the filter's value, and the filter's operator will be \"=\".\n\t * @param {*=} opt_value The filter's value.\n\t * @constructor\n\t */\n\tconstructor(field, operatorOrValue, opt_value) {\n\t\tsuper();\n\t\tthis.body_ = new FilterBody(field, operatorOrValue, opt_value);\n\t}\n\n\t/**\n\t * Adds a filter to be composed with this filter using the given operator.\n\t * @param {string} operator\n\t * @param {!Filter|string} fieldOrFilter Either a {@link Filter} instance or the\n\t * name of the field to filter by.\n\t * @param {*=} opt_operatorOrValue Either the field's operator or its value.\n\t * @param {*=} opt_value The filter's value.\n\t * @chainnable\n\t */\n\tadd(operator, fieldOrFilter, opt_operatorOrValue, opt_value) {\n\t\tvar filter = fieldOrFilter ? Filter.toFilter(fieldOrFilter, opt_operatorOrValue, opt_value) : null;\n\t\tthis.body_.add(operator, filter);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Adds filters to be composed with this filter using the given operator.\n\t * @param {string} operator\n\t * @param {...*} filters A variable amount of filters to be composed.\n\t * @chainnable\n\t */\n\taddMany(operator, ...filters) {\n\t\tthis.body_.addMany(operator, ...filters);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Adds a filter to be composed with this filter using the \"and\" operator.\n\t * @param {!Filter|string} fieldOrFilter Either a {@link Filter} instance or the\n\t * name of the field to filter by.\n\t * @param {*=} opt_operatorOrValue Either the field's operator or its value.\n\t * @param {*=} opt_value The filter's value.\n\t * @chainnable\n\t */\n\tand(fieldOrFilter, opt_operatorOrValue, opt_value) {\n\t\treturn this.add('and', fieldOrFilter, opt_operatorOrValue, opt_value);\n\t}\n\n\t/**\n\t * Returns a {@link Filter} instance that uses the \"any\" operator.\n\t * @param {string} field The name of the field to filter by.\n\t * @param {!(Array|...*)} values A variable amount of values to be used with\n\t * the \"none\" operator. Can be passed either as a single array or as\n\t * separate params.\n\t * @return {!Filter}\n\t * @static\n\t */\n\tstatic any(field) {\n\t\tvar values = Array.prototype.slice.call(arguments, 1);\n\t\tif (values.length === 1 && values[0] instanceof Array) {\n\t\t\tvalues = values[0];\n\t\t}\n\t\treturn new Filter(field, 'any', values);\n\t}\n\n\t/**\n\t * Returns a {@link Filter} instance that uses the \"gp\" operator.\n\t * This is a special use case of `Filter.polygon` for bounding\n\t * boxes.\n\t * @param {string} field The field's name.\n\t * @param {*} boxOrUpperLeft Either a `Geo.BoundingBox` instance, or\n\t * a bounding box's upper left coordinate.\n\t * @param {*=} opt_lowerRight A bounding box's lower right coordinate.\n\t * @return {!Filter}\n\t * @static\n\t */\n\tstatic boundingBox(field, boxOrUpperLeft, opt_lowerRight) {\n\t\tif (boxOrUpperLeft instanceof Geo.BoundingBox) {\n\t\t\treturn Filter.polygon(field, ...boxOrUpperLeft.getPoints());\n\t\t} else {\n\t\t\treturn Filter.polygon(field, boxOrUpperLeft, opt_lowerRight);\n\t\t}\n\t}\n\n\t/**\n\t * Gets the json object that represents this filter.\n\t * @return {!Object}\n\t */\n\tbody() {\n\t\treturn this.body_.getObject();\n\t}\n\n\t/**\n\t * Returns a {@link Filter} instance that uses the \"gd\" operator.\n\t * @param {string} field The field's name.\n\t * @param {*} locationOrCircle Either a `Geo.Circle` instance or a coordinate.\n\t * @param {Range|string=} opt_rangeOrDistance Either a `Range` instance or\n\t * the distance value.\n\t * @return {!Filter}\n\t * @static\n\t */\n\tstatic distance(field, locationOrCircle, opt_rangeOrDistance) {\n\t\tvar location = locationOrCircle;\n\t\tvar range = opt_rangeOrDistance;\n\t\tif (locationOrCircle instanceof Geo.Circle) {\n\t\t\tlocation = locationOrCircle.getCenter();\n\t\t\trange = Range.to(locationOrCircle.getRadius());\n\t\t} else if (!(opt_rangeOrDistance instanceof Range)) {\n\t\t\trange = Range.to(opt_rangeOrDistance);\n\t\t}\n\t\treturn Filter.distanceInternal_(field, location, range);\n\t}\n\n\t/**\n\t * Returns a {@link Filter} instance that uses the \"gd\" operator. This\n\t * is just an internal helper used by `Filter.distance`.\n\t * @param {string} field The field's name.\n\t * @param {*} location A location coordinate.\n\t * @param {Range} range A `Range` instance.\n\t * @return {!Filter}\n\t * @protected\n\t * @static\n\t */\n\tstatic distanceInternal_(field, location, range) {\n\t\tvar value = {\n\t\t\tlocation: Embodied.toBody(location)\n\t\t};\n\t\trange = range.body();\n\t\tif (range.from) {\n\t\t\tvalue.min = range.from;\n\t\t}\n\t\tif (range.to) {\n\t\t\tvalue.max = range.to;\n\t\t}\n\t\treturn Filter.field(field, 'gd', value);\n\t}\n\n\t/**\n\t * Returns a {@link Filter} instance that uses the \"=\" operator.\n\t * @param {string} field The name of the field to filter by.\n\t * @param {*} value The filter's value.\n\t * @return {!Filter}\n * @static\n\t */\n\tstatic equal(field, value) {\n\t\treturn new Filter(field, '=', value);\n\t}\n\n\t/**\n\t * Returns a {@link Filter} instance that uses the \"exists\" operator.\n\t * @param {string} field The field's name.\n\t * @return {!Filter}\n\t * @static\n\t */\n\tstatic exists(field) {\n\t\treturn Filter.field(field, 'exists', null);\n\t}\n\n\t/**\n\t * Returns a {@link Filter} instance that uses the \"fuzzy\" operator.\n\t * @param {string} fieldOrQuery If no second string argument is given, this\n\t * should be the query string, in which case all fields will be matched.\n\t * Otherwise, this should be the name of the field to match.\n\t * @param {string|number=} opt_queryOrFuzziness If this is a string, it should\n\t * be the query, otherwise it should be the fuzziness value.\n\t * @param {number=} opt_fuzziness The fuzziness value.\n\t * @return {!Filter}\n\t * @static\n\t */\n\tstatic fuzzy(fieldOrQuery, opt_queryOrFuzziness, opt_fuzziness) {\n\t\treturn Filter.fuzzyInternal_('fuzzy', fieldOrQuery, opt_queryOrFuzziness, opt_fuzziness);\n\t}\n\n\t/**\n\t * Returns a {@link Filter} instance that uses the given fuzzy operator. This\n\t * is an internal implementation used by the `Filter.fuzzy` method.\n\t * @param {string} operator The fuzzy operator.\n\t * @param {string} fieldOrQuery If no second string argument is given, this\n\t * should be the query string, in which case all fields will be matched.\n\t * Otherwise, this should be the name of the field to match.\n\t * @param {string|number=} opt_queryOrFuzziness If this is a string, it should\n\t * be the query, otherwise it should be the fuzziness value.\n\t * @param {number=} opt_fuzziness The fuzziness value.\n\t * @return {!Filter}\n\t * @protected\n\t * @static\n\t */\n\tstatic fuzzyInternal_(operator, fieldOrQuery, opt_queryOrFuzziness, opt_fuzziness) {\n\t\tvar arg2IsString = core.isString(opt_queryOrFuzziness);\n\n\t\tvar value = {\n\t\t\tquery: arg2IsString ? opt_queryOrFuzziness : fieldOrQuery\n\t\t};\n\t\tvar fuzziness = arg2IsString ? opt_fuzziness : opt_queryOrFuzziness;\n\t\tif (fuzziness) {\n\t\t\tvalue.fuzziness = fuzziness;\n\t\t}\n\n\t\tvar field = arg2IsString ? fieldOrQuery : Filter.ALL;\n\t\treturn Filter.field(field, operator, value);\n\t}\n\n\t/**\n\t * Returns a {@link Filter} instance that uses the \">\" operator.\n\t * @param {string} field The name of the field to filter by.\n\t * @param {*} value The filter's value.\n\t * @return {!Filter}\n * @static\n\t */\n\tstatic gt(field, value) {\n\t\treturn new Filter(field, '>', value);\n\t}\n\n\t/**\n\t * Returns a {@link Filter} instance that uses the \">=\" operator.\n\t * @param {string} field The name of the field to filter by.\n\t * @param {*} value The filter's value.\n\t * @return {!Filter}\n * @static\n\t */\n\tstatic gte(field, value) {\n\t\treturn new Filter(field, '>=', value);\n\t}\n\n\t/**\n\t * Returns a {@link Filter} instance that uses the \"match\" operator.\n\t * @param {string} fieldOrQuery If no second string argument is given, this\n\t * should be the query string, in which case all fields will be matched.\n\t * Otherwise, this should be the name of the field to match.\n\t * @param {string=} opt_query The query string.\n\t * @return {!Filter}\n\t * @static\n\t */\n\tstatic match(fieldOrQuery, opt_query) {\n\t\tvar field = core.isString(opt_query) ? fieldOrQuery : Filter.ALL;\n\t\tvar query = core.isString(opt_query) ? opt_query : fieldOrQuery;\n\t\treturn Filter.field(field, 'match', query);\n\t}\n\n\t/**\n\t * Returns a {@link Filter} instance that uses the \"missing\" operator.\n\t * @param {string} field The field's name.\n\t * @return {!Filter}\n\t * @static\n\t */\n\tstatic missing(field) {\n\t\treturn Filter.field(field, 'missing', null);\n\t}\n\n\t/**\n\t * Returns a {@link Filter} instance that uses the \"phrase\" operator.\n\t * @param {string} fieldOrQuery If no second string argument is given, this\n\t * should be the query string, in which case all fields will be matched.\n\t * Otherwise, this should be the name of the field to match.\n\t * @param {string=} opt_query The query string.\n\t * @return {!Filter}\n\t * @static\n\t */\n\tstatic phrase(fieldOrQuery, opt_query) {\n\t\tvar field = core.isString(opt_query) ? fieldOrQuery : Filter.ALL;\n\t\tvar query = core.isString(opt_query) ? opt_query : fieldOrQuery;\n\t\treturn Filter.field(field, 'phrase', query);\n\t}\n\n\t/**\n\t * Returns a {@link Filter} instance that uses the \"gp\" operator.\n\t * @param {string} field The name of the field.\n\t * @param {...!Object} points Objects representing points in the polygon.\n\t * @return {!Filter}\n\t * @static\n\t */\n\tstatic polygon(field, ...points) {\n\t\tpoints = points.map(point => Embodied.toBody(point));\n\t\treturn Filter.field(field, 'gp', points);\n\t}\n\n\t/**\n\t * Returns a {@link Filter} instance that uses the \"prefix\" operator.\n\t * @param {string} fieldOrQuery If no second argument is given, this should\n\t * be the query string, in which case all fields will be matched. Otherwise,\n\t * this should be the name of the field to match.\n\t * @param {string=} opt_query The query string.\n\t * @return {!Filter}\n\t * @static\n\t */\n\tstatic prefix(fieldOrQuery, opt_query) {\n\t\tvar field = opt_query ? fieldOrQuery : Filter.ALL;\n\t\tvar query = opt_query ? opt_query : fieldOrQuery;\n\t\treturn Filter.field(field, 'prefix', query);\n\t}\n\n\t/**\n\t * Returns a {@link Filter} instance that uses the \"range\" operator.\n\t * @param {string} field The field's name.\n\t * @param {*} rangeOrMin Either a `Range` instance or a the range's min value.\n\t * @param {*=} opt_max The range's max value.\n\t * @return {!Filter}\n\t * @static\n\t */\n\tstatic range(field, rangeOrMin, opt_max) {\n\t\tvar range = rangeOrMin;\n\t\tif (!(range instanceof Range)) {\n\t\t\trange = Range.range(rangeOrMin, opt_max);\n\t\t}\n\t\treturn Filter.field(field, 'range', range);\n\t}\n\n\t/**\n\t * Returns a {@link Filter} instance that uses the \"~\" operator.\n\t * @param {string} field The name of the field to filter by.\n\t * @param {*} value The filter's value.\n\t * @return {!Filter}\n * @static\n\t */\n\tstatic regex(field, value) {\n\t\treturn new Filter(field, '~', value);\n\t}\n\n\t/**\n\t * Returns a {@link Filter} instance that uses the \"gs\" operator.\n\t * @param {string} field The field's name.\n\t * @param {...!Object} shapes Objects representing shapes.\n\t * @return {!Filter}\n\t * @static\n\t */\n\tstatic shape(field, ...shapes) {\n\t\tshapes = shapes.map(shape => Embodied.toBody(shape));\n\t\tvar value = {\n\t\t\ttype: 'geometrycollection',\n\t\t\tgeometries: shapes\n\t\t};\n\t\treturn Filter.field(field, 'gs', value);\n\t}\n\n\t/**\n\t * Returns a {@link Filter} instance that uses the \"similar\" operator.\n\t * @param {string} fieldOrQuery If no second string argument is given, this\n\t * should be the query string, in which case all fields will be matched.\n\t * Otherwise, this should be the name of the field to match.\n\t * @param {?string} query The query string.\n\t * @return {!Filter}\n\t * @static\n\t */\n\tstatic similar(fieldOrQuery, query) {\n\t\tvar field = core.isString(query) ? fieldOrQuery : Filter.ALL;\n\t\tvar value = {\n\t\t\tquery: core.isString(query) ? query : fieldOrQuery\n\t\t};\n\t\treturn Filter.field(field, 'similar', value);\n\t}\n\n\t/**\n\t * Returns a {@link Filter} instance that uses the \"<\" operator.\n\t * @param {string} field The name of the field to filter by.\n\t * @param {*} value The filter's value.\n\t * @return {!Filter}\n * @static\n\t */\n\tstatic lt(field, value) {\n\t\treturn new Filter(field, '<', value);\n\t}\n\n\t/**\n\t * Returns a {@link Filter} instance that uses the \"<=\" operator.\n\t * @param {string} field The name of the field to filter by.\n\t * @param {*} value The filter's value.\n\t * @return {!Filter}\n * @static\n\t */\n\tstatic lte(field, value) {\n\t\treturn new Filter(field, '<=', value);\n\t}\n\n\t/**\n\t * Returns a {@link Filter} instance that uses the \"none\" operator.\n\t * @param {string} field The name of the field to filter by.\n\t * @param {!(Array|...*)} value A variable amount of values to be used with\n\t * the \"none\" operator. Can be passed either as a single array or as\n\t * separate params.\n\t * @return {!Filter}\n\t * @static\n\t */\n\tstatic none(field) {\n\t\tvar values = Array.prototype.slice.call(arguments, 1);\n\t\tif (values.length === 1 && values[0] instanceof Array) {\n\t\t\tvalues = values[0];\n\t\t}\n\t\treturn new Filter(field, 'none', values);\n\t}\n\n\t/**\n\t * Returns a {@link Filter} instance that uses the \"!=\" operator.\n\t * @param {string} field The name of the field to filter by.\n\t * @param {*} value The filter's value.\n\t * @return {!Filter}\n\t * @static\n\t */\n\tstatic notEqual(field, value) {\n\t\treturn new Filter(field, '!=', value);\n\t}\n\n\t/**\n\t * Returns a {@link Filter} instance that uses the \"not\" operator.\n\t * @param {!Filter|string} fieldOrFilter Either a {@link Filter} instance or the\n\t * name of the field to filter by.\n\t * @param {*=} opt_operatorOrValue Either the field's operator or its value.\n\t * @param {*=} opt_value The filter's value.\n\t * @return {!Filter}\n\t * @static\n\t */\n\tstatic not(fieldOrFilter, opt_operatorOrValue, opt_value) {\n\t\treturn Filter.toFilter(fieldOrFilter, opt_operatorOrValue, opt_value).add('not');\n\t}\n\n\t/**\n\t * Returns a {@link Filter} instance.\n\t * @param {string} field The name of the field to filter by.\n\t * @param {*} operatorOrValue If a third param is given, this should\n\t * be the filter's operator (like \">=\"). Otherwise, this will be\n\t * used as the filter's value, and the filter's operator will be \"=\".\n\t * @param {*=} opt_value The filter's value.\n\t * @return {!Filter}\n * @static\n\t */\n\tstatic field(field, operatorOrValue, opt_value) {\n\t\treturn new Filter(field, operatorOrValue, opt_value);\n\t}\n\n\t/**\n\t * Adds a filter to be composed with this filter using the \"or\" operator.\n\t * @param {!Filter|string} fieldOrFilter Either a {@link Filter} instance or the\n\t * name of the field to filter by.\n\t * @param {*=} opt_operatorOrValue Either the field's operator or its value.\n\t * @param {*=} opt_value The filter's value.\n\t * @chainnable\n\t */\n\tor(fieldOrFilter, opt_operatorOrValue, opt_value) {\n\t\treturn this.add('or', fieldOrFilter, opt_operatorOrValue, opt_value);\n\t}\n\n\t/**\n\t * Converts the given arguments into a {@link Filter} instance.\n\t * @param {!Filter|string} fieldOrFilter Either a {@link Filter} instance or the\n\t * name of the field to filter by.\n\t * @param {*=} opt_operatorOrValue Either the field's operator or its value.\n\t * @param {*=} opt_value The filter's value.\n\t * @return {!Filter}\n\t */\n\tstatic toFilter(fieldOrFilter, opt_operatorOrValue, opt_value) {\n\t\tvar filter = fieldOrFilter;\n\t\tif (!(filter instanceof Filter)) {\n\t\t\tfilter = Filter.field(fieldOrFilter, opt_operatorOrValue, opt_value);\n\t\t}\n\t\treturn filter;\n\t}\n}\n\n/**\n * String constant that represents all fields.\n * @type {string}\n * @static\n */\nFilter.ALL = '*';\n\nexport default Filter;\n","'use strict';\n\nimport Embodied from './Embodied';\nimport Range from './Range';\n\n/**\n * Class that represents a search aggregation.\n */\nclass Aggregation {\n\t/**\n\t * Constructs an {@link Aggregation} instance.\n\t * @param {string} field The aggregation field.\n\t * @param {string} operator The aggregation operator.\n\t * @param {*=} opt_value The aggregation value.\n\t * @constructor\n\t */\n\tconstructor(field, operator, opt_value) {\n\t\tthis.field_ = field;\n\t\tthis.operator_ = operator;\n\t\tthis.value_ = opt_value;\n\t}\n\n\t/**\n\t * Creates an {@link Aggregation} instance with the \"avg\" operator.\n\t * @param {string} field The aggregation field.\n\t * @return {!Aggregation}\n\t * @static\n\t */\n\tstatic avg(field) {\n\t\treturn Aggregation.field(field, 'avg');\n\t}\n\n\t/**\n\t * Creates an {@link Aggregation} instance with the \"count\" operator.\n\t * @param {string} field The aggregation field.\n\t * @return {!Aggregation}\n\t * @static\n\t */\n\tstatic count(field) {\n\t\treturn Aggregation.field(field, 'count');\n\t}\n\n\t/**\n\t * Creates an {@link DistanceAggregation} instance with the \"geoDistance\" operator.\n\t * @param {string} field The aggregation field.\n\t * @param {*} location The aggregation location.\n\t * @param {...!Range} ranges The aggregation ranges.\n\t * @return {!DistanceAggregation}\n\t * @static\n\t */\n\tstatic distance(field, location, ...ranges) {\n\t\treturn new Aggregation.DistanceAggregation(field, location, ...ranges);\n\t}\n\n\t/**\n\t * Creates an {@link Aggregation} instance with the \"extendedStats\" operator.\n\t * @param {string} field The aggregation field.\n\t * @return {!Aggregation}\n\t * @static\n\t */\n\tstatic extendedStats(field) {\n\t\treturn Aggregation.field(field, 'extendedStats');\n\t}\n\n\t/**\n\t * Gets this aggregation's field.\n\t * @return {string}\n\t */\n\tgetField() {\n\t\treturn this.field_;\n\t}\n\n\t/**\n\t * Gets this aggregation's operator.\n\t * @return {string}\n\t */\n\tgetOperator() {\n\t\treturn this.operator_;\n\t}\n\n\t/**\n\t * Gets this aggregation's value.\n\t * @return {*}\n\t */\n\tgetValue() {\n\t\treturn this.value_;\n\t}\n\n\t/**\n\t * Creates an {@link Aggregation} instance with the \"histogram\" operator.\n\t * @param {string} field The aggregation field.\n\t * @param {number} interval The histogram's interval.\n\t * @return {!Aggregation}\n\t * @static\n\t */\n\tstatic histogram(field, interval) {\n\t\treturn new Aggregation(field, 'histogram', interval);\n\t}\n\n\t/**\n\t * Creates an {@link Aggregation} instance with the \"max\" operator.\n\t * @param {string} field The aggregation field.\n\t * @return {!Aggregation}\n\t * @static\n\t */\n\tstatic max(field) {\n\t\treturn Aggregation.field(field, 'max');\n\t}\n\n\t/**\n\t * Creates an {@link Aggregation} instance with the \"min\" operator.\n\t * @param {string} field The aggregation field.\n\t * @return {!Aggregation}\n\t * @static\n\t */\n\tstatic min(field) {\n\t\treturn Aggregation.field(field, 'min');\n\t}\n\n\t/**\n\t * Creates an {@link Aggregation} instance with the \"missing\" operator.\n\t * @param {string} field The aggregation field.\n\t * @return {!Aggregation}\n\t * @static\n\t */\n\tstatic missing(field) {\n\t\treturn Aggregation.field(field, 'missing');\n\t}\n\n\t/**\n\t * Creates a new {@link Aggregation} instance.\n\t * @param {string} field The aggregation field.\n\t * @param {string} operator The aggregation operator.\n\t * @return {!Aggregation}\n\t * @static\n\t */\n\tstatic field(field, operator) {\n\t\treturn new Aggregation(field, operator);\n\t}\n\n\t/**\n\t * Creates an {@link RangeAggregation} instance with the \"range\" operator.\n\t * @param {string} field The aggregation field.\n\t * @param {...!Range} ranges The aggregation ranges.\n\t * @return {!RangeAggregation}\n\t * @static\n\t */\n\tstatic range(field, ...ranges) {\n\t\treturn new Aggregation.RangeAggregation(field, ...ranges);\n\t}\n\n\t/**\n\t * Creates an {@link Aggregation} instance with the \"stats\" operator.\n\t * @param {string} field The aggregation field.\n\t * @return {!Aggregation}\n\t * @static\n\t */\n\tstatic stats(field) {\n\t\treturn Aggregation.field(field, 'stats');\n\t}\n\n\t/**\n\t * Creates an {@link Aggregation} instance with the \"sum\" operator.\n\t * @param {string} field The aggregation field.\n\t * @return {!Aggregation}\n\t * @static\n\t */\n\tstatic sum(field) {\n\t\treturn Aggregation.field(field, 'sum');\n\t}\n\n\t/**\n\t * Creates an {@link Aggregation} instance with the \"terms\" operator.\n\t * @param {string} field The aggregation field.\n\t * @return {!Aggregation}\n\t * @static\n\t */\n\tstatic terms(field) {\n\t\treturn Aggregation.field(field, 'terms');\n\t}\n}\n\n/**\n * Class that represents a distance aggregation.\n * @extends {Aggregation}\n */\nclass DistanceAggregation extends Aggregation {\n\t/**\n\t * Constructs an {@link DistanceAggregation} instance.\n\t * @param {string} field The aggregation field.\n\t * @param {*} location The aggregation location.\n\t * @param {...!Range} ranges The aggregation ranges.\n\t * @constructor\n\t */\n\tconstructor(field, location, ...ranges) {\n\t\tsuper(field, 'geoDistance', {});\n\t\tthis.value_.location = Embodied.toBody(location);\n\t\tthis.value_.ranges = ranges.map(range => range.body());\n\t}\n\n\t/**\n\t * Adds a range to this aggregation.\n\t * @param {*} rangeOrFrom\n\t * @param {*=} opt_to\n\t * @chainnable\n\t */\n\trange(rangeOrFrom, opt_to) {\n\t\tvar range = rangeOrFrom;\n\t\tif (!(range instanceof Range)) {\n\t\t\trange = Range.range(rangeOrFrom, opt_to);\n\t\t}\n\t\tthis.value_.ranges.push(range.body());\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets this aggregation's unit.\n\t * @param {string} unit\n\t * @chainnable\n\t */\n\tunit(unit) {\n\t\tthis.value_.unit = unit;\n\t\treturn this;\n\t}\n}\nAggregation.DistanceAggregation = DistanceAggregation;\n\n/**\n * Class that represents a range aggregation.\n * @extends {Aggregation}\n */\nclass RangeAggregation extends Aggregation {\n\t/**\n\t * Constructs an {@link RangeAggregation} instance.\n\t * @param {string} field The aggregation field.\n\t * @param {...!Range} ranges The aggregation ranges.\n\t * @constructor\n\t */\n\tconstructor(field, ...ranges) {\n\t\tsuper(field, 'range');\n\t\tthis.value_ = ranges.map(range => range.body());\n\t}\n\n\t/**\n\t * Adds a range to this aggregation.\n\t * @param {*} rangeOrFrom\n\t * @param {*=} opt_to\n\t * @chainnable\n\t */\n\trange(rangeOrFrom, opt_to) {\n\t\tvar range = rangeOrFrom;\n\t\tif (!(range instanceof Range)) {\n\t\t\trange = Range.range(rangeOrFrom, opt_to);\n\t\t}\n\t\tthis.value_.push(range.body());\n\t\treturn this;\n\t}\n}\nAggregation.RangeAggregation = RangeAggregation;\n\nexport default Aggregation;\n","'use strict';\n\nimport core from 'bower:metal/src/core';\nimport Embodied from './Embodied';\nimport Filter from './Filter';\nimport Aggregation from './Aggregation';\n\n/**\n * Class responsible for building queries.\n * @extends {Embodied}\n */\nclass Query extends Embodied {\n\t/**\n\t * Adds an aggregation to this {@link Query} instance.\n\t * @param {string} name The aggregation name.\n\t * @param {!Aggregation|string} aggregationOrField Either an\n\t * {@link Aggregation} instance or the name of the aggregation field.\n\t * @param {string=} opt_operator The aggregation operator.\n\t * @return {!Query}\n\t * @static\n\t */\n\tstatic aggregate(name, aggregationOrField, opt_operator) {\n\t\treturn new Query().aggregate(name, aggregationOrField, opt_operator);\n\t}\n\n\t/**\n\t * Sets this query's type to \"count\".\n\t * @return {!Query}\n\t * @static\n\t */\n\tstatic count() {\n\t\treturn new Query().type('count');\n\t}\n\n\t/**\n\t * Sets this query's type to \"fetch\".\n\t * @return {!Query}\n\t * @static\n\t */\n\tstatic fetch() {\n\t\treturn new Query().type('fetch');\n\t}\n\n\t/**\n\t * Adds a filter to this Query.\n\t * @param {!Filter|string} fieldOrFilter Either a {@link Filter} or the\n\t * name of the field to filter by.\n\t * @param {*=} opt_operatorOrValue Either the field's operator or its value.\n\t * @param {*=} opt_value The filter's value.\n\t * @return {!Query}\n\t * @static\n\t */\n\tstatic filter(fieldOrFilter, opt_operatorOrValue, opt_value) {\n\t\treturn new Query().filter(fieldOrFilter, opt_operatorOrValue, opt_value);\n\t}\n\n\t/**\n\t * Sets the query offset.\n\t * @param {number} offset The index of the first entry that should be returned\n\t * by this query.\n\t * @return {!Query}\n\t * @static\n\t */\n\tstatic offset(offset) {\n\t\treturn new Query().offset(offset);\n\t}\n\n\t/**\n\t * Adds a highlight entry to this {@link Query} instance.\n\t * @param {string} field The field's name.\n\t * @return {!Query}\n\t * @static\n\t */\n\tstatic highlight(field) {\n\t\treturn new Query().highlight(field);\n\t}\n\n\t/**\n\t * Sets the query limit.\n\t * @param {number} limit The max amount of entries that this query should return.\n\t * @return {!Query}\n\t * @static\n\t */\n\tstatic limit(limit) {\n\t\treturn new Query().limit(limit);\n\t}\n\n\t/**\n\t * Adds a search to this {@link Query} instance.\n\t * @param {!Filter|string} filterOrTextOrField If no other arguments\n\t * are passed to this function, this should be either a {@link Filter}\n\t * instance or a text to be used in a match filter. In both cases\n\t * the filter will be applied to all fields. Another option is to\n\t * pass this as a field name instead, together with other arguments\n\t * so the filter can be created.\n\t * @param {string=} opt_textOrOperator Either a text to be used in a\n\t * match filter, or the operator that should be used.\n\t * @param {*=} opt_value The value to be used by the filter. Should\n\t * only be passed if an operator was passed as the second argument.\n\t * @return {!Query}\n\t * @static\n\t */\n\tstatic search(filterOrTextOrField, opt_textOrOperator, opt_value) {\n\t\treturn new Query().search(filterOrTextOrField, opt_textOrOperator, opt_value);\n\t}\n\n\t/**\n\t * Adds a sort entry to this query, specifying the field this query should be\n\t * sorted by and, optionally, the sort direction.\n\t * @param {string} field The field that the query should be sorted by.\n\t * @param {string=} opt_direction The direction the sort operation should use.\n\t * If none is given, \"asc\" is used by default.\n\t * @return {!Query}\n\t * @static\n\t */\n\tstatic sort(field, opt_direction) {\n\t\treturn new Query().sort(field, opt_direction);\n\t}\n\n\t/**\n\t * Sets the query type.\n\t * @param {string} type The query's type. For example: \"count\", \"fetch\".\n\t * @return {!Query}\n\t * @static\n\t */\n\tstatic type(type) {\n\t\treturn new Query().type(type);\n\t}\n\n\t/**\n\t * Adds an aggregation to this {@link Query} instance.\n\t * @param {string} name The aggregation name.\n\t * @param {!Aggregation|string} aggregationOrField Either an\n\t * {@link Aggregation} instance or the name of the aggregation field.\n\t * @param {string=} opt_operator The aggregation operator.\n\t * @chainnable\n\t */\n\taggregate(name, aggregationOrField, opt_operator) {\n\t\tvar aggregation = aggregationOrField;\n\t\tif (!(aggregation instanceof Aggregation)) {\n\t\t\taggregation = Aggregation.field(aggregationOrField, opt_operator);\n\t\t}\n\n\t\tvar field = aggregation.getField();\n\t\tvar value = {};\n\t\tvalue[field] = {\n\t\t\tname: name,\n\t\t\toperator: aggregation.getOperator()\n\t\t};\n\t\tif (core.isDefAndNotNull(aggregation.getValue())) {\n\t\t\tvalue[field].value = aggregation.getValue();\n\t\t}\n\n\t\tif (!this.body_.aggregation) {\n\t\t\tthis.body_.aggregation = [];\n\t\t}\n\t\tthis.body_.aggregation.push(value);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets this query's type to \"count\".\n\t * @chainnable\n\t */\n\tcount() {\n\t\treturn this.type('count');\n\t}\n\n\t/**\n\t * Sets this query's type to \"fetch\".\n\t * @chainnable\n\t */\n\tfetch() {\n\t\treturn this.type('fetch');\n\t}\n\n\t/**\n\t * Adds a filter to this Query.\n\t * @param {!Filter|string} fieldOrFilter Either a {@link Filter} or the\n\t * name of the field to filter by.\n\t * @param {*=} opt_operatorOrValue Either the field's operator or its value.\n\t * @param {*=} opt_value The filter's value.\n\t * @chainnable\n\t */\n\tfilter(fieldOrFilter, opt_operatorOrValue, opt_value) {\n\t\tvar filter = Filter.toFilter(fieldOrFilter, opt_operatorOrValue, opt_value);\n\t\tif (!this.body_.filter) {\n\t\t\tthis.body_.filter = [];\n\t\t}\n\t\tthis.body_.filter.push(filter.body());\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the query offset.\n\t * @param {number} offset The index of the first entry that should be returned\n\t * by this query.\n\t * @chainnable\n\t */\n\toffset(offset) {\n\t\tthis.body_.offset = offset;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Adds a highlight entry to this {@link Query} instance.\n\t * @param {string} field The field's name.\n\t * @chainnable\n\t */\n\thighlight(field) {\n\t\tif (!this.body_.highlight) {\n\t\t\tthis.body_.highlight = [];\n\t\t}\n\n\t\tthis.body_.highlight.push(field);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the query limit.\n\t * @param {number} limit The max amount of entries that this query should return.\n\t * @chainnable\n\t */\n\tlimit(limit) {\n\t\tthis.body_.limit = limit;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Adds a search to this {@link Query} instance.\n\t * @param {!Filter|string} filterOrTextOrField If no other arguments\n\t * are passed to this function, this should be either a {@link Filter}\n\t * instance or a text to be used in a match filter. In both cases\n\t * the filter will be applied to all fields. Another option is to\n\t * pass this as a field name instead, together with other arguments\n\t * so the filter can be created.\n\t * @param {string=} opt_textOrOperator Either a text to be used in a\n\t * match filter, or the operator that should be used.\n\t * @param {*=} opt_value The value to be used by the filter. Should\n\t * only be passed if an operator was passed as the second argument.\n\t * @chainnable\n\t */\n\tsearch(filterOrTextOrField, opt_textOrOperator, opt_value) {\n\t\tvar filter = filterOrTextOrField;\n\t\tif (opt_value) {\n\t\t\tfilter = Filter.field(filterOrTextOrField, opt_textOrOperator, opt_value);\n\t\t} else if (opt_textOrOperator) {\n\t\t\tfilter = Filter.match(filterOrTextOrField, opt_textOrOperator);\n\t\t} else if (!(filter instanceof Filter)) {\n\t\t\tfilter = Filter.match(filterOrTextOrField);\n\t\t}\n\t\tif (!this.body_.search) {\n\t\t\tthis.body_.search = [];\n\t\t}\n\t\tthis.body_.search.push(filter.body());\n\t\treturn this;\n\t}\n\n\t/**\n\t * Adds a sort entry to this query, specifying the field this query should be\n\t * sorted by and, optionally, the sort direction.\n\t * @param {string} field The field that the query should be sorted by.\n\t * @param {string=} opt_direction The direction the sort operation should use.\n\t * If none is given, \"asc\" is used by default.\n\t * @chainnable\n\t */\n\tsort(field, opt_direction) {\n\t\tif (!this.body_.sort) {\n\t\t\tthis.body_.sort = [];\n\t\t}\n\t\tvar sortEntry = {};\n\t\tsortEntry[field] = opt_direction || 'asc';\n\t\tthis.body_.sort.push(sortEntry);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the query type.\n\t * @param {string} type The query's type. For example: \"count\", \"fetch\".\n\t * @chainnable\n\t */\n\ttype(type) {\n\t\tthis.body_.type = type;\n\t\treturn this;\n\t}\n}\n\nexport default Query;\n","'use strict';\n\nimport AjaxTransport from './AjaxTransport';\n\n/**\n * Provides a factory for data transport.\n */\nclass TransportFactory {\n\tconstructor() {\n\t\tthis.transports = {};\n\t\tthis.transports[TransportFactory.DEFAULT_TRANSPORT_NAME] = AjaxTransport;\n\t}\n\n\t/**\n\t * Returns {@link TransportFactory} instance.\n\t */\n\tstatic instance() {\n\t\tif (!TransportFactory.instance_) {\n\t\t\tTransportFactory.instance_ = new TransportFactory();\n\t\t}\n\t\treturn TransportFactory.instance_;\n\t}\n\n\t/**\n\t * Gets an instance of the transport implementation with the given name.\n\t * @param {string} implementationName\n\t * @return {!Transport}\n\t */\n\tget(implementationName) {\n\t\tvar TransportClass = this.transports[implementationName];\n\n\t\tif (!TransportClass) {\n\t\t\tthrow new Error('Invalid transport name: ' + implementationName);\n\t\t}\n\n\t\ttry {\n\t\t\treturn new (TransportClass)();\n\t\t} catch (err) {\n\t\t\tthrow new Error('Can\\'t create transport', err);\n\t\t}\n\t}\n\n\t/**\n\t * Returns the default transport implementation.\n\t * @return {!Transport}\n\t */\n\tgetDefault() {\n\t\treturn this.get(TransportFactory.DEFAULT_TRANSPORT_NAME);\n\t}\n}\n\nTransportFactory.DEFAULT_TRANSPORT_NAME = 'default';\n\nexport default TransportFactory;\n","'use strict';\n\nimport core from 'bower:metal/src/core';\nimport Auth from '../api/Auth';\nimport Embodied from '../api-query/Embodied';\nimport Filter from '../api-query/Filter';\nimport Query from '../api-query/Query';\nimport TransportFactory from './TransportFactory';\nimport ClientRequest from './ClientRequest';\nimport Ajax from 'bower:metal-ajax/src/Ajax';\nimport MultiMap from 'bower:metal-multimap/src/MultiMap';\n\n/**\n * The main class for making api requests. Sending requests returns a promise that is\n * resolved when the response arrives. Usage example:\n * ```javascript\n * Launchpad\n * .url('/data/tasks')\n * .post({desc: 'Buy milkl'})\n * .then(function(response) {\n * // Handle response here.\n * console.log(response.body())\n * });\n * ```\n */\nclass Launchpad {\n\t/**\n\t * Launchpad constructor function.\n\t * @param {string} url The base url.\n\t * @param {...string} paths Any amount of paths to be appended to the base url.\n\t * @constructor\n\t */\n\tconstructor(url, ...paths) {\n\t\tif (arguments.length === 0) {\n\t\t\tthrow new Error('Invalid arguments, try `new Launchpad(baseUrl, url)`');\n\t\t}\n\n\t\tthis.auth_ = null;\n\t\tthis.body_ = null;\n\t\tthis.url_ = Ajax.joinPaths(url || '', ...paths);\n\t\tthis.headers_ = new MultiMap();\n\t\tthis.params_ = new MultiMap();\n\n\t\tthis.header('Content-Type', 'application/json');\n\t\tthis.header('X-PJAX', 'true');\n\t\tthis.header('X-Requested-With', 'XMLHttpRequest');\n\t}\n\n\t/**\n\t * Adds an aggregation to this {@link Query} instance.\n\t * @param {string} name The aggregation name.\n\t * @param {!Aggregation|string} aggregationOrField Either an\n\t * {@link Aggregation} instance or the name of the aggregation field.\n\t * @param {string=} opt_operator The aggregation operator.\n\t * @chainable\n\t */\n\taggregate(name, aggregationOrField, opt_operator) {\n\t\tthis.getOrCreateQuery_().aggregate(name, aggregationOrField, opt_operator);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Adds authorization information to this request.\n\t * @param {!Auth|string} authOrTokenOrUsername Either an {@link Auth} instance,\n\t * an authorization token, or the username.\n\t * @param {string=} opt_password If a username is given as the first param,\n\t * this should be the password.\n\t * @chainable\n\t */\n\tauth(authOrTokenOrUsername, opt_password) {\n\t\tthis.auth_ = authOrTokenOrUsername;\n\t\tif (!(this.auth_ instanceof Auth)) {\n\t\t\tthis.auth_ = Auth.create(authOrTokenOrUsername, opt_password);\n\t\t}\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the body that will be sent with this request.\n\t * @param {*} body\n\t * @chainable\n\t */\n\tbody(body) {\n\t\tthis.body_ = body;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Converts the given body object to query params.\n\t * @param {!ClientRequest} clientRequest\n\t * @param {*} body\n\t * @protected\n\t */\n\tconvertBodyToParams_(clientRequest, body) {\n\t\tif (core.isString(body)) {\n\t\t\tbody = {\n\t\t\t\tbody: body\n\t\t\t};\n\t\t} else if (body instanceof Embodied) {\n\t\t\tbody = body.body();\n\t\t}\n\t\tObject.keys(body || {}).forEach(name => clientRequest.param(name, body[name]));\n\t}\n\n\t/**\n\t * Sets this request's query type to \"count\".\n\t * @chainnable\n\t */\n\tcount() {\n\t\tthis.getOrCreateQuery_().type('count');\n\t\treturn this;\n\t}\n\n\t/**\n\t * Creates client request and encode.\n\t * @param {string} method\n\t * @param {*} body\n\t * @return {!ClientRequest} clientRequest\n\t * @protected\n\t */\n\tcreateClientRequest_(method, body) {\n\t\tvar clientRequest = new ClientRequest();\n\n\t\tclientRequest.body(body || this.body_);\n\n\t\tif (!core.isDefAndNotNull(clientRequest.body())) {\n\t\t\tif (this.query_) {\n\t\t\t\tclientRequest.body(this.query_.body());\n\t\t\t} else if (this.formData_) {\n\t\t\t\tclientRequest.body(this.formData_);\n\t\t\t}\n\t\t}\n\n\t\tclientRequest.method(method);\n\t\tclientRequest.headers(this.headers());\n\t\tclientRequest.params(this.params());\n\t\tclientRequest.url(this.url());\n\n\t\tthis.encode(clientRequest);\n\n\t\treturn clientRequest;\n\t}\n\n\t/**\n\t * Decodes clientResponse body, parsing the body for example.\n\t * @param {!ClientResponse} clientResponse The response object to be decoded.\n\t * @return {!ClientResponse} The decoded response.\n\t */\n\tdecode(clientResponse) {\n\t\tif (Launchpad.isContentTypeJson(clientResponse)) {\n\t\t\ttry {\n\t\t\t\tclientResponse.body(JSON.parse(clientResponse.body()));\n\t\t\t} catch (err) {}\n\t\t}\n\t\treturn clientResponse;\n\t}\n\n\t/**\n\t * Sends message with the DELETE http verb.\n\t * @param {string=} opt_body Content to be sent as the request's body.\n\t * @return {!Promise}\n\t */\n\tdelete(opt_body) {\n\t\treturn this.sendAsync('DELETE', opt_body);\n\t}\n\n\t/**\n\t * Encodes the given {@link ClientRequest}, converting its body to an appropriate\n\t * format for example.\n\t * @param {!ClientRequest} clientRequest The request object to encode.\n\t * @return {!ClientRequest} The encoded request.\n\t */\n\tencode(clientRequest) {\n\t\tvar body = clientRequest.body();\n\n\t\tif (core.isElement(body)) {\n\t\t\tbody = new FormData(body);\n\t\t\tclientRequest.body(body);\n\t\t}\n\n\t\tbody = this.wrapWithQuery_(body);\n\t\tif (clientRequest.method() === 'GET') {\n\t\t\tthis.convertBodyToParams_(clientRequest, body);\n\t\t\tclientRequest.removeBody();\n\t\t\tbody = null;\n\t\t}\n\n\t\tif (body instanceof FormData) {\n\t\t\tclientRequest.headers().remove('content-type');\n\t\t} else if (body instanceof Embodied) {\n\t\t\tclientRequest.body(body.toString());\n\t\t} else if (Launchpad.isContentTypeJson(clientRequest)) {\n\t\t\tclientRequest.body(JSON.stringify(clientRequest.body()));\n\t\t}\n\n\t\tthis.encodeParams_(clientRequest);\n\t\tthis.resolveAuthentication_(clientRequest);\n\n\t\treturn clientRequest;\n\t}\n\n\t/**\n\t * Encodes the params for the given request, according to their types.\n\t * @param {!ClientRequest} clientRequest\n\t * @protected\n\t */\n\tencodeParams_(clientRequest) {\n\t\tvar params = clientRequest.params();\n\t\tparams.names().forEach(function(name) {\n\t\t\tvar values = params.getAll(name);\n\t\t\tvalues.forEach(function(value, index) {\n\t\t\t\tif (value instanceof Embodied) {\n\t\t\t\t\tvalue = value.toString();\n\t\t\t\t} else if (core.isObject(value) || (value instanceof Array)) {\n\t\t\t\t\tvalue = JSON.stringify(value);\n\t\t\t\t}\n\t\t\t\tvalues[index] = value;\n\t\t\t});\n\t\t});\n\t}\n\n\t/**\n\t * Adds a filter to this request's {@link Query}.\n\t * @param {!Filter|string} fieldOrFilter Either a Filter instance or the\n\t * name of the field to filter by.\n\t * @param {*=} opt_operatorOrValue Either the field's operator or its value.\n\t * @param {*=} opt_value The filter's value.\n\t * @chainable\n\t */\n\tfilter(fieldOrFilter, opt_operatorOrValue, opt_value) {\n\t\tthis.getOrCreateQuery_().filter(fieldOrFilter, opt_operatorOrValue, opt_value);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Adds a key/value pair to be sent via the body in a `multipart/form-data` format.\n\t * If the body is set by other means (for example, through the `body` method), this\n\t * will be ignored.\n\t * @param {string} name\n\t * @param {*} value\n\t * @chainable\n\t */\n\tform(name, value) {\n\t\tif (!this.formData_) {\n\t\t\tthis.formData_ = new FormData();\n\t\t}\n\t\tthis.formData_.append(name, value);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sends message with the GET http verb.\n\t * @param {*=} opt_params Params to be added to the request url.\n\t * @return {!Promise}\n\t */\n\tget(opt_params) {\n\t\treturn this.sendAsync('GET', opt_params);\n\t}\n\n\t/**\n\t * Gets the currently used {@link Query} object. If none exists yet,\n\t * a new one is created.\n\t * @return {!Query}\n\t * @protected\n\t */\n\tgetOrCreateQuery_() {\n\t\tif (!this.query_) {\n\t\t\tthis.query_ = new Query();\n\t\t}\n\t\treturn this.query_;\n\t}\n\n\t/**\n\t * Adds a header. If the header with the same name already exists, it will\n\t * not be overwritten, but new value will be stored. The order is preserved.\n\t * @param {string} name\n\t * @param {*} value\n\t * @chainable\n\t */\n\theader(name, value) {\n\t\tif (arguments.length !== 2) {\n\t\t\tthrow new Error('Invalid arguments');\n\t\t}\n\t\tthis.headers_.set(name, value);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Gets the headers.\n\t * @return {!MultiMap}\n\t */\n\theaders() {\n\t\treturn this.headers_;\n\t}\n\n\t/**\n\t * Adds a highlight entry to this request's {@link Query} instance.\n\t * @param {string} field The field's name.\n\t * @chainable\n\t */\n\thighlight(field) {\n\t\tthis.getOrCreateQuery_().highlight(field);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the limit for this request's {@link Query}.\n\t * @param {number} limit The max amount of entries that this request should return.\n\t * @chainable\n\t */\n\tlimit(limit) {\n\t\tthis.getOrCreateQuery_().limit(limit);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the offset for this request's {@link Query}.\n\t * @param {number} offset The index of the first entry that should be returned\n\t * by this query.\n\t * @chainable\n\t */\n\toffset(offset) {\n\t\tthis.getOrCreateQuery_().offset(offset);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Adds a query. If the query with the same name already exists, it will not\n\t * be overwritten, but new value will be stored. The order is preserved.\n\t * @param {string} name\n\t * @param {*} value\n\t * @chainable\n\t */\n\tparam(name, value) {\n\t\tif (arguments.length !== 2) {\n\t\t\tthrow new Error('Invalid arguments');\n\t\t}\n\t\tthis.params_.set(name, value);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Gets the query strings map.\n\t * @return {!MultiMap}\n\t */\n\tparams() {\n\t\treturn this.params_;\n\t}\n\n\t/**\n\t * Sends message with the PATCH http verb.\n\t * @param {string=} opt_body Content to be sent as the request's body.\n\t * @return {!Promise}\n\t */\n\tpatch(opt_body) {\n\t\treturn this.sendAsync('PATCH', opt_body);\n\t}\n\n\t/**\n\t * Creates a new {@link Launchpad} instance for handling the url resulting in the\n\t * union of the current url with the given paths.\n\t * @param {...string} paths Any number of paths.\n\t * @return {!Launchpad} A new {@link Launchpad} instance for handling the given paths.\n\t */\n\tpath(...paths) {\n\t\treturn new Launchpad(this.url(), ...paths).use(this.customTransport_);\n\t}\n\n\t/**\n\t * Sends message with the POST http verb.\n\t * @param {string=} opt_body Content to be sent as the request's body.\n\t * @return {!Promise}\n\t */\n\tpost(opt_body) {\n\t\treturn this.sendAsync('POST', opt_body);\n\t}\n\n\t/**\n\t * Sends message with the PUT http verb.\n\t * @param {string=} opt_body Content to be sent as the request's body.\n\t * @return {!Promise}\n\t */\n\tput(opt_body) {\n\t\treturn this.sendAsync('PUT', opt_body);\n\t}\n\n\t/**\n\t * Adds the authentication information to the request.\n\t * @param {!ClientRequest} clientRequest\n\t * @protected\n\t */\n\tresolveAuthentication_(clientRequest) {\n\t\tif (!this.auth_) {\n\t\t\treturn;\n\t\t}\n\t\tif (this.auth_.hasToken()) {\n\t\t\tclientRequest.header('Authorization', 'Bearer ' + this.auth_.token());\n\t\t} else {\n\t\t\tvar credentials = this.auth_.username() + ':' + this.auth_.password();\n\t\t\tclientRequest.header('Authorization', 'Basic ' + btoa(credentials));\n\t\t}\n\t}\n\n\t/**\n\t * Adds a search to this request's {@link Query} instance.\n\t * @param {!Filter|string} filterOrTextOrField If no other arguments\n\t * are passed to this function, this should be either a `Filter`\n\t * instance or a text to be used in a match filter. In both cases\n\t * the filter will be applied to all fields. Another option is to\n\t * pass this as a field name instead, together with other arguments\n\t * so the filter can be created.\n\t * @param {string=} opt_textOrOperator Either a text to be used in a\n\t * match filter, or the operator that should be used.\n\t * @param {*=} opt_value The value to be used by the filter. Should\n\t * only be passed if an operator was passed as the second argument.\n\t * @chainable\n\t */\n\tsearch(filterOrTextOrField, opt_textOrOperator, opt_value) {\n\t\tthis.getOrCreateQuery_().search(filterOrTextOrField, opt_textOrOperator, opt_value);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Uses transport to send request with given method name and body\n\t * asynchronously.\n\t * @param {string} method The HTTP method to be used when sending data.\n\t * @param {string} body Content to be sent as the request's body.\n\t * @return {!Promise} Deferred request.\n\t */\n\tsendAsync(method, body) {\n\t\tvar transport = this.customTransport_ || TransportFactory.instance().getDefault();\n\n\t\tvar clientRequest = this.createClientRequest_(method, body);\n\n\t\treturn transport.send(clientRequest).then(this.decode);\n\t}\n\n\t/**\n\t * Adds a sort query to this request's body.\n\t * @param {string} field The field that the query should be sorted by.\n\t * @param {string=} opt_direction The direction the sort operation should use.\n\t * If none is given, \"asc\" is used by default.\n\t * @chainnable\n\t */\n\tsort(field, opt_direction) {\n\t\tthis.getOrCreateQuery_().sort(field, opt_direction);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Static factory for creating launchpad client for the given url.\n\t * @param {string} url The url that the client should use for sending requests.\n\t */\n\tstatic url(url) {\n\t\treturn new Launchpad(url).use(this.customTransport_);\n\t}\n\n\t/**\n\t * Returns the URL used by this client.\n\t */\n\turl() {\n\t\treturn this.url_;\n\t}\n\n\t/**\n\t * Specifies {@link Transport} implementation.\n\t * @param {!Transport} transport The transport implementation that should be used.\n\t */\n\tuse(transport) {\n\t\tthis.customTransport_ = transport;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Creates new socket.io instance. The parameters passed to socket.io\n\t * constructor will be provided:\n\t *\n\t * ```javascript\n\t * Launchpad.url('http://domain:8080/path/a').watch({id: 'myId'}, {foo: true});\n\t * // Equals:\n\t * io('domain:8080/?url=path%2Fa%3Fid%3DmyId', {foo: true});\n\t * ```\n\t *\n\t * @param {Object=} opt_params Params to be sent with the Socket IO request.\n\t * @param {Object=} opt_options Object with Socket IO options.\n\t * @return {!io} Socket IO reference. Server events can be listened on it.\n\t */\n\twatch(opt_params, opt_options) {\n\t\tif (typeof io === 'undefined') {\n\t\t\tthrow new Error('Socket.io client not loaded');\n\t\t}\n\n\t\tvar clientRequest = this.createClientRequest_('GET', opt_params);\n\n\t\tvar url = Ajax.parseUrl(\n\t\t\tAjax.addParametersToUrlQueryString(clientRequest.url(), clientRequest.params()));\n\n\t\topt_options = opt_options || {\n\t\t\t\tforceNew: true\n\t\t};\n\t\topt_options.path = opt_options.path || url[1];\n\n\t\treturn io(url[0] + '?url=' + encodeURIComponent(url[1] + url[2]), opt_options);\n\t}\n\n\t/**\n\t * Wraps the given `Embodied` instance with a {@link Query} instance if needed.\n\t * @param {Embodied} embodied\n\t * @return {Embodied}\n\t * @protected\n\t */\n\twrapWithQuery_(embodied) {\n\t\tif (embodied instanceof Filter) {\n\t\t\tembodied = Query.filter(embodied);\n\t\t}\n\t\treturn embodied;\n\t}\n}\n\nLaunchpad.isContentTypeJson = function(clientMessage) {\n\tvar contentType = clientMessage.headers().get('content-type') || '';\n\treturn contentType.indexOf('application/json') === 0;\n};\n\nexport default Launchpad;\n","import Filter from './Filter';\nimport Geo from './Geo';\nimport Query from './Query';\nimport Range from './Range';\n\nif (typeof window !== undefined) {\n\twindow.Filter = Filter;\n\twindow.Geo = Geo;\n\twindow.Query = Query;\n\twindow.Range = Range;\n}\n"],"sourceRoot":"/source/"} \ No newline at end of file