1 require=(function(e,t,n){function i(n,s){if(!t[n]){if(!e[n]){var o=typeof require=="function"&&require;if(!s&&o)return o(n,!0);if(r)return r(n,!0);throw new Error("Cannot find module '"+n+"'")}var u=t[n]={exports:{}};e[n][0].call(u.exports,function(t){var r=e[n][1][t];return i(r?r:t)},u,u.exports)}return t[n].exports}var r=typeof require=="function"&&require;for(var s=0;s<n.length;s++)i(n[s]);return i})({"querystring":[function(require,module,exports){
2 module.exports=require('SIBfUI');
3 },{}],"SIBfUI":[function(require,module,exports){
4 var isArray = typeof Array.isArray === 'function'
7 return Object.prototype.toString.call(xs) === '[object Array]'
10 var objectKeys = Object.keys || function objectKeys(object) {
11 if (object !== Object(object)) throw new TypeError('Invalid object');
13 for (var key in object) if (object.hasOwnProperty(key)) keys[keys.length] = key;
20 * Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
28 exports.version = '0.3.1';
31 * Object#toString() ref for stringify().
34 var toString = Object.prototype.toString;
37 * Cache non-integer test regexp.
40 var notint = /[^0-9]/;
43 * Parse the given query `str`, returning an object.
50 exports.parse = function(str){
51 if (null == str || '' == str) return {};
53 function promote(parent, key) {
54 if (parent[key].length == 0) return parent[key] = {};
56 for (var i in parent[key]) t[i] = parent[key][i];
63 .reduce(function(ret, pair){
65 pair = decodeURIComponent(pair.replace(/\+/g, ' '));
70 var eql = pair.indexOf('=')
71 , brace = lastBraceInKey(pair)
72 , key = pair.substr(0, brace || eql)
73 , val = pair.substr(brace || eql, pair.length)
74 , val = val.substr(val.indexOf('=') + 1, val.length)
78 if ('' == key) key = pair, val = '';
81 if (~key.indexOf(']')) {
82 var parts = key.split('[')
86 function parse(parts, parent, key) {
87 var part = parts.shift();
91 if (isArray(parent[key])) {
92 parent[key].push(val);
93 } else if ('object' == typeof parent[key]) {
95 } else if ('undefined' == typeof parent[key]) {
98 parent[key] = [parent[key], val];
102 obj = parent[key] = parent[key] || [];
105 if ('' != val) obj.push(val);
106 } else if ('object' == typeof obj) {
107 obj[objectKeys(obj).length] = val;
109 obj = parent[key] = [parent[key], val];
112 } else if (~part.indexOf(']')) {
113 part = part.substr(0, part.length - 1);
114 if(notint.test(part) && isArray(obj)) obj = promote(parent, key);
115 parse(parts, obj, part);
118 if(notint.test(part) && isArray(obj)) obj = promote(parent, key);
119 parse(parts, obj, part);
124 parse(parts, parent, 'base');
127 if (notint.test(key) && isArray(parent.base)) {
129 for(var k in parent.base) t[k] = parent.base[k];
132 set(parent.base, key, val);
140 * Turn the given `obj` into a query string
142 * @param {Object} obj
147 var stringify = exports.stringify = function(obj, prefix) {
149 return stringifyArray(obj, prefix);
150 } else if ('[object Object]' == toString.call(obj)) {
151 return stringifyObject(obj, prefix);
152 } else if ('string' == typeof obj) {
153 return stringifyString(obj, prefix);
160 * Stringify the given `str`.
162 * @param {String} str
163 * @param {String} prefix
168 function stringifyString(str, prefix) {
169 if (!prefix) throw new TypeError('stringify expects an object');
170 return prefix + '=' + encodeURIComponent(str);
174 * Stringify the given `arr`.
177 * @param {String} prefix
182 function stringifyArray(arr, prefix) {
184 if (!prefix) throw new TypeError('stringify expects an object');
185 for (var i = 0; i < arr.length; i++) {
186 ret.push(stringify(arr[i], prefix + '[]'));
188 return ret.join('&');
192 * Stringify the given `obj`.
194 * @param {Object} obj
195 * @param {String} prefix
200 function stringifyObject(obj, prefix) {
202 , keys = objectKeys(obj)
204 for (var i = 0, len = keys.length; i < len; ++i) {
206 ret.push(stringify(obj[key], prefix
207 ? prefix + '[' + encodeURIComponent(key) + ']'
208 : encodeURIComponent(key)));
210 return ret.join('&');
214 * Set `obj`'s `key` to `val` respecting
215 * the weird and wonderful syntax of a qs,
216 * where "foo=bar&foo=baz" becomes an array.
218 * @param {Object} obj
219 * @param {String} key
220 * @param {String} val
224 function set(obj, key, val) {
226 if (undefined === v) {
228 } else if (isArray(v)) {
236 * Locate last brace in `str` within the key.
238 * @param {String} str
243 function lastBraceInKey(str) {
247 for (var i = 0; i < len; ++i) {
249 if (']' == c) brace = false;
250 if ('[' == c) brace = true;
251 if ('=' == c && !brace) return i;