o: ActiveSupport::Cache::Entry	:@compressedF:@expires_in0:@created_atf1372843464.691626:@value"�
{I"
class:EFI"ProcessedAsset;�FI"logical_path;�FI"Core/loadImageViaBlob.js;�TI"
pathname;�FI"U/Users/bwrona/www/engines/cesium/app/assets/javascripts/Core/loadImageViaBlob.js;�TI"content_type;�FI"application/javascript;�FI"
mtime;�FI"2013-07-03T11:02:49+02:00;�FI"length;�Fi�
I"digest;�F"%b9a5fbce51a847ded92aba0f0a5287efI"source;�FI"�
/*global define*/

define([
        './loadBlob',
        './loadImage'
    ], function(
        loadBlob,
        loadImage) {
    "use strict";

    var dataUriRegex = /^data:/;

    /**
     * Asynchronously loads the given image URL by first downloading it as a blob using
     * XMLHttpRequest and then loading the image from the buffer via a blob URL.
     * This allows access to more information that is not accessible via normal
     * Image-based downloading, such as the size of the response.  This function
     * returns a promise that will resolve to
     * an {@link Image} once loaded, or reject if the image failed to load.  The
     * returned image will have a "blob" property with the Blob itself.  If the browser
     * does not support an XMLHttpRequests with a responseType of 'blob', or if the
     * provided URI is a data URI, this function is equivalent to calling {@link loadImage},
     * and the extra blob property will not be present.
     *
     * @exports loadImageViaBlob
     *
     * @param {String|Promise} url The source of the image, or a promise for the URL.
     *
     * @returns {Promise} a promise that will resolve to the requested data when loaded.
     *
     * @see <a href='http://www.w3.org/TR/cors/'>Cross-Origin Resource Sharing</a>
     * @see <a href='http://wiki.commonjs.org/wiki/Promises/A'>CommonJS Promises/A</a>
     *
     * @example
     * // load a single image asynchronously
     * loadImageViaBlob('some/image/url.png').then(function(image) {
     *     var blob = image.blob;
     *     // use the loaded image or XHR
     * }, function() {
     *     // an error occurred
     * });
     *
     * // load several images in parallel
     * when.all([loadImageViaBlob('image1.png'), loadImageViaBlob('image2.png')]).then(function(images) {
     *     // images is an array containing all the loaded images
     * });
     */
    var loadImageViaBlob = function(url) {
        if (dataUriRegex.test(url)) {
            return loadImage(url);
        }

        return loadBlob(url).then(function(blob) {
            var blobUrl = window.URL.createObjectURL(blob);

            return loadImage(blobUrl, false).then(function(image) {
                image.blob = blob;
                window.URL.revokeObjectURL(blobUrl);
                return image;
            }, function(e) {
                window.URL.revokeObjectURL(blobUrl);
                return e;
            });
        });
    };

    var xhrBlobSupported = (function() {
        try {
            var xhr = new XMLHttpRequest();
            xhr.responseType = 'blob';
            return xhr.responseType === 'blob';
        } catch (e) {
            return false;
        }
    })();

    return xhrBlobSupported ? loadImageViaBlob : loadImage;
});
;�FI"dependency_digest;�F"%e41abfe93f4a783733592b81b91ef592I"required_paths;�F[I"U/Users/bwrona/www/engines/cesium/app/assets/javascripts/Core/loadImageViaBlob.js;�TI"dependency_paths;�F[{I"	path;�FI"U/Users/bwrona/www/engines/cesium/app/assets/javascripts/Core/loadImageViaBlob.js;�TI"
mtime;�FI"2013-07-03T11:02:49+02:00;�FI"digest;�F"%f0881953e826820397eaa3a6e7f780c7I"
_version;�F"%6776f581a4329e299531e1d52aa59832