ship-gis/node_modules/@adobe/css-tools/dist/cjs/adobe-css-tools.cjs

3 lines
13 KiB
JavaScript
Raw Normal View 히스토리

2026-01-22 09:14:01 +09:00
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});class t extends Error{reason;filename;line;column;source;constructor(t,s,e,i,n){super(`${t}:${e}:${i}: ${s}`),this.reason=s,this.filename=t,this.line=e,this.column=i,this.source=n}}class s{start;end;source;constructor(t,s,e){this.start=t,this.end=s,this.source=e}}var e;exports.CssTypes=void 0,(e=exports.CssTypes||(exports.CssTypes={})).stylesheet="stylesheet",e.rule="rule",e.declaration="declaration",e.comment="comment",e.container="container",e.charset="charset",e.document="document",e.customMedia="custom-media",e.fontFace="font-face",e.host="host",e.import="import",e.keyframes="keyframes",e.keyframe="keyframe",e.layer="layer",e.media="media",e.namespace="namespace",e.page="page",e.startingStyle="starting-style",e.supports="supports";const i=(t,s,e)=>{let i=e,n=1e4;do{const e=s.map(s=>t.indexOf(s,i));e.push(t.indexOf("\\",i));const r=e.filter(t=>-1!==t);if(0===r.length)return-1;const o=Math.min(...r);if("\\"!==t[o])return o;i=o+2,n--}while(n>0);throw new Error("Too many escaping")},n=(t,s,e)=>{let r=e,o=1e4;do{const e=s.map(s=>t.indexOf(s,r));e.push(t.indexOf("(",r)),e.push(t.indexOf('"',r)),e.push(t.indexOf("'",r)),e.push(t.indexOf("\\",r));const c=e.filter(t=>-1!==t);if(0===c.length)return-1;const a=Math.min(...c);switch(t[a]){case"\\":r=a+2;break;case"(":{const s=n(t,[")"],a+1);if(-1===s)return-1;r=s+1}break;case'"':{const s=i(t,['"'],a+1);if(-1===s)return-1;r=s+1}break;case"'":{const s=i(t,["'"],a+1);if(-1===s)return-1;r=s+1}break;default:return a}o--}while(o>0);throw new Error("Too many escaping")},r=/\/\*[^]*?(?:\*\/|$)/g;function o(t){return t?t.trim():""}function c(t,s){const e=t&&"string"==typeof t.type,i=e?t:s;for(const s in t){const e=t[s];Array.isArray(e)?e.forEach(t=>{c(t,i)}):e&&"object"==typeof e&&c(e,i)}return e&&Object.defineProperty(t,"parent",{configurable:!0,writable:!0,enumerable:!1,value:s||null}),t}class a{level=0;indentation=" ";compress=!1;constructor(t){"string"==typeof t?.indent&&(this.indentation=t?.indent),t?.compress&&(this.compress=!0)}emit(t,s){return t}indent(t){return this.level=this.level||1,t?(this.level+=t,""):Array(this.level).join(this.indentation)}visit(t){switch(t.type){case exports.CssTypes.stylesheet:return this.stylesheet(t);case exports.CssTypes.rule:return this.rule(t);case exports.CssTypes.declaration:return this.declaration(t);case exports.CssTypes.comment:return this.comment(t);case exports.CssTypes.container:return this.container(t);case exports.CssTypes.charset:return this.charset(t);case exports.CssTypes.document:return this.document(t);case exports.CssTypes.customMedia:return this.customMedia(t);case exports.CssTypes.fontFace:return this.fontFace(t);case exports.CssTypes.host:return this.host(t);case exports.CssTypes.import:return this.import(t);case exports.CssTypes.keyframes:return this.keyframes(t);case exports.CssTypes.keyframe:return this.keyframe(t);case exports.CssTypes.layer:return this.layer(t);case exports.CssTypes.media:return this.media(t);case exports.CssTypes.namespace:return this.namespace(t);case exports.CssTypes.page:return this.page(t);case exports.CssTypes.startingStyle:return this.startingStyle(t);case exports.CssTypes.supports:return this.supports(t)}}mapVisit(t,s){let e="";s=s||"";for(let i=0,n=t.length;i<n;i++)e+=this.visit(t[i]),s&&i<n-1&&(e+=this.emit(s));return e}compile(t){return this.compress?t.stylesheet.rules.map(this.visit,this).join(""):this.stylesheet(t)}stylesheet(t){return this.mapVisit(t.stylesheet.rules,"\n\n")}comment(t){return this.compress?this.emit("",t.position):this.emit(`${this.indent()}/*${t.comment}*/`,t.position)}container(t){return this.compress?this.emit(`@container ${t.container}`,t.position)+this.emit("{")+this.mapVisit(t.rules)+this.emit("}"):this.emit(`${this.indent()}@container ${t.container}`,t.position)+this.emit(` {\n${this.indent(1)}`)+this.mapVisit(t.rules,"\n\n")+this.emit(`\n${this.indent(-1)}${this.indent()}}`)}layer(t){return this.compress?this.emit(`@layer ${t.layer}`,t.position)+(t.rules?this.emit("{")+this.mapVisit(t.rules)+this.emit(
//# sourceMappingURL=adobe-css-tools.cjs.map