/*global pako*/
(function() {
    'use strict';

    window.embedInSandcastleTemplate = function(code, addExtraLine) {
        return 'function startup(Cesium) {\n' +
           '    \'use strict\';\n' +
           '//Sandcastle_Begin\n' +
           (addExtraLine ? '\n' : '') +
           code +
           '//Sandcastle_End\n' +
           '    Sandcastle.finishedLoading();\n' +
           '}\n' +
           'if (typeof Cesium !== \'undefined\') {\n' +
           '    startup(Cesium);\n' +
           '} else if (typeof require === \'function\') {\n' +
           '    require([\'Cesium\'], startup);\n' +
           '}\n';
    };
    window.decodeBase64Data = function(base64String) {
        // data stored in the hash as:
        // Base64 encoded, raw DEFLATE compressed JSON array where index 0 is code, index 1 is html
        // restore padding
        while (base64String.length % 4 !== 0) {
            base64String += '=';
        }
        var jsonString = pako.inflate(atob(base64String), { raw: true, to: 'string' });
        // we save a few bytes by omitting the leading [" and trailing "] since they are always the same
        jsonString = '["' + jsonString + '"]';
        var json = JSON.parse(jsonString);
        // index 0 is code, index 1 is html
        var code = json[0];
        var html = json[1];
        var baseHref = json[2];

        return {
            code : code,
            html : html,
            baseHref : baseHref
        };
    };
 }());

@@ -1,30 +1,201 @@
-/*global pako*/%0A(function(
+require(%7B%0A  baseUrl: '../../Source',%0A  packages: %5B%7B%0A      name: 'ThirdParty',%0A      location: '../Apps/Sandcastle/ThirdParty'%0A    %7D%5D%0A  %7D, %5B%0A      'ThirdParty/pako.min'%0A    %5D, function(%0A        pako
 ) %7B%0A
@@ -213,16 +213,17 @@
 rict';%0A%0A
+ 
     wind
@@ -1529,17 +1529,17 @@
 son%5B2%5D;%0A
-%0A
+ 
         
@@ -1649,13 +1649,11 @@
    %7D;%0A %7D
-()
 );%0A

Use requirejs in Sandcastle-helpers