ocrmnav
Version:
DevStack - The Complete Developer Toolkit - Virtual file system, workflow automation, and more than 65+ other development tools / features in one seamless extension. Cutting down dev times never before seen.
221 lines (175 loc) • 18.2 kB
JavaScript
"use strict";
exports.id = 59;
exports.ids = [59];
exports.modules = {
/***/ 1519:
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ atRuleAfterIndex: () => (/* binding */ atRuleAfterIndex),
/* harmony export */ atRuleAfterNameIndex: () => (/* binding */ atRuleAfterNameIndex),
/* harmony export */ atRuleBetweenIndex: () => (/* binding */ atRuleBetweenIndex),
/* harmony export */ atRuleParamIndex: () => (/* binding */ atRuleParamIndex),
/* harmony export */ declarationBetweenIndex: () => (/* binding */ declarationBetweenIndex),
/* harmony export */ declarationValueIndex: () => (/* binding */ declarationValueIndex),
/* harmony export */ ruleAfterIndex: () => (/* binding */ ruleAfterIndex),
/* harmony export */ ruleBetweenIndex: () => (/* binding */ ruleBetweenIndex)
/* harmony export */ });
/* harmony import */ var _getAtRuleParams_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1520);
/* harmony import */ var _getRuleSelector_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1521);
/* harmony import */ var _validateTypes_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(579);
/** @import {AtRule, Declaration, Rule} from 'postcss' */
/**
* @param {AtRule} atRule
* @returns {number}
*/
function atRuleParamIndex(atRule) {
const index = atRuleAfterNameIndex(atRule);
return index + (atRule.raws.afterName?.length ?? 0);
}
/**
* @param {AtRule} atRule
* @returns {number}
*/
function atRuleAfterIndex(atRule) {
// subtract 1 for `}`
const endOffset = atRule.source?.end?.offset;
if (!endOffset) return atRule.toString().length - 1;
const afterLength = atRule.raws?.after?.length;
if (!afterLength) return endOffset - 1;
return endOffset - (afterLength + 1);
}
/**
* @param {AtRule} atRule
* @returns {number}
*/
function atRuleAfterNameIndex(atRule) {
// Initial 1 is for the `@`
return 1 + atRule.name.length;
}
/**
* @param {AtRule} atRule
* @returns {number}
*/
function atRuleBetweenIndex(atRule) {
return atRuleParamIndex(atRule) + (0,_getAtRuleParams_mjs__WEBPACK_IMPORTED_MODULE_0__["default"])(atRule).length;
}
/**
* @param {Declaration} decl
* @returns {number}
*/
function declarationBetweenIndex(decl) {
const { prop } = decl.raws;
const propIsObject = (0,_validateTypes_mjs__WEBPACK_IMPORTED_MODULE_2__.isObject)(prop);
return countChars([
propIsObject && 'prefix' in prop && prop.prefix,
(propIsObject && 'raw' in prop && prop.raw) || decl.prop,
propIsObject && 'suffix' in prop && prop.suffix,
]);
}
/**
* Get the index of a declaration's value
*
* @param {Declaration} decl
* @returns {number}
*/
function declarationValueIndex(decl) {
const { between, value } = decl.raws;
return (
declarationBetweenIndex(decl) +
countChars([between || ':', value && 'prefix' in value && value.prefix])
);
}
/**
* @param {Rule} rule
* @returns {number}
*/
function ruleBetweenIndex(rule) {
return (0,_getRuleSelector_mjs__WEBPACK_IMPORTED_MODULE_1__["default"])(rule).length;
}
/**
* @param {Rule} rule
* @returns {number}
*/
function ruleAfterIndex(rule) {
// subtract 1 for `}`
const endOffset = rule.source?.end?.offset;
if (!endOffset) return rule.toString().length - 1;
const afterLength = rule.raws?.after?.length;
if (!afterLength) return endOffset - 1;
return endOffset - (afterLength + 1);
}
/**
* @param {unknown[]} values
* @returns {number}
*/
function countChars(values) {
return values.reduce((/** @type {number} */ count, value) => {
if ((0,_validateTypes_mjs__WEBPACK_IMPORTED_MODULE_2__.isString)(value)) return count + value.length;
return count;
}, 0);
}
/***/ }),
/***/ 1520:
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (/* binding */ getAtRuleParams)
/* harmony export */ });
/**
* @param {import('postcss').AtRule} atRule
* @returns {string}
*/
function getAtRuleParams(atRule) {
return atRule.raws.params?.raw ?? atRule.params;
}
/***/ }),
/***/ 1521:
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (/* binding */ getRuleSelector)
/* harmony export */ });
/**
* @param {import('postcss').Rule} ruleNode
* @returns {string}
*/
function getRuleSelector(ruleNode) {
const raws = ruleNode.raws;
return (raws.selector && raws.selector.raw) || ruleNode.selector;
}
/***/ }),
/***/ 1647:
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ CommentNode: () => (/* binding */ CommentNode),
/* harmony export */ ComponentValueType: () => (/* binding */ f),
/* harmony export */ ContainerNodeBaseClass: () => (/* binding */ ContainerNodeBaseClass),
/* harmony export */ FunctionNode: () => (/* binding */ FunctionNode),
/* harmony export */ SimpleBlockNode: () => (/* binding */ SimpleBlockNode),
/* harmony export */ TokenNode: () => (/* binding */ TokenNode),
/* harmony export */ WhitespaceNode: () => (/* binding */ WhitespaceNode),
/* harmony export */ forEach: () => (/* binding */ forEach),
/* harmony export */ gatherNodeAncestry: () => (/* binding */ gatherNodeAncestry),
/* harmony export */ isCommentNode: () => (/* binding */ isCommentNode),
/* harmony export */ isFunctionNode: () => (/* binding */ isFunctionNode),
/* harmony export */ isSimpleBlockNode: () => (/* binding */ isSimpleBlockNode),
/* harmony export */ isTokenNode: () => (/* binding */ isTokenNode),
/* harmony export */ isWhiteSpaceOrCommentNode: () => (/* binding */ isWhiteSpaceOrCommentNode),
/* harmony export */ isWhitespaceNode: () => (/* binding */ isWhitespaceNode),
/* harmony export */ parseCommaSeparatedListOfComponentValues: () => (/* binding */ parseCommaSeparatedListOfComponentValues),
/* harmony export */ parseComponentValue: () => (/* binding */ parseComponentValue),
/* harmony export */ parseListOfComponentValues: () => (/* binding */ parseListOfComponentValues),
/* harmony export */ replaceComponentValues: () => (/* binding */ replaceComponentValues),
/* harmony export */ sourceIndices: () => (/* binding */ sourceIndices),
/* harmony export */ stringify: () => (/* binding */ stringify),
/* harmony export */ walk: () => (/* binding */ walk),
/* harmony export */ walkerIndexGenerator: () => (/* binding */ walkerIndexGenerator)
/* harmony export */ });
/* harmony import */ var _csstools_css_tokenizer__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(889);
var f;function walkerIndexGenerator(e){let n=e.slice();return(e,t,o)=>{let s=-1;for(let i=n.indexOf(t);i<n.length&&(s=e.indexOf(n[i]),-1===s||s<o);i++);return-1===s||s===o&&t===e[o]&&(s++,s>=e.length)?-1:(n=e.slice(),s)}}function consumeComponentValue(e,n){const t=n[0];if((0,_csstools_css_tokenizer__WEBPACK_IMPORTED_MODULE_0__.isTokenOpenParen)(t)||(0,_csstools_css_tokenizer__WEBPACK_IMPORTED_MODULE_0__.isTokenOpenCurly)(t)||(0,_csstools_css_tokenizer__WEBPACK_IMPORTED_MODULE_0__.isTokenOpenSquare)(t)){const t=consumeSimpleBlock(e,n);return{advance:t.advance,node:t.node}}if((0,_csstools_css_tokenizer__WEBPACK_IMPORTED_MODULE_0__.isTokenFunction)(t)){const t=consumeFunction(e,n);return{advance:t.advance,node:t.node}}if((0,_csstools_css_tokenizer__WEBPACK_IMPORTED_MODULE_0__.isTokenWhitespace)(t)){const t=consumeWhitespace(e,n);return{advance:t.advance,node:t.node}}if((0,_csstools_css_tokenizer__WEBPACK_IMPORTED_MODULE_0__.isTokenComment)(t)){const t=consumeComment(e,n);return{advance:t.advance,node:t.node}}return{advance:1,node:new TokenNode(t)}}!function(e){e.Function="function",e.SimpleBlock="simple-block",e.Whitespace="whitespace",e.Comment="comment",e.Token="token"}(f||(f={}));class ContainerNodeBaseClass{value=[];indexOf(e){return this.value.indexOf(e)}at(e){if("number"==typeof e)return e<0&&(e=this.value.length+e),this.value[e]}forEach(e,n){if(0===this.value.length)return;const t=walkerIndexGenerator(this.value);let o=0;for(;o<this.value.length;){const s=this.value[o];let i;if(n&&(i={...n}),!1===e({node:s,parent:this,state:i},o))return!1;if(o=t(this.value,s,o),-1===o)break}}walk(e,n){0!==this.value.length&&this.forEach(((n,t)=>!1!==e(n,t)&&((!("walk"in n.node)||!this.value.includes(n.node)||!1!==n.node.walk(e,n.state))&&void 0)),n)}}class FunctionNode extends ContainerNodeBaseClass{type=f.Function;name;endToken;constructor(e,n,t){super(),this.name=e,this.endToken=n,this.value=t}getName(){return this.name[4].value}normalize(){(0,_csstools_css_tokenizer__WEBPACK_IMPORTED_MODULE_0__.isTokenEOF)(this.endToken)&&(this.endToken=[_csstools_css_tokenizer__WEBPACK_IMPORTED_MODULE_0__.TokenType.CloseParen,")",-1,-1,void 0])}tokens(){return (0,_csstools_css_tokenizer__WEBPACK_IMPORTED_MODULE_0__.isTokenEOF)(this.endToken)?[this.name,...this.value.flatMap((e=>e.tokens()))]:[this.name,...this.value.flatMap((e=>e.tokens())),this.endToken]}toString(){const e=this.value.map((e=>(0,_csstools_css_tokenizer__WEBPACK_IMPORTED_MODULE_0__.isToken)(e)?(0,_csstools_css_tokenizer__WEBPACK_IMPORTED_MODULE_0__.stringify)(e):e.toString())).join("");return (0,_csstools_css_tokenizer__WEBPACK_IMPORTED_MODULE_0__.stringify)(this.name)+e+(0,_csstools_css_tokenizer__WEBPACK_IMPORTED_MODULE_0__.stringify)(this.endToken)}toJSON(){return{type:this.type,name:this.getName(),tokens:this.tokens(),value:this.value.map((e=>e.toJSON()))}}isFunctionNode(){return FunctionNode.isFunctionNode(this)}static isFunctionNode(e){return!!e&&(e instanceof FunctionNode&&e.type===f.Function)}}function consumeFunction(n,t){const o=[];let s=1;for(;;){const i=t[s];if(!i||(0,_csstools_css_tokenizer__WEBPACK_IMPORTED_MODULE_0__.isTokenEOF)(i))return n.onParseError(new _csstools_css_tokenizer__WEBPACK_IMPORTED_MODULE_0__.ParseError("Unexpected EOF while consuming a function.",t[0][2],t[t.length-1][3],["5.4.9. Consume a function","Unexpected EOF"])),{advance:t.length,node:new FunctionNode(t[0],i,o)};if((0,_csstools_css_tokenizer__WEBPACK_IMPORTED_MODULE_0__.isTokenCloseParen)(i))return{advance:s+1,node:new FunctionNode(t[0],i,o)};if((0,_csstools_css_tokenizer__WEBPACK_IMPORTED_MODULE_0__.isTokenWhiteSpaceOrComment)(i)){const e=consumeAllCommentsAndWhitespace(n,t.slice(s));s+=e.advance,o.push(...e.nodes);continue}const r=consumeComponentValue(n,t.slice(s));s+=r.advance,o.push(r.node)}}class SimpleBlockNode extends ContainerNodeBaseClass{type=f.SimpleBlock;startToken;endToken;constructor(e,n,t){super(),this.startToken=e,this.endToken=n,this.value=t}normalize(){if((0,_csstools_css_tokenizer__WEBPACK_IMPORTED_MODULE_0__.isTokenEOF)(this.endToken)){const e=(0,_csstools_css_tokenizer__WEBPACK_IMPORTED_MODULE_0__.mirrorVariant)(this.startToken);e&&(this.endToken=e)}}tokens(){return (0,_csstools_css_tokenizer__WEBPACK_IMPORTED_MODULE_0__.isTokenEOF)(this.endToken)?[this.startToken,...this.value.flatMap((e=>e.tokens()))]:[this.startToken,...this.value.flatMap((e=>e.tokens())),this.endToken]}toString(){const e=this.value.map((e=>(0,_csstools_css_tokenizer__WEBPACK_IMPORTED_MODULE_0__.isToken)(e)?(0,_csstools_css_tokenizer__WEBPACK_IMPORTED_MODULE_0__.stringify)(e):e.toString())).join("");return (0,_csstools_css_tokenizer__WEBPACK_IMPORTED_MODULE_0__.stringify)(this.startToken)+e+(0,_csstools_css_tokenizer__WEBPACK_IMPORTED_MODULE_0__.stringify)(this.endToken)}toJSON(){return{type:this.type,startToken:this.startToken,tokens:this.tokens(),value:this.value.map((e=>e.toJSON()))}}isSimpleBlockNode(){return SimpleBlockNode.isSimpleBlockNode(this)}static isSimpleBlockNode(e){return!!e&&(e instanceof SimpleBlockNode&&e.type===f.SimpleBlock)}}function consumeSimpleBlock(n,t){const o=(0,_csstools_css_tokenizer__WEBPACK_IMPORTED_MODULE_0__.mirrorVariantType)(t[0][0]);if(!o)throw new Error("Failed to parse, a mirror variant must exist for all block open tokens.");const s=[];let i=1;for(;;){const r=t[i];if(!r||(0,_csstools_css_tokenizer__WEBPACK_IMPORTED_MODULE_0__.isTokenEOF)(r))return n.onParseError(new _csstools_css_tokenizer__WEBPACK_IMPORTED_MODULE_0__.ParseError("Unexpected EOF while consuming a simple block.",t[0][2],t[t.length-1][3],["5.4.8. Consume a simple block","Unexpected EOF"])),{advance:t.length,node:new SimpleBlockNode(t[0],r,s)};if(r[0]===o)return{advance:i+1,node:new SimpleBlockNode(t[0],r,s)};if((0,_csstools_css_tokenizer__WEBPACK_IMPORTED_MODULE_0__.isTokenWhiteSpaceOrComment)(r)){const e=consumeAllCommentsAndWhitespace(n,t.slice(i));i+=e.advance,s.push(...e.nodes);continue}const a=consumeComponentValue(n,t.slice(i));i+=a.advance,s.push(a.node)}}class WhitespaceNode{type=f.Whitespace;value;constructor(e){this.value=e}tokens(){return this.value}toString(){return (0,_csstools_css_tokenizer__WEBPACK_IMPORTED_MODULE_0__.stringify)(...this.value)}toJSON(){return{type:this.type,tokens:this.tokens()}}isWhitespaceNode(){return WhitespaceNode.isWhitespaceNode(this)}static isWhitespaceNode(e){return!!e&&(e instanceof WhitespaceNode&&e.type===f.Whitespace)}}function consumeWhitespace(e,n){let t=0;for(;;){const e=n[t];if(!(0,_csstools_css_tokenizer__WEBPACK_IMPORTED_MODULE_0__.isTokenWhitespace)(e))return{advance:t,node:new WhitespaceNode(n.slice(0,t))};t++}}class CommentNode{type=f.Comment;value;constructor(e){this.value=e}tokens(){return[this.value]}toString(){return (0,_csstools_css_tokenizer__WEBPACK_IMPORTED_MODULE_0__.stringify)(this.value)}toJSON(){return{type:this.type,tokens:this.tokens()}}isCommentNode(){return CommentNode.isCommentNode(this)}static isCommentNode(e){return!!e&&(e instanceof CommentNode&&e.type===f.Comment)}}function consumeComment(e,n){return{advance:1,node:new CommentNode(n[0])}}function consumeAllCommentsAndWhitespace(e,n){const t=[];let o=0;for(;;)if((0,_csstools_css_tokenizer__WEBPACK_IMPORTED_MODULE_0__.isTokenWhitespace)(n[o])){const e=consumeWhitespace(0,n.slice(o));o+=e.advance,t.push(e.node)}else{if(!(0,_csstools_css_tokenizer__WEBPACK_IMPORTED_MODULE_0__.isTokenComment)(n[o]))return{advance:o,nodes:t};t.push(new CommentNode(n[o])),o++}}class TokenNode{type=f.Token;value;constructor(e){this.value=e}tokens(){return[this.value]}toString(){return this.value[1]}toJSON(){return{type:this.type,tokens:this.tokens()}}isTokenNode(){return TokenNode.isTokenNode(this)}static isTokenNode(e){return!!e&&(e instanceof TokenNode&&e.type===f.Token)}}function parseComponentValue(t,o){const s={onParseError:o?.onParseError??(()=>{})},i=[...t];(0,_csstools_css_tokenizer__WEBPACK_IMPORTED_MODULE_0__.isTokenEOF)(i[i.length-1])&&i.push([_csstools_css_tokenizer__WEBPACK_IMPORTED_MODULE_0__.TokenType.EOF,"",i[i.length-1][2],i[i.length-1][3],void 0]);const r=consumeComponentValue(s,i);if((0,_csstools_css_tokenizer__WEBPACK_IMPORTED_MODULE_0__.isTokenEOF)(i[Math.min(r.advance,i.length-1)]))return r.node;s.onParseError(new _csstools_css_tokenizer__WEBPACK_IMPORTED_MODULE_0__.ParseError("Expected EOF after parsing a component value.",t[0][2],t[t.length-1][3],["5.3.9. Parse a component value","Expected EOF"]))}function parseListOfComponentValues(t,o){const s={onParseError:o?.onParseError??(()=>{})},i=[...t];(0,_csstools_css_tokenizer__WEBPACK_IMPORTED_MODULE_0__.isTokenEOF)(i[i.length-1])&&i.push([_csstools_css_tokenizer__WEBPACK_IMPORTED_MODULE_0__.TokenType.EOF,"",i[i.length-1][2],i[i.length-1][3],void 0]);const r=[];let a=0;for(;;){if(!i[a]||(0,_csstools_css_tokenizer__WEBPACK_IMPORTED_MODULE_0__.isTokenEOF)(i[a]))return r;const n=consumeComponentValue(s,i.slice(a));r.push(n.node),a+=n.advance}}function parseCommaSeparatedListOfComponentValues(t,o){const s={onParseError:o?.onParseError??(()=>{})},i=[...t];if(0===t.length)return[];(0,_csstools_css_tokenizer__WEBPACK_IMPORTED_MODULE_0__.isTokenEOF)(i[i.length-1])&&i.push([_csstools_css_tokenizer__WEBPACK_IMPORTED_MODULE_0__.TokenType.EOF,"",i[i.length-1][2],i[i.length-1][3],void 0]);const r=[];let a=[],c=0;for(;;){if(!i[c]||(0,_csstools_css_tokenizer__WEBPACK_IMPORTED_MODULE_0__.isTokenEOF)(i[c]))return a.length&&r.push(a),r;if((0,_csstools_css_tokenizer__WEBPACK_IMPORTED_MODULE_0__.isTokenComma)(i[c])){r.push(a),a=[],c++;continue}const n=consumeComponentValue(s,t.slice(c));a.push(n.node),c+=n.advance}}function gatherNodeAncestry(e){const n=new Map;return e.walk((e=>{Array.isArray(e.node)?e.node.forEach((t=>{n.set(t,e.parent)})):n.set(e.node,e.parent)})),n}function forEach(e,n,t){if(0===e.length)return;const o=walkerIndexGenerator(e);let s=0;for(;s<e.length;){const i=e[s];let r;if(t&&(r={...t}),!1===n({node:i,parent:{value:e},state:r},s))return!1;if(s=o(e,i,s),-1===s)break}}function walk(e,n,t){0!==e.length&&forEach(e,((t,o)=>!1!==n(t,o)&&((!("walk"in t.node)||!e.includes(t.node)||!1!==t.node.walk(n,t.state))&&void 0)),t)}function replaceComponentValues(e,n){for(let t=0;t<e.length;t++){walk(e[t],((e,t)=>{if("number"!=typeof t)return;const o=n(e.node);o&&(Array.isArray(o)?e.parent.value.splice(t,1,...o):e.parent.value.splice(t,1,o))}))}return e}function stringify(e){return e.map((e=>e.map((e=>(0,_csstools_css_tokenizer__WEBPACK_IMPORTED_MODULE_0__.stringify)(...e.tokens()))).join(""))).join(",")}function isSimpleBlockNode(e){return SimpleBlockNode.isSimpleBlockNode(e)}function isFunctionNode(e){return FunctionNode.isFunctionNode(e)}function isWhitespaceNode(e){return WhitespaceNode.isWhitespaceNode(e)}function isCommentNode(e){return CommentNode.isCommentNode(e)}function isWhiteSpaceOrCommentNode(e){return isWhitespaceNode(e)||isCommentNode(e)}function isTokenNode(e){return TokenNode.isTokenNode(e)}function sourceIndices(e){if(Array.isArray(e)){const n=e[0];if(!n)return[0,0];const t=e[e.length-1]||n;return[sourceIndices(n)[0],sourceIndices(t)[1]]}const n=e.tokens(),t=n[0],o=n[n.length-1];return t&&o?[t[2],o[3]]:[0,0]}
/***/ })
};
;
//# sourceMappingURL=59.extension.js.map