lepu-test-platform-web/node_modules/csso/dist/csso-browser.js

3 lines
93 KiB
JavaScript
Raw Normal View History

!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.csso=e()}}(function(){return function e(t,r,n){function o(a,s){if(!r[a]){if(!t[a]){var l="function"==typeof require&&require;if(!s&&l)return l(a,!0);if(i)return i(a,!0);var u=new Error("Cannot find module '"+a+"'");throw u.code="MODULE_NOT_FOUND",u}var c=r[a]={exports:{}};t[a][0].call(c.exports,function(e){var r=t[a][1][e];return o(r?r:e)},c,c.exports,e,t,r,n)}return r[a].exports}for(var i="function"==typeof require&&require,a=0;a<n.length;a++)o(n[a]);return o}({1:[function(e,t,r){t.exports=function(e,t,r){if(e.block){if(this.root.firstAtrulesAllowed=!1,"Block"===e.block.type&&e.block.declarations.isEmpty())return void r.remove(t);if("StyleSheet"===e.block.type&&e.block.rules.isEmpty())return void r.remove(t)}switch(e.name){case"charset":if(e.expression.sequence.isEmpty())return void r.remove(t);if(t.prev)return void r.remove(t);break;case"import":if(!this.root.firstAtrulesAllowed)return void r.remove(t);r.prevUntil(t.prev,function(e){return"Atrule"!==e.type||"import"!==e.name&&"charset"!==e.name?(this.root.firstAtrulesAllowed=!1,r.remove(t),!0):void 0},this)}}},{}],2:[function(e,t,r){t.exports=function(e,t,r){r.remove(t)}},{}],3:[function(e,t,r){t.exports=function(e,t,r){e.value.sequence.isEmpty()&&r.remove(t)}},{}],4:[function(e,t,r){t.exports=function(e,t,r){null!==this.selector&&"*"===e.name&&t.next&&"Combinator"!==t.next.data.type&&r.remove(t)}},{}],5:[function(e,t,r){function n(e,t){return e.selector.selectors.each(function(e,r,n){var i=e.sequence.some(function(e){switch(e.type){case"Class":return t.classes&&!o.call(t.classes,e.name);case"Id":return t.ids&&!o.call(t.ids,e.name);case"Identifier":if("*"!==e.name)return t.tags&&!o.call(t.tags,e.name.toLowerCase())}});i&&n.remove(r)})}var o=Object.prototype.hasOwnProperty;t.exports=function(e,t,r,o){o&&n(e,o),(e.selector.selectors.isEmpty()||e.block.declarations.isEmpty())&&r.remove(t)}},{}],6:[function(e,t,r){function n(e){return"Operator"!==e.type?!1:"+"!==e.value&&"-"!==e.value}t.exports=function(e,t,r){var o=t.prev&&t.prev.data,i=t.next&&t.next.data;(n(o)||n(i))&&r.remove(t)}},{}],7:[function(e,t,r){var n=e("../../utils/walk.js").all,o={Space:e("./Space.js"),Atrule:e("./Atrule.js"),Ruleset:e("./Ruleset.js"),Declaration:e("./Declaration.js"),Identifier:e("./Identifier.js"),Comment:e("./Comment.js")};t.exports=function(e,t){n(e,function(e,r,n){o.hasOwnProperty(e.type)&&o[e.type].call(this,e,r,n,t)})}},{"../../utils/walk.js":45,"./Atrule.js":1,"./Comment.js":2,"./Declaration.js":3,"./Identifier.js":4,"./Ruleset.js":5,"./Space.js":6}],8:[function(e,t,r){var n=e("../../utils/names.js").keyword,o=e("./atrule/keyframes.js");t.exports=function(e){"keyframes"===n(e.name).name&&o(e)}},{"../../utils/names.js":42,"./atrule/keyframes.js":15}],9:[function(e,t,r){function n(e){return""!==e&&"-"!==e?(e=e.replace(o,"a"),!i.test(e)):void 0}var o=/\\([0-9A-Fa-f]{1,6})[ \t\n\f\r]?|\\./g,i=/^(-?\d|--)|[\u0000-\u002c\u002e\u002f\u003A-\u0040\u005B-\u005E\u0060\u007B-\u009f]/;t.exports=function(e){var t=e.value;if(t&&"String"===t.type){var r=t.value.replace(/^(.)(.*)\1$/,"$2");n(r)&&(e.value={type:"Identifier",info:t.info,name:r})}}},{}],10:[function(e,t,r){var n=e("./Number.js").pack,o={px:!0,mm:!0,cm:!0,"in":!0,pt:!0,pc:!0,em:!0,ex:!0,ch:!0,rem:!0,vh:!0,vw:!0,vmin:!0,vmax:!0,vm:!0};t.exports=function(e,t){var r=n(e.value);if(e.value=r,"0"===r&&this.declaration){var i=e.unit.toLowerCase();if(!o.hasOwnProperty(i))return;if("flex"===this.declaration.property.name)return;if(this["function"]&&"calc"===this["function"].name)return;t.data={type:"Number",info:e.info,value:r}}}},{"./Number.js":11}],11:[function(e,t,r){function n(e){return e=String(e).replace(/^(?:\+|(-))?0*(\d*)(?:\.0*|(\.\d*?)0*)?$/,"$1$2$3"),0!==e.length&&"-"!==e||(e="0"),e}t.exports=function(e){e.value=n(e.value)},t.exports.pack=n},{}],12:[function(e,t,r){t.export
}return r}function a(e,t){return t.each(function(t){for(var r=t.id,n=e.head;n;){var o=n.data.id;if(o===r)return;if(o>r)break;n=n.next}e.insert(e.createItem(t),n)}),e}function s(e,t){return e.some(function(e){return t.some(function(t){return e.compareMarker===t.compareMarker})})}function l(e){switch(e.type){case"Ruleset":return s(e.selector.selectors,this);case"Atrule":if(e.block)return"StyleSheet"!==e.block.type?!1:e.block.rules.some(l,this)}return!0}var u=Object.prototype.hasOwnProperty;t.exports={isEqualLists:n,isEqualDeclarations:o,compareDeclarations:i,addSelectors:a,hasSimilarSelectors:s,unsafeToSkipNode:l}},{}],35:[function(e,t,r){function n(e,t){var r=Object.create(null);if(!Array.isArray(e))return!1;for(var n=0;n<e.length;n++){var o=e[n];t&&(o=o.toLowerCase()),r[o]=!0}return r}function o(e){var t=!1;if(e.scopes&&Array.isArray(e.scopes)){t=Object.create(null);for(var r=0;r<e.scopes.length;r++){var o=e.scopes[r];if(!o||!Array.isArray(o))throw new Error("Wrong usage format");for(var a=0;a<o.length;a++){var s=o[a];if(i.call(t,s))throw new Error("Class can't be used for several scopes: "+s);t[s]=r+1}}}return{tags:n(e.tags,!0),ids:n(e.ids),classes:n(e.classes),scopes:t}}var i=Object.prototype.hasOwnProperty;t.exports={buildIndex:o}},{}],36:[function(e,t,r){function n(e,t,r,n){return t.debug&&console.error("## "+e+" done in %d ms\n",Date.now()-r),n}function o(e){var t;return function(r,n){var o=r;if(n&&(o="["+((Date.now()-t)/1e3).toFixed(3)+"s] "+o),e>1&&n){var i=h(n,!0);2===e&&i.length>256&&(i=i.substr(0,256)+"..."),o+="\n "+i+"\n"}console.error(o),t=Date.now()}}function i(e){var t={};for(var r in e)t[r]=e[r];return t}function a(e){return e=i(e),"function"!=typeof e.logger&&e.debug&&(e.logger=o(e.debug)),e}function s(e,t,r){Array.isArray(r)||(r=[r]),r.forEach(function(r){r(e,t)})}function l(e,t,r){r=r||{};var o,i=r.filename||"<unknown>",l=n("parsing",r,Date.now(),p(t,{context:e,filename:i,positions:Boolean(r.sourceMap)}));r.beforeCompress&&n("beforeCompress",r,Date.now(),s(l,r,r.beforeCompress));var u=n("compress",r,Date.now(),f(l,a(r)));return r.afterCompress&&n("afterCompress",r,Date.now(),s(u,r,r.afterCompress)),o=r.sourceMap?n("translateWithSourceMap",r,Date.now(),function(){var e=d(u.ast);return e.map._file=i,e.map.setSourceContent(i,t),e}()):n("translate",r,Date.now(),{css:h(u.ast),map:null})}function u(e,t){return l("stylesheet",e,t)}function c(e,t){return l("block",e,t)}var p=e("./parser"),f=e("./compressor"),h=e("./utils/translate"),d=e("./utils/translateWithSourceMap"),m=e("./utils/walk"),g=e("./utils/clone"),v=e("./utils/list");t.exports={version:e("../package.json").version,List:v,minify:u,minifyBlock:c,parse:p,compress:f,translate:h,translateWithSourceMap:d,walk:m.all,walkRules:m.rules,walkRulesRight:m.rulesRight,clone:g}},{"../package.json":57,"./compressor":21,"./parser":38,"./utils/clone":40,"./utils/list":41,"./utils/translate":43,"./utils/translateWithSourceMap":44,"./utils/walk":45}],37:[function(e,t,r){r.TokenType={String:"String",Comment:"Comment",Unknown:"Unknown",Newline:"Newline",Space:"Space",Tab:"Tab",ExclamationMark:"ExclamationMark",QuotationMark:"QuotationMark",NumberSign:"NumberSign",DollarSign:"DollarSign",PercentSign:"PercentSign",Ampersand:"Ampersand",Apostrophe:"Apostrophe",LeftParenthesis:"LeftParenthesis",RightParenthesis:"RightParenthesis",Asterisk:"Asterisk",PlusSign:"PlusSign",Comma:"Comma",HyphenMinus:"HyphenMinus",FullStop:"FullStop",Solidus:"Solidus",Colon:"Colon",Semicolon:"Semicolon",LessThanSign:"LessThanSign",EqualsSign:"EqualsSign",GreaterThanSign:"GreaterThanSign",QuestionMark:"QuestionMark",CommercialAt:"CommercialAt",LeftSquareBracket:"LeftSquareBracket",ReverseSolidus:"ReverseSolidus",RightSquareBracket:"RightSquareBracket",CircumflexAccent:"CircumflexAccent",LowLine:"LowLine",LeftCurlyBracket:"LeftCurlyBracket",VerticalLine:"VerticalLine",RightCurlyBracket:"RightCurlyBracket",Tilde:"Tilde",Identifier:"Identifier",DecimalNumber:"DecimalNumber"}},{}],38:[function(e,t,r){"use strict";function n(e){var t,r=new Error(e),n=0,o=1,i=1;throw null!==fe.token?(n=fe.token.offse
case"StyleSheet":return i(e.rules.map(u));case"Atrule":var t=["@",e.name];return e.expression&&!e.expression.sequence.isEmpty()&&t.push(" ",u(e.expression)),e.block?t.push("{",u(e.block),"}"):t.push(";"),a(e.info,t);case"Ruleset":return i([u(e.selector),"{",u(e.block),"}"]);case"Selector":return i(e.selectors.map(u)).join(",");case"SimpleSelector":var t=e.sequence.map(function(e){return"Combinator"===e.type&&"/deep/"===e.name?" "+u(e)+" ":u(e)});return a(e.info,t);case"Block":return i(e.declarations.map(u)).join(";");case"Declaration":return a(e.info,[u(e.property),":",u(e.value)]);case"Property":return e.name;case"Value":return e.important?s(e.sequence)+"!important":s(e.sequence);case"Attribute":var r=u(e.name),n=" ";return null!==e.operator&&(r+=e.operator,null!==e.value&&(r+=u(e.value),"String"===e.value.type&&(n=""))),null!==e.flags&&(r+=n+e.flags),"["+r+"]";case"FunctionalPseudo":return":"+e.name+"("+l(e.arguments,",")+")";case"Function":return e.name+"("+l(e.arguments,",")+")";case"Negation":return":not("+l(e.sequence,",")+")";case"Braces":return e.open+s(e.sequence)+e.close;case"Argument":case"AtruleExpression":return s(e.sequence);case"Url":return"url("+u(e.value)+")";case"Progid":return u(e.value);case"Combinator":return e.name;case"Identifier":return e.name;case"PseudoClass":return":"+e.name;case"PseudoElement":return"::"+e.name;case"Class":return"."+e.name;case"Id":return"#"+e.name;case"Hash":return"#"+e.value;case"Dimension":return e.value+e.unit;case"Nth":return e.value;case"Number":return e.value;case"String":return e.value;case"Operator":return e.value;case"Raw":return e.value;case"Unknown":return e.value;case"Percentage":return e.value+"%";case"Space":return" ";case"Comment":return"/*"+e.value+"*/";default:throw new Error("Unknown node type: "+e.type)}}var c=e("source-map").SourceMapGenerator,p=e("source-map").SourceNode;t.exports=function(e){return o(i(u(e)))}},{"source-map":56}],45:[function(e,t,r){function n(e,t,r){switch(e.type){case"StyleSheet":var o=this.stylesheet;this.stylesheet=e,e.rules.each(n,this),this.stylesheet=o;break;case"Atrule":null!==e.block&&n.call(this,e.block),this.fn(e,t,r);break;case"Ruleset":this.fn(e,t,r)}}function o(e,t,r){switch(e.type){case"StyleSheet":var n=this.stylesheet;this.stylesheet=e,e.rules.eachRight(o,this),this.stylesheet=n;break;case"Atrule":null!==e.block&&o.call(this,e.block),this.fn(e,t,r);break;case"Ruleset":this.fn(e,t,r)}}function i(e,t,r){switch(e.type){case"StyleSheet":var n=this.stylesheet;this.stylesheet=e,e.rules.each(i,this),this.stylesheet=n;break;case"Atrule":null!==e.expression&&i.call(this,e.expression),null!==e.block&&i.call(this,e.block);break;case"Ruleset":this.ruleset=e,null!==e.selector&&i.call(this,e.selector),i.call(this,e.block),this.ruleset=null;break;case"Selector":var o=this.selector;this.selector=e,e.selectors.each(i,this),this.selector=o;break;case"Block":e.declarations.each(i,this);break;case"Declaration":this.declaration=e,i.call(this,e.property),i.call(this,e.value),this.declaration=null;break;case"Attribute":i.call(this,e.name),null!==e.value&&i.call(this,e.value);break;case"FunctionalPseudo":case"Function":this["function"]=e,e.arguments.each(i,this),this["function"]=null;break;case"AtruleExpression":this.atruleExpression=e,e.sequence.each(i,this),this.atruleExpression=null;break;case"Value":case"Argument":case"SimpleSelector":case"Braces":case"Negation":e.sequence.each(i,this);break;case"Url":case"Progid":i.call(this,e.value)}this.fn(e,t,r)}function a(e,t){var r={fn:t,root:e,stylesheet:null,atruleExpression:null,ruleset:null,selector:null,declaration:null,"function":null};return r}t.exports={all:function(e,t){i.call(a(e,t),e)},rules:function(e,t){n.call(a(e,t),e)},rulesRight:function(e,t){o.call(a(e,t),e)}}},{}],46:[function(e,t,r){function n(){this._array=[],this._set=Object.create(null)}var o=e("./util"),i=Object.prototype.hasOwnProperty;n.fromArray=function(e,t){for(var r=new n,o=0,i=e.length;i>o;o++)r.add(e[o],t);return r},n.prototype.size=function(){return Object.getOwnPropertyNames(this._set).length},n.prototype.add=function