1 |
- {"version":3,"sources":["indent.js"],"names":["__rest","s","e","t","p","Object","prototype","hasOwnProperty","call","indexOf","getOwnPropertySymbols","i","length","propertyIsEnumerable","defineProperty","exports","value","util_1","require","pull","offset","str","slice","push","space","padStart","indent","pos","shift","pad","start","undefined","update","line","assign","tokens","_a","source","fields","rewireSource","map","default"],"mappings":"AAAA;;AACA,IAAIA,MAAM,GAAI,QAAQ,KAAKA,MAAd,IAAyB,UAAUC,CAAV,EAAaC,CAAb,EAAgB;AAClD,MAAIC,CAAC,GAAG,EAAR;;AACA,OAAK,IAAIC,CAAT,IAAcH,CAAd,EAAiB,IAAII,MAAM,CAACC,SAAP,CAAiBC,cAAjB,CAAgCC,IAAhC,CAAqCP,CAArC,EAAwCG,CAAxC,KAA8CF,CAAC,CAACO,OAAF,CAAUL,CAAV,IAAe,CAAjE,EACbD,CAAC,CAACC,CAAD,CAAD,GAAOH,CAAC,CAACG,CAAD,CAAR;;AACJ,MAAIH,CAAC,IAAI,IAAL,IAAa,OAAOI,MAAM,CAACK,qBAAd,KAAwC,UAAzD,EACI,KAAK,IAAIC,CAAC,GAAG,CAAR,EAAWP,CAAC,GAAGC,MAAM,CAACK,qBAAP,CAA6BT,CAA7B,CAApB,EAAqDU,CAAC,GAAGP,CAAC,CAACQ,MAA3D,EAAmED,CAAC,EAApE,EAAwE;AACpE,QAAIT,CAAC,CAACO,OAAF,CAAUL,CAAC,CAACO,CAAD,CAAX,IAAkB,CAAlB,IAAuBN,MAAM,CAACC,SAAP,CAAiBO,oBAAjB,CAAsCL,IAAtC,CAA2CP,CAA3C,EAA8CG,CAAC,CAACO,CAAD,CAA/C,CAA3B,EACIR,CAAC,CAACC,CAAC,CAACO,CAAD,CAAF,CAAD,GAAUV,CAAC,CAACG,CAAC,CAACO,CAAD,CAAF,CAAX;AACP;AACL,SAAOR,CAAP;AACH,CAVD;;AAWAE,MAAM,CAACS,cAAP,CAAsBC,OAAtB,EAA+B,YAA/B,EAA6C;AAAEC,EAAAA,K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CAACsB,YAAP,CAAoBlC,MAAM,CAAC6B,MAAP,CAAc7B,MAAM,CAAC6B,MAAP,CAAc,EAAd,EAAkBI,MAAlB,CAAd,EAAyC;AAAED,MAAAA,MAAM,EAAEA,MAAM,CAACG,GAAP,CAAWR,MAAX;AAAV,KAAzC,CAApB,CAAP;AACH,GAHD;AAIH;;AACDjB,OAAO,CAAC0B,OAAR,GAAkBf,MAAlB","sourcesContent":["\"use strict\";\nvar __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst util_1 = require(\"../util\");\nconst pull = (offset) => (str) => str.slice(offset);\nconst push = (offset) => {\n const space = ''.padStart(offset, ' ');\n return (str) => str + space;\n};\nfunction indent(pos) {\n let shift;\n const pad = (start) => {\n if (shift === undefined) {\n const offset = pos - start.length;\n shift = offset > 0 ? push(offset) : pull(-offset);\n }\n return shift(start);\n };\n const update = (line) => (Object.assign(Object.assign({}, line), { tokens: Object.assign(Object.assign({}, line.tokens), { start: pad(line.tokens.start) }) }));\n return (_a) => {\n var { source } = _a, fields = __rest(_a, [\"source\"]);\n return util_1.rewireSource(Object.assign(Object.assign({}, fields), { source: source.map(update) }));\n };\n}\nexports.default = indent;\n"],"file":"indent.cjs"}
|