Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Beginnings of new dashboard

  • Loading branch information...
commit 5130a6f283d5997253f3f2638a97459dd29758eb 1 parent 6e60494
@dallonf dallonf authored
View
3  .gitmodules
@@ -0,0 +1,3 @@
+[submodule "lib/resources/dashboard/bootstrap"]
+ path = lib/resources/dashboard/bootstrap
+ url = https://github.com/deployd/bootstrap
View
34 lib/resources/dashboard/auth.html
@@ -0,0 +1,34 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>Deployd Dashboard</title>
+ <link rel='stylesheet/less' type="text/css" href='/dashboard/stylesheets/style.less' />
+ <script type="text/javascript" src="/dashboard/js/lib/less-1.3.0.min.js"></script>
+ <link href='http://fonts.googleapis.com/css?family=Bitter:400,700,400italic' rel='stylesheet' type='text/css'>
+ </head>
+ <body>
+
+ <div class="modal" id="authModal">
+ <div class="modal-header">
+ <h3>Deployd Dashboard</h3>
+ </div>
+ <div class="modal-body">
+ <div class="alert alert-error hide" id="error">That key is invalid</div>
+ <div class="alert alert-info">Use <code>dpd showkey</code> to get your app's key.</div>
+ <p>Authenticate with your deployd dashboard:</p>
+ <form>
+
+ <label>Authentication key: <textarea class="full-width" rows="6" name="key"></textarea></label>
+ </form>
+ </div>
+ <div class="modal-footer">
+ <a href="#" class="btn btn-primary save">Authenticate</a>
+ </div>
+ </div>
+
+ <script type="text/javascript" src="/dashboard/js/lib/jquery-1.7.2.min.js"></script>
+ <script type="text/javascript" src="/dashboard/js/lib/jquery.cookie.js"></script>
+ <script type="text/javascript" src="/dpd.js"></script>
+ <script type="text/javascript" src="/dashboard/js/auth.js"></script>
+ </body>
+</html>
1  lib/resources/dashboard/bootstrap
@@ -0,0 +1 @@
+Subproject commit bb57155a7b66f9f784e4db6f420333e328159533
View
29 lib/resources/dashboard/index.ejs
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>Deployd Dashboard</title>
+ <link rel='stylesheet/less' type="text/css" href='/dashboard/stylesheets/style.less' />
+ <script type="text/javascript" src="/dashboard/js/lib/less-1.3.0.min.js"></script>
+ <link href='http://fonts.googleapis.com/css?family=Bitter:400,700,400italic' rel='stylesheet' type='text/css'>
+ </head>
+ <body>
+
+ <div id="header" class="subnav clearfix"></div>
+
+ <div id="body-container" class="container-fluid">
+ <div class="row-fluid">
+ <div class="span2">
+ <ul class="nav nav-stacked type-icons" id="resource-sidebar">
+ </ul>
+ </div>
+ <div class="span10" id="body">
+ </div>
+ </div>
+ </div>
+
+ <script type="text/javascript" src="/dashboard/js/lib/jquery-1.7.2.min.js"></script>
+ <script type="text/javascript" src="/dashboard/js/lib/jquery.cookie.js"></script>
+ <script type="text/javascript" src="/dpd.js"></script>
+ <script type="text/javascript" src="/dashboard/js/dashboard.js"></script>
+ </body>
+</html>
View
822 lib/resources/dashboard/index.html
@@ -1,822 +0,0 @@
-<!DOCTYPE html>
-<html>
- <head>
- <title>Deployd Dashboard</title>
-
- <link rel='stylesheet' type="text/css" href='stylesheets/style.css' />
-
- <link href='http://fonts.googleapis.com/css?family=Bitter:400,700,400italic' rel='stylesheet' type='text/css'>
- </head>
- <body>
-
- <div id="header" class="subnav clearfix"></div>
-
- <div id="resources-container">
- </div>
- <div id="body-container" class="container-fluid hide">
- <div class="row-fluid">
- <div class="span2">
- <ul class="nav nav-stacked type-icons" id="resource-sidebar">
- </ul>
- </div>
- <div class="span10" id="body">
- </div>
- </div>
- </div>
-
- <div class="modal" id="authModal" style="display: none">
- </div>
-
- <script type="x-ejs-template" id="header-template" >
-<div class="full-width-container">
- <ul class="nav nav-pills pull-left" style="margin-left: 19px;">
- <li>
- <a href="<%- appUrl %>" target="_blank"><%- appUrl %></a>
- </li>
- </ul>
- <div class="pull-right">
- <span id="save-status"></span>
- <button id="undo-btn" class="btn btn-warning"><i class="icon-exclamation-sign icon-white"></i> Undo <span class="action-label"></span></button>
- </div>
-</div>
-</script>
-
- <script type="x-ejs-template" id="auth-modal-template" >
-<div class="modal-header">
- <h3>Deployd Dashboard</h3>
-</div>
-<div class="modal-body">
- <div class="alert alert-info">Use <code>dpd showkey</code> to get your app's key.</div>
- <p>Authenticate with your deployd dashboard:</p>
- <form>
- <label>Authentication key: <textarea class="full-width" rows="6" name="key"></textarea></label>
- </form>
-</div>
-<div class="modal-footer">
- <a href="#" class="btn btn-primary save">Authenticate</a>
-</div>
-</script>
-
- <script type="x-ejs-template" id="resources-template" >
-<div id="resource-editor" class="resource-list">
- <div class="container">
- <div class="well">
- <div class="clearfix">
- <h3 class="pull-left">Dashboard</h3>
- <div class="btn-group pull-right">
- <a class="btn btn-success dropdown-toggle" data-toggle="dropdown" href="#">
- <i class="icon-white icon-plus"></i> Resource
- &nbsp;<span class="caret"></span>
- </a>
- <ul id="property-types" class="dropdown-menu">
- </ul>
- </div>
- </div>
- <ul id="resource-list" class="component-list">
- <% /* <li class="component-item locked" id="files-resource">
- <div class="component-item-header">
- <i title="Files" class="icon-white static"></i>
- <span class="path">Files</span>
- <div class="pull-right">
- <i class="icon-white icon-lock"></i>
- </div>
- </div>
- </li> */ %>
- </ul>
- <div id="resource-list-empty" class="component-list-empty" style="display: none;">
- <!-- <div class="alert alert-info"><strong>This app has no resources.</strong></div> -->
- <div class="get-started-light">
- <p>
- <strong><i class="icon-white icon-th-list"></i> Store data</strong> - Add a <i>collection resource</i> to save and query data over a simple http api.
- </p>
- <p>
- <strong><i class="icon-white icon-user"></i> Authenticate users</strong> - Add a <i>users collection</i> resource to create and authenticate users over http.
- </p>
- </div>
- <div class="tutorial-help">
- <p>If you're new to Deployd, check out our Hello World tutorial to quickly dive into Deployd</p>
- <a href="http://www.deployd.com/docs/tutorials/hello-world.html" target="_blank" class="btn btn-primary"><i class="icon-question-sign icon-white"></i> Go to Tutorial</a>
- </div>
- </div>
- </div>
- </div>
-</div>
-</script>
- <script type="x-ejs-template" id="collection-template" >
-<div id="model-editor">
- <div class="tab-content">
- <div id="properties" class="container tab-pane active">
- <div class="panel well stacked">
- <h3>
- Properties
- </h3>
- <div id="property-list">
- </div>
- </div>
-
- <div id="property-now-what" class="alert alert-info hide">
- When you're done adding properties, you should <a href="#data" class="cta-link">add some data</a> to this collection.
- </div>
- </div>
- <div id="data" class="tab-pane well stacked">
-
- </div>
-
- <div id="api" class="tab-pane well stacked">
-
- </div>
-
- <div id="events" class="tab-pane">
- <div class="row-fluid">
- <div class="span9">
- <div id="events-panel" class="well stacked">
- </div>
-
- </div>
- <div class="span3">
- <div id="property-reference" class="well">
-
- </div>
- </div>
- </div>
-</div>
-
-</script>
- <script type="x-ejs-template" id="static-template" >
-<div id="resource-editor" class="file-list">
- <div class="container">
- <div class="well">
- <div class="clearfix">
- <h3 class="pull-left">Files</h3>
- <div class="pull-right">
-
- <a href="#dpd-js-modal" data-toggle="modal" class="btn btn-primary"><i class="icon-white icon-file"></i> Use dpd.js</a>
- <a href="#sync-info-modal" data-toggle="modal" class="btn btn-primary"><i class="icon-white icon-resize-vertical"></i> Setup Local Sync</a>
-
- </div>
- </div>
- <div id="files-empty" data-bind="visible: !(files().length || folders().length)">
- <div class="alert alert-info"><strong>There are no files in your app.</strong> Create or upload some files to get started.</div>
- <div class="get-started" style="margin-bottom: 0;">
- <p>
- <strong><i class="icon-upload icon-white"></i> Uploading</strong> - If you've already built part of your app, you can quickly get your files online by uploading them.
- </p>
- <p>
- <strong><i class="icon-pencil icon-white"></i> Editing</strong> - You can create your entire app in the dashboard if you want. Create a file and use deployd's built-in text editor to write HTML, JavaScript, and CSS.
- </p>
- <p>
- <strong><i class="icon-download-alt icon-white"></i> Working Locally</strong> - Setup the <a href="#sync-info-modal" data-toggle="modal">deployd command line tool</a> to easily sync files to deployd from your favorite text-editor.
- </p>
- </div>
- </div>
- <div id="files" data-bind="template: 'folder-template'" class="file-list-container">
- </div>
- <a href="#" class="btn btn-success" data-bind="click: addFile"><i class="icon-plus icon-white"></i> File</a>
- <a href="#" class="btn btn-success" data-bind="click: addFolder"><i class="icon-plus icon-white"></i> Folder</a>
- <span class="fileinput-button btn btn-primary">
- <i class="icon-upload icon-white" title="Upload"></i>
- Upload
- <input type="file" multiple="multiple" data-bind="event: {change: onChangeUpload}" />
- </spab>
- <span id="currentUploads" data-bind="text: uploadingText"></span>
- </div>
- </div>
- </div>
-</div>
-
-<div id="dpd-js-modal" class="hide modal">
- <div class="modal-header">
- <a class="close" data-dismiss="modal">&times;</a>
- <h3>Using Dpd.js</h3>
- </div>
- <div class="modal-body">
- <p>Deployd generates a JavaScript client library for your app using the resources you add.</p>
- <p><a href="/dpd.js" target="_blank">dpd.js</a> is automatically hosted by your server. To use it in your app, add it to your HTML pages:</p>
- <pre class="prettyprint lang-html">&lt;script src="http://code.jquery.com/jquery-latest.min.js"&gt;&lt;/script&gt;
-&lt;script src="dpd.js"&gt;&lt;/script&gt;</pre>
- <p><strong>If you would like to use dpd.js in your local testing</strong>, you will need to use the <a href="#sync-info-modal" data-toggle="modal">Local Sync command line tool</a> and run the `dpdc dev` command.</p>
- <!-- <p><strong>If you would like to use dpd.js in your local testing</strong>, use the dpd.js loader proxy. Put it at the root of your app and include it just like the full library. When you load the script, it will download the latest version of dpd.js from your server. When you upload your app, Deployd will replace the loader proxy with the full library.</p>
- <a href="/dpd.js?proxy=true" class="btn btn-primary"><i class="icon-white icon-download"></i> Download dpd.js proxy</a> -->
- </div>
-</div>
-
-<div id="sync-info-modal" class="hide modal" style="margin-top: -280px">
- <div class="modal-header">
- <a class="close" data-dismiss="modal">&times;</a>
- <h3>Setup Local Sync</h3>
- </div>
- <div class="modal-body">
- <p>To sync your app's files with your local filesystem, first install the <code>dpdc</code> command line utility. <em>It requires <a href="http://nodejs.org/#download">Node.js</a>.</em></p>
-
- <p>Run the following commands from the command line to install the utility and setup your app.</p>
-
- <pre><code>npm install dpdc -g</code></pre>
-
- <p>To copy all your apps files run the following command. It will create a folder for you and configure it to point to your remote deployd server.</p>
-
- <pre><code>dpdc clone <%= window.location.host %></code></pre>
-
- <p id="scroll_to_here" >Now you can push and pull the entire contents of the directory with the following commands.</p>
-
- <pre><code>dpdc push</code></pre>
-
- <p>Running <code>dpdc push</code> will upload all the files of your current directory to your deployd server.</p>
-
- <pre><code>dpdc pull</code></pre>
-
- <p>Running <code>dpdc pull</code> will download all of your app's files into the current directory.</p>
-
-
- <p>You can see your changes without uploading by running a dev server.</p>
-
- <pre><code>dpdc dev</code></pre>
- </div>
- <div class="modal-footer">
-
- </div>
-</div>
-
-<script type="text/html" id="folder-template">
- <div class="add-buttons">
- <a href="#" data-bind="click: addFile"><i class="icon-plus icon-white "></i> File</a>
- &nbsp;
- <a href="#" data-bind="click: addFolder"><i class="icon-plus icon-white "></i> Folder</a>
- &nbsp;
- <a class="fileinput-button">
- <i class="icon-white icon-upload" title="Upload"></i>
- Upload
- <input type="file" multiple="multiple" data-bind="event: {change: onChangeUpload}" />
- </a>
- <span id="currentUploads" data-bind="text: uploadingText"></span>
- </div>
- <ul class="file-list">
- <!-- ko foreach: folders -->
- <li class="folder" data-bind="click: $parent.onClickFolder">
- <i class="icon-white icon-folder-close" data-bind="css: {'icon-folder-close': !isOpen(), 'icon-folder-open': isOpen}"></i>
- <span data-bind="text: name"></span>
- <div class="buttons">
- <a href="#" class="btn" data-bind="click: $parent.deleteFolder"><i class="icon-remove"></i> Delete</a>
- </div>
- </li>
- <li class="file-list-container" data-bind="template: {name: 'folder-template', data: viewModel}, visible: isOpen">
- </li>
- <!-- /ko -->
- <!-- ko foreach: files -->
- <li class="file" data-bind="click: $parent.onClickFile">
- <i class="icon-white icon-file"></i>
- <span data-bind="text: $data"></span>
- <div class="buttons">
- <a href="#" target="_blank" class="btn" data-bind="attr: {href: '/' + $parent.getPath($data)}, clickBubble: false"><i class="icon-eye-open"></i> View</a>
- <a href="#" class="btn" data-bind="click: $parent.deleteFile"><i class="icon-remove"></i> Delete</a>
- </div>
- </li>
- <!-- /ko -->
- </ul>
-</script>
-</script>
- <script type="x-ejs-template" id="file-template" >
-<tr class="component-item">
- <td>
- <i class="icon-file"></i>
- <a href="#edit<%= path %>"><%= filename %></a>
- </td>
- <td style="width: 149px;">
- <a class="view btn" href="<%= path %>" target="_blank"><i class="icon-eye-open"></i> View</a>
- <a class="delete btn" href="#" filename="<%= filename %>"><i class="icon-remove"></i> Delete</a>
- </td>
-</tr>
-</script>
- <script type="x-ejs-template" id="file-editor-template" >
-<div class="well">
- <div id="file-nav" class="clearfix">
- <button class="pull-left btn back"><i class="icon-folder-open"></i> Back</button>
- <div class="pull-left" id="file-status"></div>
- <button id="save-btn" class="pull-right btn btn-success">Save</button>
- </div>
- <div class="editor-container">
- <div id="editor"></div>
- </div>
-</div>
-
-</script>
-
- <script type="x-ejs-template" id="resource-types-template" >
-<% types.each(function(typeModel) { var type = typeModel.toJSON() %>
- <li class="type-icons" data-cid="<%- typeModel.cid %>" rel="popover" data-content="<%= type.tooltip %>" data-original-title="<%- type.tooltipTitle %>">
- <a href="#">
- <i class="<%= type.label.toLowerCase().replace(' ', '-') %> icon-hack"></i>
- <%- type.label %>
- </a>
- </li>
-<% }); %>
-</script>
- <script type="x-ejs-template" id="resource-sidebar-template" >
-<li>
- <a href="#">
- <i class="icon-white icon-align-justify"></i>&nbsp;
- Dashboard
- </a>
-</li>
-<% /* <li <%= app.files ? 'class="active"' : '' %>>
- <a href="#files">
- <i class="icon-white static"></i>&nbsp;
- Files
- </a>
-</li> */ %>
-<% collection.each(function(resourceModel) { var resource = resourceModel.toJSON(); %>
- <li class="<%= resource.id === app.resourceId ? 'active' : '' %>" >
- <a href="#<%= resource.id %>">
- <i class="icon-white <%- resource.type.toLowerCase() %>"></i>&nbsp;
- <%- resource.path.substr(1) %>
- </a>
- <% if (resource.id === app.resourceId && (resource.type === 'Collection' || resource.type === 'UserCollection')) { %>
- <ul class="nav">
- <li class="active"><a href="#properties" data-toggle="tab"><i class="icon-white icon-list"></i> Properties</a></li>
- <li><a href="#data" data-toggle="tab"><i class="icon-white icon-list-alt"></i> Data</a></li>
- <li><a href="#events" data-toggle="tab"><i class="icon-white icon-exclamation-sign"></i> Events</a></li>
- <li><a href="#api" data-toggle="tab"><i class="icon-white icon-info-sign"></i> API</a></li>
- </ul>
- <% } %>
- </li>
-<% }); %>
-</script>
- <script type="x-ejs-template" id="resource-template" >
-<div class="component-item-header">
- <i title="<%= resource.typeLabel %>" class="type-icon icon-white <%= resource.typeLabel.toLowerCase().replace(' ', '-') %>"></i>
- <% if (resource.c_active) { %>
- <input style="margin-left: 3px; width: 225px;" type="text" class="code" name="path" value="<%- resource.path %>" />
- <a style="margin-right: 3px;" href="#" class="btn btn-primary save-btn">save</a>
- <a href="#" class="btn cancel-btn">cancel</a>
- <% } else { %>
- <span class="code path"><%- resource.path %></span>
- <div class="pull-right">
- <i class="icon-white icon-remove delete-btn"></i>
- </div>
- <% } %>
- <div class="tags pull-right">
- <!-- <span class="label label-info type"><%- resource.typeLabel %></span> -->
- </div>
-</div>
-</script>
-
- <script type="x-ejs-template" id="collection-routes-template" >
-<h3>API</h3>
-
-<ul class="nav nav-tabs" id="event-nav">
- <li class="active"><a href="#js-examples" data-toggle='tab'>JavaScript</a></li>
- <li><a href="#rest-examples" data-toggle='tab'>REST</a></li>
-</ul>
-
-<div class="tab-content tab-content-styled">
- <div id="js-examples" class="tab-pane active">
- <p>Deployd generates a browser JavaScript api for easily accessing data from the <code><%= resourceData.path %></code> collection. To use it you first need to include jQuery and the generated script.</p>
-
- <pre class="prettyprint code">&lt;script src="http://code.jquery.com/jquery-latest.min.js"&gt;&lt;/script&gt;
-&lt;script src="dpd.js"&gt;&lt;/script&gt;</pre>
-
- <%
- function ns(path) {
- path = path.replace('/', '');
- if(path.indexOf('-') > -1) path = "['" + path + "']";
- else path = '.' + path;
- return path;
- }
-
- function getObj() {
- var props = resourceData.properties
- , keys = _.keys(props)
- , obj = {}
- , key
- , vals = {string: 'foobar', number: 123, boolean: true, date: new Date()}
- ;
-
- while(key = keys.shift()) {
- if(props[key].type != 'date') obj[key] = vals[props[key].type];
- }
-
- return JSON.stringify(obj);
- }
- %>
-
- <% if (resourceData.type === 'UserCollection') { %>
- <p>Register a new user in the <code><%= resourceData.path %></code> collection:</p>
- <pre class="code prettyprint">
- dpd<%= ns(resourceData.path) %>.post({"email": "foo@bar.com", "password": "mypassword"}, function(user, err) {
- if(err) return console.log(err);
- console.log(user);
- });</pre>
-
- <p>Login an existing user in the <code><%= resourceData.path %></code> collection:</p>
- <pre class="code prettyprint">
- dpd<%= ns(resourceData.path) %>.login({"email": "foo@bar.com", "password": "mypassword"}, function(user, err) {
- if(err) return console.log(err);
- console.log(user);
- });</pre>
-
- <p>Get the current user in the <code><%= resourceData.path %></code> collection:</p>
- <pre class="code prettyprint">
- dpd<%= ns(resourceData.path) %>.me(function(me) {
- console.log(me);
- });</pre>
-
- <p>Logout the current user in the <code><%= resourceData.path %></code> collection:</p>
- <pre class="code prettyprint">
- dpd<%= ns(resourceData.path) %>.logout(function(err) {
- if(err) console.log(err);
- });</pre>
-
- <% } else { %>
-
- <p>Insert data into the <code><%= resourceData.path %></code> collection:</p>
- <pre class="code prettyprint">
- dpd<%= ns(resourceData.path) %>.post(<%= getObj() %>, function(result, err) {
- if(err) return console.log(err);
- console.log(result, result.id);
- });</pre>
-
- <% } %>
-
- <p>Get all the objects in the <code><%= resourceData.path %></code> collection:</p>
- <pre class="code prettyprint">
- dpd<%= ns(resourceData.path) %>.get(function (result, err) {
- if(err) return console.log(err);
- console.log(result);
- });</pre>
-
- <p>Get all the objects in the <code><%= resourceData.path %></code> collection that match a <a href="http://www.mongodb.org/display/DOCS/Advanced+Queries">query</a>:</p>
- <pre class="code prettyprint">
- var query = <%= getObj() %>;
-
- dpd<%= ns(resourceData.path) %>.get(query, function (result) {
- console.log(result);
- });</pre>
-
- <p>Get a single object in the <code><%= resourceData.path %></code> collection by id:</p>
- <pre class="code prettyprint">
- dpd<%= ns(resourceData.path) %>.first("000000000000000000000000", function (result) {
- console.log(result);
- });</pre>
-
- <p>Get a single object in the <code><%= resourceData.path %></code> collection that matches a <a href="http://www.mongodb.org/display/DOCS/Advanced+Queries">query</a>:</p>
- <pre class="code prettyprint">
- var query = <%= getObj() %>;
-
- dpd<%= ns(resourceData.path) %>.first(query, function (result) {
- console.log(result);
- });</pre>
-
- <p>Update an object in the <code><%= resourceData.path %></code> collection:</p>
- <pre class="code prettyprint">
- dpd<%= ns(resourceData.path) %>.put("000000000000000000000000", <%= getObj() %>, function(result, err) {
- if(err) return console.log(err);
- console.log(result, result.id);
- });</pre>
-
- <p>Remove a single object from the <code><%= resourceData.path %></code> collection:</p>
- <pre class="code prettyprint">
- dpd<%= ns(resourceData.path) %>.del("000000000000000000000000", function (err) {
- if(err) console.log(err);
- });</pre>
-
- </div>
-
-
- <div id="rest-examples" class="tab-pane">
- <p>Access the <code><%= resourceData.path %></code> collection over http.</p>
-
- <table class="table table-bordered table-striped">
- <thead>
- <tr>
- <th>Task</th>
- <th>Method</th>
- <th>Route</th>
- <th>Accepts</th>
- <th>Returns</th>
- </tr>
- <tbody>
- <tr>
- <td><a href="http://deployd.github.com/deployd/#Listing-data" target="_blank">Listing data</a></td>
- <td>GET</td>
- <td><a href="<%- resourceData.path %>" target="_blank"><%- resourceData.path %></a></td>
- <td><em>Nothing</em></td>
- <td>An array of objects</td>
- </tr>
- <tr>
- <td><a href="http://deployd.github.com/deployd/#Saving-data" target="_blank">Creating an object</a></td>
- <td>POST</td>
- <td><%- resourceData.path %></td>
- <td>A single object</td>
- <td>The saved object (or errors)</td>
- </tr>
- <tr>
- <td><a href="http://deployd.github.com/deployd/#Retrieving-a-specific-object" target="_blank">Getting an object</a></td>
- <td>GET</td>
- <td><%- resourceData.path %>/&lt;id&gt;</td>
- <td><em>Nothing</em></td>
- <td>A single object</td>
- </tr>
- <tr>
- <td><a href="http://deployd.github.com/deployd/#Updating-an-object" target="_blank">Updating an object</a></td>
- <td>PUT</td>
- <td><%- resourceData.path %>/&lt;id&gt;</td>
- <td>A single object</td>
- <td>The saved object (or errors)</td>
- </tr>
- <tr>
- <td><a href="http://deployd.github.com/deployd/#Deleting-an-object" target="_blank">Deleting an object</a></td>
- <td>DELETE</td>
- <td><%- resourceData.path %>/&lt;id&gt;</td>
- <td>A single object</td>
- <td><em>Nothing</em></td>
- </tr>
- <% if (resourceData.type === 'UserCollection') { %>
- <tr>
- <td><a href="http://deployd.github.com/deployd/#Authenticating-a-user" target="_blank">Logging in</a></td>
- <td>POST</td>
- <td><%- resourceData.path %>/login</td>
- <td><code>email</code> and <code>password</code> of user</td>
- <td>The user, plus session cookie (or error)</td>
- </tr>
- <tr>
- <td><a href="http://deployd.github.com/deployd/#Logging-out" target="_blank">Logging out</a></td>
- <td>POST</td>
- <td><%- resourceData.path %>/logout</td>
- <td><em>Nothing</em></td>
- <td><em>Nothing</em></td>
- </tr>
- <tr>
- <td><a href="http://deployd.github.com/deployd/#Current-user" target="_blank">Getting the current user</a></td>
- <td>GET</td>
- <td><a href="<%- resourceData.path %>/me" target="_blank"><%- resourceData.path %>/me</a></td>
- <td><em>Nothing</em></td>
- <td>A single object</td>
- </tr>
- <% } %>
- </tbody>
- </thead>
- </table>
- </div>
-</div>
-</script>
- <script type="x-ejs-template" id="collection-data-template" >
-<h3>Data</h3>
-<div id="current-data">
- <div class="table-container">
- <table class="table table-bordered table-striped">
- <thead class="type-icons">
- <tr>
- <td class="code">
- <i class="icon-white icon-hack string" data-bind="tooltip: 'string'"></i>
- id
- </td>
- <!-- ko foreach: properties -->
- <td class="code">
- <i class="icon-white icon-hack" data-bind="tooltip: typeLabel, cssNamed: type"></i>
- <span data-bind="text: name"></span>
- </td>
- <!-- /ko -->
- <td></td>
- </tr>
- <tbody data-bind="foreach: collection">
- <tr>
- <td data-bind="text: id"></td>
- <!-- ko foreach: $root.properties -->
- <td data-bind="event: {dblclick: $parent._onDoubleclick}">
- <span data-bind="text: $parent.c_formatted(name(), type()), visible: !$parent.c_editing()"></span>
- <div data-bind="visible: $parent.c_editing, template: 'data-cell-edit-template'"></div>
- </td>
- <!-- /ko -->
- <td>
- <a href="#" class="btn" data-bind="click: c_toggleEditing, visible: !c_editing()"><i class="icon-edit"></i> edit</a>
- <a href="#" class="btn" data-bind="click: $root.deleteRow, visible: !c_editing()"><i class="icon-remove-sign"></i> delete</a>
-
- <a href="#" class="btn btn-primary" data-bind="click: $root.saveRow, visible: c_editing"><i class="icon-white icon-ok-sign"></i> done</a>
- <a href="#" class="btn" data-bind="click: c_toggleEditing, visible: c_editing">cancel</a>
- </td>
- </tr>
- </tbody>
- <tfoot>
- <tr data-bind="visible: !collection().length">
- <td data-bind="attr: {colspan: properties().length + 2}">
- <div class="alert alert-info" style="margin: 40px auto; width: 120px;">This collection is empty.</div>
- </td>
-
- </tr>
- <tr data-bind="with: newRow">
- <td>...</td>
- <!-- ko foreach: $root.properties -->
- <td>
- <div data-bind="template: 'data-cell-edit-template'"></div>
- </td>
- <!-- /ko -->
- <td>
- <a href="#" class="btn btn-success" data-bind="click: $root.saveRow"><i class="icon-white icon-plus"></i> Add</a>
- </td>
- </tr>
- </tfoot>
- </table>
- </div>
- <input id="current-data-querystring" data-bind="value: queryString, valueUpdate: 'afterkeydown', tooltip: {placement: 'left', title: queryError, trigger: 'focus'}" type="text" placeholder="Query string" />
-</div>
-
-<script type="text/html" id="data-cell-edit-template">
- <div class="data-cell-input">
- <i class="icon-white icon-warning-sign" data-bind="tooltip: {title: $parent.c_errors()[name()]}, visible: $parent.c_errors()[name()]"></i>
- <!-- ko if: type() === 'string' --> <input type="text" data-bind="value: $parent[name()], hasfocus: $parent.c_focus() === name(), event: {keydown: $parent._onKeypress}", /> <!-- /ko -->
- <!-- ko if: type() === 'boolean' --> <input type="checkbox" data-bind="checked: $parent[name()]" /> <!-- /ko -->
- <!-- ko if: type() === 'date' --> <input type="datetime" data-bind="value: $parent[name()], hasfocus: $parent.c_focus() === name(), event: {keydown: $parent._onKeypress}" /> <!-- /ko -->
- <!-- ko if: type() === 'number' --> <input type="number" data-bind="value: $parent[name()], hasfocus: $parent.c_focus() === name(), event: {keydown: $parent._onKeypress}" /> <!-- /ko -->
- <!-- ko if: type() === 'password' --> <input type="password" placeholder="*******" data-bind="value: $parent[name()], hasfocus: $parent.c_focus() === name(), event: {keydown: $parent._onKeypress}" /> <!-- /ko -->
- <!-- ko if: type() === 'object' --> {...} <!-- /ko -->
- <!-- ko if: type() === 'array' --> [...] <!-- /ko -->
- </div>
-</script>
-</script>
-
- <script type="x-ejs-template" id="property-list-template" >
-<% isUsers = typeof resourceTypeId !== 'undefined' && resourceTypeId === 'UserCollection'; %>
-<ul class="component-list">
- <li class="component-item locked"><div class="component-item-header">
- <i class="icon-white string" data-bind="tooltip: {placement: 'left', title: 'string'}"></i>
- <span class="code name">id</span>
- <div class="pull-right">
- <i class="icon-white icon-lock" title="Locked"></i>
- </div>
- </div></li>
- <% if(isUsers) { %>
- <li class="component-item locked"><div class="component-item-header">
- <i class="icon-white string" data-bind="tooltip: {placement: 'left', title: 'string'}"></i>
- <span class="code name">email</span>
- <div class="pull-right">
- <i class="icon-white icon-lock" title="Locked"></i>
- </div>
- </div></li>
- <li class="component-item"><div class="component-item-header">
- <i class="icon-white string" data-bind="tooltip: {placement: 'left', title: 'string'}"></i>
- <span class="code name">password</span>
- <div class="pull-right">
- <i class="icon-white icon-lock" title="Locked"></i>
- </div>
- </div></li>
- <% } %>
- <!-- ko foreach: properties -->
- <li class="component-item" data-bind="css: {active: editing}"><div class="component-item-header clearfix" data-bind="click: onClickHeader">
- <div data-bind="template: 'property-single-template', visible: editing"></div>
- <div data-bind="visible: !editing()">
- <i class="icon-white" data-bind="tooltip: {placement: 'left', title: typeLabel}, cssNamed: type"></i>
- <span class="code name" data-bind="text: name, click: toggleEditing"></span>
- <span class="label" data-bind="visible: required">required</span>
- <div class="pull-right">
- <a href="#" data-bind="click: $root.removeProperty"><i class="icon-white icon-remove"></i></a>
- </div>
- </div>
- </div></li>
- <!-- /ko -->
- <div class="placeholder component-item-header">
- <div data-bind="visible: !properties().length">
- <div class="get-started" style="margin-top: 0;">
- <% if(isUsers) { %>
- <p>
- <strong><i class="icon-user icon-white"></i> Users</strong> - Add properties unique to the users you want to store in this collection. Users have email and password properties by default. These are required to login a user.
- </p>
- <% } else { %>
- <p>
- <strong><i class="icon-list icon-white"></i> Properties</strong> - Describe the JSON objects you want to store in your collection by adding properties and setting their type.
- </p>
- <% } %>
- <p>
- <strong><i class="icon-ban-circle icon-white"></i> Validation</strong> - By describing the data you expect in your collection you enable deployd to automatically validate new objects.
- </p>
- </div>
- <div class="alert alert-info">
- <strong>Get started</strong> by adding properties to describe the <strong><%= isUsers ? 'users' : 'data' %></strong> you want to store in this collection.
- </div>
- </div>
- <div data-bind="template: {name: 'property-single-template', data: newProperty}"></div>
- </div>
-</ul>
-
-<script type="text/html" id="property-single-template">
- <div class="btn-group pull-left type-selector">
- <a class="btn dropdown-toggle" href="#" data-bind="tooltip: {placement: 'left', title: typeLabel()}" data-toggle="dropdown">
- <i class="icon-hack" data-bind="cssNamed: type()"></i>
- <span class="caret"></span>
- </a>
- <ul class="dropdown-menu" data-bind="foreach: $root.propertyTypes">
- <li data-bind="css: {active: $parent.type() == id()}, popover: {placement: 'right', title: label, content: tooltip}">
- <a href="#" data-bind="click: $parent.setType">
- <i class="icon-hack" data-bind="cssNamed: id"></i>&nbsp;
- <span data-bind="text:label"></span></a>
- </li>
- </ul>
- </div>
- <input type="text" placeholder="myPropertyName" data-bind="value: name, hasfocus: nameFocus, event: { keypress: onNameKeypress, keydown: onNameKeyDown }" />
- <button class="btn" data-bind="click: toggleEditing, clickBubble: false, visible: !isNew">done</button>
- <div class="pull-right">
- <label class="checkbox pull-left"><input type="checkbox" data-bind="checked: required" />Required</label>
- <a href="#" class="delete-btn" data-bind="click: $root.removeProperty, visible: !isNew"><i class="icon-white icon-remove"></i></a>
- <button class="btn btn-success" data-bind="click: $root.addProperty, visible: isNew"><i class="icon-white icon-plus"></i>&nbsp;Add</button>
- </div>
-</script>
-
-</script>
- <script type="x-ejs-template" id="property-reference-template" >
-<h3>Properties</h3>
-<ul class="component-list">
- <li class="component-item locked">
- <div class="component-item-header">
- <i class="icon-white string" title="string"></i>&nbsp;
- <span class="code">id</span>
- </div>
- </li>
- <% if (model.get('type') == 'UserCollction') { %>
- <li class="component-item locked">
- <div class="component-item-header">
- <i class="icon-white string" title="string"></i>&nbsp;
- <span class="code">email</span>
- </div>
- </li>
- <li class="component-item locked">
- <div class="component-item-header">
- <i class="icon-white string" title="string"></i>&nbsp;
- <span class="code">password</span>
- </div>
- </li>
- <% } %>
- <% model.get('properties').forEach(function(propModel) { var prop = propModel.toJSON(); %>
- <li class="component-item locked">
- <div class="component-item-header">
- <i class="icon-white <%- prop.type %>" title="<%- prop.typeLabel %>"></i>&nbsp;
- <span class="code"><%- prop.name %></span>
- </div>
- </li>
- <% }) %>
-</ul>
-
-
-</script>
- <script type="x-ejs-template" id="events-template" >
-
-<h3 class="clearfix">
- Events
- <a class="pull-right header-link" target="_blank" href="http://deployd.github.com/deployd/#Collection-Event-Handlers">Documentation</a>
-</h3>
-
-<ul class="nav nav-tabs" id="event-nav">
- <li><a href="#get-panel" data-toggle='tab' data-editor="onGet">On GET</a></li>
- <li class="active"><a href="#validate-panel" data-toggle='tab' data-editor="onValidate">On Validate</a></li>
- <li><a href="#post-panel" data-toggle='tab' data-editor="onPost">On POST</a></li>
- <li><a href="#put-panel" data-toggle='tab' data-editor="onPut">On PUT</a></li>
- <li><a href="#delete-panel" data-toggle='tab' data-editor="onDelete">On DELETE</a></li>
-</ul>
-<div class="tab-content tab-content-styled">
- <div class="tab-pane" id="get-panel">
- <div class="editor-container">
- <div id="onGet"></div>
- </div>
- </div>
- <div class="tab-pane active" id="validate-panel">
- <div class="editor-container">
- <div id="onValidate"></div>
- </div>
- </div>
- <div class="tab-pane" id="post-panel">
- <div class="editor-container">
- <div id="onPost"></div>
- </div>
- </div>
- <div class="tab-pane" id="put-panel">
- <div class="editor-container">
- <div id="onPut"></div>
- </div>
- </div>
- <div class="tab-pane" id="delete-panel">
- <div class="editor-container">
- <div id="onDelete"></div>
- </div>
- </div>
-</div>
-</script>
-
- <script type="x-ejs-template" id="empty-html-template" >
-<!doctype html>
-
-<html>
- <head>
- <xscript src="http://code.jquery.com/jquery-latest.min.js"></xscript>
- <xscript src="dpd.js"></xscript>
- </head>
- <body>
-
- </body>
-</html>
-</script>
-
-
- <script type="text/javascript" src="js/lib.js"></script>
- <script src="js/require.js" data-main="js/entry.js"></script>
-
-
-
- </body>
-</html>
View
25 lib/resources/dashboard/js/auth.js
@@ -0,0 +1,25 @@
+$(document).ready(function() {
+
+ $('.save').click(function() {
+ $('#error').hide();
+ var key = $.trim($('textarea[name=key]').val());
+
+ $.cookie('DpdSshKey', key);
+
+ //Make sure it works
+ $.ajaxSetup({
+ headers: {
+ 'dpd-ssh-key': key || true
+ }
+ });
+ dpd('dashboard').get('is-root', function(res) {
+ if (res && res.isRoot) {
+ window.location.reload();
+ } else {
+ $('#error').show();
+ }
+ });
+
+ });
+
+});
View
15 lib/resources/dashboard/js/dashboard.js
@@ -0,0 +1,15 @@
+(function() {
+ var key = $.cookie('DpdSshKey');
+ $.ajaxSetup({
+ headers: {
+ 'dpd-ssh-key': key || true
+ }
+ });
+})();
+
+
+$(document).ready(function() {
+ dpd('__resources').get(function(res, err) {
+ $('#body').text(JSON.stringify(err) || JSON.stringify(res));
+ });
+});
View
1  lib/resources/dashboard/js/entry.js
@@ -1 +0,0 @@
-define("model/property",["require","exports","module"],function(require,exports,module){var Property=module.exports=Backbone.Model.extend({defaults:{required:!1},parse:function(json){return json.$renameFrom=json.name,json},toJSON:function(){var json=Backbone.Model.prototype.toJSON.call(this);return json.$renameFrom=json.$renameFrom||json.id,json.$renameFrom==json.name&&delete json.$renameFrom,json}})}),define("model/property-collection",["require","exports","module","./property"],function(require,exports,module){var Property=require("./property"),PropertyCollection=module.exports=Backbone.Collection.extend({model:Property,comparator:function(prop){return prop.get("order")}})}),define("model/collection-settings",["require","exports","module","./property-collection"],function(require,exports,module){var PropertyCollection=require("./property-collection"),CollectionSettings=module.exports=Backbone.Model.extend({url:function(){return"/__resources/"+this.id},defaults:{properties:null,onGet:"",onPost:'/* Authentication */\n// if (!me || !me.isAdmin) {\n// cancel("You must be an admin!", 401);\n// }\n\n/* Automatic properties */\n// this.creator = me.id;\n// this.creatorName = me.name;\n',onPut:'/* Readonly properties */\n// protect("creator");\n',onDelete:"",onValidate:'/* Validation */\n// if (this.name.length < 10) {\n// error("name", "Must be at least 10 characters");\n// }\n'},initialize:function(){this.set({properties:new PropertyCollection}),this.get("properties").on("add",this.triggerChanged,this),this.get("properties").on("remove",this.triggerChanged,this),this.get("properties").on("update",this.triggerChanged,this),this.get("properties").on("change:name",this.triggerChanged,this),this.get("properties").on("change:required",this.triggerChanged,this),this.get("properties").on("change:order",this.triggerChanged,this)},parse:function(json){var properties=json.properties;return delete json.properties,this.get("properties").each(function(prop){var newProp=properties[prop.get("name")];newProp&&_.each(prop.attributes,function(value,key){_.str.startsWith(key,"c_")&&(newProp[key]=value)})}),properties&&this.get("properties").reset(Backbone.Utils.parseDictionary(properties,{keyProperty:"name"}),{parse:!0}),json},triggerChanged:function(){this.trigger("change")},toJSON:function(){var json=Backbone.Model.prototype.toJSON.call(this);return json.properties=Backbone.Utils.toJSONDictionary(json.properties.toJSON(),{keyProperty:"name"}),json}})}),define("app",["require","exports","module","./model/collection-settings"],function(require,exports,module){var CollectionSettings=require("./model/collection-settings"),App=Backbone.Model.extend({defaults:{appName:"My App",appUrl:"",authKey:!0,resourceType:"",files:undefined},initialize:function(){this.on("change:resourceTypeId",this.setDocLink,this),this.on("change:resourceId",this.loadResource,this),this.on("change:authKey",function(){var authKey=this.get("authKey");authKey?$.cookie("DPDAuthKey",authKey,{expires:31}):$.cookie("DPDAuthKey",null)},this),this.set({appUrl:location.protocol+"//"+location.host,authKey:$.cookie("DPDAuthKey")||!0}),this.setDocLink()},loadResource:function(){var self=this;if(self.get("resourceId")){var resource=new Backbone.Model({id:self.get("resourceId")});resource.url="/__resources/"+resource.id,resource.fetch({success:function(){self.set({resourceName:resource.get("path"),resourceType:resource.get("typeLabel"),resourceTypeId:resource.get("type")});if(resource.get("type")==="UserCollection"||resource.get("type")==="Collection"){var newResource=new CollectionSettings;newResource.set(newResource.parse(resource.attributes)),resource=newResource}self.set({resource:resource})}})}else self.set({resource:null,resourceName:undefined,resourceType:undefined,resourceTypeId:undefined})},setDocLink:function(){var type=this.get("resourceTypeId"),url="http://deployd.github.com/deployd/";type==="Static"?url+="#Files-Resource":type==="Collection"?url+="#Collection-Resource":type==="UserCollection"&&(url+="#User-Collection-Resource"),this.set("documentation",url)}});module.exports=new App}),define("view/save-status-view",["require","exports","module"],function(require,exports,module){function init(preventReset){$span=$("#save-status"),preventReset?($span.text(currentText),setActive(active)):(set(""),setActive(!1))}function saving(){set("Saving..."),setActive(!0)}function saved(){var now=new Date;set("Last saved "+now.toLocaleTimeString()),setActive(!1)}function set(text){currentText=text,$span.text(text)}function error(){set("Error"),setActive(!1)}function setActive(nowActive){nowActive?$span.removeClass("inactive"):$span.addClass("inactive"),active=nowActive}var $span,currentText="",active=!1;module.exports={init:init,saving:saving,saved:saved,error:error},init()}),define("backbone-utils",["require","exports","module","./app","./view/save-status-view"],function(require,exports,module){function isArray(o){return Object.prototype.toString.call(o)==="[object Array]"}var app=require("./app"),saveStatus=require("./view/save-status-view");Backbone.View.prototype.close=function(){this.remove(),this.unbind()};var oldSync=Backbone.sync;Backbone.sync=function(method,model,options){var url=_.isFunction(model.url)?model.url():model.url;url=app.get("appUrl")+url;if(method==="create"||method==="update"||method==="delete"){saveStatus.saving();var lastSuccess=options.success,lastError=options.error,success=function(){saveStatus.saved(),lastSuccess&&lastSuccess.apply(this,arguments)},error=function(){saveStatus.error(),lastError&&lastError.apply(this,arguments)};options.success=success,options.error=error}if(method==="create"||method==="update"){var data=options.data||model.toJSON();typeof data!="string"&&(Backbone.Utils.removeClientValues(data),options.contentType="application/json",options.data=JSON.stringify(data))}return options.headers={"dpd-ssh-key":app.get("authKey")||!0},options.url=options.url||url,oldSync(method,model,options)};var oldCheckUrl=Backbone.History.prototype.checkUrl;Backbone.History.prototype.checkUrl=function(e){this._lastFragment=this.fragment;if(this.getFragment()!==this.fragment){var loadEvent={cancel:!1};this.trigger("load",loadEvent);if(loadEvent.cancel)return this.navigate(this.fragment,{trigger:!0,replace:!0}),e.preventDefault(),window.location.hash=this.fragment,!1}oldCheckUrl.apply(this,arguments)},Backbone.Utils=Backbone.Utils||{},Backbone.Utils.removeClientValues=function(json){return isArray(json)?_.each(json,function(val,index){typeof val=="object"&&Backbone.Utils.removeClientValues(val)}):_.each(json,function(val,key){_.str.startsWith(key,"c_")?delete json[key]:typeof val=="object"&&Backbone.Utils.removeClientValues(val)}),json},Backbone.Utils.parseDictionary=function(resp,options){var defaults={keyProperty:"label"};options=_.defaults(options||{},defaults);var keys=Object.keys(resp),result=[];return _.each(keys,function(key){var model=resp[key];model.id=key,model[options.keyProperty]=model[options.keyProperty]||key,result.push(model)}),result},Backbone.Utils.toJSONDictionary=function(json,options){var defaults={keyProperty:"label"};_.defaults(options,defaults);var result={};return _.each(json,function(model){var key=model[options.keyProperty];delete model[options.keyProperty],result[key]=model}),result},Backbone.Utils.cancelEvent=function(e){return!1}}),define("knockout-utils",["require","exports","module"],function(require,exports,module){function objectEquals(x,y){var p;for(p in y)if(typeof x[p]=="undefined")return!1;for(p in y)if(y[p])switch(typeof y[p]){case"object":if(!objectEquals(x[p],y[p]))return!1;break;case"function":if(typeof x[p]=="undefined"||p!="equals"&&y[p].toString()!=x[p].toString())return!1;break;default:if(y[p]!=x[p])return!1}else if(x[p])return!1;for(p in x)if(typeof y[p]=="undefined")return!1;return!0}var unwrap=ko.utils.unwrapObservable;ko.bindingHandlers.cssNamed={update:function(element,valueAccessor){var value=ko.utils.unwrapObservable(valueAccessor()),lastClass=$(element).data("knockoutCssNamed");$(element).removeClass(lastClass||" ").addClass(value).data("knockoutCssNamed",value)}},ko.bindingHandlers.enter={init:function(element,valueAccessor,allBindings,viewModel){var handler=ko.utils.unwrapObservable(valueAccessor());$(element).keypress(function(e){e.which===13&&handler.call(viewModel,viewModel,e)})}},ko.bindingHandlers.escape={init:function(element,valueAccessor,allBindings,viewModel){var handler=ko.utils.unwrapObservable(valueAccessor());$(element).keypress(function(e){e.which===23&&handler.call(viewModel,viewModel,e)})}},ko.bindingHandlers.tooltip={init:function(element,valueAccessor){var value=ko.toJS(valueAccessor());typeof value=="string"&&(value={title:value}),$(element).tooltip(value)},update:function(element,valueAccessor){var value=valueAccessor(),title;typeof value=="string"?title=value:title=unwrap(value.title),$(element).attr("data-original-title",title).tooltip("fixTitle")}},ko.bindingHandlers.popover={init:function(element,valueAccessor){var value=ko.toJS(valueAccessor());$(element).popover(value)},update:function(element,valueAccessor){$(element).attr("data-original-title",unwrap(valueAccessor().title)),$(element).attr("data-content",unwrap(valueAccessor().content))}},ko.extenders.variableName=function(target){var result=ko.computed({read:target,write:function(newValue){var current=target();newValue=newValue.replace(/[^A-Za-z0-9]/g,""),current!==newValue&&target(newValue)}});return result(target()),result},module.exports={objectEquals:objectEquals}}),define("view/undo-button-view",["require","exports","module"],function(require,exports,module){function init(){$button=$("#undo-btn"),$actionLabel=$(".action-label",$button),hide(),$button.click(function(){reverseFunc(),$button.hide()})}function show(label,reverse){$button.show(),$actionLabel.text(label),reverseFunc=reverse}function hide(){$button.hide(),reverseFunc=null,$actionLabel.text("")}var $button,$actionLabel,reverseFunc;module.exports={init:init,show:show,hide:hide},init()}),define("view/divider-drag",["require","exports","module"],function(require,exports,module){module.exports=function(){function setDividerPoint(y){y>totalHeight-MIN_AREA?y=totalHeight-MIN_AREA:y<MIN_AREA&&(y=MIN_AREA),dividerPoint=y,$top.outerHeight(y-dividerHeight/2),$bottom.outerHeight(totalHeight-y-dividerHeight),$divider.css("top",y),$(".main-area .panel").height($top.innerHeight()-44)}var DIVIDER_PADDING=10,MIN_AREA=50,$area=$(".main-area"),$top=$(".top-panel",$area),$bottom=$(".bottom-panel",$area),$divider=$(".divider",$area),dividerHeight=$divider.outerHeight(),totalHeight=$area.innerHeight(),dividerPoint=0;setDividerPoint(totalHeight-totalHeight/3),$divider.mousedown(function(){var drag=function(e){var y=e.pageY-$area.offset().top;return setDividerPoint(y),!1};return $(window).mousemove(drag),$(window).mouseup(function(){return $(window).unbind("mousemove",drag),!1}),!1}),$(window).resize(function(){var percent=dividerPoint/totalHeight;totalHeight=$area.innerHeight(),setDividerPoint(totalHeight*percent)})}}),define("router",["require","exports","module","./app"],function(require,exports,module){var app=require("./app"),Router=Backbone.Router.extend({routes:{"":"home",files:"files","files/*path":"editFile",":id":"resource"},home:function(){app.set({resourceId:undefined,files:undefined})},resource:function(id){app.set({resourceId:id,files:undefined})},files:function(){app.set({resourceId:undefined,files:!0})},editFile:function(path){app.set({resourceId:undefined,files:path})}});module.exports=new Router}),define("model/resource",["require","exports","module"],function(require,exports,module){var Resource=module.exports=Backbone.Model.extend({defaults:{path:"",order:0},parse:function(json){return json.$renameFrom=json.path,json},initialize:function(){this.on("change:path",this.sanitizePath,this)},sanitizePath:function(){var path=this.get("path");path=Resource.sanitizePath(path),path!==this.get("path")&&this.set({path:path})}});Resource.sanitizePath=function(path){return path=path.toLowerCase().replace(/[ _]/g,"-").replace(/[^a-z0-9\/\-]/g,""),_.str.startsWith(path,"/")||(path="/"+path),path}}),define("model/resource-collection",["require","exports","module","../model/resource","../app"],function(require,exports,module){var Resource=require("../model/resource"),app=require("../app"),ResourceCollection=module.exports=Backbone.Collection.extend({model:Resource,url:"/__resources",initialize:function(){this.on("error",this.error,this)},comparator:function(resource){return resource.get("order")},error:function(){app.set({authKey:undefined},{silent:!0}),app.trigger("change:authKey")},fetch:function(options){options=_.extend(options||{},{data:{q:'{"type": {"$ne": "Static"}}'}}),Backbone.Collection.prototype.fetch.call(this,options)}})}),define("view/template-view",["require","exports","module"],function(require,exports,module){var TemplateView=module.exports=Backbone.View.extend({initialize:function(){this.template=_.template($("#"+this.template).html()),this.render(),this.model&&this.model.on("change",this.render,this),this.collection&&(this.collection.on("reset",this.render,this),this.collection.on("add",this.render,this),this.collection.on("remove",this.render,this))},templateData:function(){return{model:this.model,collection:this.collection}},render:function(){$(this.el).html(this.template(this.templateData()))}})}),define("view/auth-modal-view",["require","exports","module","../app","./template-view"],function(require,exports,module){var app=require("../app"),TemplateView=require("./template-view"),AuthModalView=module.exports=TemplateView.extend({el:"#authModal",template:"auth-modal-template",initialize:function(){_.bindAll(this),TemplateView.prototype.initialize.apply(this,arguments),this.$el=$(this.el).modal({show:!1}),this.$el.on("click",".save",this.saveAuthToken),this.$el.on("hidden",this.cancel)},saveAuthToken:function(){return this.hide(),setTimeout(_.bind(function(){var authKey=this.$el.find("[name=key]").val().replace(/\s/g,"");app.set({authKey:authKey},{silent:!0}),app.trigger("change:authKey")},this),0),!1},show:function(){this.$el.find("[name=key]").val(app.get("authKey")),this.$el.modal("show")},hide:function(){this._programHide=!0,setTimeout(_.bind(function(){this._programHide=!1},this),0),this.$el.modal("hide")},update:function(){app.get("authKey")?this.hide():this.show()},showError:function(){this.$el.find(".key-error").show()},hideError:function(){this.$el.find(".key-error").hide()},cancel:function(){this._programHide||setTimeout(this.show,0)}})}),define("view/resource-sidebar-view",["require","exports","module","./template-view","../app"],function(require,exports,module){var TemplateView=require("./template-view"),app=require("../app"),ResourceSidebarView=module.exports=TemplateView.extend({el:"#resource-sidebar",template:"resource-sidebar-template",initialize:function(){app.on("change:resourceId",this.render,this),app.on("change:files",this.render,this),TemplateView.prototype.initialize.apply(this,arguments)},templateData:function(){return _.extend(TemplateView.prototype.templateData.apply(this),{app:app.toJSON()})}})}),define("view/component-type-sidebar-view",["require","exports","module"],function(require,exports,module){var ComponentTypeSidebarView=module.exports=Backbone.View.extend({events:{"click li":"onAddItem"},initialize:function(){this.collection=this.collection||this.options.collection,this.template=this.template||this.options.template,this.listView=this.listView||this.options.listView,this.collection.on("reset",this.render,this)},render:function(){var self=this;$(this.el).html(this.template({types:this.collection})),self.$("li").each(function(){}).popover({placement:"right"})},onAddItem:function(e){var typeCid=$(e.currentTarget).attr("data-cid"),type=this.collection.getByCid(typeCid);this.listView.addItem(type)}})}),define("view/resource-view",["require","exports","module","./undo-button-view","../router"],function(require,exports,module){var undo=require("./undo-button-view"),router=require("../router"),template=_.template($("#resource-template").html()),ResourceView=module.exports=Backbone.View.extend({tagName:"li",className:"component-item",events:{"click .delete-btn":"delete","click .component-item-header":"onClickHeader","click .path":"activate","click .rename-btn":"activate","click .cancel-btn":"deactivate","click .save-btn":"save",'keypress input[name="path"]':"onKeypress",'keyup input[name="path"]':"onKeyup"},initialize:function(){this.parentView=this.options.parentView,this.model.on("change:c_active",this.render,this),this.model.on("change:id",this.render,this),this.model.on("change:path",this.render,this)},render:function(){var $el=$(this.el);return $el.attr("id",this.model.cid).html(template({resource:this.model.toJSON()})),this.model.isNew()?$el.addClass("unsaved"):$el.removeClass("unsaved"),this},gotoDetail:function(){return this.model.isNew()||router.navigate(this.model.get("id"),{trigger:!0}),!1},"delete":function(){var self=this;return self.model.isNew()?self.model.destroy():confirm("Do you wish to delete this resource? All associated data and configuration will be permanently removed.")&&self.model.destroy({wait:!0}),!1},activate:function(){return this.model.set({c_active:!0}),this.$('input[name="path"]').focus(),!1},deactivate:function(){return this.model.isNew()?this.delete():this.model.set({c_active:!1}),!1},save:function(){return this.model.save({path:this.$('input[name="path"]').val()}),this.model.set({c_active:!1}),!1},onClickHeader:function(e){if($(e.target).hasClass("component-item-header")||$(e.target).hasClass("type-icon"))return this.model.get("c_active")?this.deactivate():this.gotoDetail(),!1;this.onFocus(e)},onFocus:function(e){$(e.target).focus()},onKeypress:function(e){var val=$(e.currentTarget).val();_.str.startsWith(val,"/")||(val="/"+val,$(e.currentTarget).val(val))},onKeyup:function(e){e.which==13&&(this.model.isNew()?this.model.save({path:this.$('input[name="path"]').val()},{success:_.bind(function(){this.gotoDetail()},this)}):this.save()),e.which==27&&this.deactivate()},destroy:function(){this.model.off("change:c_active",this.render),this.model.off("change:id",this.render),this.model.off("change:path",this.render)}})}),define("view/resource-list-view",["require","exports","module","../model/resource","./resource-view"],function(require,exports,module){var Resource=require("../model/resource"),ResourceView=require("./resource-view"),ResourceListView=module.exports=Backbone.View.extend({el:"#resource-list",emptyEl:"#resource-list-empty",subViews:[],initialize:function(){this.parentView=this.options.parentView,this.collection=this.options.collection,this.typeCollection=this.options.typeCollection,this.collection.on("reset",this.render,this),this.collection.on("add",this.render,this),this.collection.on("remove",this.render,this),this.initializeDom(),this.render()},initializeDom:function(){},addItem:function(type,index){isNaN(index)&&(index=this.collection.length);var resource=new Resource({path:type.get("defaultPath"),typeLabel:type.get("label"),type:type.get("id"),order:index+1,c_active:!0});return this.collection.add(resource,{at:index}),this.updateOrder(),setTimeout(function(){this.$("#"+resource.cid).find('input[name="path"]').focus()},0),!1},updateOrder:function(){var self=this,items=[];$(this.el).children().each(function(){var item=self.collection.getByCid($(this).attr("id"));item&&items.push(item)});var order=0;_.each(items,function(item){order+=1,item.isNew()?item.set({order:order},{silent:!0}):item.save({order:order},{silent:!0})})},onReceiveComponent:function($newItem,index){var typeCid=$newItem.attr("data-cid"),type=this.parentView.resourceTypes.getByCid(typeCid);$newItem.remove(),this.addItem(type,index)},onReorder:function(){this.updateOrder()},render:function(e){var self=this;_.each(self.subViews,function(subView){subView.destroy()}),$(self.el).find("li:not(.locked)").remove(),self.collection.length?($(self.emptyEl).hide(),self.subViews=self.collection.map(function(resource){var view=new ResourceView({model:resource,parentView:self});return $(self.el).append(view.el),view.render(),view})):$(self.emptyEl).show()}})}),define("model/resource-type-collection",["require","exports","module","../backbone-utils"],function(require,exports,module){require("../backbone-utils");var ResourceTypeCollection=module.exports=Backbone.Collection.extend({url:"/__resources/types",sort:function(model){return model.get("label")},parse:function(json){return Object.keys(json).forEach(function(key){key==="Collection"?(json[key].tooltip="Add a simple store to save, update, fetch and delete JSON objects. Available over REST at the specified url.",json[key].tooltipTitle="Persist Data"):key==="UserCollection"?(json[key].tooltip="Add a collection of users such as 'admins', 'authors', or just 'users'. Store users as JSON objects and log them in over REST.",json[key].tooltipTitle="Manage Users"):key==="Static"&&delete json[key]}),Backbone.Utils.parseDictionary(json)}})}),define("view/resources-view",["require","exports","module","./component-type-sidebar-view","./resource-list-view","./template-view","../model/resource-collection","../model/resource-type-collection","router"],function(require,exports,module){var ComponentTypeSidebarView=require("./component-type-sidebar-view"),ResourceListView=require("./resource-list-view"),TemplateView=require("./template-view"),ResourceCollection=require("../model/resource-collection"),ResourceTypeCollection=require("../model/resource-type-collection"),router=require("router"),ResourcesView=module.exports=TemplateView.extend({el:"#resources-container",template:"resources-template",typesTemplate:_.template($("#resource-types-template").html()),events:{"click #property-types a":"addItem","click #files-resource":"goToFiles"},initialize:function(){this.resources=this.options.resources,this.resourceTypes=new ResourceTypeCollection,TemplateView.prototype.initialize.apply(this,arguments),this.resourceListView=new ResourceListView({collection:this.resources,typeCollection:this.resourceTypes,parentView:this}),this.resourceTypes.on("reset",this.renderTypes,this),this.resourceTypes.fetch()},goToFiles:function(){router.navigate("files",{trigger:!0})},addItem:function(e){var typeCid=$(e.currentTarget).parents("li").attr("data-cid"),type=this.resourceTypes.getByCid(typeCid);this.resourceListView.addItem(type)},renderTypes:function(){$("#property-types").html(this.typesTemplate({types:this.resourceTypes})).find("li").popover({placement:"left"})}})}),define("view/header-view",["require","exports","module","../model/resource","./save-status-view","./undo-button-view"],function(require,exports,module){var Resource=require("../model/resource"),saveStatus=require("./save-status-view"),undoBtn=require("./undo-button-view"),HeaderView=module.exports=Backbone.View.extend({el:"#header",template:_.template($("#header-template").html()),events:{"click .resourceName":"rename"},initialize:function(){this.model.on("change",this.render,this),this.render()},rename:function(){var resource=this.model.get("resource"),newName=prompt("Enter a new name for this "+resource.get("type"),resource.get("path"));return newName&&(newName=Resource.sanitizePath(newName),resource.save({path:newName,$renameFrom:resource.get("path")}),this.model.set("resourceName",newName)),!1},render:function(){return $(this.el).html(this.template(this.model.toJSON())),saveStatus.init(!0),undoBtn.init(),this}})}),define("model/property-type-collection",["require","exports","module","../backbone-utils"],function(require,exports,module){require("../backbone-utils");var PropertyTypeCollection=module.exports=Backbone.Collection.extend({url:"/property-types",initialize:function(){this.reset([{id:"string",label:"string",tooltip:"Add a string property. If the incoming value is not a string it will be rejected.",tooltipTitle:"Arbitrary Text"},{id:"number",label:"number",tooltip:"Add a number property. If the incoming value is not a number it will be rejected. Supports floating point values.",tooltipTitle:"JSON Number"},{id:"boolean",label:"boolean",tooltip:"Add a boolean property. If the incoming value is not 'true' or 'false' it will be rejected.",tooltipTitle:"True or false"},{id:"date",label:"date",tooltip:"Add a date string property. If the incoming value is not a valid date string it will be rejected.",tooltipTitle:"A specific point in time"},{id:"object",label:"object",tooltip:"Add an object property. If the incoming value is not an object it will be rejected.",tooltipTitle:"JSON Object"},{id:"array",label:"array",tooltip:"Add an array property. If the incoming value is not an array it will be rejected.",tooltipTitle:"JSON Array"}])},fetch:function(){var self=this;setTimeout(function(){self.trigger("reset")},0)},sort:function(model){return model.get("label")}})}),define("model/data-collection",["require","exports","module"],function(require,exports,module){var DataCollection=module.exports=Backbone.Collection.extend({url:function(){var url=this.path;return this.querystring&&(this.querystring.indexOf("{")==0?url+="?q="+this.querystring:url+="?"+this.querystring),url}})}),define("view-model/property-view-model",["require","exports","module"],function(require,exports){function create(data,contextToAdd){function execCommand(data,e){return e.metaKey||e.which===38||e.which===40?(commands[e.which]&&commands[e.which](data),!1):!0}data=_.defaults(data||{},{name:" ",type:"string",typeLabel:"string",required:!1}),data.id=data.name;var self=ko.mapping.fromJS(data,propertyMapping);self.name=self.name.extend({variableName:!0}),self.editing=ko.observable(!1),self.nameFocus=ko.observable(),self.isNew=contextToAdd!=null,self.toggleEditing=function(){return self.editing(!self.editing()),self.editing()&&self.nameFocus(!0),!1},self.onClickHeader=function(data,e){return!self.editing()||e.target===e.currentTarget||$(e.target).is("div")?(self.toggleEditing(),!1):!0},self.onNameKeypress=function(data,e){return e.which==13&&setTimeout(function(){self.isNew?contextToAdd.addProperty():self.editing(!1)},1),!0},self.onNameKeyDown=function(data,e){return commands[e.which]?execCommand(data,e):!0},self.setType=function(data){self.type(ko.utils.unwrapObservable(data.id)),self.typeLabel(ko.utils.unwrapObservable(data.label))};var types=["string","number","boolean","date","object","array"],commands={66:function(data){data.type("boolean")},83:function(data){data.type("string")},77:function(data){data.type("number")},68:function(data){data.type("date")},38:function(data){var cur=data.type();for(var i=0;i<types.length;i++)if(cur===types[i]){data.type(types[i+1]||types[0]);return}},40:function(data){var cur=data.type();for(var i=0;i<types.length;i++)if(cur===types[i]){data.type(types[i-1]||types[types.length-1]);return}},79:function(data){data.required(!data.required())}};return self}var propertyMapping={include:["required","id","$renameFrom"]};exports.create=create}),define("view-model/property-list-view-model",["require","exports","module","../view/undo-button-view","./property-view-model"],function(require,exports){function create(){var vm={properties:ko.observableArray(),propertyTypes:ko.observableArray()};return vm.newProperty=propertyViewModel.create({},vm),vm.newProperty.nameFocus(!0),vm.addProperty=_.bind(function(){this.newProperty.name()&&this.newProperty.type()&&(this.properties.push(propertyViewModel.create(ko.mapping.toJS(this.newProperty))),this.newProperty.name(""))},vm),vm.removeProperty=_.bind(function(prop){var self=this,index=this.properties.indexOf(prop);undoBtn.show("Delete "+prop.name(),function(){self.properties.splice(index,0,prop)}),this.properties.remove(prop)},vm),vm.onNewNameKeypress=_.bind(function(context,e){return e.which==13&&setTimeout(function(){vm.addProperty()},1),!0},vm),vm}var undoBtn=require("../view/undo-button-view"),propertyViewModel=require("./property-view-model");exports.create=create}),define("view/property-list-view",["require","exports","module","../knockout-utils","../app","./undo-button-view","../view-model/property-list-view-model","../view-model/property-view-model"],function(require,exports,module){var koUtil=require("../knockout-utils"),app=require("../app"),undoBtn=require("./undo-button-view"),propertyListViewModel=require("../view-model/property-list-view-model"),propertyViewModel=require("../view-model/property-view-model"),PropertyListView=module.exports=Backbone.View.extend({el:"#property-list",template:_.template($("#property-list-template").html()),initialize:function(){this.collection=this.collection||this.options.collection,this.typeCollection=this.typeCollection||this.options.typeCollection,this.initializeViewModel(),this.mapProperties(),this.collection.on("reset",this.mapProperties,this),this.mapTypes(),this.typeCollection.on("reset",this.mapTypes,this),this.render()},initializeViewModel:function(){var view=this;this.viewModel=propertyListViewModel.create(),this.mapping={properties:{key:function(data){return ko.utils.unwrapObservable(data.name)},create:_.bind(function(options){return propertyViewModel.create(options.data)},this)}},ko.computed(function(){var lastJSON=view._lastJSON,unmapped=ko.mapping.toJS(this),newJSON=unmapped.properties;lastJSON&&!koUtil.objectEquals(lastJSON,newJSON)&&(view.collection.reset(unmapped.properties,{silent:!0}),view.collection.trigger("update"),view._lastJSON=newJSON)},this.viewModel).extend({throttle:100})},mapProperties:function(){var json=this.collection.toJSON();this._lastJSON=json,ko.mapping.fromJS({properties:json},this.mapping,this.viewModel);var newJson=ko.mapping.toJS(this.viewModel);koUtil.objectEquals(newJson.properties,json)||(console.log("WARNING: viewmodel/model mismatched. Remapping..."),this.viewModel.properties.removeAll(),setTimeout(_.bind(this.mapProperties,this),1))},mapTypes:function(){ko.mapping.fromJS({propertyTypes:this.typeCollection.toJSON()},this.mapping,this.viewModel)},render:function(){this.el&&ko.cleanNode(this.el),$(this.el).html(this.template({resourceTypeId:app.get("resourceTypeId")})),ko.applyBindings(this.viewModel,this.el)},close:function(){ko.removeNode(this.el)}})}),define("view/property-reference-view",["require","exports","module"],function(require,exports,module){var PropertyReferenceView=module.exports=Backbone.View.extend({el:"#property-reference",template:_.template($("#property-reference-template").html()),initialize:function(){this.render(),this.model.on("change",this.render,this)},render:function(){$(this.el).html(this.template({model:this.model})),this.$("li i").tooltip({placement:"left"})}})}),define("view-model/collection-data-view-model",["require","exports","module"],function(require,exports,module){createRow=exports.createRow=function(data,props,vm){function map(data,props){var defaults={id:null};props.forEach(function(prop){defaults[prop.name]=undefined}),data=_.defaults(data,defaults),ko.mapping.fromJS(data,{},self)}var self={};return map(data,props),self.c_editing=ko.observable(!1),self.c_focus=ko.observable(),self.c_errors=ko.observable({}),self.c_formatted=function(name,type){var name=ko.utils.unwrapObservable(name),type=ko.utils.unwrapObservable(type),value=ko.utils.unwrapObservable(self[name]);return type==="password"||typeof value=="undefined"?"...":value},self.c_toggleEditing=function(){self.c_editing()&&!self.isNew?vm.revertRow(self):self.c_editing(!0)},self.c_remapProps=function(props){var data=ko.mapping.toJS(self);map(data,props)},self._onKeypress=function(data,e){return e.which==13?setTimeout(function(){vm.saveRow(self)},1):e.which==27&&!self.isNew&&setTimeout(function(){vm.revertRow(self)},1),!0},self._onDoubleclick=function(data,e){if(!!self.c_editing())return!0;self.c_editing(!0),self.c_focus(data.name())},self},create=exports.create=function(){var self={properties:ko.observableArray(),collection:ko.observableArray(),queryString:ko.observable(),queryError:ko.observable("")};return self.newRow=createRow({},[],self),self.newRow.isNew=!0,self}}),define("view/collection-data-view",["require","exports","module","../view-model/collection-data-view-model","../app","./undo-button-view"],function(require,exports,module){var collectionDataViewModel=require("../view-model/collection-data-view-model"),app=require("../app"),undoBtn=require("./undo-button-view"),CollectionDataView=module.exports=Backbone.View.extend({el:"#data",template:_.template($("#collection-data-template").html()),initialize:function(){var self=this;self.properties=self.options.properties,self.collection=self.options.collection,self.initializeViewModel(),self.initializeMapping(),self.isUser=app.get("resourceTypeId")==="UserCollection",self.mapProperties(),self.properties.on("reset",self.mapProperties,self),self.properties.on("add",self.mapProperties,self),self.properties.on("remove",self.mapProperties,self),self.properties.on("change:name",self.mapProperties,self),self.mapCollection(),self.collection.on("reset",self.mapCollection,self),self.collection.on("add",self.mapCollection,self),self.collection.on("remove",self.mapCollection,self),function e(model,xhr){if(self._cleared)return;xhr&&xhr.responseText?self.viewModel.queryError(xhr.responseText):self.viewModel.queryError(""),self._timeout=setTimeout(function(){self.collection.fetch({success:poll,error:poll})},1e3)}(),self.render()},initializeViewModel:function(){var view=this,vm=view.viewModel=collectionDataViewModel.create();vm.deleteRow=function(data){var collection=view.collection,row=collection.get(data.id()),index=collection.indexOf(row);row&&row.destroy({wait:!0}),row.set("id",undefined),undoBtn.show("Delete row",function(){collection.create(row,{at:index})})},vm.saveRow=function(data){function error(model,xhr){try{var res=JSON.parse(xhr.responseText);data.c_errors(res.errors)}catch(e){alert("An error occurred when saving: "+xhr.responseText)}}var rowData=ko.mapping.toJS(data),collection=view.collection;if(data.isNew)collection.create(rowData,{success:function(){data.c_errors({}),vm.properties().forEach(function(prop){data[prop.name()]&&data[prop.name()](null)})},error:error,wait:!0});else{var row=collection.get(data.id());row.save(rowData,{success:function(){data.c_editing(!1),data.c_errors({}),ko.mapping.fromJS(row.toJSON(),{},data)},error:error})}},vm.revertRow=function(data){var collection=view.collection,row=collection.get(data.id());row.fetch({success:function(){ko.mapping.fromJS(row.toJSON(),{},data),data.c_editing(!1)}})},ko.computed(function(){view.collection.querystring=vm.queryString()},vm).extend({throttle:100}),ko.computed(function(){var error=vm.queryError(),$field=view.$("#current-data-querystring");error?$field.attr("data-original-title",error).tooltip("fixTitle").tooltip("show"):$field.attr("data-original-title","").tooltip("fixTitle").tooltip("hide")},vm)},initializeMapping:function(){var view=this,vm=this.viewModel;view.propertiesMapping={properties:{key:function(data){return ko.utils.unwrapObservable(data.id)}}},view.collectionMapping={collection:{key:function(data){return ko.utils.unwrapObservable(data.id)},create:function(options){return collectionDataViewModel.createRow(options.data,ko.mapping.toJS(vm.properties),vm)},update:function(options){return options.target.c_editing()?options.data:options.target}}}},mapProperties:function(){var props=this.properties.toJSON();app.get("resourceTypeId")==="UserCollection"&&props.unshift({name:"email",type:"string",typeLabel:"string"},{name:"password",type:"password",typeLabel:"password"}),this.viewModel.collection().forEach(function(row){row.c_remapProps(props)}),this.viewModel.newRow.c_remapProps(props),ko.mapping.fromJS({properties:props},this.propertiesMapping,this.viewModel)},mapCollection:function(){ko.mapping.fromJS({collection:this.collection.toJSON()},this.collectionMapping,this.viewModel)},render:function(){var self=this;ko.cleanNode(this.el),$(this.el).html(this.template({resourceType:app.get("resourceTypeId")})),ko.applyBindings(this.viewModel,this.el)},close:function(){this._cleared=!0,clearTimeout(this._timeout),ko.removeNode(this.el)}})}),define("view/code-editor-view",["require","exports","module"],function(require,exports,module){function getEditor(el){return _editor||(_editor=ace.edit($editorEl[0]),_editor.setTheme("ace/theme/deployd"),_editor.setShowPrintMargin(!1)),$(el).append($editorEl),_editor}var JavaScriptMode=ace.require("ace/mode/javascript").Mode,CssMode=ace.require("ace/mode/css").Mode,HtmlMode=ace.require("ace/mode/html").Mode,$editorEl=$("<div>"),_editor,CodeEditorView=module.exports=Backbone.View.extend(Backbone.Events).extend({initialize:function(){this.mode=this.options.mode,_.bindAll(this,"trackUpdate","update","render")},trackUpdate:function(){this._timeout&&clearTimeout(this._timeout);var length=this.updateTime||1e3;this._timeout=setTimeout(this.update,length)},update:function(){this.trigger("change")},getText:function(){return this.editor?this.editor.getSession().getValue():undefined},setText:function(val){this.editor.getSession().setValue(val),clearTimeout(this._timeout)},resize:function(){this.editor.resize()},render:function(){var view=this,editor=getEditor(this.el);editor.resize();var mode=this.mode||"js";return mode==="html"||mode==="htm"?editor.getSession().setMode(new HtmlMode):mode==="css"?editor.getSession().setMode(new CssMode):mode==="js"&&editor.getSession().setMode(new JavaScriptMode),editor.getSession().on("change",this.trackUpdate),editor.commands.addCommand({name:"save",bindKey:{win:"Ctrl-S",mac:"Command-S"},exec:function(editor){view.trigger("save")}}),this.editor=editor,editor.focus(),this},close:function(){this._timeout&&clearTimeout(this._timeout),this.off(),this.setText("")}})}),define("view/collection-event-view",["require","exports","module","./code-editor-view"],function(require,exports,module){var CodeEditorView=require("./code-editor-view"),CollectionEventView=module.exports=Backbone.View.extend({template:_.template($("#events-template").html()),events:{"click #event-nav a":"updateRender"},initialize:function(){var self=this;$(this.el).html(this.template(this.model.toJSON())),this.editor=(new CodeEditorView({})).render(),this.editor.on("change",self.update,self),this.resize=_.bind(this.resize,this),$("#resource-sidebar").on("click","a",this.resize)},getActive:function(){return this.$("#event-nav .active a").attr("data-editor")},update:function(e){var text=this.editor.getText();typeof text!="undefined"&&this.model.set(this.getActive(),text)},updateRender:function(){this.update(),setTimeout(_.bind(this.render,this),1)},render:function(){var active=this.getActive();return this.editor.setText(this.model.get(active)),this.editor.setElement("#"+active),this.editor.render(),this},resize:function(){setTimeout(_.bind(this.editor.resize,this),1)},close:function(){$("#resource-sidebar").off("click","a",this.resize),this.editor.close()}})}),define("view/collection-routes-view",["require","exports","module"],function(require,exports,module){var CollectionRoutesView=module.exports=Backbone.View.extend({el:"#api",template:_.template($("#collection-routes-template").html(),null,{variable:"resourceData"}),initialize:function(){this.render(),this.model.on("change",this.render,this)},render:function(){$(this.el).html(this.template(this.model.toJSON())),prettyPrint()}})}),define("view/collection-view",["require","exports","module","../model/property-type-collection","../model/collection-settings","../model/data-collection","./property-list-view","./property-reference-view","./collection-data-view","./collection-event-view","./collection-routes-view","../app","../router","./undo-button-view"],function(require,exports,module){var PropertyTypeCollection=require("../model/property-type-collection"),CollectionSettings=require("../model/collection-settings"),DataCollection=require("../model/data-collection"),PropertyListView=require("./property-list-view"),PropertyReferenceView=require("./property-reference-view"),CollectionDataView=require("./collection-data-view"),CollectionEventView=require("./collection-event-view"),CollectionRoutesView=require("./collection-routes-view"),app=require("../app"),router=require("../router"),undoBtn=require("./undo-button-view"),CollectionView=module.exports=Backbone.View.extend({template:_.template($("#collection-template").html()),events:{"click .cta-link":"onClickCta"},initialize:function(){$(this.el).html(this.template({})),this.propertyTypes=new PropertyTypeCollection,this.dataCollection=new DataCollection([]),this.dataCollection.path=this.model.get("path"),this.dataCollection.fetch(),this.model.on("change:path",function(){this.dataCollection.path=this.model.get("path")},this),this.propertyListView=new PropertyListView({collection:this.model.get("properties"),typeCollection:this.propertyTypes,parentView:this}),this.PropertyReferenceView=new PropertyReferenceView({model:this.model}),this.dataView=new CollectionDataView({properties:this.model.get("properties"),collection:this.dataCollection}),this.routesView=new CollectionRoutesView({model:this.model}),this.eventsView=(new CollectionEventView({el:this.$("#events-panel"),model:this.model})).render(),this.model.on("change",this.save,this),this.dataCollection.on("reset",this.render,this),this.model.on("change",this.render,this),this.propertyTypes.fetch(),this.render(),this.initializeDom()},initializeDom:function(){this.onKeypress=_.bind(this.onKeypress,this),$(".icon-info-sign").popover(),this.model.get("properties").length?this.$('#resource-sidebar a[href="#data"]').click():this.$('#resource-sidebar a[href="#properties"]').click()},save:function(){var self=this;this.model.save()},onKeypress:function(e){if((e.ctrlKey||e.metaKey)&&e.which=="83")return this.save(),e.preventDefault(),!1},onClickCta:function(e){var href=$(e.currentTarget).attr("href"),$navLink=$('#resource-sidebar a[href="'+href+'"]');return $navLink.click(),!1},navigate:function(e){var $link=$(e.currentTarget),selector=$link.attr("href");return $(window).scrollTop($(selector).offset().top-50),!1},render:function(){var $nowWhat=$("#property-now-what");return this.model.get("properties").length&&!this.dataCollection.length?$nowWhat.show():$nowWhat.hide(),this},close:function(){Backbone.View.prototype.close.call(this),this.propertyListView.close(),this.dataView.close(),this.eventsView.close(),$(window).off("scroll",this.onScroll)}})}),define("model/file",["require","exports","module","../app"],function(require,exports,module){var app=require("../app"),File=module.exports=Backbone.Model.extend({url:function(){var info=this.get("info"),path=this.get("path");return info?(path==="/"&&(path=""),path+"/"+(info.name||info.fileName)):path},sync:function(method,model,options){function next(){}var self=this,args=arguments,info=model.get("info"),data=model.get("data");if(method==="create"&&(info||data)){var form;if(info)form=new FormData,form.append("data",info);else if(data||data==="")form=data;var url=_.isFunction(model.url)?model.url():model.url;url=app.get("appUrl")+url;var xhr=new XMLHttpRequest;xhr.open("POST",url),xhr.setRequestHeader("x-dssh-key",app.get("authKey")),xhr.send(form),xhr.addEventListener("readystatechange",function(){typeof options.success=="function"&&options.success(),self.trigger("sync")})}else Backbone.sync.apply(model,args)}})}),define("view-model/folder-view-model",["require","exports","module","model/file","model/resource","app"],function(require,exports,module){function parseModel(json){return{data:json}}function fetchFolders(options){return options=_.extend(options||{},{data:{type:"Static"}}),Backbone.Collection.prototype.fetch.call(this,options)}var File=require("model/file"),Resource=require("model/resource"),app=require("app"),foldersMapping={folders:{key:function(data){return ko.utils.unwrapObservable(data.path)}}},template=exports.template={eventIsButton:function(e){var $target=$(e.target);return $target.is("a")||$target.parentsUntil(".file, .folder").is("a")?!0:!1},mapFiles:function(){this.files(this.model.get("data"))},mapFolders:function(){var folders=[],self=this;this.foldersCollection.each(function(folder){var path=folder.get("path");if(path==="/")return;var prefix="/"+self.getPath("");if(path.indexOf(prefix)!==-1){var relPath=path.slice(prefix.length);if(relPath.length&&relPath.indexOf("/")===-1){var folderEntry=_.find(self.folders(),function(folder){return folder.path===path});folderEntry||(folder.urlRoot=self.foldersCollection.url,folderEntry={path:path,name:relPath,model:folder,isOpen:ko.observable(!1),viewModel:create(path)}),self.foldersToOpen[path]&&(folderEntry.isOpen(!0),delete self.foldersToOpen[path]),folders.push(folderEntry)}}}),self.folders(folders)},fetch:function(){this.fetchFiles(),this.fetchFolders(),_.each(this.folders(),function(f){f.isOpen()&&f.viewModel.fetch()})},fetchFolders:function(){this.foldersCollection.fetch()},fetchFiles:function(){this.model.fetch()},getPath:function(filename){var path=this.path.slice(1);return this.path!=="/"&&(path+="/"),path+filename},deleteFile:function(filename){var file=new File({path:this.path,info:{name:filename},id:filename}),self=this;file.destroy({success:function(){self.fetchFiles()}})},editFile:function(filename){app.set("new file",!1),app.set("files",this.getPath(filename))},onClickFile:function(filename,e){if(!!this.eventIsButton(e))return!0;this.editFile(filename)},onChangeUpload:function(data,e){var files=e.target.files&&e.target.files,self=this;_.each(files,self.uploadFile)},uploadFile:function(file){var f=new File({info:file,path:this.path}),name=file.name,self=this;this.uploadingFiles.push(name),f.on("sync",function(){self.fetchFiles(),self.uploadingFiles.remove(name)}),f.save()},addFile:function(){var name=prompt("Enter a name for this file, including the extension:");name&&(app.set("new file",!0),app.set("files",this.getPath(name)))},deleteFolder:function(folder){var self=this;folder.model.destroy({success:function(){self.fetchFolders()}})},addFolder:function(){var name=prompt("Enter a name for this folder:"),self=this;if(name){var resourcePath=Resource.sanitizePath(name);self.path!=="/"&&(resourcePath=self.path+resourcePath),this.foldersCollection.create({path:resourcePath,type:"Static"},{success:function(){self.foldersToOpen[resourcePath]=!0,self.fetchFolders()}})}},toggleFolder:function(folder){folder.isOpen(!folder.isOpen()),folder.isOpen()&&folder.viewModel.fetch()},onClickFolder:function(folder,e){if(!!this.eventIsButton(e))return!0;this.toggleFolder(folder)}},create=exports.create=function(path){path=path||"/";var self=Object.create(template);_.bindAll(self),self.path=path,self.model=new Backbone.Model,self.model.parse=parseModel,self.model.url=path,self.model.on("change:data",self.mapFiles,self);var foldersCollection=self.foldersCollection=new Backbone.Collection;return foldersCollection.url="/resources",foldersCollection.fetch=fetchFolders,foldersCollection.on("reset",self.mapFolders,self),self.foldersToOpen={},self.files=ko.observableArray(),self.folders=ko.observableArray(),self.uploadingFiles=ko.observableArray(),self.uploadingText=ko.computed(function(){var count=this.uploadingFiles().length;return count==1?"Uploading "+this.uploadingFiles()[0]+"...":count?"Uploading "+count+" files...":""},self),self}}),define("view/static-view",["require","exports","module","view-model/folder-view-model"],function(require,exports,module){var FolderViewModel=require("view-model/folder-view-model"),viewModelInstance,StaticView=module.exports=Backbone.View.extend({template:_.template($("#static-template").html()),initialize:function(){this.initializeViewModel(),this.render()},initializeViewModel:function(){viewModelInstance||(viewModelInstance=FolderViewModel.create()),this.viewModel=viewModelInstance,this.viewModel.fetch()},render:function(){this.$el.html(this.template({})),ko.cleanNode(this.el),ko.applyBindings(this.viewModel,this.el),prettyPrint()},close:function(){ko.removeNode(this.el)}})}),define("view/file-editor-view",["require","exports","module","../app","../model/file","./code-editor-view"],function(require,exports,module){var app=require("../app"),CodeEditorView=require("./code-editor-view"),File=require("../model/file"),saveStatus=require("./save-status-view"),FileEditorView=module.exports=Backbone.View.extend(Backbone.Events).extend({template:_.template($("#file-editor-template").html()),events:{"click .back":"back","click #save-btn":"save"},initialize:function(){$(this.el).html(this.template({}));var path=this.path="/"+app.get("files"),view=this,type=path.slice(path.indexOf(".")+1),editor=this.editor=(new CodeEditorView({el:$("#editor"),mode:type})).render();editor.updateTime=1,_.bind(view.save,view),editor.on("save",function(){view.save()}),editor.on("change",function(){view.hasChanges()});if(app.get("new file")){if(path.indexOf(".html")>-1||path.indexOf(".htm")>-1)editor.setText($("#empty-html-template").html().replace(/\n/,"").replace(/xscript/g,"script")),view.hasChanges()}else $.get(path,function(data){editor.setText(data)},"text"),view.saved();var container=$(".editor-container"),win=$(window);win.resize(function(){container.height(win.height()-200),editor.resize()}),win.resize()},back:function(){return app.set("files",!0),!1},save:function(){var file=new File({path:this.path,data:this.editor.getText()});file.save({},{success:function(){saveStatus.saved()}}),this.saved(),saveStatus.saving()},hasChanges:function(){$("#file-status").empty().append('<i class="icon-file"></i> '+this.link()+' <i class="icon-asterisk"></i>'),$("#save-btn").removeAttr("disabled")},link:function(){return'<a href="'+this.path+'" target="_blank">'+this.path+"</a>"},saved:function(){$("#file-status").empty().append('<i class="icon-file"></i> '+this.link()),$("#save-btn").attr("disabled",!0)},close:function(){this.editor.close()}})}),define("view/app-view",["require","exports","module","../app","../router","./undo-button-view","./save-status-view","../model/resource-collection","./auth-modal-view","./resource-sidebar-view","./resources-view","./header-view","./collection-view","./static-view","./file-editor-view"],function(require,exports,module){var app=require("../app"),router=require("../router"),undoBtn=require("./undo-button-view"),saveStatus=require("./save-status-view"),ResourceCollection=require("../model/resource-collection"),AuthModalView=require("./auth-modal-view"),ResourceSidebarView=require("./resource-sidebar-view"),ResourcesView=require("./resources-view"),HeaderView=require("./header-view"),CollectionView=require("./collection-view"),StaticView=require("./static-view"),FileEditorView=require("./file-editor-view"),AppView=module.exports=Backbone.View.extend({initialize:function(){this.resources=new ResourceCollection,this.modal=new AuthModalView,this.authenticate(),this.resources.fetch(),app.on("change:authKey",this.authenticate,this),this.resources.on("reset",this.initRender,this),this.resources.on("error",this.modal.showError,this.modal)},authenticate:function(){app.get("authKey")?this.resources.fetch():this.modal.show()},initRender:function(){this.resourceSidebarView=new ResourceSidebarView({collection:this.resources}),this.resourceView=new ResourcesView({resources:this.resources}),this.headerView=new HeaderView({model:app}),this.resources.off("reset",this.initRender,this),app.on("change:resource",this.render,this),app.on("change:files",this.render,this),this.render()},render:function(){this.bodyView&&this.bodyView.close();var resource=app.get("resource"),files=app.get("files");if(app.get("resourceId")||files){var viewClass=null;if(files)files!==!0?viewClass=FileEditorView:viewClass=StaticView;else if(resource){var type=resource.get("type");if(type==="Collection"||type==="UserCollection")viewClass=CollectionView}if(viewClass){var el=$("<div>");$("#body").empty().append(el),this.bodyView=new viewClass({model:resource,el:el})}$("#body-container").show(),$("#resources-container").hide();if(files){var path="/files";files!==!0&&(path+="/"+files),router.navigate(path)}else router.navigate(app.get("resourceId"))}else $("#body-container").hide(),$("#resources-container").show(),this.resources.fetch(),router.navigate("");undoBtn.init(),saveStatus.init()}}),instance;AppView.init=function(){return instance||(instance=new AppView),instance}}),define("entry",["require","exports","module","./backbone-utils","./knockout-utils","./view/undo-button-view","./view/divider-drag","./view/app-view","./router"],function(require,exports,module){require("./backbone-utils"),require("./knockout-utils"),require("./view/undo-button-view"),require("./view/divider-drag");var AppView=require("./view/app-view"),router=require("./router");AppView.init(),Backbone.history.start()})
View
96 lib/resources/dashboard/js/lib.js
0 additions, 96 deletions not shown
View
4 lib/resources/dashboard/js/lib/jquery-1.7.2.min.js
@@ -0,0 +1,4 @@
+/*! jQuery v1.7.2 jquery.com | jquery.org/license */
+(function(a,b){function cy(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cu(a){if(!cj[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){ck||(ck=c.createElement("iframe"),ck.frameBorder=ck.width=ck.height=0),b.appendChild(ck);if(!cl||!ck.createElement)cl=(ck.contentWindow||ck.contentDocument).document,cl.write((f.support.boxModel?"<!doctype html>":"")+"<html><body>"),cl.close();d=cl.createElement(a),cl.body.appendChild(d),e=f.css(d,"display"),b.removeChild(ck)}cj[a]=e}return cj[a]}function ct(a,b){var c={};f.each(cp.concat.apply([],cp.slice(0,b)),function(){c[this]=a});return c}function cs(){cq=b}function cr(){setTimeout(cs,0);return cq=f.now()}function ci(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ch(){try{return new a.XMLHttpRequest}catch(b){}}function cb(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g<i;g++){if(g===1)for(h in a.converters)typeof h=="string"&&(e[h.toLowerCase()]=a.converters[h]);l=k,k=d[g];if(k==="*")k=l;else if(l!=="*"&&l!==k){m=l+" "+k,n=e[m]||e["* "+k];if(!n){p=b;for(o in e){j=o.split(" ");if(j[0]===l||j[0]==="*"){p=e[j[1]+" "+k];if(p){o=e[o],o===!0?n=p:p===!0&&(n=o);break}}}}!n&&!p&&f.error("No conversion from "+m.replace(" "," to ")),n!==!0&&(c=n?n(c):p(o(c)))}}return c}function ca(a,c,d){var e=a.contents,f=a.dataTypes,g=a.responseFields,h,i,j,k;for(i in g)i in d&&(c[g[i]]=d[i]);while(f[0]==="*")f.shift(),h===b&&(h=a.mimeType||c.getResponseHeader("content-type"));if(h)for(i in e)if(e[i]&&e[i].test(h)){f.unshift(i);break}if(f[0]in d)j=f[0];else{for(i in d){if(!f[0]||a.converters[i+" "+f[0]]){j=i;break}k||(k=i)}j=j||k}if(j){j!==f[0]&&f.unshift(j);return d[j]}}function b_(a,b,c,d){if(f.isArray(b))f.each(b,function(b,e){c||bD.test(a)?d(a,e):b_(a+"["+(typeof e=="object"?b:"")+"]",e,c,d)});else if(!c&&f.type(b)==="object")for(var e in b)b_(a+"["+e+"]",b[e],c,d);else d(a,b)}function b$(a,c){var d,e,g=f.ajaxSettings.flatOptions||{};for(d in c)c[d]!==b&&((g[d]?a:e||(e={}))[d]=c[d]);e&&f.extend(!0,a,e)}function bZ(a,c,d,e,f,g){f=f||c.dataTypes[0],g=g||{},g[f]=!0;var h=a[f],i=0,j=h?h.length:0,k=a===bS,l;for(;i<j&&(k||!l);i++)l=h[i](c,d,e),typeof l=="string"&&(!k||g[l]?l=b:(c.dataTypes.unshift(l),l=bZ(a,c,d,e,l,g)));(k||!l)&&!g["*"]&&(l=bZ(a,c,d,e,"*",g));return l}function bY(a){return function(b,c){typeof b!="string"&&(c=b,b="*");if(f.isFunction(c)){var d=b.toLowerCase().split(bO),e=0,g=d.length,h,i,j;for(;e<g;e++)h=d[e],j=/^\+/.test(h),j&&(h=h.substr(1)||"*"),i=a[h]=a[h]||[],i[j?"unshift":"push"](c)}}}function bB(a,b,c){var d=b==="width"?a.offsetWidth:a.offsetHeight,e=b==="width"?1:0,g=4;if(d>0){if(c!=="border")for(;e<g;e+=2)c||(d-=parseFloat(f.css(a,"padding"+bx[e]))||0),c==="margin"?d+=parseFloat(f.css(a,c+bx[e]))||0:d-=parseFloat(f.css(a,"border"+bx[e]+"Width"))||0;return d+"px"}d=by(a,b);if(d<0||d==null)d=a.style[b];if(bt.test(d))return d;d=parseFloat(d)||0;if(c)for(;e<g;e+=2)d+=parseFloat(f.css(a,"padding"+bx[e]))||0,c!=="padding"&&(d+=parseFloat(f.css(a,"border"+bx[e]+"Width"))||0),c==="margin"&&(d+=parseFloat(f.css(a,c+bx[e]))||0);return d+"px"}function bo(a){var b=c.createElement("div");bh.appendChild(b),b.innerHTML=a.outerHTML;return b.firstChild}function bn(a){var b=(a.nodeName||"").toLowerCase();b==="input"?bm(a):b!=="script"&&typeof a.getElementsByTagName!="undefined"&&f.grep(a.getElementsByTagName("input"),bm)}function bm(a){if(a.type==="checkbox"||a.type==="radio")a.defaultChecked=a.checked}function bl(a){return typeof a.getElementsByTagName!="undefined"?a.getElementsByTagName("*"):typeof a.querySelectorAll!="undefined"?a.querySelectorAll("*"):[]}function bk(a,b){var c;b.nodeType===1&&(b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase(),c==="object"?b.outerHTML=a.outerHTML:c!=="input"||a.type!=="checkbox"&&a.type!=="radio"?c==="option"?b.selected=a.defaultSelected:c==="input"||c==="textarea"?b.defaultValue=a.defaultValue:c==="script"&&b.text!==a.text&&(b.text=a.text):(a.checked&&(b.defaultChecked=b.checked=a.checked),b.value!==a.value&&(b.value=a.value)),b.removeAttribute(f.expando),b.removeAttribute("_submit_attached"),b.removeAttribute("_change_attached"))}function bj(a,b){if(b.nodeType===1&&!!f.hasData(a)){var c,d,e,g=f._data(a),h=f._data(b,g),i=g.events;if(i){delete h.handle,h.events={};for(c in i)for(d=0,e=i[c].length;d<e;d++)f.event.add(b,c,i[c][d])}h.data&&(h.data=f.extend({},h.data))}}function bi(a,b){return f.nodeName(a,"table")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function U(a){var b=V.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}function T(a,b,c){b=b||0;if(f.isFunction(b))return f.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return f.grep(a,function(a,d){return a===b===c});if(typeof b=="string"){var d=f.grep(a,function(a){return a.nodeType===1});if(O.test(b))return f.filter(b,d,!c);b=f.filter(b,d)}return f.grep(a,function(a,d){return f.inArray(a,b)>=0===c})}function S(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function K(){return!0}function J(){return!1}function n(a,b,c){var d=b+"defer",e=b+"queue",g=b+"mark",h=f._data(a,d);h&&(c==="queue"||!f._data(a,e))&&(c==="mark"||!f._data(a,g))&&setTimeout(function(){!f._data(a,e)&&!f._data(a,g)&&(f.removeData(a,d,!0),h.fire())},0)}function m(a){for(var b in a){if(b==="data"&&f.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function l(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(k,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNumeric(d)?+d:j.test(d)?f.parseJSON(d):d}catch(g){}f.data(a,c,d)}else d=b}return d}function h(a){var b=g[a]={},c,d;a=a.split(/\s+/);for(c=0,d=a.length;c<d;c++)b[a[c]]=!0;return b}var c=a.document,d=a.navigator,e=a.location,f=function(){function J(){if(!e.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(J,1);return}e.ready()}}var e=function(a,b){return new e.fn.init(a,b,h)},f=a.jQuery,g=a.$,h,i=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q=/(?:^|:|,)(?:\s*\[)+/g,r=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,v=/-([a-z]|[0-9])/ig,w=/^-ms-/,x=function(a,b){return(b+"").toUpperCase()},y=d.userAgent,z,A,B,C=Object.prototype.toString,D=Object.prototype.hasOwnProperty,E=Array.prototype.push,F=Array.prototype.slice,G=String.prototype.trim,H=Array.prototype.indexOf,I={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=m.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.7.2",length:0,size:function(){return this.length},toArray:function(){return F.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?E.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),A.add(a);return this},eq:function(a){a=+a;return a===-1?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(F.apply(this,arguments),"slice",F.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:E,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j<k;j++)if((a=arguments[j])!=null)for(c in a){d=i[c],f=a[c];if(i===f)continue;l&&f&&(e.isPlainObject(f)||(g=e.isArray(f)))?(g?(g=!1,h=d&&e.isArray(d)?d:[]):h=d&&e.isPlainObject(d)?d:{},i[c]=e.extend(l,h,f)):f!==b&&(i[c]=f)}return i},e.extend({noConflict:function(b){a.$===e&&(a.$=g),b&&a.jQuery===e&&(a.jQuery=f);return e},isReady:!1,readyWait:1,holdReady:function(a){a?e.readyWait++:e.ready(!0)},ready:function(a){if(a===!0&&!--e.readyWait||a!==!0&&!e.isReady){if(!c.body)return setTimeout(e.ready,1);e.isReady=!0;if(a!==!0&&--e.readyWait>0)return;A.fireWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").off("ready")}},bindReady:function(){if(!A){A=e.Callbacks("once memory");if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",B,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",B),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&J()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a!=null&&a==a.window},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return a==null?String(a):I[C.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!D.call(a,"constructor")&&!D.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||D.call(a,d)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw new Error(a)},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(n.test(b.replace(o,"@").replace(p,"]").replace(q,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(c){if(typeof c!="string"||!c)return null;var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(g){d=b}(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&e.error("Invalid XML: "+c);return d},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(w,"ms-").replace(v,x)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g<h;)if(c.apply(a[g++],d)===!1)break}else if(i){for(f in a)if(c.call(a[f],f,a[f])===!1)break}else for(;g<h;)if(c.call(a[g],g,a[g++])===!1)break;return a},trim:G?function(a){return a==null?"":G.call(a)}:function(a){return a==null?"":(a+"").replace(k,"").replace(l,"")},makeArray:function(a,b){var c=b||[];if(a!=null){var d=e.type(a);a.length==null||d==="string"||d==="function"||d==="regexp"||e.isWindow(a)?E.call(c,a):e.merge(c,a)}return c},inArray:function(a,b,c){var d;if(b){if(H)return H.call(b,a,c);d=b.length,c=c?c<0?Math.max(0,d+c):c:0;for(;c<d;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,c){var d=a.length,e=0;if(typeof c.length=="number")for(var f=c.length;e<f;e++)a[d++]=c[e];else while(c[e]!==b)a[d++]=c[e++];a.length=d;return a},grep:function(a,b,c){var d=[],e;c=!!c;for(var f=0,g=a.length;f<g;f++)e=!!b(a[f],f),c!==e&&d.push(a[f]);return d},map:function(a,c,d){var f,g,h=[],i=0,j=a.length,k=a instanceof e||j!==b&&typeof j=="number"&&(j>0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i<j;i++)f=c(a[i],i,d),f!=null&&(h[h.length]=f);else for(g in a)f=c(a[g],g,d),f!=null&&(h[h.length]=f);return h.concat.apply([],h)},guid:1,proxy:function(a,c){if(typeof c=="string"){var d=a[c];c=a,a=d}if(!e.isFunction(a))return b;var f=F.call(arguments,2),g=function(){return a.apply(c,f.concat(F.call(arguments)))};g.guid=a.guid=a.guid||g.guid||e.guid++;return g},access:function(a,c,d,f,g,h,i){var j,k=d==null,l=0,m=a.length;if(d&&typeof d=="object"){for(l in d)e.access(a,c,l,d[l],1,h,f);g=1}else if(f!==b){j=i===b&&e.isFunction(f),k&&(j?(j=c,c=function(a,b,c){return j.call(e(a),c)}):(c.call(a,f),c=null));if(c)for(;l<m;l++)c(a[l],d,j?f.call(a[l],l,c(a[l],d)):f,i);g=1}return g?a:k?c.call(a):m?c(a[0],d):h},now:function(){return(new Date).getTime()},uaMatch:function(a){a=a.toLowerCase();var b=r.exec(a)||s.exec(a)||t.exec(a)||a.indexOf("compatible")<0&&u.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},sub:function(){function a(b,c){return new a.fn.init(b,c)}e.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.sub=this.sub,a.fn.init=function(d,f){f&&f instanceof e&&!(f instanceof a)&&(f=a(f));return e.fn.init.call(this,d,f,b)},a.fn.init.prototype=a.fn;var b=a(c);return a},browser:{}}),e.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,b){I["[object "+b+"]"]=b.toLowerCase()}),z=e.uaMatch(y),z.browser&&(e.browser[z.browser]=!0,e.browser.version=z.version),e.browser.webkit&&(e.browser.safari=!0),j.test(" ")&&(k=/^[\s\xA0]+/,l=/[\s\xA0]+$/),h=e(c),c.addEventListener?B=function(){c.removeEventListener("DOMContentLoaded",B,!1),e.ready()}:c.attachEvent&&(B=function(){c.readyState==="complete"&&(c.detachEvent("onreadystatechange",B),e.ready())});return e}(),g={};f.Callbacks=function(a){a=a?g[a]||h(a):{};var c=[],d=[],e,i,j,k,l,m,n=function(b){var d,e,g,h,i;for(d=0,e=b.length;d<e;d++)g=b[d],h=f.type(g),h==="array"?n(g):h==="function"&&(!a.unique||!p.has(g))&&c.push(g)},o=function(b,f){f=f||[],e=!a.memory||[b,f],i=!0,j=!0,m=k||0,k=0,l=c.length;for(;c&&m<l;m++)if(c[m].apply(b,f)===!1&&a.stopOnFalse){e=!0;break}j=!1,c&&(a.once?e===!0?p.disable():c=[]:d&&d.length&&(e=d.shift(),p.fireWith(e[0],e[1])))},p={add:function(){if(c){var a=c.length;n(arguments),j?l=c.length:e&&e!==!0&&(k=a,o(e[0],e[1]))}return this},remove:function(){if(c){var b=arguments,d=0,e=b.length;for(;d<e;d++)for(var f=0;f<c.length;f++)if(b[d]===c[f]){j&&f<=l&&(l--,f<=m&&m--),c.splice(f--,1);if(a.unique)break}}return this},has:function(a){if(c){var b=0,d=c.length;for(;b<d;b++)if(a===c[b])return!0}return!1},empty:function(){c=[];return this},disable:function(){c=d=e=b;return this},disabled:function(){return!c},lock:function(){d=b,(!e||e===!0)&&p.disable();return this},locked:function(){return!d},fireWith:function(b,c){d&&(j?a.once||d.push([b,c]):(!a.once||!e)&&o(b,c));return this},fire:function(){p.fireWith(this,arguments);return this},fired:function(){return!!i}};return p};var i=[].slice;f.extend({Deferred:function(a){var b=f.Callbacks("once memory"),c=f.Callbacks("once memory"),d=f.Callbacks("memory"),e="pending",g={resolve:b,reject:c,notify:d},h={done:b.add,fail:c.add,progress:d.add,state:function(){return e},isResolved:b.fired,isRejected:c.fired,then:function(a,b,c){i.done(a).fail(b).progress(c);return this},always:function(){i.done.apply(i,arguments).fail.apply(i,arguments);return this},pipe:function(a,b,c){return f.Deferred(function(d){f.each({done:[a,"resolve"],fail:[b,"reject"],progress:[c,"notify"]},function(a,b){var c=b[0],e=b[1],g;f.isFunction(c)?i[a](function(){g=c.apply(this,arguments),g&&f.isFunction(g.promise)?g.promise().then(d.resolve,d.reject,d.notify):d[e+"With"](this===i?d:this,[g])}):i[a](d[e])})}).promise()},promise:function(a){if(a==null)a=h;else for(var b in h)a[b]=h[b];return a}},i=h.promise({}),j;for(j in g)i[j]=g[j].fire,i[j+"With"]=g[j].fireWith;i.done(function(){e="resolved"},c.disable,d.lock).fail(function(){e="rejected"},b.disable,d.lock),a&&a.call(i,i);return i},when:function(a){function m(a){return function(b){e[a]=arguments.length>1?i.call(arguments,0):b,j.notifyWith(k,e)}}function l(a){return function(c){b[a]=arguments.length>1?i.call(arguments,0):c,--g||j.resolveWith(j,b)}}var b=i.call(arguments,0),c=0,d=b.length,e=Array(d),g=d,h=d,j=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred(),k=j.promise();if(d>1){for(;c<d;c++)b[c]&&b[c].promise&&f.isFunction(b[c].promise)?b[c].promise().then(l(c),j.reject,m(c)):--g;g||j.resolveWith(j,b)}else j!==a&&j.resolveWith(j,d?[a]:[]);return k}}),f.support=function(){var b,d,e,g,h,i,j,k,l,m,n,o,p=c.createElement("div"),q=c.documentElement;p.setAttribute("className","t"),p.innerHTML=" <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>",d=p.getElementsByTagName("*"),e=p.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=p.getElementsByTagName("input")[0],b={leadingWhitespace:p.firstChild.nodeType===3,tbody:!p.getElementsByTagName("tbody").length,htmlSerialize:!!p.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:p.className!=="t",enctype:!!c.createElement("form").enctype,html5Clone:c.createElement("nav").cloneNode(!0).outerHTML!=="<:nav></:nav>",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,pixelMargin:!0},f.boxModel=b.boxModel=c.compatMode==="CSS1Compat",i.checked=!0,b.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,b.optDisabled=!h.disabled;try{delete p.test}catch(r){b.deleteExpando=!1}!p.addEventListener&&p.attachEvent&&p.fireEvent&&(p.attachEvent("onclick",function(){b.noCloneEvent=!1}),p.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),b.radioValue=i.value==="t",i.setAttribute("checked","checked"),i.setAttribute("name","t"),p.appendChild(i),j=c.createDocumentFragment(),j.appendChild(p.lastChild),b.checkClone=j.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=i.checked,j.removeChild(i),j.appendChild(p);if(p.attachEvent)for(n in{submit:1,change:1,focusin:1})m="on"+n,o=m in p,o||(p.setAttribute(m,"return;"),o=typeof p[m]=="function"),b[n+"Bubbles"]=o;j.removeChild(p),j=g=h=p=i=null,f(function(){var d,e,g,h,i,j,l,m,n,q,r,s,t,u=c.getElementsByTagName("body")[0];!u||(m=1,t="padding:0;margin:0;border:",r="position:absolute;top:0;left:0;width:1px;height:1px;",s=t+"0;visibility:hidden;",n="style='"+r+t+"5px solid #000;",q="<div "+n+"display:block;'><div style='"+t+"0;display:block;overflow:hidden;'></div></div>"+"<table "+n+"' cellpadding='0' cellspacing='0'>"+"<tr><td></td></tr></table>",d=c.createElement("div"),d.style.cssText=s+"width:0;height:0;position:static;top:0;margin-top:"+m+"px",u.insertBefore(d,u.firstChild),p=c.createElement("div"),d.appendChild(p),p.innerHTML="<table><tr><td style='"+t+"0;display:none'></td><td>t</td></tr></table>",k=p.getElementsByTagName("td"),o=k[0].offsetHeight===0,k[0].style.display="",k[1].style.display="none",b.reliableHiddenOffsets=o&&k[0].offsetHeight===0,a.getComputedStyle&&(p.innerHTML="",l=c.createElement("div"),l.style.width="0",l.style.marginRight="0",p.style.width="2px",p.appendChild(l),b.reliableMarginRight=(parseInt((a.getComputedStyle(l,null)||{marginRight:0}).marginRight,10)||0)===0),typeof p.style.zoom!="undefined"&&(p.innerHTML="",p.style.width=p.style.padding="1px",p.style.border=0,p.style.overflow="hidden",p.style.display="inline",p.style.zoom=1,b.inlineBlockNeedsLayout=p.offsetWidth===3,p.style.display="block",p.style.overflow="visible",p.innerHTML="<div style='width:5px;'></div>",b.shrinkWrapBlocks=p.offsetWidth!==3),p.style.cssText=r+s,p.innerHTML=q,e=p.firstChild,g=e.firstChild,i=e.nextSibling.firstChild.firstChild,j={doesNotAddBorder:g.offsetTop!==5,doesAddBorderForTableAndCells:i.offsetTop===5},g.style.position="fixed",g.style.top="20px",j.fixedPosition=g.offsetTop===20||g.offsetTop===15,g.style.position=g.style.top="",e.style.overflow="hidden",e.style.position="relative",j.subtractsBorderForOverflowNotVisible=g.offsetTop===-5,j.doesNotIncludeMarginInBodyOffset=u.offsetTop!==m,a.getComputedStyle&&(p.style.marginTop="1%",b.pixelMargin=(a.getComputedStyle(p,null)||{marginTop:0}).marginTop!=="1%"),typeof d.style.zoom!="undefined"&&(d.style.zoom=1),u.removeChild(d),l=p=d=null,f.extend(b,j))});return b}();var j=/^(?:\{.*\}|\[.*\])$/,k=/([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!m(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g,h,i,j=f.expando,k=typeof c=="string",l=a.nodeType,m=l?f.cache:a,n=l?a[j]:a[j]&&j,o=c==="events";if((!n||!m[n]||!o&&!e&&!m[n].data)&&k&&d===b)return;n||(l?a[j]=n=++f.uuid:n=j),m[n]||(m[n]={},l||(m[n].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?m[n]=f.extend(m[n],c):m[n].data=f.extend(m[n].data,c);g=h=m[n],e||(h.data||(h.data={}),h=h.data),d!==b&&(h[f.camelCase(c)]=d);if(o&&!h[c])return g.events;k?(i=h[c],i==null&&(i=h[f.camelCase(c)])):i=h;return i}},removeData:function(a,b,c){if(!!f.acceptData(a)){var d,e,g,h=f.expando,i=a.nodeType,j=i?f.cache:a,k=i?a[h]:h;if(!j[k])return;if(b){d=c?j[k]:j[k].data;if(d){f.isArray(b)||(b in d?b=[b]:(b=f.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,g=b.length;e<g;e++)delete d[b[e]];if(!(c?m:f.isEmptyObject)(d))return}}if(!c){delete j[k].data;if(!m(j[k]))return}f.support.deleteExpando||!j.setInterval?delete j[k]:j[k]=null,i&&(f.support.deleteExpando?delete a[h]:a.removeAttribute?a.removeAttribute(h):a[h]=null)}},_data:function(a,b,c){return f.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=f.noData[a.nodeName.toLowerCase()];if(b)return b!==!0&&a.getAttribute("classid")===b}return!0}}),f.fn.extend({data:function(a,c){var d,e,g,h,i,j=this[0],k=0,m=null;if(a===b){if(this.length){m=f.data(j);if(j.nodeType===1&&!f._data(j,"parsedAttrs")){g=j.attributes;for(i=g.length;k<i;k++)h=g[k].name,h.indexOf("data-")===0&&(h=f.camelCase(h.substring(5)),l(j,h,m[h]));f._data(j,"parsedAttrs",!0)}}return m}if(typeof a=="object")return this.each(function(){f.data(this,a)});d=a.split(".",2),d[1]=d[1]?"."+d[1]:"",e=d[1]+"!";return f.access(this,function(c){if(c===b){m=this.triggerHandler("getData"+e,[d[0]]),m===b&&j&&(m=f.data(j,a),m=l(j,a,m));return m===b&&d[1]?this.data(d[0]):m}d[1]=c,this.each(function(){var b=f(this);b.triggerHandler("setData"+e,d),f.data(this,a,c),b.triggerHandler("changeData"+e,d)})},null,c,arguments.length>1,null,!1)},removeData:function(a){return this.each(function(){f.removeData(this,a)})}}),f.extend({_mark:function(a,b){a&&(b=(b||"fx")+"mark",f._data(a,b,(f._data(a,b)||0)+1))},_unmark:function(a,b,c){a!==!0&&(c=b,b=a,a=!1);if(b){c=c||"fx";var d=c+"mark",e=a?0:(f._data(b,d)||1)-1;e?f._data(b,d,e):(f.removeData(b,d,!0),n(b,c,"mark"))}},queue:function(a,b,c){var d;if(a){b=(b||"fx")+"queue",d=f._data(a,b),c&&(!d||f.isArray(c)?d=f._data(a,b,f.makeArray(c)):d.push(c));return d||[]}},dequeue:function(a,b){b=b||"fx";var c=f.queue(a,b),d=c.shift(),e={};d==="inprogress"&&(d=c.shift()),d&&(b==="fx"&&c.unshift("inprogress"),f._data(a,b+".run",e),d.call(a,function(){f.dequeue(a,b)},e)),c.length||(f.removeData(a,b+"queue "+b+".run",!0),n(a,b,"queue"))}}),f.fn.extend({queue:function(a,c){var d=2;typeof a!="string"&&(c=a,a="fx",d--);if(arguments.length<d)return f.queue(this[0],a);return c===b?this:this.each(function(){var b=f.queue(this,a,c);a==="fx"&&b[0]!=="inprogress"&&f.dequeue(this,a)})},dequeue:function(a){return this.each(function(){f.dequeue(this,a)})},delay:function(a,b){a=f.fx?f.fx.speeds[a]||a:a,b=b||"fx";return this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,c){function m(){--h||d.resolveWith(e,[e])}typeof a!="string"&&(c=a,a=b),a=a||"fx";var d=f.Deferred(),e=this,g=e.length,h=1,i=a+"defer",j=a+"queue",k=a+"mark",l;while(g--)if(l=f.data(e[g],i,b,!0)||(f.data(e[g],j,b,!0)||f.data(e[g],k,b,!0))&&f.data(e[g],i,f.Callbacks("once memory"),!0))h++,l.add(m);m();return d.promise(c)}});var o=/[\n\t\r]/g,p=/\s+/,q=/\r/g,r=/^(?:button|input)$/i,s=/^(?:button|input|object|select|textarea)$/i,t=/^a(?:rea)?$/i,u=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,v=f.support.getSetAttribute,w,x,y;f.fn.extend({attr:function(a,b){return f.access(this,f.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){f.removeAttr(this,a)})},prop:function(a,b){return f.access(this,f.prop,a,b,arguments.length>1)},removeProp:function(a){a=f.propFix[a]||a;return this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,g,h,i;if(f.isFunction(a))return this.each(function(b){f(this).addClass(a.call(this,b,this.className))});if(a&&typeof a=="string"){b=a.split(p);for(c=0,d=this.length;c<d;c++){e=this[c];if(e.nodeType===1)if(!e.className&&b.length===1)e.className=a;else{g=" "+e.className+" ";for(h=0,i=b.length;h<i;h++)~g.indexOf(" "+b[h]+" ")||(g+=b[h]+" ");e.className=f.trim(g)}}}return this},removeClass:function(a){var c,d,e,g,h,i,j;if(f.isFunction(a))return this.each(function(b){f(this).removeClass(a.call(this,b,this.className))});if(a&&typeof a=="string"||a===b){c=(a||"").split(p);for(d=0,e=this.length;d<e;d++){g=this[d];if(g.nodeType===1&&g.className)if(a){h=(" "+g.className+" ").replace(o," ");for(i=0,j=c.length;i<j;i++)h=h.replace(" "+c[i]+" "," ");g.className=f.trim(h)}else g.className=""}}return this},toggleClass:function(a,b){var c=typeof a,d=typeof b=="boolean";if(f.isFunction(a))return this.each(function(c){f(this).toggleClass(a.call(this,c,this.className,b),b)});return this.each(function(){if(c==="string"){var e,g=0,h=f(this),i=b,j=a.split(p);while(e=j[g++])i=d?i:!h.hasClass(e),h[i?"addClass":"removeClass"](e)}else if(c==="undefined"||c==="boolean")this.className&&f._data(this,"__className__",this.className),this.className=this.className||a===!1?"":f._data(this,"__className__")||""})},hasClass:function(a){var b=" "+a+" ",c=0,d=this.length;for(;c<d;c++)if(this[c].nodeType===1&&(" "+this[c].className+" ").replace(o," ").indexOf(b)>-1)return!0;return!1},val:function(a){var c,d,e,g=this[0];{if(!!arguments.length){e=f.isFunction(a);return this.each(function(d){var g=f(this),h;if(this.nodeType===1){e?h=a.call(this,d,g.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.type]||f.valHooks[this.nodeName.toLowerCase()];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}if(g){c=f.valHooks[g.type]||f.valHooks[g.nodeName.toLowerCase()];if(c&&"get"in c&&(d=c.get(g,"value"))!==b)return d;d=g.value;return typeof d=="string"?d.replace(q,""):d==null?"":d}}}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,g=a.selectedIndex,h=[],i=a.options,j=a.type==="select-one";if(g<0)return null;c=j?g:0,d=j?g+1:i.length;for(;c<d;c++){e=i[c];if(e.selected&&(f.support.optDisabled?!e.disabled:e.getAttribute("disabled")===null)&&(!e.parentNode.disabled||!f.nodeName(e.parentNode,"optgroup"))){b=f(e).val();if(j)return b;h.push(b)}}if(j&&!h.length&&i.length)return f(i[g]).val();return h},set:function(a,b){var c=f.makeArray(b);f(a).find("option").each(function(){this.selected=f.inArray(f(this).val(),c)>=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,d,e){var g,h,i,j=a.nodeType;if(!!a&&j!==3&&j!==8&&j!==2){if(e&&c in f.attrFn)return f(a)[c](d);if(typeof a.getAttribute=="undefined")return f.prop(a,c,d);i=j!==1||!f.isXMLDoc(a),i&&(c=c.toLowerCase(),h=f.attrHooks[c]||(u.test(c)?x:w));if(d!==b){if(d===null){f.removeAttr(a,c);return}if(h&&"set"in h&&i&&(g=h.set(a,d,c))!==b)return g;a.setAttribute(c,""+d);return d}if(h&&"get"in h&&i&&(g=h.get(a,c))!==null)return g;g=a.getAttribute(c);return g===null?b:g}},removeAttr:function(a,b){var c,d,e,g,h,i=0;if(b&&a.nodeType===1){d=b.toLowerCase().split(p),g=d.length;for(;i<g;i++)e=d[i],e&&(c=f.propFix[e]||e,h=u.test(e),h||f.attr(a,e,""),a.removeAttribute(v?e:c),h&&c in a&&(a[c]=!1))}},attrHooks:{type:{set:function(a,b){if(r.test(a.nodeName)&&a.parentNode)f.error("type property can't be changed");else if(!f.support.radioValue&&b==="radio"&&f.nodeName(a,"input")){var c=a.value;a.setAttribute("type",b),c&&(a.value=c);return b}}},value:{get:function(a,b){if(w&&f.nodeName(a,"button"))return w.get(a,b);return b in a?a.value:null},set:function(a,b,c){if(w&&f.nodeName(a,"button"))return w.set(a,b,c);a.value=b}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(a,c,d){var e,g,h,i=a.nodeType;if(!!a&&i!==3&&i!==8&&i!==2){h=i!==1||!f.isXMLDoc(a),h&&(c=f.propFix[c]||c,g=f.propHooks[c]);return d!==b?g&&"set"in g&&(e=g.set(a,d,c))!==b?e:a[c]=d:g&&"get"in g&&(e=g.get(a,c))!==null?e:a[c]}},propHooks:{tabIndex:{get:function(a){var c=a.getAttributeNode("tabindex");return c&&c.specified?parseInt(c.value,10):s.test(a.nodeName)||t.test(a.nodeName)&&a.href?0:b}}}}),f.attrHooks.tabindex=f.propHooks.tabIndex,x={get:function(a,c){var d,e=f.prop(a,c);return e===!0||typeof e!="boolean"&&(d=a.getAttributeNode(c))&&d.nodeValue!==!1?c.toLowerCase():b},set:function(a,b,c){var d;b===!1?f.removeAttr(a,c):(d=f.propFix[c]||c,d in a&&(a[d]=!0),a.setAttribute(c,c.toLowerCase()));return c}},v||(y={name:!0,id:!0,coords:!0},w=f.valHooks.button={get:function(a,c){var d;d=a.getAttributeNode(c);return d&&(y[c]?d.nodeValue!=="":d.specified)?d.nodeValue:b},set:function(a,b,d){var e=a.getAttributeNode(d);e||(e=c.createAttribute(d),a.setAttributeNode(e));return e.nodeValue=b+""}},f.attrHooks.tabindex.set=w.set,f.each(["width","height"],function(a,b){f.attrHooks[b]=f.extend(f.attrHooks[b],{set:function(a,c){if(c===""){a.setAttribute(b,"auto");return c}}})}),f.attrHooks.contenteditable={get:w.get,set:function(a,b,c){b===""&&(b="false"),w.set(a,b,c)}}),f.support.hrefNormalized||f.each(["href","src","width","height"],function(a,c){f.attrHooks[c]=f.extend(f.attrHooks[c],{get:function(a){var d=a.getAttribute(c,2);return d===null?b:d}})}),f.support.style||(f.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||b},set:function(a,b){return a.style.cssText=""+b}}),f.support.optSelected||(f.propHooks.selected=f.extend(f.propHooks.selected,{get:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex);return null}})),f.support.enctype||(f.propFix.enctype="encoding"),f.support.checkOn||f.each(["radio","checkbox"],function(){f.valHooks[this]={get:function(a){return a.getAttribute("value")===null?"on":a.value}}}),f.each(["radio","checkbox"],function(){f.valHooks[this]=f.extend(f.valHooks[this],{set:function(a,b){if(f.isArray(b))return a.checked=f.inArray(f(a).val(),b)>=0}})});var z=/^(?:textarea|input|select)$/i,A=/^([^\.]*)?(?:\.(.+))?$/,B=/(?:^|\s)hover(\.\S+)?\b/,C=/^key/,D=/^(?:mouse|contextmenu)|click/,E=/^(?:focusinfocus|focusoutblur)$/,F=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,G=function(
+a){var b=F.exec(a);b&&(b[1]=(b[1]||"").toLowerCase(),b[3]=b[3]&&new RegExp("(?:^|\\s)"+b[3]+"(?:\\s|$)"));return b},H=function(a,b){var c=a.attributes||{};return(!b[1]||a.nodeName.toLowerCase()===b[1])&&(!b[2]||(c.id||{}).value===b[2])&&(!b[3]||b[3].test((c["class"]||{}).value))},I=function(a){return f.event.special.hover?a:a.replace(B,"mouseenter$1 mouseleave$1")};f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3||a.nodeType===8||!c||!d||!(h=f._data(a)))){d.handler&&(p=d,d=p.handler,g=p.selector),d.guid||(d.guid=f.guid++),j=h.events,j||(h.events=j={}),i=h.handle,i||(h.handle=i=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.dispatch.apply(i.elem,arguments):b},i.elem=a),c=f.trim(I(c)).split(" ");for(k=0;k<c.length;k++){l=A.exec(c[k])||[],m=l[1],n=(l[2]||"").split(".").sort(),s=f.event.special[m]||{},m=(g?s.delegateType:s.bindType)||m,s=f.event.special[m]||{},o=f.extend({type:m,origType:l[1],data:e,handler:d,guid:d.guid,selector:g,quick:g&&G(g),namespace:n.join(".")},p),r=j[m];if(!r){r=j[m]=[],r.delegateCount=0;if(!s.setup||s.setup.call(a,e,n,i)===!1)a.addEventListener?a.addEventListener(m,i,!1):a.attachEvent&&a.attachEvent("on"+m,i)}s.add&&(s.add.call(a,o),o.handler.guid||(o.handler.guid=d.guid)),g?r.splice(r.delegateCount++,0,o):r.push(o),f.event.global[m]=!0}a=null}},global:{},remove:function(a,b,c,d,e){var g=f.hasData(a)&&f._data(a),h,i,j,k,l,m,n,o,p,q,r,s;if(!!g&&!!(o=g.events)){b=f.trim(I(b||"")).split(" ");for(h=0;h<b.length;h++){i=A.exec(b[h])||[],j=k=i[1],l=i[2];if(!j){for(j in o)f.event.remove(a,j+b[h],c,d,!0);continue}p=f.event.special[j]||{},j=(d?p.delegateType:p.bindType)||j,r=o[j]||[],m=r.length,l=l?new RegExp("(^|\\.)"+l.split(".").sort().join("\\.(?:.*\\.)?")+"(\\.|$)"):null;for(n=0;n<r.length;n++)s=r[n],(e||k===s.origType)&&(!c||c.guid===s.guid)&&(!l||l.test(s.namespace))&&(!d||d===s.selector||d==="**"&&s.selector)&&(r.splice(n--,1),s.selector&&r.delegateCount--,p.remove&&p.remove.call(a,s));r.length===0&&m!==r.length&&((!p.teardown||p.teardown.call(a,l)===!1)&&f.removeEvent(a,j,g.handle),delete o[j])}f.isEmptyObject(o)&&(q=g.handle,q&&(q.elem=null),f.removeData(a,["events","handle"],!0))}},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(c,d,e,g){if(!e||e.nodeType!==3&&e.nodeType!==8){var h=c.type||c,i=[],j,k,l,m,n,o,p,q,r,s;if(E.test(h+f.event.triggered))return;h.indexOf("!")>=0&&(h=h.slice(0,-1),k=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if((!e||f.event.customEvent[h])&&!f.event.global[h])return;c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.isTrigger=!0,c.exclusive=k,c.namespace=i.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)"):null,o=h.indexOf(":")<0?"on"+h:"";if(!e){j=f.cache;for(l in j)j[l].events&&j[l].events[h]&&f.event.trigger(c,d,j[l].handle.elem,!0);return}c.result=b,c.target||(c.target=e),d=d!=null?f.makeArray(d):[],d.unshift(c),p=f.event.special[h]||{};if(p.trigger&&p.trigger.apply(e,d)===!1)return;r=[[e,p.bindType||h]];if(!g&&!p.noBubble&&!f.isWindow(e)){s=p.delegateType||h,m=E.test(s+h)?e:e.parentNode,n=null;for(;m;m=m.parentNode)r.push([m,s]),n=m;n&&n===e.ownerDocument&&r.push([n.defaultView||n.parentWindow||a,s])}for(l=0;l<r.length&&!c.isPropagationStopped();l++)m=r[l][0],c.type=r[l][1],q=(f._data(m,"events")||{})[c.type]&&f._data(m,"handle"),q&&q.apply(m,d),q=o&&m[o],q&&f.acceptData(m)&&q.apply(m,d)===!1&&c.preventDefault();c.type=h,!g&&!c.isDefaultPrevented()&&(!p._default||p._default.apply(e.ownerDocument,d)===!1)&&(h!=="click"||!f.nodeName(e,"a"))&&f.acceptData(e)&&o&&e[h]&&(h!=="focus"&&h!=="blur"||c.target.offsetWidth!==0)&&!f.isWindow(e)&&(n=e[o],n&&(e[o]=null),f.event.triggered=h,e[h](),f.event.triggered=b,n&&(e[o]=n));return c.result}},dispatch:function(c){c=f.event.fix(c||a.event);var d=(f._data(this,"events")||{})[c.type]||[],e=d.delegateCount,g=[].slice.call(arguments,0),h=!c.exclusive&&!c.namespace,i=f.event.special[c.type]||{},j=[],k,l,m,n,o,p,q,r,s,t,u;g[0]=c,c.delegateTarget=this;if(!i.preDispatch||i.preDispatch.call(this,c)!==!1){if(e&&(!c.button||c.type!=="click")){n=f(this),n.context=this.ownerDocument||this;for(m=c.target;m!=this;m=m.parentNode||this)if(m.disabled!==!0){p={},r=[],n[0]=m;for(k=0;k<e;k++)s=d[k],t=s.selector,p[t]===b&&(p[t]=s.quick?H(m,s.quick):n.is(t)),p[t]&&r.push(s);r.length&&j.push({elem:m,matches:r})}}d.length>e&&j.push({elem:this,matches:d.slice(e)});for(k=0;k<j.length&&!c.isPropagationStopped();k++){q=j[k],c.currentTarget=q.elem;for(l=0;l<q.matches.length&&!c.isImmediatePropagationStopped();l++){s=q.matches[l];if(h||!c.namespace&&!s.namespace||c.namespace_re&&c.namespace_re.test(s.namespace))c.data=s.data,c.handleObj=s,o=((f.event.special[s.origType]||{}).handle||s.handler).apply(q.elem,g),o!==b&&(c.result=o,o===!1&&(c.preventDefault(),c.stopPropagation()))}}i.postDispatch&&i.postDispatch.call(this,c);return c.result}},props:"attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){a.which==null&&(a.which=b.charCode!=null?b.charCode:b.keyCode);return a}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,d){var e,f,g,h=d.button,i=d.fromElement;a.pageX==null&&d.clientX!=null&&(e=a.target.ownerDocument||c,f=e.documentElement,g=e.body,a.pageX=d.clientX+(f&&f.scrollLeft||g&&g.scrollLeft||0)-(f&&f.clientLeft||g&&g.clientLeft||0),a.pageY=d.clientY+(f&&f.scrollTop||g&&g.scrollTop||0)-(f&&f.clientTop||g&&g.clientTop||0)),!a.relatedTarget&&i&&(a.relatedTarget=i===a.target?d.toElement:i),!a.which&&h!==b&&(a.which=h&1?1:h&2?3:h&4?2:0);return a}},fix:function(a){if(a[f.expando])return a;var d,e,g=a,h=f.event.fixHooks[a.type]||{},i=h.props?this.props.concat(h.props):this.props;a=f.Event(g);for(d=i.length;d;)e=i[--d],a[e]=g[e];a.target||(a.target=g.srcElement||c),a.target.nodeType===3&&(a.target=a.target.parentNode),a.metaKey===b&&(a.metaKey=a.ctrlKey);return h.filter?h.filter(a,g):a},special:{ready:{setup:f.bindReady},load:{noBubble:!0},focus:{delegateType:"focusin"},blur:{delegateType:"focusout"},beforeunload:{setup:function(a,b,c){f.isWindow(this)&&(this.onbeforeunload=c)},teardown:function(a,b){this.onbeforeunload===b&&(this.onbeforeunload=null)}}},simulate:function(a,b,c,d){var e=f.extend(new f.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?f.event.trigger(e,null,b):f.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},f.event.handle=f.event.dispatch,f.removeEvent=c.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){a.detachEvent&&a.detachEvent("on"+b,c)},f.Event=function(a,b){if(!(this instanceof f.Event))return new f.Event(a,b);a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault()?K:J):this.type=a,b&&f.extend(this,b),this.timeStamp=a&&a.timeStamp||f.now(),this[f.expando]=!0},f.Event.prototype={preventDefault:function(){this.isDefaultPrevented=K;var a=this.originalEvent;!a||(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){this.isPropagationStopped=K;var a=this.originalEvent;!a||(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=K,this.stopPropagation()},isDefaultPrevented:J,isPropagationStopped:J,isImmediatePropagationStopped:J},f.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){f.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c=this,d=a.relatedTarget,e=a.handleObj,g=e.selector,h;if(!d||d!==c&&!f.contains(c,d))a.type=e.origType,h=e.handler.apply(this,arguments),a.type=b;return h}}}),f.support.submitBubbles||(f.event.special.submit={setup:function(){if(f.nodeName(this,"form"))return!1;f.event.add(this,"click._submit keypress._submit",function(a){var c=a.target,d=f.nodeName(c,"input")||f.nodeName(c,"button")?c.form:b;d&&!d._submit_attached&&(f.event.add(d,"submit._submit",function(a){a._submit_bubble=!0}),d._submit_attached=!0)})},postDispatch:function(a){a._submit_bubble&&(delete a._submit_bubble,this.parentNode&&!a.isTrigger&&f.event.simulate("submit",this.parentNode,a,!0))},teardown:function(){if(f.nodeName(this,"form"))return!1;f.event.remove(this,"._submit")}}),f.support.changeBubbles||(f.event.special.change={setup:function(){if(z.test(this.nodeName)){if(this.type==="checkbox"||this.type==="radio")f.event.add(this,"propertychange._change",function(a){a.originalEvent.propertyName==="checked"&&(this._just_changed=!0)}),f.event.add(this,"click._change",function(a){this._just_changed&&!a.isTrigger&&(this._just_changed=!1,f.event.simulate("change",this,a,!0))});return!1}f.event.add(this,"beforeactivate._change",function(a){var b=a.target;z.test(b.nodeName)&&!b._change_attached&&(f.event.add(b,"change._change",function(a){this.parentNode&&!a.isSimulated&&!a.isTrigger&&f.event.simulate("change",this.parentNode,a,!0)}),b._change_attached=!0)})},handle:function(a){var b=a.target;if(this!==b||a.isSimulated||a.isTrigger||b.type!=="radio"&&b.type!=="checkbox")return a.handleObj.handler.apply(this,arguments)},teardown:function(){f.event.remove(this,"._change");return z.test(this.nodeName)}}),f.support.focusinBubbles||f.each({focus:"focusin",blur:"focusout"},function(a,b){var d=0,e=function(a){f.event.simulate(b,a.target,f.event.fix(a),!0)};f.event.special[b]={setup:function(){d++===0&&c.addEventListener(a,e,!0)},teardown:function(){--d===0&&c.removeEventListener(a,e,!0)}}}),f.fn.extend({on:function(a,c,d,e,g){var h,i;if(typeof a=="object"){typeof c!="string"&&(d=d||c,c=b);for(i in a)this.on(i,c,d,a[i],g);return this}d==null&&e==null?(e=c,d=c=b):e==null&&(typeof c=="string"?(e=d,d=b):(e=d,d=c,c=b));if(e===!1)e=J;else if(!e)return this;g===1&&(h=e,e=function(a){f().off(a);return h.apply(this,arguments)},e.guid=h.guid||(h.guid=f.guid++));return this.each(function(){f.event.add(this,a,e,d,c)})},one:function(a,b,c,d){return this.on(a,b,c,d,1)},off:function(a,c,d){if(a&&a.preventDefault&&a.handleObj){var e=a.handleObj;f(a.delegateTarget).off(e.namespace?e.origType+"."+e.namespace:e.origType,e.selector,e.handler);return this}if(typeof a=="object"){for(var g in a)this.off(g,c,a[g]);return this}if(c===!1||typeof c=="function")d=c,c=b;d===!1&&(d=J);return this.each(function(){f.event.remove(this,a,d,c)})},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},live:function(a,b,c){f(this.context).on(a,this.selector,b,c);return this},die:function(a,b){f(this.context).off(a,this.selector||"**",b);return this},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return arguments.length==1?this.off(a,"**"):this.off(b,a,c)},trigger:function(a,b){return this.each(function(){f.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0])return f.event.trigger(a,b,this[0],!0)},toggle:function(a){var b=arguments,c=a.guid||f.guid++,d=0,e=function(c){var e=(f._data(this,"lastToggle"+a.guid)||0)%d;f._data(this,"lastToggle"+a.guid,e+1),c.preventDefault();return b[e].apply(this,arguments)||!1};e.guid=c;while(d<b.length)b[d++].guid=c;return this.click(e)},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}}),f.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){f.fn[b]=function(a,c){c==null&&(c=a,a=null);return arguments.length>0?this.on(b,null,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0),C.test(b)&&(f.event.fixHooks[b]=f.event.keyHooks),D.test(b)&&(f.event.fixHooks[b]=f.event.mouseHooks)}),function(){function x(a,b,c,e,f,g){for(var h=0,i=e.length;h<i;h++){var j=e[h];if(j){var k=!1;j=j[a];while(j){if(j[d]===c){k=e[j.sizset];break}if(j.nodeType===1){g||(j[d]=c,j.sizset=h);if(typeof b!="string"){if(j===b){k=!0;break}}else if(m.filter(b,[j]).length>0){k=j;break}}j=j[a]}e[h]=k}}}function w(a,b,c,e,f,g){for(var h=0,i=e.length;h<i;h++){var j=e[h];if(j){var k=!1;j=j[a];while(j){if(j[d]===c){k=e[j.sizset];break}j.nodeType===1&&!g&&(j[d]=c,j.sizset=h);if(j.nodeName.toLowerCase()===b){k=j;break}j=j[a]}e[h]=k}}}var a=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d="sizcache"+(Math.random()+"").replace(".",""),e=0,g=Object.prototype.toString,h=!1,i=!0,j=/\\/g,k=/\r\n/g,l=/\W/;[0,0].sort(function(){i=!1;return 0});var m=function(b,d,e,f){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return e;var i,j,k,l,n,q,r,t,u=!0,v=m.isXML(d),w=[],x=b;do{a.exec(""),i=a.exec(x);if(i){x=i[3],w.push(i[1]);if(i[2]){l=i[3];break}}}while(i);if(w.length>1&&p.exec(b))if(w.length===2&&o.relative[w[0]])j=y(w[0]+w[1],d,f);else{j=o.relative[w[0]]?[d]:m(w.shift(),d);while(w.length)b=w.shift(),o.relative[b]&&(b+=w.shift()),j=y(b,j,f)}else{!f&&w.length>1&&d.nodeType===9&&!v&&o.match.ID.test(w[0])&&!o.match.ID.test(w[w.length-1])&&(n=m.find(w.shift(),d,v),d=n.expr?m.filter(n.expr,n.set)[0]:n.set[0]);if(d){n=f?{expr:w.pop(),set:s(f)}:m.find(w.pop(),w.length===1&&(w[0]==="~"||w[0]==="+")&&d.parentNode?d.parentNode:d,v),j=n.expr?m.filter(n.expr,n.set):n.set,w.length>0?k=s(j):u=!1;while(w.length)q=w.pop(),r=q,o.relative[q]?r=w.pop():q="",r==null&&(r=d),o.relative[q](k,r,v)}else k=w=[]}k||(k=j),k||m.error(q||b);if(g.call(k)==="[object Array]")if(!u)e.push.apply(e,k);else if(d&&d.nodeType===1)for(t=0;k[t]!=null;t++)k[t]&&(k[t]===!0||k[t].nodeType===1&&m.contains(d,k[t]))&&e.push(j[t]);else for(t=0;k[t]!=null;t++)k[t]&&k[t].nodeType===1&&e.push(j[t]);else s(k,e);l&&(m(l,h,e,f),m.uniqueSort(e));return e};m.uniqueSort=function(a){if(u){h=i,a.sort(u);if(h)for(var b=1;b<a.length;b++)a[b]===a[b-1]&&a.splice(b--,1)}return a},m.matches=function(a,b){return m(a,null,null,b)},m.matchesSelector=function(a,b){return m(b,null,null,[a]).length>0},m.find=function(a,b,c){var d,e,f,g,h,i;if(!a)return[];for(e=0,f=o.order.length;e<f;e++){h=o.order[e];if(g=o.leftMatch[h].exec(a)){i=g[1],g.splice(1,1);if(i.substr(i.length-1)!=="\\"){g[1]=(g[1]||"").replace(j,""),d=o.find[h](g,b,c);if(d!=null){a=a.replace(o.match[h],"");break}}}}d||(d=typeof b.getElementsByTagName!="undefined"?b.getElementsByTagName("*"):[]);return{set:d,expr:a}},m.filter=function(a,c,d,e){var f,g,h,i,j,k,l,n,p,q=a,r=[],s=c,t=c&&c[0]&&m.isXML(c[0]);while(a&&c.length){for(h in o.filter)if((f=o.leftMatch[h].exec(a))!=null&&f[2]){k=o.filter[h],l=f[1],g=!1,f.splice(1,1);if(l.substr(l.length-1)==="\\")continue;s===r&&(r=[]);if(o.preFilter[h]){f=o.preFilter[h](f,s,d,r,e,t);if(!f)g=i=!0;else if(f===!0)continue}if(f)for(n=0;(j=s[n])!=null;n++)j&&(i=k(j,f,n,s),p=e^i,d&&i!=null?p?g=!0:s[n]=!1:p&&(r.push(j),g=!0));if(i!==b){d||(s=r),a=a.replace(o.match[h],"");if(!g)return[];break}}if(a===q)if(g==null)m.error(a);else break;q=a}return s},m.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)};var n=m.getText=function(a){var b,c,d=a.nodeType,e="";if(d){if(d===1||d===9||d===11){if(typeof a.textContent=="string")return a.textContent;if(typeof a.innerText=="string")return a.innerText.replace(k,"");for(a=a.firstChild;a;a=a.nextSibling)e+=n(a)}else if(d===3||d===4)return a.nodeValue}else for(b=0;c=a[b];b++)c.nodeType!==8&&(e+=n(c));return e},o=m.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(a){return a.getAttribute("href")},type:function(a){return a.getAttribute("type")}},relative:{"+":function(a,b){var c=typeof b=="string",d=c&&!l.test(b),e=c&&!d;d&&(b=b.toLowerCase());for(var f=0,g=a.length,h;f<g;f++)if(h=a[f]){while((h=h.previousSibling)&&h.nodeType!==1);a[f]=e||h&&h.nodeName.toLowerCase()===b?h||!1:h===b}e&&m.filter(b,a,!0)},">":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!l.test(b)){b=b.toLowerCase();for(;e<f;e++){c=a[e];if(c){var g=c.parentNode;a[e]=g.nodeName.toLowerCase()===b?g:!1}}}else{for(;e<f;e++)c=a[e],c&&(a[e]=d?c.parentNode:c.parentNode===b);d&&m.filter(b,a,!0)}},"":function(a,b,c){var d,f=e++,g=x;typeof b=="string"&&!l.test(b)&&(b=b.toLowerCase(),d=b,g=w),g("parentNode",b,f,a,d,c)},"~":function(a,b,c){var d,f=e++,g=x;typeof b=="string"&&!l.test(b)&&(b=b.toLowerCase(),d=b,g=w),g("previousSibling",b,f,a,d,c)}},find:{ID:function(a,b,c){if(typeof b.getElementById!="undefined"&&!c){var d=b.getElementById(a[1]);return d&&d.parentNode?[d]:[]}},NAME:function(a,b){if(typeof b.getElementsByName!="undefined"){var c=[],d=b.getElementsByName(a[1]);for(var e=0,f=d.length;e<f;e++)d[e].getAttribute("name")===a[1]&&c.push(d[e]);return c.length===0?null:c}},TAG:function(a,b){if(typeof b.getElementsByTagName!="undefined")return b.getElementsByTagName(a[1])}},preFilter:{CLASS:function(a,b,c,d,e,f){a=" "+a[1].replace(j,"")+" ";if(f)return a;for(var g=0,h;(h=b[g])!=null;g++)h&&(e^(h.className&&(" "+h.className+" ").replace(/[\t\n\r]/g," ").indexOf(a)>=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(j,"")},TAG:function(a,b){return a[1].replace(j,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||m.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&m.error(a[0]);a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(j,"");!f&&o.attrMap[g]&&(a[1]=o.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(j,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=m(b[3],null,null,c);else{var g=m.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(o.match.POS.test(b[0])||o.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!m(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return b<c[3]-0},gt:function(a,b,c){return b>c[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=o.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||n([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h<i;h++)if(g[h]===a)return!1;return!0}m.error(e)},CHILD:function(a,b){var c,e,f,g,h,i,j,k=b[1],l=a;switch(k){case"only":case"first":while(l=l.previousSibling)if(l.nodeType===1)return!1;if(k==="first")return!0;l=a;case"last":while(l=l.nextSibling)if(l.nodeType===1)return!1;return!0;case"nth":c=b[2],e=b[3];if(c===1&&e===0)return!0;f=b[0],g=a.parentNode;if(g&&(g[d]!==f||!a.nodeIndex)){i=0;for(l=g.firstChild;l;l=l.nextSibling)l.nodeType===1&&(l.nodeIndex=++i);g[d]=f}j=a.nodeIndex-e;return c===0?j===0:j%c===0&&j/c>=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||!!a.nodeName&&a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=m.attr?m.attr(a,c):o.attrHandle[c]?o.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":!f&&m.attr?d!=null:f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=o.setFilters[e];if(f)return f(a,c,b,d)}}},p=o.match.POS,q=function(a,b){return"\\"+(b-0+1)};for(var r in o.match)o.match[r]=new RegExp(o.match[r].source+/(?![^\[]*\])(?![^\(]*\))/.source),o.leftMatch[r]=new RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[r].source.replace(/\\(\d+)/g,q));o.match.globalPOS=p;var s=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(t){s=function(a,b){var c=0,d=b||[];if(g.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var e=a.length;c<e;c++)d.push(a[c]);else for(;a[c];c++)d.push(a[c]);return d}}var u,v;c.documentElement.compareDocumentPosition?u=function(a,b){if(a===b){h=!0;return 0}if(!a.compareDocumentPosition||!b.compareDocumentPosition)return a.compareDocumentPosition?-1:1;return a.compareDocumentPosition(b)&4?-1:1}:(u=function(a,b){if(a===b){h=!0;return 0}if(a.sourceIndex&&b.sourceIndex)return a.sourceIndex-b.sourceIndex;var c,d,e=[],f=[],g=a.parentNode,i=b.parentNode,j=g;if(g===i)return v(a,b);if(!g)return-1;if(!i)return 1;while(j)e.unshift(j),j=j.parentNode;j=i;while(j)f.unshift(j),j=j.parentNode;c=e.length,d=f.length;for(var k=0;k<c&&k<d;k++)if(e[k]!==f[k])return v(e[k],f[k]);return k===c?v(a,f[k],-1):v(e[k],b,1)},v=function(a,b,c){if(a===b)return c;var d=a.nextSibling;while(d){if(d===b)return-1;d=d.nextSibling}return 1}),function(){var a=c.createElement("div"),d="script"+(new Date).getTime(),e=c.documentElement;a.innerHTML="<a name='"+d+"'/>",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(o.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},o.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(o.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="<a href='#'></a>",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(o.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=m,b=c.createElement("div"),d="__sizzle__";b.innerHTML="<p class='TEST'></p>";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){m=function(b,e,f,g){e=e||c;if(!g&&!m.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return s(e.getElementsByTagName(b),f);if(h[2]&&o.find.CLASS&&e.getElementsByClassName)return s(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return s([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return s([],f);if(i.id===h[3])return s([i],f)}try{return s(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var k=e,l=e.getAttribute("id"),n=l||d,p=e.parentNode,q=/^\s*[+~]/.test(b);l?n=n.replace(/'/g,"\\$&"):e.setAttribute("id",n),q&&p&&(e=e.parentNode);try{if(!q||p)return s(e.querySelectorAll("[id='"+n+"'] "+b),f)}catch(r){}finally{l||k.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)m[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}m.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!m.isXML(a))try{if(e||!o.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return m(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="<div class='test e'></div><div class='test'></div>";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;o.order.splice(1,0,"CLASS"),o.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?m.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?m.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:m.contains=function(){return!1},m.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var y=function(a,b,c){var d,e=[],f="",g=b.nodeType?[b]:b;while(d=o.match.PSEUDO.exec(a))f+=d[0],a=a.replace(o.match.PSEUDO,"");a=o.relative[a]?a+"*":a;for(var h=0,i=g.length;h<i;h++)m(a,g[h],e,c);return m.filter(f,e)};m.attr=f.attr,m.selectors.attrMap={},f.find=m,f.expr=m.selectors,f.expr[":"]=f.expr.filters,f.unique=m.uniqueSort,f.text=m.getText,f.isXMLDoc=m.isXML,f.contains=m.contains}();var L=/Until$/,M=/^(?:parents|prevUntil|prevAll)/,N=/,/,O=/^.[^:#\[\.,]*$/,P=Array.prototype.slice,Q=f.expr.match.globalPOS,R={children:!0,contents:!0,next:!0,prev:!0};f.fn.extend({find:function(a){var b=this,c,d;if(typeof a!="string")return f(a).filter(function(){for(c=0,d=b.length;c<d;c++)if(f.contains(b[c],this))return!0});var e=this.pushStack("","find",a),g,h,i;for(c=0,d=this.length;c<d;c++){g=e.length,f.find(a,this[c],e);if(c>0)for(h=g;h<e.length;h++)for(i=0;i<g;i++)if(e[i]===e[h]){e.splice(h--,1);break}}return e},has:function(a){var b=f(a);return this.filter(function(){for(var a=0,c=b.length;a<c;a++)if(f.contains(this,b[a]))return!0})},not:function(a){return this.pushStack(T(this,a,!1),"not",a)},filter:function(a){return this.pushStack(T(this,a,!0),"filter",a)},is:function(a){return!!a&&(typeof a=="string"?Q.test(a)?f(a,this.context).index(this[0])>=0:f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h=1;while(g&&g.ownerDocument&&g!==b){for(d=0;d<a.length;d++)f(g).is(a[d])&&c.push({selector:a[d],elem:g,level:h});g=g.parentNode,h++}return c}var i=Q.test(a)||typeof a!="string"?f(a,b||this.context):0;for(d=0,e=this.length;d<e;d++){g=this[d];while(g){if(i?i.index(g)>-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a)return this[0]&&this[0].parentNode?this.prevAll().length:-1;if(typeof a=="string")return f.inArray(this[0],f(a));return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(S(c[0])||S(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c);L.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!R[a]?f.unique(e):e,(this.length>1||N.test(d))&&M.test(a)&&(e=e.reverse());return this.pushStack(e,a,P.call(arguments).join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var V="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",W=/ jQuery\d+="(?:\d+|null)"/g,X=/^\s+/,Y=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Z=/<([\w:]+)/,$=/<tbody/i,_=/<|&#?\w+;/,ba=/<(?:script|style)/i,bb=/<(?:script|object|embed|option|style)/i,bc=new RegExp("<(?:"+V+")[\\s/>]","i"),bd=/checked\s*(?:[^=]|=\s*.checked.)/i,be=/\/(java|ecma)script/i,bf=/^\s*<!(?:\[CDATA\[|\-\-)/,bg={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]},bh=U(c);bg.optgroup=bg.option,bg.tbody=bg.tfoot=bg.colgroup=bg.caption=bg.thead,bg.th=bg.td,f.support.htmlSerialize||(bg._default=[1,"div<div>","</div>"]),f.fn.extend({text:function(a){return f.access(this,function(a){return a===b?f.text(this):this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a))},null,a,arguments.length)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=f.isFunction(a);return this.each(function(c){f(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f
+.clean(arguments);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f.clean(arguments));return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){return f.access(this,function(a){var c=this[0]||{},d=0,e=this.length;if(a===b)return c.nodeType===1?c.innerHTML.replace(W,""):null;if(typeof a=="string"&&!ba.test(a)&&(f.support.leadingWhitespace||!X.test(a))&&!bg[(Z.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Y,"<$1></$2>");try{for(;d<e;d++)c=this[d]||{},c.nodeType===1&&(f.cleanData(c.getElementsByTagName("*")),c.innerHTML=a);c=0}catch(g){}}c&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(f.isFunction(a))return this.each(function(b){var c=f(this),d=c.html();c.replaceWith(a.call(this,b,d))});typeof a!="string"&&(a=f(a).detach());return this.each(function(){var b=this.nextSibling,c=this.parentNode;f(this).remove(),b?f(b).before(a):f(c).append(a)})}return this.length?this.pushStack(f(f.isFunction(a)?a():a),"replaceWith",a):this},detach:function(a){return this.remove(a,!0)},domManip:function(a,c,d){var e,g,h,i,j=a[0],k=[];if(!f.support.checkClone&&arguments.length===3&&typeof j=="string"&&bd.test(j))return this.each(function(){f(this).domManip(a,c,d,!0)});if(f.isFunction(j))return this.each(function(e){var g=f(this);a[0]=j.call(this,e,c?g.html():b),g.domManip(a,c,d)});if(this[0]){i=j&&j.parentNode,f.support.parentNode&&i&&i.nodeType===11&&i.childNodes.length===this.length?e={fragment:i}:e=f.buildFragment(a,this,k),h=e.fragment,h.childNodes.length===1?g=h=h.firstChild:g=h.firstChild;if(g){c=c&&f.nodeName(g,"tr");for(var l=0,m=this.length,n=m-1;l<m;l++)d.call(c?bi(this[l],g):this[l],e.cacheable||m>1&&l<n?f.clone(h,!0,!0):h)}k.length&&f.each(k,function(a,b){b.src?f.ajax({type:"GET",global:!1,url:b.src,async:!1,dataType:"script"}):f.globalEval((b.text||b.textContent||b.innerHTML||"").replace(bf,"/*$0*/")),b.parentNode&&b.parentNode.removeChild(b)})}return this}}),f.buildFragment=function(a,b,d){var e,g,h,i,j=a[0];b&&b[0]&&(i=b[0].ownerDocument||b[0]),i.createDocumentFragment||(i=c),a.length===1&&typeof j=="string"&&j.length<512&&i===c&&j.charAt(0)==="<"&&!bb.test(j)&&(f.support.checkClone||!bd.test(j))&&(f.support.html5Clone||!bc.test(j))&&(g=!0,h=f.fragments[j],h&&h!==1&&(e=h)),e||(e=i.createDocumentFragment(),f.clean(a,i,e,d)),g&&(f.fragments[j]=h?e:1);return{fragment:e,cacheable:g}},f.fragments={},f.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){f.fn[a]=function(c){var d=[],e=f(c),g=this.length===1&&this[0].parentNode;if(g&&g.nodeType===11&&g.childNodes.length===1&&e.length===1){e[b](this[0]);return this}for(var h=0,i=e.length;h<i;h++){var j=(h>0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d,e,g,h=f.support.html5Clone||f.isXMLDoc(a)||!bc.test("<"+a.nodeName+">")?a.cloneNode(!0):bo(a);if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bk(a,h),d=bl(a),e=bl(h);for(g=0;d[g];++g)e[g]&&bk(d[g],e[g])}if(b){bj(a,h);if(c){d=bl(a),e=bl(h);for(g=0;d[g];++g)bj(d[g],e[g])}}d=e=null;return h},clean:function(a,b,d,e){var g,h,i,j=[];b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);for(var k=0,l;(l=a[k])!=null;k++){typeof l=="number"&&(l+="");if(!l)continue;if(typeof l=="string")if(!_.test(l))l=b.createTextNode(l);else{l=l.replace(Y,"<$1></$2>");var m=(Z.exec(l)||["",""])[1].toLowerCase(),n=bg[m]||bg._default,o=n[0],p=b.createElement("div"),q=bh.childNodes,r;b===c?bh.appendChild(p):U(b).appendChild(p),p.innerHTML=n[1]+l+n[2];while(o--)p=p.lastChild;if(!f.support.tbody){var s=$.test(l),t=m==="table"&&!s?p.firstChild&&p.firstChild.childNodes:n[1]==="<table>"&&!s?p.childNodes:[];for(i=t.length-1;i>=0;--i)f.nodeName(t[i],"tbody")&&!t[i].childNodes.length&&t[i].parentNode.removeChild(t[i])}!f.support.leadingWhitespace&&X.test(l)&&p.insertBefore(b.createTextNode(X.exec(l)[0]),p.firstChild),l=p.childNodes,p&&(p.parentNode.removeChild(p),q.length>0&&(r=q[q.length-1],r&&r.parentNode&&r.parentNode.removeChild(r)))}var u;if(!f.support.appendChecked)if(l[0]&&typeof (u=l.length)=="number")for(i=0;i<u;i++)bn(l[i]);else bn(l);l.nodeType?j.push(l):j=f.merge(j,l)}if(d){g=function(a){return!a.type||be.test(a.type)};for(k=0;j[k];k++){h=j[k];if(e&&f.nodeName(h,"script")&&(!h.type||be.test(h.type)))e.push(h.parentNode?h.parentNode.removeChild(h):h);else{if(h.nodeType===1){var v=f.grep(h.getElementsByTagName("script"),g);j.splice.apply(j,[k+1,0].concat(v))}d.appendChild(h)}}}return j},cleanData:function(a){var b,c,d=f.cache,e=f.event.special,g=f.support.deleteExpando;for(var h=0,i;(i=a[h])!=null;h++){if(i.nodeName&&f.noData[i.nodeName.toLowerCase()])continue;c=i[f.expando];if(c){b=d[c];if(b&&b.events){for(var j in b.events)e[j]?f.event.remove(i,j):f.removeEvent(i,j,b.handle);b.handle&&(b.handle.elem=null)}g?delete i[f.expando]:i.removeAttribute&&i.removeAttribute(f.expando),delete d[c]}}}});var bp=/alpha\([^)]*\)/i,bq=/opacity=([^)]*)/,br=/([A-Z]|^ms)/g,bs=/^[\-+]?(?:\d*\.)?\d+$/i,bt=/^-?(?:\d*\.)?\d+(?!px)[^\d\s]+$/i,bu=/^([\-+])=([\-+.\de]+)/,bv=/^margin/,bw={position:"absolute",visibility:"hidden",display:"block"},bx=["Top","Right","Bottom","Left"],by,bz,bA;f.fn.css=function(a,c){return f.access(this,function(a,c,d){return d!==b?f.style(a,c,d):f.css(a,c)},a,c,arguments.length>1)},f.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=by(a,"opacity");return c===""?"1":c}return a.style.opacity}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":f.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(!!a&&a.nodeType!==3&&a.nodeType!==8&&!!a.style){var g,h,i=f.camelCase(c),j=a.style,k=f.cssHooks[i];c=f.cssProps[i]||i;if(d===b){if(k&&"get"in k&&(g=k.get(a,!1,e))!==b)return g;return j[c]}h=typeof d,h==="string"&&(g=bu.exec(d))&&(d=+(g[1]+1)*+g[2]+parseFloat(f.css(a,c)),h="number");if(d==null||h==="number"&&isNaN(d))return;h==="number"&&!f.cssNumber[i]&&(d+="px");if(!k||!("set"in k)||(d=k.set(a,d))!==b)try{j[c]=d}catch(l){}}},css:function(a,c,d){var e,g;c=f.camelCase(c),g=f.cssHooks[c],c=f.cssProps[c]||c,c==="cssFloat"&&(c="float");if(g&&"get"in g&&(e=g.get(a,!0,d))!==b)return e;if(by)return by(a,c)},swap:function(a,b,c){var d={},e,f;for(f in b)d[f]=a.style[f],a.style[f]=b[f];e=c.call(a);for(f in b)a.style[f]=d[f];return e}}),f.curCSS=f.css,c.defaultView&&c.defaultView.getComputedStyle&&(bz=function(a,b){var c,d,e,g,h=a.style;b=b.replace(br,"-$1").toLowerCase(),(d=a.ownerDocument.defaultView)&&(e=d.getComputedStyle(a,null))&&(c=e.getPropertyValue(b),c===""&&!f.contains(a.ownerDocument.documentElement,a)&&(c=f.style(a,b))),!f.support.pixelMargin&&e&&bv.test(b)&&bt.test(c)&&(g=h.width,h.width=c,c=e.width,h.width=g);return c}),c.documentElement.currentStyle&&(bA=function(a,b){var c,d,e,f=a.currentStyle&&a.currentStyle[b],g=a.style;f==null&&g&&(e=g[b])&&(f=e),bt.test(f)&&(c=g.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),g.left=b==="fontSize"?"1em":f,f=g.pixelLeft+"px",g.left=c,d&&(a.runtimeStyle.left=d));return f===""?"auto":f}),by=bz||bA,f.each(["height","width"],function(a,b){f.cssHooks[b]={get:function(a,c,d){if(c)return a.offsetWidth!==0?bB(a,b,d):f.swap(a,bw,function(){return bB(a,b,d)})},set:function(a,b){return bs.test(b)?b+"px":b}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return bq.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=f.isNumeric(b)?"alpha(opacity="+b*100+")":"",g=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&f.trim(g.replace(bp,""))===""){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bp.test(g)?g.replace(bp,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){return f.swap(a,{display:"inline-block"},function(){return b?by(a,"margin-right"):a.style.marginRight})}})}),f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style&&a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)}),f.each({margin:"",padding:"",border:"Width"},function(a,b){f.cssHooks[a+b]={expand:function(c){var d,e=typeof c=="string"?c.split(" "):[c],f={};for(d=0;d<4;d++)f[a+bx[d]+b]=e[d]||e[d-2]||e[0];return f}}});var bC=/%20/g,bD=/\[\]$/,bE=/\r?\n/g,bF=/#.*$/,bG=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bH=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bI=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,bJ=/^(?:GET|HEAD)$/,bK=/^\/\//,bL=/\?/,bM=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,bN=/^(?:select|textarea)/i,bO=/\s+/,bP=/([?&])_=[^&]*/,bQ=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bR=f.fn.load,bS={},bT={},bU,bV,bW=["*/"]+["*"];try{bU=e.href}catch(bX){bU=c.createElement("a"),bU.href="",bU=bU.href}bV=bQ.exec(bU.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bR)return bR.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("<div>").append(c.replace(bM,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bN.test(this.nodeName)||bH.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bE,"\r\n")}}):{name:b.name,value:c.replace(bE,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.on(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?b$(a,f.ajaxSettings):(b=a,a=f.ajaxSettings),b$(a,b);return a},ajaxSettings:{url:bU,isLocal:bI.test(bV[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":bW},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:bY(bS),ajaxTransport:bY(bT),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a>0?4:0;var o,r,u,w=c,x=l?ca(d,v,l):b,y,z;if(a>=200&&a<300||a===304){if(d.ifModified){if(y=v.getResponseHeader("Last-Modified"))f.lastModified[k]=y;if(z=v.getResponseHeader("Etag"))f.etag[k]=z}if(a===304)w="notmodified",o=!0;else try{r=cb(d,x),w="success",o=!0}catch(A){w="parsererror",u=A}}else{u=w;if(!w||a)w="error",a<0&&(a=0)}v.status=a,v.statusText=""+(c||w),o?h.resolveWith(e,[r,w,v]):h.rejectWith(e,[v,w,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.fireWith(e,[v,w]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f.Callbacks("once memory"),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bG.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.add,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bF,"").replace(bK,bV[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bO),d.crossDomain==null&&(r=bQ.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bV[1]&&r[2]==bV[2]&&(r[3]||(r[1]==="http:"?80:443))==(bV[3]||(bV[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),bZ(bS,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bJ.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bL.test(d.url)?"&":"?")+d.data,delete d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bP,"$1_="+x);d.url=y+(y===d.url?(bL.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", "+bW+"; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=bZ(bT,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){if(s<2)w(-1,z);else throw z}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)b_(g,a[g],c,e);return d.join("&").replace(bC,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var cc=f.now(),cd=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+cc++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=typeof b.data=="string"&&/^application\/x\-www\-form\-urlencoded/.test(b.contentType);if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(cd.test(b.url)||e&&cd.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(cd,l),b.url===j&&(e&&(k=k.replace(cd,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var ce=a.ActiveXObject?function(){for(var a in cg)cg[a](0,1)}:!1,cf=0,cg;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ch()||ci()}:ch,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,ce&&delete cg[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n);try{m.text=h.responseText}catch(a){}try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cf,ce&&(cg||(cg={},f(a).unload(ce)),cg[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var cj={},ck,cl,cm=/^(?:toggle|show|hide)$/,cn=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,co,cp=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cq;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(ct("show",3),a,b,c);for(var g=0,h=this.length;g<h;g++)d=this[g],d.style&&(e=d.style.display,!f._data(d,"olddisplay")&&e==="none"&&(e=d.style.display=""),(e===""&&f.css(d,"display")==="none"||!f.contains(d.ownerDocument.documentElement,d))&&f._data(d,"olddisplay",cu(d.nodeName)));for(g=0;g<h;g++){d=this[g];if(d.style){e=d.style.display;if(e===""||e==="none")d.style.display=f._data(d,"olddisplay")||""}}return this},hide:function(a,b,c){if(a||a===0)return this.animate(ct("hide",3),a,b,c);var d,e,g=0,h=this.length;for(;g<h;g++)d=this[g],d.style&&(e=f.css(d,"display"),e!=="none"&&!f._data(d,"olddisplay")&&f._data(d,"olddisplay",e));for(g=0;g<h;g++)this[g].style&&(this[g].style.display="none");return this},_toggle:f.fn.toggle,toggle:function(a,b,c){var d=typeof a=="boolean";f.isFunction(a)&&f.isFunction(b)?this._toggle.apply(this,arguments):a==null||d?this.each(function(){var b=d?a:f(this).is(":hidden");f(this)[b?"show":"hide"]()}):this.animate(ct("toggle",3),a,b,c);return this},fadeTo:function(a,b,c,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){function g(){e.queue===!1&&f._mark(this);var b=f.extend({},e),c=this.nodeType===1,d=c&&f(this).is(":hidden"),g,h,i,j,k,l,m,n,o,p,q;b.animatedProperties={};for(i in a){g=f.camelCase(i),i!==g&&(a[g]=a[i],delete a[i]);if((k=f.cssHooks[g])&&"expand"in k){l=k.expand(a[g]),delete a[g];for(i in l)i in a||(a[i]=l[i])}}for(g in a){h=a[g],f.isArray(h)?(b.animatedProperties[g]=h[1],h=a[g]=h[0]):b.animatedProperties[g]=b.specialEasing&&b.specialEasing[g]||b.easing||"swing";if(h==="hide"&&d||h==="show"&&!d)return b.complete.call(this);c&&(g==="height"||g==="width")&&(b.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY],f.css(this,"display")==="inline"&&f.css(this,"float")==="none"&&(!f.support.inlineBlockNeedsLayout||cu(this.nodeName)==="inline"?this.style.display="inline-block":this.style.zoom=1))}b.overflow!=null&&(this.style.overflow="hidden");for(i in a)j=new f.fx(this,b,i),h=a[i],cm.test(h)?(q=f._data(this,"toggle"+i)||(h==="toggle"?d?"show":"hide":0),q?(f._data(this,"toggle"+i,q==="show"?"hide":"show"),j[q]()):j[h]()):(m=cn.exec(h),n=j.cur(),m?(o=parseFloat(m[2]),p=m[3]||(f.cssNumber[i]?"":"px"),p!=="px"&&(f.style(this,i,(o||1)+p),n=(o||1)/j.cur()*n,f.style(this,i,n+p)),m[1]&&(o=(m[1]==="-="?-1:1)*o+n),j.custom(n,o,p)):j.custom(n,h,""));return!0}var e=f.speed(b,c,d);if(f.isEmptyObject(a))return this.each(e.complete,[!1]);a=f.extend({},a);return e.queue===!1?this.each(g):this.queue(e.queue,g)},stop:function(a,c,d){typeof a!="string"&&(d=c,c=a,a=b),c&&a!==!1&&this.queue(a||"fx",[]);return this.each(function(){function h(a,b,c){var e=b[c];f.removeData(a,c,!0),e.stop(d)}var b,c=!1,e=f.timers,g=f._data(this);d||f._unmark(!0,this);if(a==null)for(b in g)g[b]&&g[b].stop&&b.indexOf(".run")===b.length-4&&h(this,g,b);else g[b=a+".run"]&&g[b].stop&&h(this,g,b);for(b=e.length;b--;)e[b].elem===this&&(a==null||e[b].queue===a)&&(d?e[b](!0):e[b].saveState(),c=!0,e.splice(b,1));(!d||!c)&&f.dequeue(this,a)})}}),f.each({slideDown:ct("show",1),slideUp:ct("hide",1),slideToggle:ct("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){f.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),f.extend({speed:function(a,b,c){var d=a&&typeof a=="object"?f.extend({},a):{complete:c||!c&&b||f.isFunction(a)&&a,duration:a,easing:c&&b||b&&!f.isFunction(b)&&b};d.duration=f.fx.off?0:typeof d.duration=="number"?d.duration:d.duration in f.fx.speeds?f.fx.speeds[d.duration]:f.fx.speeds._default;if(d.queue==null||d.queue===!0)d.queue="fx";d.old=d.complete,d.complete=function(a){f.isFunction(d.old)&&d.old.call(this),d.queue?f.dequeue(this,d.queue):a!==!1&&f._unmark(this)};return d},easing:{linear:function(a){return a},swing:function(a){return-Math.cos(a*Math.PI)/2+.5}},timers:[],fx:function(a,b,c){this.options=b,this.elem=a,this.prop=c,b.orig=b.orig||{}}}),f.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this),(f.fx.step[this.prop]||f.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a,b=f.css(this.elem,this.prop);return isNaN(a=parseFloat(b))?!b||b==="auto"?0:b:a},custom:function(a,c,d){function h(a){return e.step(a)}var e=this,g=f.fx;this.startTime=cq||cr(),this.end=c,this.now=this.start=a,this.pos=this.state=0,this.unit=d||this.unit||(f.cssNumber[this.prop]?"":"px"),h.queue=this.options.queue,h.elem=this.elem,h.saveState=function(){f._data(e.elem,"fxshow"+e.prop)===b&&(e.options.hide?f._data(e.elem,"fxshow"+e.prop,e.start):e.options.show&&f._data(e.elem,"fxshow"+e.prop,e.end))},h()&&f.timers.push(h)&&!co&&(co=setInterval(g.tick,g.interval))},show:function(){var a=f._data(this.elem,"fxshow"+this.prop);this.options.orig[this.prop]=a||f.style(this.elem,this.prop),this.options.show=!0,a!==b?this.custom(this.cur(),a):this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur()),f(this.elem).show()},hide:function(){this.options.orig[this.prop]=f._data(this.elem,"fxshow"+this.prop)||f.style(this.elem,this.prop),this.options.hide=!0,this.custom(this.cur(),0)},step:function(a){var b,c,d,e=cq||cr(),g=!0,h=this.elem,i=this.options;if(a||e>=i.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),i.animatedProperties[this.prop]=!0;for(b in i.animatedProperties)i.animatedProperties[b]!==!0&&(g=!1);if(g){i.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){h.style["overflow"+b]=i.overflow[a]}),i.hide&&f(h).hide();if(i.hide||i.show)for(b in i.animatedProperties)f.style(h,b,i.orig[b]),f.removeData(h,"fxshow"+b,!0),f.removeData(h,"toggle"+b,!0);d=i.complete,d&&(i.complete=!1,d.call(h))}return!1}i.duration==Infinity?this.now=e:(c=e-this.startTime,this.state=c/i.duration,this.pos=f.easing[i.animatedProperties[this.prop]](this.state,c,0,1,i.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){var a,b=f.timers,c=0;for(;c<b.length;c++)a=b[c],!a()&&b[c]===a&&b.splice(c--,1);b.length||f.fx.stop()},interval:13,stop:function(){clearInterval(co),co=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){f.style(a.elem,"opacity",a.now)},_default:function(a){a.elem.style&&a.elem.style[a.prop]!=null?a.elem.style[a.prop]=a.now+a.unit:a.elem[a.prop]=a.now}}}),f.each(cp.concat.apply([],cp),function(a,b){b.indexOf("margin")&&(f.fx.step[b]=function(a){f.style(a.elem,b,Math.max(0,a.now)+a.unit)})}),f.expr&&f.expr.filters&&(f.expr.filters.animated=function(a){return f.grep(f.timers,function(b){return a===b.elem}).length});var cv,cw=/^t(?:able|d|h)$/i,cx=/^(?:body|html)$/i;"getBoundingClientRect"in c.documentElement?cv=function(a,b,c,d){try{d=a.getBoundingClientRect()}catch(e){}if(!d||!f.contains(c,a))return d?{top:d.top,left:d.left}:{top:0,left:0};var g=b.body,h=cy(b),i=c.clientTop||g.clientTop||0,j=c.clientLeft||g.clientLeft||0,k=h.pageYOffset||f.support.boxModel&&c.scrollTop||g.scrollTop,l=h.pageXOffset||f.support.boxModel&&c.scrollLeft||g.scrollLeft,m=d.top+k-i,n=d.left+l-j;return{top:m,left:n}}:cv=function(a,b,c){var d,e=a.offsetParent,g=a,h=b.body,i=b.defaultView,j=i?i.getComputedStyle(a,null):a.currentStyle,k=a.offsetTop,l=a.offsetLeft;while((a=a.parentNode)&&a!==h&&a!==c){if(f.support.fixedPosition&&j.position==="fixed")break;d=i?i.getComputedStyle(a,null):a.currentStyle,k-=a.scrollTop,l-=a.scrollLeft,a===e&&(k+=a.offsetTop,l+=a.offsetLeft,f.support.doesNotAddBorder&&(!f.support.doesAddBorderForTableAndCells||!cw.test(a.nodeName))&&(k+=parseFloat(d.borderTopWidth)||0,l+=parseFloat(d.borderLeftWidth)||0),g=e,e=a.offsetParent),f.support.subtractsBorderForOverflowNotVisible&&d.overflow!=="visible"&&(k+=parseFloat(d.borderTopWidth)||0,l+=parseFloat(d.borderLeftWidth)||0),j=d}if(j.position==="relative"||j.position==="static")k+=h.offsetTop,l+=h.offsetLeft;f.support.fixedPosition&&j.position==="fixed"&&(k+=Math.max(c.scrollTop,h.scrollTop),l+=Math.max(c.scrollLeft,h.scrollLeft));return{top:k,left:l}},f.fn.offset=function(a){if(arguments.length)return a===b?this:this.each(function(b){f.offset.setOffset(this,a,b)});var c=this[0],d=c&&c.ownerDocument;if(!d)return null;if(c===d.body)return f.offset.bodyOffset(c);return cv(c,d,d.documentElement)},f.offset={bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;f.support.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(f.css(a,"marginTop"))||0,c+=parseFloat(f.css(a,"marginLeft"))||0);return{top:b,left:c}},setOffset:function(a,b,c){var d=f.css(a,"position");d==="static"&&(a.style.position="relative");var e=f(a),g=e.offset(),h=f.css(a,"top"),i=f.css(a,"left"),j=(d==="absolute"||d==="fixed")&&f.inArray("auto",[h,i])>-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cx.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cx.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,c){var d=/Y/.test(c);f.fn[a]=function(e){return f.access(this,function(a,e,g){var h=cy(a);if(g===b)return h?c in h?h[c]:f.support.boxModel&&h.document.documentElement[e]||h.document.body[e]:a[e];h?h.scrollTo(d?f(h).scrollLeft():g,d?g:f(h).scrollTop()):a[e]=g},a,e,arguments.length,null)}}),f.each({Height:"height",Width:"width"},function(a,c){var d="client"+a,e="scroll"+a,g="offset"+a;f.fn["inner"+a]=function(){var a=this[0];return a?a.style?parseFloat(f.css(a,c,"padding")):this[c]():null},f.fn["outer"+a]=function(a){var b=this[0];return b?b.style?parseFloat(f.css(b,c,a?"margin":"border")):this[c]():null},f.fn[c]=function(a){return f.access(this,function(a,c,h){var i,j,k,l;if(f.isWindow(a)){i=a.document,j=i.documentElement[d];return f.support.boxModel&&j||i.body&&i.body[d]||j}if(a.nodeType===9){i=a.documentElement;if(i[d]>=i[e])return i[d];return Math.max(a.body[e],i[e],a.body[g],i[g])}if(h===b){k=f.css(a,c),l=parseFloat(k);return f.isNumeric(l)?l:k}f(a).css(c,h)},c,a,arguments.length,null)}}),a.jQuery=a.$=f,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return f})})(window);
View
47 lib/resources/dashboard/js/lib/jquery.cookie.js
@@ -0,0 +1,47 @@
+/*!
+ * jQuery Cookie Plugin
+ * https://github.com/carhartl/jquery-cookie
+ *
+ * Copyright 2011, Klaus Hartl
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.opensource.org/licenses/GPL-2.0
+ */
+(function($) {
+ $.cookie = function(key, value, options) {
+
+ // key and at least value given, set cookie...
+ if (arguments.length > 1 && (!/Object/.test(Object.prototype.toString.call(value)) || value === null || value === undefined)) {
+ options = $.extend({}, options);
+
+ if (value === null || value === undefined) {
+ options.expires = -1;
+ }
+
+ if (typeof options.expires === 'number') {
+ var days = options.expires, t = options.expires = new Date();
+ t.setDate(t.getDate() + days);
+ }
+
+ value = String(value);
+
+ return (document.cookie = [
+ encodeURIComponent(key), '=', options.raw ? value : encodeURIComponent(value),
+ options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
+ options.path ? '; path=' + options.path : '',
+ options.domain ? '; domain=' + options.domain : '',
+ options.secure ? '; secure' : ''
+ ].join(''));
+ }
+
+ // key and possibly options given, get cookie...
+ options = value || {};
+ var decode = options.raw ? function(s) { return s; } : decodeURIComponent;
+
+ var pairs = document.cookie.split('; ');
+ for (var i = 0, pair; pair = pairs[i] && pairs[i].split('='); i++) {
+ if (decode(pair[0]) === key) return decode(pair[1] || ''); // IE saves cookies with empty string as "c; ", e.g. without "=" as opposed to EOMB, thus pair[1] may be undefined
+ }
+ return null;
+ };
+})(jQuery);
View
9 lib/resources/dashboard/js/lib/less-1.3.0.min.js
@@ -0,0 +1,9 @@
+//
+// LESS - Leaner CSS v1.3.0
+// http://lesscss.org
+//
+// Copyright (c) 2009-2011, Alexis Sellier
+// Licensed under the Apache 2.0 License.
+//
+(function(a,b){function c(b){return a.less[b.split("/")[1]]}function l(){var a=document.getElementsByTagName("style");for(var b=0;b<a.length;b++)a[b].type.match(j)&&(new d.Parser).parse(a[b].innerHTML||"",function(c,d){var e=d.toCSS(),f=a[b];f.type="text/css",f.styleSheet?f.styleSheet.cssText=e:f.innerHTML=e})}function m(a,b){for(var c=0;c<d.sheets.length;c++)n(d.sheets[c],a,b,d.sheets.length-(c+1))}function n(b,c,e,f){var h=a.location.href.replace(/[#?].*$/,""),i=b.href.replace(/\?.*$/,""),j=g&&g.getItem(i),k=g&&g.getItem(i+":timestamp"),l={css:j,timestamp:k};/^(https?|file):/.test(i)||(i.charAt(0)=="/"?i=a.location.protocol+"//"+a.location.host+i:i=h.slice(0,h.lastIndexOf("/")+1)+i);var m=i.match(/([^\/]+)$/)[1];q(b.href,b.type,function(a,g){if(!e&&l&&g&&(new Date(g)).valueOf()===(new Date(l.timestamp)).valueOf())p(l.css,b),c(null,null,a,b,{local:!0,remaining:f});else try{(new d.Parser({optimization:d.optimization,paths:[i.replace(/[\w\.-]+$/,"")],mime:b.type,filename:m})).parse(a,function(d,e){if(d)return u(d,i);try{c(d,e,a,b,{local:!1,lastModified:g,remaining:f}),s(document.getElementById("less-error-message:"+o(i)))}catch(d){u(d,i)}})}catch(h){u(h,i)}},function(a,b){throw new Error("Couldn't load "+b+" ("+a+")")})}function o(a){return a.replace(/^[a-z]+:\/\/?[^\/]+/,"").replace(/^\//,"").replace(/\?.*$/,"").replace(/\.[^\.\/]+$/,"").replace(/[^\.\w-]+/g,"-").replace(/\./g,":")}function p(a,b,c){var d,e=b.href?b.href.replace(/\?.*$/,""):"",f="less:"+(b.title||o(e));(d=document.getElementById(f))===null&&(d=document.createElement("style"),d.type="text/css",d.media=b.media||"screen",d.id=f,document.getElementsByTagName("head")[0].appendChild(d));if(d.styleSheet)try{d.styleSheet.cssText=a}catch(h){throw new Error("Couldn't reassign styleSheet.cssText.")}else(function(a){d.childNodes.length>0?d.firstChild.nodeValue!==a.nodeValue&&d.replaceChild(a,d.firstChild):d.appendChild(a)})(document.createTextNode(a));c&&g&&(t("saving "+e+" to cache."),g.setItem(e,a),g.setItem(e+":timestamp",c))}function q(a,b,c,e){function i(b,c,d){b.status>=200&&b.status<300?c(b.responseText,b.getResponseHeader("Last-Modified")):typeof d=="function"&&d(b.status,a)}var g=r(),h=f?!1:d.async;typeof g.overrideMimeType=="function"&&g.overrideMimeType("text/css"),g.open("GET",a,h),g.setRequestHeader("Accept",b||"text/x-less, text/css; q=0.9, */*; q=0.5"),g.send(null),f?g.status===0||g.status>=200&&g.status<300?c(g.responseText):e(g.status,a):h?g.onreadystatechange=function(){g.readyState==4&&i(g,c,e)}:i(g,c,e)}function r(){if(a.XMLHttpRequest)return new XMLHttpRequest;try{return new ActiveXObject("MSXML2.XMLHTTP.3.0")}catch(b){return t("browser doesn't support AJAX."),null}}function s(a){return a&&a.parentNode.removeChild(a)}function t(a){d.env=="development"&&typeof console!="undefined"&&console.log("less: "+a)}function u(a,b){var c="less-error-message:"+o(b),e='<li><label>{line}</label><pre class="{class}">{content}</pre></li>',f=document.createElement("div"),g,h,i=[],j=a.filename||b;f.id=c,f.className="less-error-message",h="<h3>"+(a.message||"There is an error in your .less file")+"</h3>"+'<p>in <a href="'+j+'">'+j+"</a> ";var k=function(a,b,c){a.extract[b]&&i.push(e.replace(/\{line\}/,parseInt(a.line)+(b-1)).replace(/\{class\}/,c).replace(/\{content\}/,a.extract[b]))};a.stack?h+="<br/>"+a.stack.split("\n").slice(1).join("<br/>"):a.extract&&(k(a,0,""),k(a,1,"line"),k(a,2,""),h+="on line "+a.line+", column "+(a.column+1)+":</p>"+"<ul>"+i.join("")+"</ul>"),f.innerHTML=h,p([".less-error-message ul, .less-error-message li {","list-style-type: none;","margin-right: 15px;","padding: 4px 0;","margin: 0;","}",".less-error-message label {","font-size: 12px;","margin-right: 15px;","padding: 4px 0;","color: #cc7777;","}",".less-error-message pre {","color: #dd6666;","padding: 4px 0;","margin: 0;","display: inline-block;","}",".less-error-message pre.line {","color: #ff0000;","}",".less-error-message h3 {","font-size: 20px;","font-weight: bold;","padding: 15px 0 5px 0;","margin: 0;","}",".less-error-message a {","color: #10a","}",".less-error-message .error {","color: red;","font-weight: bold;","padding-bottom: 2px;","border-bottom: 1px dashed red;","}"].join("\n"),{title:"error-message"}),f.style.cssText=["font-family: Arial, sans-serif","border: 1px solid #e00","background-color: #eee","border-radius: 5px","-webkit-border-radius: 5px","-moz-border-radius: 5px","color: #e00","padding: 15px","margin-bottom: 15px"].join(";"),d.env=="development"&&(g=setInterval(function(){document.body&&(document.getElementById(c)?document.body.replaceChild(f,document.getElementById(c)):document.body.insertBefore(f,document.body.firstChild),clearInterval(g))},10))}typeof define=="function"&&define.amd&&define("less",[],function(){return d}),Array.isArray||(Array.isArray=function(a){return Object.prototype.toString.call(a)==="[object Array]"||a instanceof Array}),Array.prototype.forEach||(Array.prototype.forEach=function(a,b){var c=this.length>>>0;for(var d=0;d<c;d++)d in this&&a.call(b,this[d],d,this)}),Array.prototype.map||(Array.prototype.map=function(a){var b=this.length>>>0,c=new Array(b),d=arguments[1];for(var e=0;e<b;e++)e in this&&(c[e]=a.call(d,this[e],e,this));return c}),Array.prototype.filter||(Array.prototype.filter=function(a){var b=[],c=arguments[1];for(var d=0;d<this.length;d++)a.call(c,this[d])&&b.push(this[d]);return b}),Array.prototype.reduce||(Array.prototype.reduce=function(a){var b=this.length>>>0,c=0;if(b===0&&arguments.length===1)throw new TypeError;if(arguments.length>=2)var d=arguments[1];else do{if(c in this){d=this[c++];break}if(++c>=b)throw new TypeError}while(!0);for(;c<b;c++)c in this&&(d=a.call(null,d,this[c],c,this));return d}),Array.prototype.indexOf||(Array.prototype.indexOf=function(a){var b=this.length,c=arguments[1]||0;if(!b)return-1;if(c>=b)return-1;c<0&&(c+=b);for(;c<b;c++){if(!Object.prototype.hasOwnProperty.call(this,c))continue;if(a===this[c])return c}return-1}),Object.keys||(Object.keys=function(a){var b=[];for(var c in a)Object.prototype.hasOwnProperty.call(a,c)&&b.push(c);return b}),String.prototype.trim||(String.prototype.trim=function(){return String(this).replace(/^\s\s*/,"").replace(/\s\s*$/,"")});var d,e;typeof environment=="object"&&{}.toString.call(environment)==="[object Environment]"?(typeof a=="undefined"?d={}:d=a.less={},e=d.tree={},d.mode="rhino"):typeof a=="undefined"?(d=exports,e=c("./tree"),d.mode="node"):(typeof a.less=="undefined"&&(a.less={}),d=a.less,e=a.less.tree={},d.mode="browser"),d.Parser=function v(a){function q(){h=k[g],i=f,l=f}function r(){k[g]=h,f=i,l=f}function s(){f>l&&(k[g]=k[g].slice(f-l),l=f)}function t(a){var c,d,e,h,i,j,n,o;if(a instanceof Function)return a.call(m.parsers);if(typeof a=="string")c=b.charAt(f)===a?a:null,e=1,s();else{s();if(c=a.exec(k[g]))e=c[0].length;else return null}if(c){o=f+=e,j=f+k[g].length-e;while(f<j){h=b.charCodeAt(f);if(h!==32&&h!==10&&h!==9)break;f++}return k[g]=k[g].slice(e+(f-o)),l=f,k[g].length===0&&g<k.length-1&&g++,typeof c=="string"?c:c.length===1?c[0]:c}}function u(a,c){var d=t(a);if(!d)v(c||(typeof a=="string"?"expected '"+a+"' got '"+b.charAt(f)+"'":"unexpected token"));else return d}function v(a,b){throw{index:f,type:b||"Syntax",message:a}}function w(a){return typeof a=="string"?b.charAt(f)===a:a.test(k[g])?!0:!1}function x(a){return d.mode==="node"?c("path").basename(a):a.match(/[^\/]+$/)[0]}function y(a,c){return a.filename&&c.filename&&a.filename!==c.filename?m.imports.contents[x(a.filename)]:b}function z(a,b){for(var c=a,d=-1;c>=0&&b.charAt(c)!=="\n";c--)d++;return{line:typeof a=="number"?(b.slice(0,a).match(/\n/g)||"").length:null,column:d}}function A(a,b){var c=y(a,b),d=z(a.index,c),e=d.line,f=d.column,g=c.split("\n");this.type=a.type||"Syntax",this.message=a.message,this.filename=a.filename||b.filename,this.index=a.index,this.line=typeof e=="number"?e+1:null,this.callLine=a.call&&z(a.call,c).line+1,this.callExtract=g[z(a.call,c).line],this.stack=a.stack,this.column=f,this.extract=[g[e-1],g[e],g[e+1]]}var b,f,g,h,i,j,k,l,m,n=this,o=function(){},p=this.imports={paths:a&&a.paths||[],queue:[],files:{},contents:{},mime:a&&a.mime,error:null,push:function(b,c){var e=this;this.queue.push(b),d.Parser.importer(b,this.paths,function(a,d,f){e.queue.splice(e.queue.indexOf(b),1),e.files[b]=d,e.contents[b]=f,a&&!e.error&&(e.error=a),c(a,d),e.queue.length===0&&o()},a)}};return this.env=a=a||{},this.optimization="optimization"in this.env?this.env.optimization:1,this.env.filename=this.env.filename||null,m={imports:p,parse:function(h,i){var n,p,q,r,s,u,v=[],w,x=null;f=g=l=j=0,b=h.replace(/\r\n/g,"\n"),k=function(c){var d=0,e=/[^"'`\{\}\/\(\)\\]+/g,f=/\/\*(?:[^*]|\*+[^\/*])*\*+\/|\/\/.*/g,g=/"((?:[^"\\\r\n]|\\.)*)"|'((?:[^'\\\r\n]|\\.)*)'|`((?:[^`\\\r\n]|\\.)*)`/g,h=0,i,j=c[0],k;for(var l=0,m,n;l<b.length;l++){e.lastIndex=l,(i=e.exec(b))&&i.index===l&&(l+=i[0].length,j.push(i[0])),m=b.charAt(l),f.lastIndex=g.lastIndex=l,(i=g.exec(b))&&i.index===l&&(l+=i[0].length,j.push(i[0]),m=b.charAt(l)),!k&&m==="/"&&(n=b.charAt(l+1),(n==="/"||n==="*")&&(i=f.exec(b))&&i.index===l&&(l+=i[0].length,j.push(i[0]),m=b.charAt(l)));switch(m){case"{":if(!k){h++,j.push(m);break};case"}":if(!k){h--,j.push(m),c[++d]=j=[];break};case"(":if(!k){k=!0,j.push(m);break};case")":if(k){k=!1,j.push(m);break};default:j.push(m)}}return h>0&&(x=new A({index:l,type:"Parse",message:"missing closing `}`",filename:a.filename},a)),c.map(function(a){return a.join("")})}([[]]);if(x)return i(x);try{n=new e.Ruleset([],t(this.parsers.primary)),n.root=!0}catch(y){return i(new A(y,a))}n.toCSS=function(b){var f,g,h;return function(f,g){var h=[],i;f=f||{},typeof g=="object"&&!Array.isArray(g)&&(g=Object.keys(g).map(function(a){var b=g[a];return b instanceof e.Value||(b instanceof e.Expression||(b=new e.Expression([b])),b=new e.Value([b])),new e.Rule("@"+a,b,!1,0)}),h=[new e.Ruleset(null,g)]);try{var j=b.call(this,{frames:h}).toCSS([],{compress:f.compress||!1})}catch(k){throw new A(k,a)}if(i=m.imports.error)throw i instanceof A?i:new A(i,a);return f.yuicompress&&d.mode==="node"?c("./cssmin").compressor.cssmin(j):f.compress?j.replace(/(\s)+/g,"$1"):j}}(n.eval);if(f<b.length-1){f=j,u=b.split("\n"),s=(b.slice(0,f).match(/\n/g)||"").length+1;for(var z=f,B=-1;z>=0&&b.charAt(z)!=="\n";z--)B++;x={type:"Parse",message:"Syntax Error on line "+s,index:f,filename:a.filename,line:s,column:B,extract:[u[s-2],u[s-1],u[s]]}}this.imports.queue.length>0?o=function(){i(x,n)}:i(x,n)},parsers:{primary:function(){var a,b=[];while((a=t(this.mixin.definition)||t(this.rule)||t(this.ruleset)||t(this.mixin.call)||t(this.comment)||t(this.directive))||t(/^[\s\n]+/))a&&b.push(a);return b},comment:function(){var a;if(b.charAt(f)!=="/")return;if(b.charAt(f+1)==="/")return new e.Comment(t(/^\/\/.*/),!0);if(a=t(/^\/\*(?:[^*]|\*+[^\/*])*\*+\/\n?/))return new e.Comment(a)},entities:{quoted:function(){var a,c=f,d;b.charAt(c)==="~"&&(c++,d=!0);if(b.charAt(c)!=='"'&&b.charAt(c)!=="'")return;d&&t("~");if(a=t(/^"((?:[^"\\\r\n]|\\.)*)"|'((?:[^'\\\r\n]|\\.)*)'/))return new e.Quoted(a[0],a[1]||a[2],d)},keyword:function(){var a;if(a=t(/^[_A-Za-z-][_A-Za-z0-9-]*/))return e.colors.hasOwnProperty(a)?new e.Color(e.colors[a].slice(1)):new e.Keyword(a)},call:function(){var b,c,d=f;if(!(b=/^([\w-]+|%|progid:[\w\.]+)\(/.exec(k[g])))return;b=b[1].toLowerCase();if(b==="url")return null;f+=b.length;if(b==="alpha")return t(this.alpha);t("("),c=t(this.entities.arguments);if(!t(")"))return;if(b)return new e.Call(b,c,d,a.filename)},arguments:function(){var a=[],b;while(b=t(this.entities.assignment)||t(this.expression)){a.push(b);if(!t(","))break}return a},literal:function(){return t(this.entities.dimension)||t(this.entities.color)||t(this.entities.quoted)},assignment:function(){var a,b;if((a=t(/^\w+(?=\s?=)/i))&&t("=")&&(b=t(this.entity)))return new e.Assignment(a,b)},url:function(){var a;if(b.charAt(f)!=="u"||!t(/^url\(/))return;return a=t(this.entities.quoted)||t(this.entities.variable)||t(this.entities.dataURI)||t(/^[-\w%@$\/.&=:;#+?~]+/)||"",u(")"),new e.URL(a.value||a.data||a instanceof e.Variable?a:new e.Anonymous(a),p.paths)},dataURI:function(){var a;if(t(/^data:/)){a={},a.mime=t(/^[^\/]+\/[^,;)]+/)||"",a.charset=t(/^;\s*charset=[^,;)]+/)||"",a.base64=t(/^;\s*base64/)||"",a.data=t(/^,\s*[^)]+/);if(a.data)return a}},variable:function(){var c,d=f;if(b.charAt(f)==="@"&&(c=t(/^@@?[\w-]+/)))return new e.Variable(c,d,a.filename)},color:function(){var a;if(b.charAt(f)==="#"&&(a=t(/^#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})/)))return new e.Color(a[1])},dimension:function(){var a,c=b.charCodeAt(f);if(c>57||c<45||c===47)return;if(a=t(/^(-?\d*\.?\d+)(px|%|em|rem|pc|ex|in|deg|s|ms|pt|cm|mm|rad|grad|turn)?/))return new e.Dimension(a[1],a[2])},javascript:function(){var a,c=f,d;b.charAt(c)==="~"&&(c++,d=!0);if(b.charAt(c)!=="`")return;d&&t("~");if(a=t(/^`([^`]*)`/))return new e.JavaScript(a[1],f,d)}},variable:function(){var a;if(b.charAt(f)==="@"&&(a=t(/^(@[\w-]+)\s*:/)))return a[1]},shorthand:function(){var a,b;if(!w(/^[@\w.%-]+\/[@\w.-]+/))return;if((a=t(this.entity))&&t("/")&&(b=t(this.entity)))return new e.Shorthand(a,b)},mixin:{call:function(){var c=[],d,g,h,i=f,j=b.charAt(f),k=!1;if(j!=="."&&j!=="#")return;while(d=t(/^[#.](?:[\w-]|\\(?:[a-fA-F0-9]{1,6} ?|[^a-fA-F0-9]))+/))c.push(new e.Element(g,d,f)),g=t(">");t("(")&&(h=t(this.entities.arguments))&&t(")"),t(this.important)&&(k=!0);if(c.length>0&&(t(";")||w("}")))return new e.mixin.Call(c,h||[],i,a.filename,k)},definition:function(){var a,c=[],d,g,h,i,j,k=!1;if(b.charAt(f)!=="."&&b.charAt(f)!=="#"||w(/^[^{]*(;|})/))return;q();if(d=t(/^([#.](?:[\w-]|\\(?:[a-fA-F0-9]{1,6} ?|[^a-fA-F0-9]))+)\s*\(/)){a=d[1];do{if(b.charAt(f)==="."&&t(/^\.{3}/)){k=!0;break}if(!(h=t(this.entities.variable)||t(this.entities.literal)||t(this.entities.keyword)))break;if(h instanceof e.Variable)if(t(":"))i=u(this.expression,"expected expression"),c.push({name:h.name,value:i});else{if(t(/^\.{3}/)){c.push({name:h.name,variadic:!0}),k=!0;break}c.push({name:h.name})}else c.push({value:h})}while(t(","));u(")"),t(/^when/)&&(j=u(this.conditions,"expected condition")),g=t(this.block);if(g)return new e.mixin.Definition(a,c,g,j,k);r()}}},entity:function(){return t(this.entities.literal)||t(this.entities.variable)||t(this.entities.url)||t(this.entities.call)||t(this.entities.keyword)||t(this.entities.javascript)||t(this.comment)},end:function(){return t(";")||w("}")},alpha:function(){var a;if(!t(/^\(opacity=/i))return;if(a=t(/^\d+/)||t(this.entities.variable))return u(")"),new e.Alpha(a)},element:function(){var a,b,c,d;c=t(this.combinator),a=t(/^(?:\d+\.\d+|\d+)%/)||t(/^(?:[.#]?|:*)(?:[\w-]|\\(?:[a-fA-F0-9]{1,6} ?|[^a-fA-F0-9]))+/)||t("*")||t(this.attribute)||t(/^\([^)@]+\)/),a||t("(")&&(d=t(this.entities.variable))&&t(")")&&(a=new e.Paren(d));if(a)return new e.Element(c,a,f);if(c.value&&c.value.charAt(0)==="&")return new e.Element(c,null,f)},combinator:function(){var a,c=b.charAt(f);if(c===">"||c==="+"||c==="~"){f++;while(b.charAt(f)===" ")f++;return new e.Combinator(c)}if(c==="&"){a="&",f++,b.charAt(f)===" "&&(a="& ");while(b.charAt(f)===" ")f++;return new e.Combinator(a)}return b.charAt(f-1)===" "?new e.Combinator(" "):new e.Combinator(null)},selector:function(){var a,c,d=[],g,h;if(t("("))return a=t(this.entity),u(")"),new e.Selector([new e.Element("",a,f)]);while(c=t(this.element)){g=b.charAt(f),d.push(c);if(g==="{"||g==="}"||g===";"||g===",")break}if(d.length>0)return new e.Selector(d)},tag:function(){return t(/^[a-zA-Z][a-zA-Z-]*[0-9]?/)||t("*")},attribute:function(){var a="",b,c,d;if(!t("["))return;if(b=t(/^[a-zA-Z-]+/)||t(this.entities.quoted))(d=t(/^[|~*$^]?=/))&&(c=t(this.entities.quoted)||t(/^[\w-]+/))?a=[b,d,c.toCSS?c.toCSS():c].join(""):a=b;if(!t("]"))return;if(a)return"["+a+"]"},block:function(){var a;if(t("{")&&(a=t(this.primary))&&t("}"))return a},ruleset:function(){var b=[],c,d,g;q();while(c=t(this.selector)){b.push(c),t(this.comment);if(!t(","))break;t(this.comment)}if(b.length>0&&(d=t(this.block)))return new e.Ruleset(b,d,a.strictImports);j=f,r()},rule:function(){var a,c,d=b.charAt(f),h,l;q();if(d==="."||d==="#"||d==="&")return;if(a=t(this.variable)||t(this.property)){a.charAt(0)!="@"&&(l=/^([^@+\/'"*`(;{}-]*);/.exec(k[g]))?(f+=l[0].length-1,c=new e.Anonymous(l[1])):a==="font"?c=t(this.font):c=t(this.value),h=t(this.important);if(c&&t(this.end))return new e.Rule(a,c,h,i);j=f,r()}},"import":function(){var a,b,c=f;if(t(/^@import\s+/)&&(a=t(this.entities.quoted)||t(this.entities.url))){b=t(this.mediaFeatures);if(t(";"))return new e.Import(a,p,b,c)}},mediaFeature:function(){var a,b,c=[];do if(a=t(this.entities.keyword))c.push(a);else if(t("(")){b=t(this.property),a=t(this.entity);if(!t(")"))return null;if(b&&a)c.push(new e.Paren(new e.Rule(b,a,null,f,!0)));else if(a)c.push(new e.Paren(a));else return null}while(a);if(c.length>0)return new e.Expression(c)},mediaFeatures:function(){var a,b=[];do if(a=t(this.mediaFeature)){b.push(a);if(!t(","))break}else if(a=t(this.entities.variable)){b.push(a);if(!t(","))break}while(a);return b.length>0?b:null},media:function(){var a,b;if(t(/^@media/)){a=t(this.mediaFeatures);if(b=t(this.block))return new e.Media(b,a)}},directive:function(){var a,c,d,g,h,i;if(b.charAt(f)!=="@")return;if(c=t(this["import"])||t(this.media))return c;if(a=t(/^@page|@keyframes/)||t(/^@(?:-webkit-|-moz-|-o-|-ms-)[a-z0-9-]+/)){g=(t(/^[^{]+/)||"").trim();if(d=t(this.block))return new e.Directive(a+" "+g,d)}else if(a=t(/^@[-a-z]+/))if(a==="@font-face"){if(d=t(this.block))return new e.Directive(a,d)}else if((c=t(this.entity))&&t(";"))return new e.Directive(a,c)},font:function(){var a=[],b=[],c,d,f,g;while(g=t(this.shorthand)||t(this.entity))b.push(g);a.push(new e.Expression(b));if(t(","))while(g=t(this.expression)){a.push(g);if(!t(","))break}return new e.Value(a)},value:function(){var a,b=[],c;while(a=t(this.expression)){b.push(a);if(!t(","))break}if(b.length>0)return new e.Value(b)},important:function(){if(b.charAt(f)==="!")return t(/^! *important/)},sub:function(){var a;if(t("(")&&(a=t(this.expression))&&t(")"))return a},multiplication:function(){var a,b,c,d;if(a=t(this.operand)){while(!w(/^\/\*/)&&(c=t("/")||t("*"))&&(b=t(this.operand)))d=new e.Operation(c,[d||a,b]);return d||a}},addition:function(){var a,c,d,g;if(a=t(this.multiplication)){while((d=t(/^[-+]\s+/)||b.charAt(f-1)!=" "&&(t("+")||t("-")))&&(c=t(this.multiplication)))g=new e.Operation(d,[g||a,c]);return g||a}},conditions:function(){var a,b,c=f,d;if(a=t(this.condition)){while(t(",")&&(b=t(this.condition)))d=new e.Condition("or",d||a,b,c);return d||a}},condition:function(){var a,b,c,d,g=f,h=!1;t(/^not/)&&(h=!0),u("(");if(a=t(this.addition)||t(this.entities.keyword)||t(this.entities.quoted))return(d=t(/^(?:>=|=<|[<=>])/))?(b=t(this.addition)||t(this.entities.keyword)||t(this.entities.quoted))?c=new e.Condition(d,a,b,g,h):v("expected expression"):c=new e.Condition("=",a,new e.Keyword("true"),g,h),u(")"),t(/^and/)?new e.Condition("and",c,t(this.condition)):c},operand:function(){var a,c=b.charAt(f+1);b.charAt(f)==="-"&&(c==="@"||c==="(")&&(a=t("-"));var d=t(this.sub)||t(this.entities.dimension)||t(this.entities.color)||t(this.entities.variable)||t(this.entities.call);return a?new e.Operation("*",[new e.Dimension(-1),d]):d},expression:function(){var a,b,c=[],d;while(a=t(this.addition)||t(this.entity))c.push(a);if(c.length>0)return new e.Expression(c)},property:function(){var a;if(a=t(/^(\*?-?[-a-z_0-9]+)\s*:/))return a[1]}}}};if(d.mode==="browser"||d.mode==="rhino")d.Parser.importer=function(a,b,c,d){!/^([a-z]+:)?\//.test(a)&&b.length>0&&(a=b[0]+a),n({href:a,title:a,type:d.mime},function(e){e&&typeof d.errback=="function"?d.errback.call(null,a,b,c,d):c.apply(null,arguments)},!0)};(function(a){function b(b){return a.functions.hsla(b.h,b.s,b.l,b.a)}function c(b){if(b instanceof a.Dimension)return parseFloat(b.unit=="%"?b.value/100:b.value);if(typeof b=="number")return b;throw{error:"RuntimeError",message:"color functions take numbers as parameters"}}function d(a){return Math.min(1,Math.max(0,a))}a.functions={rgb:function(a,b,c){return this.rgba(a,b,c,1)},rgba:function(b,d,e,f){var g=[b,d,e].map(function(a){return c(a)}),f=c(f);return new a.Color(g,f)},hsl:function(a,b,c){return this.hsla(a,b,c,1)},hsla:function(a,b,d,e){function h(a){return a=a<0?a+1:a>1?a-1:a,a*6<1?g+(f-g)*a*6:a*2<1?f:a*3<2?g+(f-g)*(2/3-a)*6:g}a=c(a)%360/360,b=c(b),d=c(d),e=c(e);var f=d<=.5?d*(b+1):d+b-d*b,g=d*2-f;return this.rgba(h(a+1/3)*255,h(a)*255,h(a-1/3)*255,e)},hue:function(b){return new a.Dimension(Math.round(b.toHSL().h))},saturation:function(b){return new a.Dimension(Math.round(b.toHSL().s*100),"%")},lightness:function(b){return new a.Dimension(Math.round(b.toHSL().l*100),"%")},alpha:function(b){return new a.Dimension(b.toHSL().a)},saturate:function(a,c){var e=a.toHSL();return e.s+=c.value/100,e.s=d(e.s),b(e)},desaturate:function(a,c){var e=a.toHSL();return e.s-=c.value/100,e.s=d(e.s),b(e)},lighten:function(a,c){var e=a.toHSL();return e.l+=c.value/100,e.l=d(e.l),b(e)},darken:function(a,c){var e=a.toHSL();return e.l-=c.value/100,e.l=d(e.l),b(e)},fadein:function(a,c){var e=a.toHSL();return e.a+=c.value/100,e.a=d(e.a),b(e)},fadeout:function(a,c){var e=a.toHSL();return e.a-=c.value/100,e.a=d(e.a),b(e)},fade:function(a,c){var e=a.toHSL();return e.a=c.value/100,e.a=d(e.a),b(e)},spin:function(a,c){var d=a.toHSL(),e=(d.h+c.value)%360;return d.h=e<0?360+e:e,b(d)},mix:function(b,c,d){var e=d.value/100,f=e*2-1,g=b.toHSL().a-c.toHSL().a,h=((f*g==-1?f:(f+g)/(1+f*g))+1)/2,i=1-h,j=[b.rgb[0]*h+c.rgb[0]*i,b.rgb[1]*h+c.rgb[1]*i,b.rgb[2]*h+c.rgb[2]*i],k=b.alpha*e+c.alpha*(1-e);return new a.Color(j,k)},greyscale:function(b){return this.desaturate(b,new a.Dimension(100))},e:function(b){return new a.Anonymous(b instanceof a.JavaScript?b.evaluated:b)},escape:function(b){return new a.Anonymous(encodeURI(b.value).replace(/=/g,"%3D").replace(/:/g,"%3A").replace(/#/g,"%23").replace(/;/g,"%3B").replace(/\(/g,"%28").replace(/\)/g,"%29"))},"%":function(b){var c=Array.prototype.slice.call(arguments,1),d=b.value;for(var e=0;e<c.length;e++)d=d.replace(/%[sda]/i,function(a){var b=a.match(/s/i)?c[e].value:c[e].toCSS();return a.match(/[A-Z]$/)?encodeURIComponent(b):b});return d=d.replace(/%%/g,"%"),new a.Quoted('"'+d+'"',d)},round:function(a){return this._math("round",a)},ceil:function(a){return this._math("ceil",a)},floor:function(a){return this._math("floor",a)},_math:function(b,d){if(d instanceof a.Dimension)return new a.Dimension(Math[b](c(d)),d.unit);if(typeof d=="number")return Math[b](d);throw{type:"Argument",message:"argument must be a number"}},argb:function(b){return new a.Anonymous(b.toARGB())},percentage:function(b){return new a.Dimension(b.value*100,"%")},color:function(b){if(b instanceof a.Quoted)return new a.Color(b.value.slice(1));throw{type:"Argument",message:"argument must be a string"}},iscolor:function(b){return this._isa(b,a.Color)},isnumber:function(b){return this._isa(b,a.Dimension)},isstring:function(b){return this._isa(b,a.Quoted)},iskeyword:function(b){return this._isa(b,a.Keyword)},isurl:function(b){return this._isa(b,a.URL)},ispixel:function(b){return b instanceof a.Dimension&&b.unit==="px"?a.True:a.False},ispercentage:function(b){return b instanceof a.Dimension&&b.unit==="%"?a.True:a.False},isem:function(b){return b instanceof a.Dimension&&b.unit==="em"?a.True:a.False},_isa:function(b,c){return b instanceof c?a.True:a.False}}})(c("./tree")),function(a){a.colors={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgrey:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",grey:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"}}(c("./tree")),function(a){a.Alpha=function(a){this.value=a},a.Alpha.prototype={toCSS:function(){return"alpha(opacity="+(this.value.toCSS?this.value.toCSS():this.value)+")"},eval:function(a){return this.value.eval&&(this.value=this.value.eval(a)),this}}}(c("../tree")),function(a){a.Anonymous=function(a){this.value=a.value||a},a.Anonymous.prototype={toCSS:function(){return this.value},eval:function(){return this}}}(c("../tree")),function(a){a.Assignment=function(a,b){this.key=a,this.value=b},a.Assignment.prototype={toCSS:function(){return this.key+"="+(this.value.toCSS?this.value.toCSS():this.value)},eval:function(a){return this.value.eval&&(this.value=this.value.eval(a)),this}}}(c("../tree")),function(a){a.Call=function(a,b,c,d){this.name=a,this.args=b,this.index=c,this.filename=d},a.Call.prototype={eval:function(b){var c=this.args.map(function(a){return a.eval(b)});if(!(this.name in a.functions))return new a.Anonymous(this.name+"("+c.map(function(a){return a.toCSS()}).join(", ")+")");try{return a.functions[this.name].apply(a.functions,c)}catch(d){throw{type:d.type||"Runtime",message:"error evaluating function `"+this.name+"`"+(d.message?": "+d.message:""),index:this.index,filename:this.filename}}},toCSS:function(a){return this.eval(a).toCSS()}}}(c("../tree")),function(a){a.Color=function(a,b){Array.isArray(a)?this.rgb=a:a.length==6?this.rgb=a.match(/.{2}/g).map(function(a){return parseInt(a,16)}):this.rgb=a.split("").map(function(a){return parseInt(a+a,16)}),this.alpha=typeof b=="number"?b:1},a.Color.prototype={eval:function(){return this},toCSS:function(){return this.alpha<1?"rgba("+this.rgb.map(function(a){return Math.round(a)}).concat(this.alpha).join(", ")+")":"#"+this.rgb.map(function(a){return a=Math.round(a),a=(a>255?255:a<0?0:a).toString(16),a.length===1?"0"+a:a}).join("")},operate:function(b,c){var d=[];c instanceof a.Color||(c=c.toColor());for(var e=0;e<3;e++)d[e]=a.operate(b,this.rgb[e],c.rgb[e]);return new a.Color(d,this.alpha+c.alpha)},toHSL:function(){var a=this.rgb[0]/255,b=this.rgb[1]/255,c=this.rgb[2]/255,d=this.alpha,e=Math.max(a,b,c),f=Math.min(a,b,c),g,h,i=(e+f)/2,j=e-f;if(e===f)g=h=0;else{h=i>.5?j/(2-e-f):j/(e+f);switch(e){case a:g=(b-c)/j+(b<c?6:0);break;case b:g=(c-a)/j+2;break;case c:g=(a-b)/j+4}g/=6}return{h:g*360,s:h,l:i,a:d}},toARGB:function(){var a=[Math.round(this.alpha*255)].concat(this.rgb);return"#"+a.map(function(a){return a=Math.round(a),a=(a>255?255:a<0?0:a).toString(16),a.length===1?"0"+a:a}).join("")}}}(c("../tree")),function(a){a.Comment=function(a,b){this.value=a,this.silent=!!b},a.Comment.prototype={toCSS:function(a){return a.compress?"":this.value},eval:function(){return this}}}(c("../tree")),function(a){a.Condition=function(a,b,c,d,e){this.op=a.trim(),this.lvalue=b,this.rvalue=c,this.index=d,this.negate=e},a.Condition.prototype.eval=function(a){var b=this.lvalue.eval(a),c=this.rvalue.eval(a),d=this.index,e,e=function(a){switch(a){case"and":return b&&c;case"or":return b||c;default:if(b.compare)e=b.compare(c);else if(c.compare)e=c.compare(b);else throw{type:"Type",message:"Unable to perform comparison",index:d};switch(e){case-1:return a==="<"||a==="=<";case 0:return a==="="||a===">="||a==="=<";case 1:return a===">"||a===">="}}}(this.op);return this.negate?!e:e}}(c("../tree")),function(a){a.Dimension=function(a,b){this.value=parseFloat(a),this.unit=b||null},a.Dimension.prototype={eval:function(){return this},toColor:function(){return new a.Color([this.value,this.value,this.value])},toCSS:function(){var a=this.value+this.unit;return a},operate:function(b,c){return new a.Dimension(a.operate(b,this.value,c.value),this.unit||c.unit)},compare:function(b){return b instanceof a.Dimension?b.value>this.value?-1:b.value<this.value?1:0:-1}}}(c("../tree")),function(a){a.Directive=function(b,c,d){this.name=b,Array.isArray(c)?(this.ruleset=new a.Ruleset([],c),this.ruleset.allowImports=!0):this.value=c},a.Directive.prototype={toCSS:function(a,b){return this.ruleset?(this.ruleset.root=!0,this.name+(b.compress?"{":" {\n ")+this.ruleset.toCSS(a,b).trim().replace(/\n/g,"\n ")+(b.compress?"}":"\n}\n")):this.name+" "+this.value.toCSS()+";\n"},eval:function(a){return a.frames.unshift(this),this.ruleset=this.ruleset&&this.ruleset.eval(a),a.frames.shift(),this},variable:function(b){return a.Ruleset.prototype.variable.call(this.ruleset,b)},find:function(){return a.Ruleset.prototype.find.apply(this.ruleset,arguments)},rulesets:function(){return a.Ruleset.prototype.rulesets.apply(this.ruleset)}}}(c("../tree")),function(a){a.Element=function(b,c,d){this.combinator=b instanceof a.Combinator?b:new a.Combinator(b),typeof c=="string"?this.value=c.trim():c?this.value=c:this.value="",this.index=d},a.Element.prototype.eval=function(b){return new a.Element(this.combinator,this.value.eval?this.value.eval(b):this.value,this.index)},a.Element.prototype.toCSS=function(a){return this.combinator.toCSS(a||{})+(this.value.toCSS?this.value.toCSS(a):this.value)},a.Combinator=function(a){a===" "?this.value=" ":a==="& "?this.value="& ":this.value=a?a.trim():""},a.Combinator.prototype.toCSS=function(a){return{"":""," ":" ","&":"","& ":" ",":":" :","+":a.compress?"+":" + ","~":a.compress?"~":" ~ ",">":a.compress?">":" > "}[this.value]}}(c("../tree")),function(a){a.Expression=function(a){this.value=a},a.Expression.prototype={eval:function(b){return this.value.length>1?new a.Expression(this.value.map(function(a){return a.eval(b)})):this.value.length===1?this.value[0].eval(b):this},toCSS:function(a){return this.value.map(function(b){return b.toCSS?b.toCSS(a):""}).join(" ")}}}(c("../tree")),function(a){a.Import=function(b,c,d,e){var f=this;this.index=e,this._path=b,this.features=d&&new a.Value(d),b instanceof a.Quoted?this.path=/\.(le?|c)ss(\?.*)?$/.test(b.value)?b.value:b.value+".less":this.path=b.value.value||b.value,this.css=/css(\?.*)?$/.test(this.path),this.css||c.push(this.path,function(b,c){b&&(b.index=e),f.root=c||new a.Ruleset([],[])})},a.Import.prototype={toCSS:function(a){var b=this.features?" "+this.features.toCSS(a):"";return this.css?"@import "+this._path.toCSS()+b+";\n":""},eval:function(b){var c,d=this.features&&this.features.eval(b);if(this.css)return this;c=new a.Ruleset([],this.root.rules.slice(0));for(var e=0;e<c.rules.length;e++)c.rules[e]instanceof a.Import&&Array.prototype
+.splice.apply(c.rules,[e,1].concat(c.rules[e].eval(b)));return this.features?new a.Media(c.rules,this.features.value):c.rules}}}(c("../tree")),function(a){a.JavaScript=function(a,b,c){this.escaped=c,this.expression=a,this.index=b},a.JavaScript.prototype={eval:function(b){var c,d=this,e={},f=this.expression.replace(/@\{([\w-]+)\}/g,function(c,e){return a.jsify((new a.Variable("@"+e,d.index)).eval(b))});try{f=new Function("return ("+f+")")}catch(g){throw{message:"JavaScript evaluation error: `"+f+"`",index:this.index}}for(var h in b.frames[0].variables())e[h.slice(1)]={value:b.frames[0].variables()[h].value,toJS:function(){return this.value.eval(b).toCSS()}};try{c=f.call(e)}catch(g){throw{message:"JavaScript evaluation error: '"+g.name+": "+g.message+"'",index:this.index}}return typeof c=="string"?new a.Quoted('"'+c+'"',c,this.escaped,this.index):Array.isArray(c)?new a.Anonymous(c.join(", ")):new a.Anonymous(c)}}}(c("../tree")),function(a){a.Keyword=function(a){this.value=a},a.Keyword.prototype={eval:function(){return this},toCSS:function(){return this.value},compare:function(b){return b instanceof a.Keyword?b.value===this.value?0:1:-1}},a.True=new a.Keyword("true"),a.False=new a.Keyword("false")}(c("../tree")),function(a){a.Media=function(b,c){var d=new a.Element("&",null,0),e=[new a.Selector([d])];this.features=new a.Value(c),this.ruleset=new a.Ruleset(e,b),this.ruleset.allowImports=!0},a.Media.prototype={toCSS:function(a,b){var c=this.features.toCSS(b);return this.ruleset.root=a.length===0||a[0].multiMedia,"@media "+c+(b.compress?"{":" {\n ")+this.ruleset.toCSS(a,b).trim().replace(/\n/g,"\n ")+(b.compress?"}":"\n}\n")},eval:function(b){b.mediaBlocks||(b.mediaBlocks=[],b.mediaPath=[]);var c=b.mediaBlocks.length;b.mediaPath.push(this),b.mediaBlocks.push(this);var d=new a.Media([],[]);return d.features=this.features.eval(b),b.frames.unshift(this.ruleset),d.ruleset=this.ruleset.eval(b),b.frames.shift(),b.mediaBlocks[c]=d,b.mediaPath.pop(),b.mediaPath.length===0?d.evalTop(b):d.evalNested(b)},variable:function(b){return a.Ruleset.prototype.variable.call(this.ruleset,b)},find:function(){return a.Ruleset.prototype.find.apply(this.ruleset,arguments)},rulesets:function(){return a.Ruleset.prototype.rulesets.apply(this.ruleset)},evalTop:function(b){var c=this;if(b.mediaBlocks.length>1){var d=new a.Element("&",null,0),e=[new a.Selector([d])];c=new a.Ruleset(e,b.mediaBlocks),c.multiMedia=!0}return delete b.mediaBlocks,delete b.mediaPath,c},evalNested:function(b){var c,d,e=b.mediaPath.concat([this]);for(c=0;c<e.length;c++)d=e[c].features instanceof a.Value?e[c].features.value:e[c].features,e[c]=Array.isArray(d)?d:[d];return this.features=new a.Value(this.permute(e).map(function(b){b=b.map(function(b){return b.toCSS?b:new a.Anonymous(b)});for(c=b.length-1;c>0;c--)b.splice(c,0,new a.Anonymous("and"));return new a.Expression(b)})),new a.Ruleset([],[])},permute:function(a){if(a.length===0)return[];if(a.length===1)return a[0];var b=[],c=this.permute(a.slice(1));for(var d=0;d<c.length;d++)for(var e=0;e<a[0].length;e++)b.push([a[0][e]].concat(c[d]));return b}}}(c("../tree")),function(a){a.mixin={},a.mixin.Call=function(b,c,d,e,f){this.selector=new a.Selector(b),this.arguments=c,this.index=d,this.filename=e,this.important=f},a.mixin.Call.prototype={eval:function(a){var b,c,d=[],e=!1;for(var f=0;f<a.frames.length;f++)if((b=a.frames[f].find(this.selector)).length>0){c=this.arguments&&this.arguments.map(function(b){return b.eval(a)});for(var g=0;g<b.length;g++)if(b[g].match(c,a))try{Array.prototype.push.apply(d,b[g].eval(a,this.arguments,this.important).rules),e=!0}catch(h){throw{message:h.message,index:this.index,filename:this.filename,stack:h.stack}}if(e)return d;throw{type:"Runtime",message:"No matching definition was found for `"+this.selector.toCSS().trim()+"("+this.arguments.map(function(a){return a.toCSS()}).join(", ")+")`",index:this.index,filename:this.filename}}throw{type:"Name",message:this.selector.toCSS().trim()+" is undefined",index:this.index,filename:this.filename}}},a.mixin.Definition=function(b,c,d,e,f){this.name=b,this.selectors=[new a.Selector([new a.Element(null,b)])],this.params=c,this.condition=e,this.variadic=f,this.arity=c.length,this.rules=d,this._lookups={},this.required=c.reduce(function(a,b){return!b.name||b.name&&!b.value?a+1:a},0),this.parent=a.Ruleset.prototype,this.frames=[]},a.mixin.Definition.prototype={toCSS:function(){return""},variable:function(a){return this.parent.variable.call(this,a)},variables:function(){return this.parent.variables.call(this)},find:function(){return this.parent.find.apply(this,arguments)},rulesets:function(){return this.parent.rulesets.apply(this)},evalParams:function(b,c){var d=new a.Ruleset(null,[]),e;for(var f=0,g,h;f<this.params.length;f++)if(h=this.params[f].name)if(this.params[f].variadic&&c){e=[];for(var i=f;i<c.length;i++)e.push(c[i].eval(b));d.rules.unshift(new a.Rule(h,(new a.Expression(e)).eval(b)))}else if(g=c&&c[f]||this.params[f].value)d.rules.unshift(new a.Rule(h,g.eval(b)));else throw{type:"Runtime",message:"wrong number of arguments for "+this.name+" ("+c.length+" for "+this.arity+")"};return d},eval:function(b,c,d){var e=this.evalParams(b,c),f,g=[],h,i;for(var j=0;j<Math.max(this.params.length,c&&c.length);j++)g.push(c[j]||this.params[j].value);return e.rules.unshift(new a.Rule("@arguments",(new a.Expression(g)).eval(b))),h=d?this.rules.map(function(b){return new a.Rule(b.name,b.value,"!important",b.index)}):this.rules.slice(0),(new a.Ruleset(null,h)).eval({frames:[this,e].concat(this.frames,b.frames)})},match:function(a,b){var c=a&&a.length||0,d,e;if(!this.variadic){if(c<this.required)return!1;if(c>this.params.length)return!1;if(this.required>0&&c>this.params.length)return!1}if(this.condition&&!this.condition.eval({frames:[this.evalParams(b,a)].concat(b.frames)}))return!1;d=Math.min(c,this.arity);for(var f=0;f<d;f++)if(!this.params[f].name&&a[f].eval(b).toCSS()!=this.params[f].value.eval(b).toCSS())return!1;return!0}}}(c("../tree")),function(a){a.Operation=function(a,b){this.op=a.trim(),this.operands=b},a.Operation.prototype.eval=function(b){var c=this.operands[0].eval(b),d=this.operands[1].eval(b),e;if(c instanceof a.Dimension&&d instanceof a.Color)if(this.op==="*"||this.op==="+")e=d,d=c,c=e;else throw{name:"OperationError",message:"Can't substract or divide a color from a number"};return c.operate(this.op,d)},a.operate=function(a,b,c){switch(a){case"+":return b+c;case"-":return b-c;case"*":return b*c;case"/":return b/c}}}(c("../tree")),function(a){a.Paren=function(a){this.value=a},a.Paren.prototype={toCSS:function(a){return"("+this.value.toCSS(a)+")"},eval:function(b){return new a.Paren(this.value.eval(b))}}}(c("../tree")),function(a){a.Quoted=function(a,b,c,d){this.escaped=c,this.value=b||"",this.quote=a.charAt(0),this.index=d},a.Quoted.prototype={toCSS:function(){return this.escaped?this.value:this.quote+this.value+this.quote},eval:function(b){var c=this,d=this.value.replace(/`([^`]+)`/g,function(d,e){return(new a.JavaScript(e,c.index,!0)).eval(b).value}).replace(/@\{([\w-]+)\}/g,function(d,e){var f=(new a.Variable("@"+e,c.index)).eval(b);return"value"in f?f.value:f.toCSS()});return new a.Quoted(this.quote+d+this.quote,d,this.escaped,this.index)}}}(c("../tree")),function(a){a.Rule=function(b,c,d,e,f){this.name=b,this.value=c instanceof a.Value?c:new a.Value([c]),this.important=d?" "+d.trim():"",this.index=e,this.inline=f||!1,b.charAt(0)==="@"?this.variable=!0:this.variable=!1},a.Rule.prototype.toCSS=function(a){return this.variable?"":this.name+(a.compress?":":": ")+this.value.toCSS(a)+this.important+(this.inline?"":";")},a.Rule.prototype.eval=function(b){return new a.Rule(this.name,this.value.eval(b),this.important,this.index,this.inline)},a.Shorthand=function(a,b){this.a=a,this.b=b},a.Shorthand.prototype={toCSS:function(a){return this.a.toCSS(a)+"/"+this.b.toCSS(a)},eval:function(){return this}}}(c("../tree")),function(a){a.Ruleset=function(a,b,c){this.selectors=a,this.rules=b,this._lookups={},this.strictImports=c},a.Ruleset.prototype={eval:function(b){var c=this.selectors&&this.selectors.map(function(a){return a.eval(b)}),d=new a.Ruleset(c,this.rules.slice(0),this.strictImports);d.root=this.root,d.allowImports=this.allowImports,b.frames.unshift(d);if(d.root||d.allowImports||!d.strictImports)for(var e=0;e<d.rules.length;e++)d.rules[e]instanceof a.Import&&Array.prototype.splice.apply(d.rules,[e,1].concat(d.rules[e].eval(b)));for(var e=0;e<d.rules.length;e++)d.rules[e]instanceof a.mixin.Definition&&(d.rules[e].frames=b.frames.slice(0));for(var e=0;e<d.rules.length;e++)d.rules[e]instanceof a.mixin.Call&&Array.prototype.splice.apply(d.rules,[e,1].concat(d.rules[e].eval(b)));for(var e=0,f;e<d.rules.length;e++)f=d.rules[e],f instanceof a.mixin.Definition||(d.rules[e]=f.eval?f.eval(b):f);return b.frames.shift(),d},match:function(a){return!a||a.length===0},variables:function(){return this._variables?this._variables:this._variables=this.rules.reduce(function(b,c){return c instanceof a.Rule&&c.variable===!0&&(b[c.name]=c),b},{})},variable:function(a){return this.variables()[a]},rulesets:function(){return this._rulesets?this._rulesets:this._rulesets=this.rules.filter(function(b){return b instanceof a.Ruleset||b instanceof a.mixin.Definition})},find:function(b,c){c=c||this;var d=[],e,f,g=b.toCSS();return g in this._lookups?this._lookups[g]:(this.rulesets().forEach(function(e){if(e!==c)for(var g=0;g<e.selectors.length;g++)if(f=b.match(e.selectors[g])){b.elements.length>e.selectors[g].elements.length?Array.prototype.push.apply(d,e.find(new a.Selector(b.elements.slice(1)),c)):d.push(e);break}}),this._lookups[g]=d)},toCSS:function(b,c){var d=[],e=[],f=[],g=[],h,i;this.root||(b.length===0?g=this.selectors.map(function(a){return[a]}):this.joinSelectors(g,b,this.selectors));for(var j=0;j<this.rules.length;j++)i=this.rules[j],i.rules||i instanceof a.Directive||i instanceof a.Media?f.push(i.toCSS(g,c)):i instanceof a.Comment?i.silent||(this.root?f.push(i.toCSS(c)):e.push(i.toCSS(c))):i.toCSS&&!i.variable?e.push(i.toCSS(c)):i.value&&!i.variable&&e.push(i.value.toString());return f=f.join(""),this.root?d.push(e.join(c.compress?"":"\n")):e.length>0&&(h=g.map(function(a){return a.map(function(a){return a.toCSS(c)}).join("").trim()}).join(c.compress?",":",\n"),d.push(h,(c.compress?"{":" {\n ")+e.join(c.compress?"":"\n ")+(c.compress?"}":"\n}\n"))),d.push(f),d.join("")+(c.compress?"\n":"")},joinSelectors:function(a,b,c){for(var d=0;d<c.length;d++)this.joinSelector(a,b,c[d])},joinSelector:function(b,c,d){var e=[],f=[],g=[],h=[],i=!1,j;for(var k=0;k<d.elements.length;k++)j=d.elements[k],j.combinator.value.charAt(0)==="&"&&(i=!0),i?h.push(j):g.push(j);i||(h=g,g=[]),g.length>0&&e.push(new a.Selector(g)),h.length>0&&f.push(new a.Selector(h));for(var l=0;l<c.length;l++)b.push(e.concat(c[l]).concat(f))}}}(c("../tree")),function(a){a.Selector=function(a){this.elements=a,this.elements[0].combinator.value===""&&(this.elements[0].combinator.value=" ")},a.Selector.prototype.match=function(a){var b=this.elements.length,c=a.elements.length,d=Math.min(b,c);if(b<c)return!1;for(var e=0;e<d;e++)if(this.elements[e].value!==a.elements[e].value)return!1;return!0},a.Selector.prototype.eval=function(b){return new a.Selector(this.elements.map(function(a){return a.eval(b)}))},a.Selector.prototype.toCSS=function(a){return this._css?this._css:this._css=this.elements.map(function(b){return typeof b=="string"?" "+b.trim():b.toCSS(a)}).join("")}}(c("../tree")),function(b){b.URL=function(b,c){b.data?this.attrs=b:(typeof a!="undefined"&&!/^(?:https?:\/\/|file:\/\/|data:|\/)/.test(b.value)&&c.length>0&&(b.value=c[0]+(b.value.charAt(0)==="/"?b.value.slice(1):b.value)),this.value=b,this.paths=c)},b.URL.prototype={toCSS:function(){return"url("+(this.attrs?"data:"+this.attrs.mime+this.attrs.charset+this.attrs.base64+this.attrs.data:this.value.toCSS())+")"},eval:function(a){return this.attrs?this:new b.URL(this.value.eval(a),this.paths)}}}(c("../tree")),function(a){a.Value=function(a){this.value=a,this.is="value"},a.Value.prototype={eval:function(b){return this.value.length===1?this.value[0].eval(b):new a.Value(this.value.map(function(a){return a.eval(b)}))},toCSS:function(a){return this.value.map(function(b){return b.toCSS(a)}).join(a.compress?",":", ")}}}(c("../tree")),function(a){a.Variable=function(a,b,c){this.name=a,this.index=b,this.file=c},a.Variable.prototype={eval:function(b){var c,d,e=this.name;e.indexOf("@@")==0&&(e="@"+(new a.Variable(e.slice(1))).eval(b).value);if(c=a.find(b.frames,function(a){if(d=a.variable(e))return d.value.eval(b)}))return c;throw{type:"Name",message:"variable "+e+" is undefined",filename:this.file,index:this.index}}}}(c("../tree")),function(a){a.find=function(a,b){for(var c=0,d;c<a.length;c++)if(d=b.call(a,a[c]))return d;return null},a.jsify=function(a){return Array.isArray(a.value)&&a.value.length>1?"["+a.value.map(function(a){return a.toCSS(!1)}).join(", ")+"]":a.toCSS(!1)}}(c("./tree"));var f=location.protocol==="file:"||location.protocol==="chrome:"||location.protocol==="chrome-extension:"||location.protocol==="resource:";d.env=d.env||(location.hostname=="127.0.0.1"||location.hostname=="0.0.0.0"||location.hostname=="localhost"||location.port.length>0||f?"development":"production"),d.async=!1,d.poll=d.poll||(f?1e3:1500),d.watch=function(){return this.watchMode=!0},d.unwatch=function(){return this.watchMode=!1},d.env==="development"?(d.optimization=0,/!watch/.test(location.hash)&&d.watch(),d.watchTimer=setInterval(function(){d.watchMode&&m(function(a,b,c,d,e){b&&p(b.toCSS(),d,e.lastModified)})},d.poll)):d.optimization=3;var g;try{g=typeof a.localStorage=="undefined"?null:a.localStorage}catch(h){g=null}var i=document.getElementsByTagName("link"),j=/^text\/(x-)?less$/;d.sheets=[];for(var k=0;k<i.length;k++)(i[k].rel==="stylesheet/less"||i[k].rel.match(/stylesheet/)&&i[k].type.match(j))&&d.sheets.push(i[k]);d.refresh=function(a){var b,c;b=c=new Date,m(function(a,d,e,f,g){g.local?t("loading "+f.href+" from cache."):(t("parsed "+f.href+" successfully."),p(d.toCSS(),f,g.lastModified)),t("css for "+f.href+" generated in "+(new Date-c)+"ms"),g.remaining===0&&t("css generated in "+(new Date-b)+"ms"),c=new Date},a),l()},d.refreshStyles=l,d.refresh(d.env==="development")})(window);
View
2,053 lib/resources/dashboard/js/require.js
@@ -1,2053 +0,0 @@
-/** vim: et:ts=4:sw=4:sts=4
- * @license RequireJS 1.0.7 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
- * Available via the MIT or new BSD license.
- * see: http://github.com/jrburke/requirejs for details
- */
-/*jslint strict: false, plusplus: false, sub: true */
-/*global window, navigator, document, importScripts, jQuery, setTimeout, opera */
-
-var requirejs, require, define;
-(function () {
- //Change this version number for each release.
- var version = "1.0.7",
- commentRegExp = /(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg,
- cjsRequireRegExp = /require\(\s*["']([^'"\s]+)["']\s*\)/g,
- currDirRegExp = /^\.\//,
- jsSuffixRegExp = /\.js$/,
- ostring = Object.prototype.toString,
- ap = Array.prototype,
- aps = ap.slice,
- apsp = ap.splice,
- isBrowser = !!(typeof window !== "undefined" && navigator && document),
- isWebWorker = !isBrowser && typeof importScripts !== "undefined",
- //PS3 indicates loaded and complete, but need to wait for complete
- //specifically. Sequence is "loading", "loaded", execution,
- // then "complete". The UA check is unfortunate, but not sure how
- //to feature test w/o causing perf issues.
- readyRegExp = isBrowser && navigator.platform === 'PLAYSTATION 3' ?
- /^complete$/ : /^(complete|loaded)$/,
- defContextName = "_",
- //Oh the tragedy, detecting opera. See the usage of isOpera for reason.
- isOpera = typeof opera !== "undefined" && opera.toString() === "[object Opera]",
- empty = {},
- contexts = {},
- globalDefQueue = [],
- interactiveScript = null,
- checkLoadedDepth = 0,
- useInteractive = false,
- reservedDependencies = {
- require: true,
- module: true,
- exports: true
- },
- req, cfg = {}, currentlyAddingScript, s, head, baseElement, scripts, script,
- src, subPath, mainScript, dataMain, globalI, ctx, jQueryCheck, checkLoadedTimeoutId;
-
- function isFunction(it) {
- return ostring.call(it) === "[object Function]";
- }
-
- function isArray(it) {
- return ostring.call(it) === "[object Array]";
- }
-
- /**
- * Simple function to mix in properties from source into target,
- * but only if target does not already have a property of the same name.
- * This is not robust in IE for transferring methods that match
- * Object.prototype names, but the uses of mixin here seem unlikely to
- * trigger a problem related to that.
- */
- function mixin(target, source, force) {
- for (var prop in source) {
- if (!(prop in empty) && (!(prop in target) || force)) {
- target[prop] = source[prop];
- }
- }
- return req;
- }
-
- /**
- * Constructs an error with a pointer to an URL with more information.
- * @param {String} id the error ID that maps to an ID on a web page.
- * @param {String} message human readable error.
- * @param {Error} [err] the original error, if there is one.
- *
- * @returns {Error}
- */
- function makeError(id, msg, err) {
- var e = new Error(msg + '\nhttp://requirejs.org/docs/errors.html#' + id);
- if (err) {
- e.originalError = err;
- }
- return e;
- }
-
- /**
- * Used to set up package paths from a packagePaths or packages config object.
- * @param {Object} pkgs the object to store the new package config
- * @param {Array} currentPackages an array of packages to configure
- * @param {String} [dir] a prefix dir to use.
- */
- function configurePackageDir(pkgs, currentPackages, dir) {
- var i, location, pkgObj;
-
- for (i = 0; (pkgObj = currentPackages[i]); i++) {
- pkgObj = typeof pkgObj === "string" ? { name: pkgObj } : pkgObj;
- location = pkgObj.location;
-
- //Add dir to the path, but avoid paths that start with a slash
- //or have a colon (indicates a protocol)
- if (dir && (!location || (location.indexOf("/") !== 0 && location.indexOf(":") === -1))) {
- location = dir + "/" + (location || pkgObj.name);
- }
-
- //Create a brand new object on pkgs, since currentPackages can
- //be passed in again, and config.pkgs is the internal transformed
- //state for all package configs.
- pkgs[pkgObj.name] = {
- name: pkgObj.name,
- location: location || pkgObj.name,
- //Remove leading dot in main, so main paths are normalized,
- //and remove any trailing .js, since different package
- //envs have different conventions: some use a module name,
- //some use a file name.
- main: (pkgObj.main || "main")
- .replace(currDirRegExp, '')
- .replace(jsSuffixRegExp, '')
- };
- }
- }
-
- /**
- * jQuery 1.4.3-1.5.x use a readyWait/ready() pairing to hold DOM
- * ready callbacks, but jQuery 1.6 supports a holdReady() API instead.
- * At some point remove the readyWait/ready() support and just stick
- * with using holdReady.
- */
- function jQueryHoldReady($, shouldHold) {
- if ($.holdReady) {
- $.holdReady(shouldHold);
- } else if (shouldHold) {
- $.readyWait += 1;
- } else {
- $.ready(true);
- }
- }
-
- if (typeof define !== "undefined") {
- //If a define is already in play via another AMD loader,
- //do not overwrite.
- return;
- }
-
- if (typeof requirejs !== "undefined") {
- if (isFunction(requirejs)) {
- //Do not overwrite and existing requirejs instance.
- return;
- } else {
- cfg = requirejs;
- requirejs = undefined;
- }
- }
-
- //Allow for a require config object
- if (typeof require !== "undefined" && !isFunction(require)) {
- //assume it is a config object.
- cfg = require;
- require = undefined;
- }
-
- /**
- * Creates a new context for use in require and define calls.
- * Handle most of the heavy lifting. Do not want to use an object
- * with prototype here to avoid using "this" in require, in case it
- * needs to be used in more super secure envs that do not want this.
- * Also there should not be that many contexts in the page. Usually just
- * one for the default context, but could be extra for multiversion cases
- * or if a package needs a special context for a dependency that conflicts
- * with the standard context.
- */
- function newContext(contextName) {
- var context, resume,
- config = {
- waitSeconds: 7,
- baseUrl: "./",
- paths: {},
- pkgs: {},
- catchError: {}
- },
- defQueue = [],
- specified = {
- "require": true,
- "exports": true,
- "module": true
- },
- urlMap = {},
- defined = {},
- loaded = {},
- waiting = {},
- waitAry = [],
- urlFetched = {},
- managerCounter = 0,
- managerCallbacks = {},
- plugins = {},
- //Used to indicate which modules in a build scenario
- //need to be full executed.
- needFullExec = {},
- fullExec = {},
- resumeDepth = 0;
-
- /**
- * Trims the . and .. from an array of path segments.
- * It will keep a leading path segment if a .. will become
- * the first path segment, to help with module name lookups,
- * which act like paths, but can be remapped. But the end result,
- * all paths that use this function should look normalized.
- * NOTE: this method MODIFIES the input array.
- * @param {Array} ary the array of path segments.
- */
- function trimDots(ary) {
- var i, part;
- for (i = 0; (part = ary[i]); i++) {
- if (part === ".") {
- ary.splice(i, 1);
- i -= 1;
- } else if (part === "..") {
- if (i === 1 && (ary[2] === '..' || ary[0] === '..')) {
- //End of the line. Keep at least one non-dot
- //path segment at the front so it can be mapped
- //correctly to disk. Otherwise, there is likely
- //no path mapping for a path starting with '..'.
- //This can still fail, but catches the most reasonable
- //uses of ..
- break;
- } else if (i > 0) {
- ary.splice(i - 1, 2);
- i -= 2;
- }
- }
- }
- }
-
- /**
- * Given a relative module name, like ./something, normalize it to
- * a real name that can be mapped to a path.
- * @param {String} name the relative name
- * @param {String} baseName a real name that the name arg is relative
- * to.
- * @returns {String} normalized name
- */
- function normalize(name, baseName) {
- var pkgName, pkgConfig;
-
- //Adjust any relative paths.
- if (name && name.charAt(0) === ".") {
- //If have a base name, try to normalize against it,
- //otherwise, assume it is a top-level require that will
- //be relative to baseUrl in the end.
- if (baseName) {
- if (config.pkgs[baseName]) {
- //If the baseName is a package name, then just treat it as one
- //name to concat the name with.
- baseName = [baseName];
- } else {
- //Convert baseName to array, and lop off the last part,
- //so that . matches that "directory" and not name of the baseName's
- //module. For instance, baseName of "one/two/three", maps to
- //"one/two/three.js", but we want the directory, "one/two" for
- //this normalization.
- baseName = baseName.split("/");
- baseName = baseName.slice(0, baseName.length - 1);
- }
-
- name = baseName.concat(name.split("/"));
- trimDots(name);
-
- //Some use of packages may use a . path to reference the
- //"main" module name, so normalize for that.
- pkgConfig = config.pkgs[(pkgName = name[0])];
- name = name.join("/");
- if (pkgConfig && name === pkgName + '/' + pkgConfig.main) {
- name = pkgName;
- }
- } else if (name.indexOf("./") === 0) {
- // No baseName, so this is ID is resolved relative
- // to baseUrl, pull off the leading dot.
- name = name.substring(2);
- }
- }
- return name;
- }
-
- /**
- * Creates a module mapping that includes plugin prefix, module
- * name, and path. If parentModuleMap is provided it will
- * also normalize the name via require.normalize()
- *
- * @param {String} name the module name
- * @param {String} [parentModuleMap] parent module map
- * for the module name, used to resolve relative names.
- *
- * @returns {Object}
- */
- function makeModuleMap(name, parentModuleMap) {
- var index = name ? name.indexOf("!") : -1,
- prefix = null,
- parentName = parentModuleMap ? parentModuleMap.name : null,
- originalName = name,
- normalizedName, url, pluginModule;
-
- if (index !== -1) {
- prefix = name.substring(0, index);
- name = name.substring(index + 1, name.length);
- }
-
- if (prefix) {
- prefix = normalize(prefix, parentName);
- }
-
- //Account for relative paths if there is a base name.
- if (name) {
- if (prefix) {
- pluginModule = defined[prefix];
- if (pluginModule && pluginModule.normalize) {
- //Plugin is loaded, use its normalize method.
- normalizedName = pluginModule.normalize(name, function (name) {
- return normalize(name, parentName);
- });
- } else {
- normalizedName = normalize(name, parentName);
- }
- } else {
- //A regular module.
- normalizedName = normalize(name, parentName);
-
- url = urlMap[normalizedName];
- if (!url) {
- //Calculate url for the module, if it has a name.
- //Use name here since nameToUrl also calls normalize,
- //and for relative names that are outside the baseUrl
- //this causes havoc. Was thinking of just removing
- //parentModuleMap to avoid extra normalization, but
- //normalize() still does a dot removal because of
- //issue #142, so just pass in name here and redo
- //the normalization. Paths outside baseUrl are just
- //messy to support.
- url = context.nameToUrl(name, null, parentModuleMap);
-
- //Store the URL mapping for later.
- urlMap[normalizedName] = url;
- }
- }
- }
-
- return {
- prefix: prefix,
- name: normalizedName,
- parentMap: parentModuleMap,
- url: url,
- originalName: originalName,
- fullName: prefix ? prefix + "!" + (normalizedName || '') : normalizedName
- };
- }
-
- /**
- * Determine if priority loading is done. If so clear the priorityWait
- */
- function isPriorityDone() {
- var priorityDone = true,
- priorityWait = config.priorityWait,
- priorityName, i;
- if (priorityWait) {
- for (i = 0; (priorityName = priorityWait[i]); i++) {
- if (!loaded[priorityName]) {
- priorityDone = false;
- break;
- }
- }
- if (priorityDone) {
- delete config.priorityWait;
- }
- }
- return priorityDone;
- }
-
- function makeContextModuleFunc(func, relModuleMap, enableBuildCallback) {
- return function () {
- //A version of a require function that passes a moduleName
- //value for items that may need to
- //look up paths relative to the moduleName
- var args = aps.call(arguments, 0), lastArg;
- if (enableBuildCallback &&
- isFunction((lastArg = args[args.length - 1]))) {
- lastArg.__requireJsBuild = true;
- }
- args.push(relModuleMap);
- return func.apply(null, args);
- };
- }
-
- /**
- * Helper function that creates a require function object to give to
- * modules that ask for it as a dependency. It needs to be specific
- * per module because of the implication of path mappings that may
- * need to be relative to the module name.
- */
- function makeRequire(relModuleMap, enableBuildCallback, altRequire) {
- var modRequire = makeContextModuleFunc(altRequire || context.require, relModuleMap, enableBuildCallback);
-
- mixin(modRequire, {
- nameToUrl: makeContextModuleFunc(context.nameToUrl, relModuleMap),
- toUrl: makeContextModuleFunc(context.toUrl, relModuleMap),
- defined: makeContextModuleFunc(context.requireDefined, relModuleMap),
- specified: makeContextModuleFunc(context.requireSpecified, relModuleMap),
- isBrowser: req.isBrowser
- });
- return modRequire;
- }
-
- /*
- * Queues a dependency for checking after the loader is out of a
- * "paused" state, for example while a script file is being loaded
- * in the browser, where it may have many modules defined in it.
- */
- function queueDependency(manager) {
- context.paused.push(manager);
- }
-
- function execManager(manager) {
- var i, ret, err, errFile, errModuleTree,
- cb = manager.callback,
- map = manager.map,
- fullName = map.fullName,
- args = manager.deps,
- listeners = manager.listeners,
- cjsModule;
-
- //Call the callback to define the module, if necessary.
- if (cb && isFunction(cb)) {
- if (config.catchError.define) {
- try {
- ret = req.execCb(fullName, manager.callback, args, defined[fullName]);
- } catch (e) {
- err = e;
- }
- } else {
- ret = req.execCb(fullName, manager.callback, args, defined[fullName]);
- }
-
- if (fullName) {
- //If setting exports via "module" is in play,
- //favor that over return value and exports. After that,
- //favor a non-undefined return value over exports use.
- cjsModule = manager.cjsModule;
- if (cjsModule &&
- cjsModule.exports !== undefined &&
- //Make sure it is not already the exports value
- cjsModule.exports !== defined[fullName]) {
- ret = defined[fullName] = manager.cjsModule.exports;
- } else if (ret === undefined && manager.usingExports) {
- //exports already set the defined value.
- ret = defined[fullName];
- } else {
- //Use the return value from the function.
- defined[fullName] = ret;
- //If this module needed full execution in a build
- //environment, mark that now.
- if (needFullExec[fullName]) {
- fullExec[fullName] = true;
- }
- }
- }
- } else if (fullName) {
- //May just be an object definition for the module. Only
- //worry about defining if have a module name.
- ret = defined[fullName] = cb;
-
- //If this module needed full execution in a build
- //environment, mark that now.
- if (needFullExec[fullName]) {
- fullExec[fullName] = true;
- }
- }
-
- //Clean up waiting. Do this before error calls, and before
- //calling back listeners, so that bookkeeping is correct
- //in the event of an error and error is reported in correct order,
- //since the listeners will likely have errors if the
- //onError function does not throw.
- if (waiting[manager.id]) {
- delete waiting[manager.id];
- manager.isDone = true;
- context.waitCount -= 1;
- if (context.waitCount === 0) {
- //Clear the wait array used for cycles.
- waitAry = [];
- }
- }
-
- //Do not need to track manager callback now that it is defined.
- delete managerCallbacks[fullName];
-
- //Allow instrumentation like the optimizer to know the order
- //of modules executed and their dependencies.
- if (req.onResourceLoad && !manager.placeholder) {
- req.onResourceLoad(context, map, manager.depArray);
- }
-
- if (err) {
- errFile = (fullName ? makeModuleMap(fullName).url : '') ||
- err.fileName || err.sourceURL;
- errModuleTree = err.moduleTree;
- err = makeError('defineerror', 'Error evaluating ' +
- 'module "' + fullName + '" at location "' +
- errFile + '":\n' +
- err + '\nfileName:' + errFile +
- '\nlineNumber: ' + (err.lineNumber || err.line), err);
- err.moduleName = fullName;
- err.moduleTree = errModuleTree;
- return req.onError(err);
- }
-
- //Let listeners know of this manager's value.
- for (i = 0; (cb = listeners[i]); i++) {
- cb(ret);
- }
-
- return undefined;
- }
-
- /**
- * Helper that creates a callack function that is called when a dependency
- * is ready, and sets the i-th dependency for the manager as the
- * value passed to the callback generated by this function.
- */
- function makeArgCallback(manager, i) {
- return function (value) {
- //Only do the work if it has not been done
- //already for a dependency. Cycle breaking
- //logic in forceExec could mean this function
- //is called more than once for a given dependency.
- if (!manager.depDone[i]) {
- manager.depDone[i] = true;
- manager.deps[i] = value;
- manager.depCount -= 1;
- if (!manager.depCount) {
- //All done, execute!
- execManager(manager);
- }
- }
- };
- }
-
- function callPlugin(pluginName, depManager) {
- var map = depManager.map,
- fullName = map.fullName,
- name = map.name,
- plugin = plugins[pluginName] ||
- (plugins[pluginName] = defined[pluginName]),
- load;
-
- //No need to continue if the manager is already
- //in the process of loading.
- if (depManager.loading) {
- return;
- }
- depManager.loading = true;
-
- load = function (ret) {
- depManager.callback = function () {
- return ret;
- };
- execManager(depManager);
-
- loaded[depManager.id] = true;
-
- //The loading of this plugin
- //might have placed other things
- //in the paused queue. In particular,
- //a loader plugin that depends on
- //a different plugin loaded resource.
- resume();
- };
-
- //Allow plugins to load other code without having to know the
- //context or how to "complete" the load.
- load.fromText = function (moduleName, text) {
- /*jslint evil: true */
- var hasInteractive = useInteractive;
-
- //Indicate a the module is in process of loading.
- loaded[moduleName] = false;
- context.scriptCount += 1;
-
- //Indicate this is not a "real" module, so do not track it
- //for builds, it does not map to a real file.
- context.fake[moduleName] = true;
-
- //Turn off interactive script matching for IE for any define
- //calls in the text, then turn it back on at the end.
- if (hasInteractive) {
- useInteractive = false;
- }
-
- req.exec(text);
-
- if (hasInteractive) {
- useInteractive = true;
- }
-
- //Support anonymous modules.
- context.completeLoad(moduleName);
- };
-
- //No need to continue if the plugin value has already been
- //defined by a build.
- if (fullName in defined) {
- load(defined[fullName]);
- } else {
- //Use parentName here since the plugin's name is not reliable,
- //could be some weird string with no path that actually wants to
- //reference the parentName's path.
- plugin.load(name, makeRequire(map.parentMap, true, function (deps, cb) {
- var moduleDeps = [],
- i, dep, depMap;
- //Convert deps to full names and hold on to them
- //for reference later, when figuring out if they
- //are blocked by a circular dependency.
- for (i = 0; (dep = deps[i]); i++) {
- depMap = makeModuleMap(dep, map.parentMap);
- deps[i] = depMap.fullName;
- if (!depMap.prefix) {
- moduleDeps.push(deps[i]);
- }
- }
- depManager.moduleDeps = (depManager.moduleDeps || []).concat(moduleDeps);
- return context.require(deps, cb);
- }), load, config);
- }
- }
-
- /**
- * Adds the manager to the waiting queue. Only fully
- * resolved items should be in the waiting queue.
- */
- function addWait(manager) {
- if (!waiting[manager.id]) {
- waiting[manager.id] = manager;
- waitAry.push(manager);
- context.waitCount += 1;
- }
- }
-
- /**
- * Function added to every manager object. Created out here
- * to avoid new function creation for each manager instance.
- */
- function managerAdd(cb) {
- this.listeners.push(cb);
- }
-
- function getManager(map, shouldQueue) {
- var fullName = map.fullName,
- prefix = map.prefix,
- plugin = prefix ? plugins[prefix] ||
- (plugins[prefix] = defined[prefix]) : null,
- manager, created, pluginManager, prefixMap;
-
- if (fullName) {
- manager = managerCallbacks[fullName];
- }
-
- if (!manager) {
- created = true;
- manager = {
- //ID is just the full name, but if it is a plugin resource
- //for a plugin that has not been loaded,
- //then add an ID counter to it.
- id: (prefix && !plugin ?
- (managerCounter++) + '__p@:' : '') +
- (fullName || '__r@' + (managerCounter++)),
- map: map,
- depCount: 0,
- depDone: [],
- depCallbacks: [],
- deps: [],
- listeners: [],
- add: managerAdd
- };
-
- specified[manager.id] = true;
-
- //Only track the manager/reuse it if this is a non-plugin
- //resource. Also only track plugin resources once
- //the plugin has been loaded, and so the fullName is the
- //true normalized value.
- if (fullName && (!prefix || plugins[prefix])) {
- managerCallbacks[fullName] = manager;
- }
- }
-
- //If there is a plugin needed, but it is not loaded,
- //first load the plugin, then continue on.
- if (prefix && !plugin) {
- prefixMap = makeModuleMap(prefix);
-
- //Clear out defined and urlFetched if the plugin was previously
- //loaded/defined, but not as full module (as in a build
- //situation). However, only do this work if the plugin is in
- //defined but does not have a module export value.
- if (prefix in defined && !defined[prefix]) {
- delete defined[prefix];
- delete urlFetched[prefixMap.url];
- }
-
- pluginManager = getManager(prefixMap, true);
- pluginManager.add(function (plugin) {
- //Create a new manager for the normalized
- //resource ID and have it call this manager when
- //done.
- var newMap = makeModuleMap(map.originalName, map.parentMap),
- normalizedManager = getManager(newMap, true);
-
- //Indicate this manager is a placeholder for the real,
- //normalized thing. Important for when trying to map
- //modules and dependencies, for instance, in a build.
- manager.placeholder = true;
-
- normalizedManager.add(function (resource) {
- manager.callback = function () {
- return resource;
- };
- execManager(manager);
- });
- });
- } else if (created && shouldQueue) {
- //Indicate the resource is not loaded yet if it is to be
- //queued.
- loaded[manager.id] = false;
- queueDependency(manager);
- addWait(manager);
- }
-
- return manager;
- }
-
- function main(inName, depArray, callback, relModuleMap) {