mirror of
https://github.com/django/django.git
synced 2024-12-01 15:42:04 +01:00
40 lines
77 KiB
JavaScript
40 lines
77 KiB
JavaScript
|
/*! blanket - v1.1.5 */
|
||
|
"undefined"!=typeof QUnit&&(QUnit.config.autostart=!1),function(a){/*
|
||
|
Copyright (C) 2013 Ariya Hidayat <ariya.hidayat@gmail.com>
|
||
|
Copyright (C) 2013 Thaddee Tyl <thaddee.tyl@gmail.com>
|
||
|
Copyright (C) 2013 Mathias Bynens <mathias@qiwi.be>
|
||
|
Copyright (C) 2012 Ariya Hidayat <ariya.hidayat@gmail.com>
|
||
|
Copyright (C) 2012 Mathias Bynens <mathias@qiwi.be>
|
||
|
Copyright (C) 2012 Joost-Wim Boekesteijn <joost-wim@boekesteijn.nl>
|
||
|
Copyright (C) 2012 Kris Kowal <kris.kowal@cixar.com>
|
||
|
Copyright (C) 2012 Yusuke Suzuki <utatane.tea@gmail.com>
|
||
|
Copyright (C) 2012 Arpad Borsos <arpad.borsos@googlemail.com>
|
||
|
Copyright (C) 2011 Ariya Hidayat <ariya.hidayat@gmail.com>
|
||
|
|
||
|
Redistribution and use in source and binary forms, with or without
|
||
|
modification, are permitted provided that the following conditions are met:
|
||
|
|
||
|
* Redistributions of source code must retain the above copyright
|
||
|
notice, this list of conditions and the following disclaimer.
|
||
|
* Redistributions in binary form must reproduce the above copyright
|
||
|
notice, this list of conditions and the following disclaimer in the
|
||
|
documentation and/or other materials provided with the distribution.
|
||
|
|
||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||
|
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||
|
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||
|
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||
|
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||
|
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||
|
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||
|
*/
|
||
|
!function(b,c){"use strict";"function"==typeof a&&a.amd?a(["exports"],c):c("undefined"!=typeof exports?exports:b.esprima={})}(this,function(a){"use strict";function b(a,b){if(!a)throw new Error("ASSERT: "+b)}function c(a){return a>=48&&57>=a}function d(a){return"0123456789abcdefABCDEF".indexOf(a)>=0}function e(a){return"01234567".indexOf(a)>=0}function f(a){return 32===a||9===a||11===a||12===a||160===a||a>=5760&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].indexOf(a)>=0}function g(a){return 10===a||13===a||8232===a||8233===a}function h(a){return 36===a||95===a||a>=65&&90>=a||a>=97&&122>=a||92===a||a>=128&&ec.NonAsciiIdentifierStart.test(String.fromCharCode(a))}function i(a){return 36===a||95===a||a>=65&&90>=a||a>=97&&122>=a||a>=48&&57>=a||92===a||a>=128&&ec.NonAsciiIdentifierPart.test(String.fromCharCode(a))}function j(a){switch(a){case"class":case"enum":case"export":case"extends":case"import":case"super":return!0;default:return!1}}function k(a){switch(a){case"implements":case"interface":case"package":case"private":case"protected":case"public":case"static":case"yield":case"let":return!0;default:return!1}}function l(a){return"eval"===a||"arguments"===a}function m(a){if(hc&&k(a))return!0;switch(a.length){case 2:return"if"===a||"in"===a||"do"===a;case 3:return"var"===a||"for"===a||"new"===a||"try"===a||"let"===a;case 4:return"this"===a||"else"===a||"case"===a||"void"===a||"with"===a||"enum"===a;case 5:return"while"===a||"break"===a||"catch"===a||"throw"===a||"const"===a||"yield"===a||"class"===a||"super"===a;case 6:return"return"===a||"typeof"===a||"delete"===a||"switch"===a||"export"===a||"import"===a;case 7:return"default"===a||"finally"===a||"extends"===a;case 8:return"function"===a||"continue"===a||"debugger"===a;case 10:return"instanceof"===a;default:return!1}}function n(a,c,d,e,f){var g;b("number"==typeof d,"Comment must have valid position"),oc.lastCommentStart>=d||(oc.lastCommentStart=d,g={type:a,value:c},pc.range&&(g.range=[d,e]),pc.loc&&(g.loc=f),pc.comments.push(g),pc.attachComment&&(pc.leadingComments.push(g),pc.trailingComments.push(g)))}function o(a){var b,c,d,e;for(b=ic-a,c={start:{line:jc,column:ic-kc-a}};lc>ic;)if(d=gc.charCodeAt(ic),++ic,g(d))return pc.comments&&(e=gc.slice(b+a,ic-1),c.end={line:jc,column:ic-kc-1},n("Line",e,b,ic-1,c)),13===d&&10===gc.charCodeAt(ic)&&++ic,++jc,void(kc=ic);pc.comments&&(e=gc.slice(b+a,ic),c.end={line:jc,column:ic-kc},n("Line",e,b,ic,c))}function p(){var a,b,c,d;for(pc.comments&&(a=ic-2,b={start:{line:jc,column:ic-kc-2}});lc>ic;)if(c=gc.charCodeAt(ic),g(c))13===c&&10===gc.charCodeAt(ic+1)&&++ic,++jc,++ic,kc=ic,ic>=lc&&O({},dc.UnexpectedToken,"ILLEGAL");else if(42===c){if(47===gc.charCodeAt(ic+1))return++ic,++ic,void(pc.comments&&(d=gc.slice(a+2,ic-2),b.end={line:jc,column:ic-kc},n("Block",d,a,ic,b)));++ic}else++ic;O({},dc.UnexpectedToken,"ILLEGAL")}function q(){var a,b;for(b=0===ic;lc>ic;)if(a=gc.charCodeAt(ic),f(a))++ic;else if(g(a))++ic,13===a&&10===gc.charCodeAt(ic)&&++ic,++jc,kc=ic,b=!0;else if(47===a)if(a=gc.charCodeAt(ic+1),47===a)++ic,++ic,o(2),b=!0;else{if(42!==a)break;++ic,++ic,p()}else if(b&&45===a){if(45!==gc.charCodeAt(ic+1)||62!==gc.charCodeAt(ic+2))break;ic+=3,o(3)}else{if(60!==a)break;if("!--"!==gc.slice(ic+1,ic+4))break;++ic,++ic,++ic,++ic,o(4)}}function r(a){var b,c,e,f=0;for(c="u"===a?4:2,b=0;c>b;++b){if(!(lc>ic&&d(gc[ic])))return"";e=gc[ic++],f=16*f+"0123456789abcdef".indexOf(e.toLowerCase())}return String.fromCharCode(f)}function s(){var a,b;for(a=gc.charCodeAt(ic++),b=String.fromCharCode(a),92===a&&(117!==gc.charCodeAt(ic)&&O({},dc.UnexpectedToken,"ILLEGAL"),++ic,a=r("u"),a&&"\\"!==a&&h(a.charCodeAt(0))||O({},dc.UnexpectedToken,"ILLEGAL"),b=a);lc>ic&&(a=gc.charCodeAt(ic),i(a));)++ic,b+=String.fromCharCode(a),92===a&&(b=b.substr(0,b.length-1),117!==gc.charCodeAt(ic)&&O({},dc.UnexpectedToken,"ILLEGAL"),++ic,a=r("u"),a&&"\\"!==a&&i(a.charCodeAt(0))||O({},dc.UnexpectedToken,"ILLEGAL"),b+=a);return b}function t(){var a,b;for(a=ic++;lc>ic;){if(b=gc.charCodeAt(ic),92===b)return ic=a,s();if(!i(b))break;++ic}return gc.
|
||
|
if(!(a.type===bc.Program&&a.body.length>0)){for(pc.trailingComments.length>0?pc.trailingComments[0].range[0]>=a.range[1]?(c=pc.trailingComments,pc.trailingComments=[]):pc.trailingComments.length=0:pc.bottomRightStack.length>0&&pc.bottomRightStack[pc.bottomRightStack.length-1].trailingComments&&pc.bottomRightStack[pc.bottomRightStack.length-1].trailingComments[0].range[0]>=a.range[1]&&(c=pc.bottomRightStack[pc.bottomRightStack.length-1].trailingComments,delete pc.bottomRightStack[pc.bottomRightStack.length-1].trailingComments);pc.bottomRightStack.length>0&&pc.bottomRightStack[pc.bottomRightStack.length-1].range[0]>=a.range[0];)b=pc.bottomRightStack.pop();b?b.leadingComments&&b.leadingComments[b.leadingComments.length-1].range[1]<=a.range[0]&&(a.leadingComments=b.leadingComments,delete b.leadingComments):pc.leadingComments.length>0&&pc.leadingComments[pc.leadingComments.length-1].range[1]<=a.range[0]&&(a.leadingComments=pc.leadingComments,pc.leadingComments=[]),c&&(a.trailingComments=c),pc.bottomRightStack.push(a)}},markEnd:function(a,b){return pc.range&&(a.range=[b.start,ic]),pc.loc&&(a.loc=new M(void 0===b.startLineNumber?b.lineNumber:b.startLineNumber,b.start-(void 0===b.startLineStart?b.lineStart:b.startLineStart),jc,ic-kc),this.postProcess(a)),pc.attachComment&&this.processComment(a),a},postProcess:function(a){return pc.source&&(a.loc.source=pc.source),a},createArrayExpression:function(a){return{type:bc.ArrayExpression,elements:a}},createAssignmentExpression:function(a,b,c){return{type:bc.AssignmentExpression,operator:a,left:b,right:c}},createBinaryExpression:function(a,b,c){var d="||"===a||"&&"===a?bc.LogicalExpression:bc.BinaryExpression;return{type:d,operator:a,left:b,right:c}},createBlockStatement:function(a){return{type:bc.BlockStatement,body:a}},createBreakStatement:function(a){return{type:bc.BreakStatement,label:a}},createCallExpression:function(a,b){return{type:bc.CallExpression,callee:a,arguments:b}},createCatchClause:function(a,b){return{type:bc.CatchClause,param:a,body:b}},createConditionalExpression:function(a,b,c){return{type:bc.ConditionalExpression,test:a,consequent:b,alternate:c}},createContinueStatement:function(a){return{type:bc.ContinueStatement,label:a}},createDebuggerStatement:function(){return{type:bc.DebuggerStatement}},createDoWhileStatement:function(a,b){return{type:bc.DoWhileStatement,body:a,test:b}},createEmptyStatement:function(){return{type:bc.EmptyStatement}},createExpressionStatement:function(a){return{type:bc.ExpressionStatement,expression:a}},createForStatement:function(a,b,c,d){return{type:bc.ForStatement,init:a,test:b,update:c,body:d}},createForInStatement:function(a,b,c){return{type:bc.ForInStatement,left:a,right:b,body:c,each:!1}},createFunctionDeclaration:function(a,b,c,d){return{type:bc.FunctionDeclaration,id:a,params:b,defaults:c,body:d,rest:null,generator:!1,expression:!1}},createFunctionExpression:function(a,b,c,d){return{type:bc.FunctionExpression,id:a,params:b,defaults:c,body:d,rest:null,generator:!1,expression:!1}},createIdentifier:function(a){return{type:bc.Identifier,name:a}},createIfStatement:function(a,b,c){return{type:bc.IfStatement,test:a,consequent:b,alternate:c}},createLabeledStatement:function(a,b){return{type:bc.LabeledStatement,label:a,body:b}},createLiteral:function(a){return{type:bc.Literal,value:a.value,raw:gc.slice(a.start,a.end)}},createMemberExpression:function(a,b,c){return{type:bc.MemberExpression,computed:"["===a,object:b,property:c}},createNewExpression:function(a,b){return{type:bc.NewExpression,callee:a,arguments:b}},createObjectExpression:function(a){return{type:bc.ObjectExpression,properties:a}},createPostfixExpression:function(a,b){return{type:bc.UpdateExpression,operator:a,argument:b,prefix:!1}},createProgram:function(a){return{type:bc.Program,body:a}},createProperty:function(a,b,c){return{type:bc.Property,key:b,value:c,kind:a}},createReturnStatement:function(a){return{type:bc.ReturnStatement,argument:a}},createSequenceExpression:function(a){return{type:bc.SequenceExpression,expressions:a}},createSwitchCase:function(a,b){return{type:bc.SwitchCase,
|
||
|
* falafel (c) James Halliday / MIT License
|
||
|
* https://github.com/substack/node-falafel
|
||
|
*/
|
||
|
function(a,b){function c(a,b,c){function d(b){c[a.range[0]]=b;for(var d=a.range[0]+1;d<a.range[1];d++)c[d]=""}if(a.range)if(a.parent=b,a.source=function(){return c.slice(a.range[0],a.range[1]).join("")},a.update&&"object"==typeof a.update){var g=a.update;f(e(g),function(a){d[a]=g[a]}),a.update=d}else a.update=d}var d=a("esprima").parse,e=Object.keys||function(a){var b=[];for(var c in a)b.push(c);return b},f=function(a,b){if(a.forEach)return a.forEach(b);for(var c=0;c<a.length;c++)b.call(a,a[c],c,a)},g=Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)};b.exports=function(a,b,h){"function"==typeof b&&(h=b,b={}),"object"==typeof a&&(b=a,a=b.source,delete b.source),a=void 0===a?b.source:a,b.range=!0,"string"!=typeof a&&(a=String(a));var i=d(a,b),j={chunks:a.split(""),toString:function(){return j.chunks.join("")},inspect:function(){return j.toString()}};return function k(a,b){c(a,b,j.chunks),f(e(a),function(b){if("parent"!==b){var d=a[b];g(d)?f(d,function(b){b&&"string"==typeof b.type&&k(b,a)}):d&&"string"==typeof d.type&&(c(d,a,j.chunks),k(d,a))}}),h(a)}(i,void 0),j},window.falafel=b.exports}(function(){return{parse:esprima.parse}},{exports:{}});var inBrowser="undefined"!=typeof window&&this===window,parseAndModify=inBrowser?window.falafel:require("falafel");(inBrowser?window:exports).blanket=function(){var a,b=["ExpressionStatement","BreakStatement","ContinueStatement","VariableDeclaration","ReturnStatement","ThrowStatement","TryStatement","FunctionDeclaration","IfStatement","WhileStatement","DoWhileStatement","ForStatement","ForInStatement","SwitchStatement","WithStatement"],c=["IfStatement","WhileStatement","DoWhileStatement","ForStatement","ForInStatement","WithStatement"],d=Math.floor(1e3*Math.random()),e={},f={reporter:null,adapter:null,filter:null,customVariable:null,loader:null,ignoreScriptError:!1,existingRequireJS:!1,autoStart:!1,timeout:180,ignoreCors:!1,branchTracking:!1,sourceURL:!1,debug:!1,engineOnly:!1,testReadyCallback:null,commonJS:!1,instrumentCache:!1,modulePattern:null};return inBrowser&&"undefined"!=typeof window.blanket&&(a=window.blanket.noConflict()),_blanket={noConflict:function(){return a?a:_blanket},_getCopyNumber:function(){return d},extend:function(a){_blanket._extend(_blanket,a)},_extend:function(a,b){if(b)for(var c in b)a[c]instanceof Object&&"function"!=typeof a[c]?_blanket._extend(a[c],b[c]):a[c]=b[c]},getCovVar:function(){var a=_blanket.options("customVariable");return a?(_blanket.options("debug")&&console.log("BLANKET-Using custom tracking variable:",a),inBrowser?"window."+a:a):inBrowser?"window._$blanket":"_$jscoverage"},options:function(a,b){if("string"!=typeof a)_blanket._extend(f,a);else{if("undefined"==typeof b)return f[a];f[a]=b}},instrument:function(a,b){var c=a.inputFile,d=a.inputFileName;if(_blanket.options("instrumentCache")&&sessionStorage&&sessionStorage.getItem("blanket_instrument_store-"+d))_blanket.options("debug")&&console.log("BLANKET-Reading instrumentation from cache: ",d),b(sessionStorage.getItem("blanket_instrument_store-"+d));else{var e=_blanket._prepareSource(c);_blanket._trackingArraySetup=[],c=c.replace(/^\#\!.*/,"");var f=parseAndModify(c,{loc:!0,comment:!0},_blanket._addTracking(d));f=_blanket._trackingSetup(d,e)+f,_blanket.options("sourceURL")&&(f+="\n//@ sourceURL="+d.replace("http://","")),_blanket.options("debug")&&console.log("BLANKET-Instrumented file: ",d),_blanket.options("instrumentCache")&&sessionStorage&&(_blanket.options("debug")&&console.log("BLANKET-Saving instrumentation to cache: ",d),sessionStorage.setItem("blanket_instrument_store-"+d,f)),b(f)}},_trackingArraySetup:[],_branchingArraySetup:[],_prepareSource:function(a){return a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/(\r\n|\n|\r)/gm,"\n").split("\n")},_trackingSetup:function(a,b){var c=_blanket.options("branchTracking"),d=b.join("',\n'"),e="",f=_blanket.getCovVar();return e+="if (typeof "+f+" === 'undefined') "+f+" = {};\n",c&&(e+="var _$branchFcn=function(f,l,c,r){ ",e+="if (!!r) { ",e+=f+"[f].branchData[l][c][0] = "+f+"[f].branchData[l][c][0] || [
|