@podlite/toc 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,8 @@
1
+ # @podlite/toc
2
+
3
+ ## Upcoming
4
+
5
+ ## 0.0.1
6
+ - initial release
7
+ - implement Table of conents =Toc block
8
+ - add support :caption for =table
package/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2022 Alexandr Zahatski
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
package/README.md ADDED
@@ -0,0 +1,15 @@
1
+ # =Toc block
2
+
3
+ ## Contributing
4
+
5
+ This is an open source program. Feel free to fork and contribute.
6
+
7
+ In order to keep the match between this documentation and the last release, please contribute and pull requests on the dedicated develop branch.
8
+
9
+ ## AUTHOR
10
+
11
+ Copyright (c) 2022 Alexandr Zahatski
12
+
13
+ ## License
14
+
15
+ Released under a MIT License.
package/index.js ADDED
@@ -0,0 +1,2 @@
1
+ 'use strict'
2
+ module.exports = require('./lib')
package/jest.config.js ADDED
@@ -0,0 +1,2 @@
1
+
2
+ module.exports = require('../../jest.config')
@@ -0,0 +1 @@
1
+ {"extends": "../../jest.tsconfig.json"}
@@ -0,0 +1,2 @@
1
+ export declare const prepareDataForToc: (data: any[]) => any;
2
+ export declare const getTocPod: (tocTree: any, tocTitle?: string) => string;
package/lib/helpers.js ADDED
@@ -0,0 +1,123 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getTocPod = exports.prepareDataForToc = void 0;
7
+ const schema_1 = require("@podlite/schema");
8
+ const makeTransformer_1 = __importDefault(require("pod6/built/helpers/makeTransformer"));
9
+ const prepareDataForToc = (data) => {
10
+ const isSemanticBlock = (node) => {
11
+ const name = node.name || '';
12
+ const isTypeBlock = (node.type || '') === 'block';
13
+ return isTypeBlock && name === name.toUpperCase();
14
+ };
15
+ const reduceLevel = (arr) => {
16
+ return arr.reduce((i, c) => {
17
+ return (i.includes(c) ? [...i] : [...i, c]).sort((a, b) => a - b);
18
+ }, []);
19
+ };
20
+ const normalizeLevels = (data) => {
21
+ const namesLevels = {};
22
+ for (const node of data) {
23
+ if (isSemanticBlock(node)) {
24
+ const level = 1;
25
+ node.level = level;
26
+ namesLevels['head'] = reduceLevel([...(namesLevels['head'] || []), 1]);
27
+ }
28
+ else {
29
+ // TODO: eliminate string level (=item)
30
+ // default level is 1 for all items
31
+ namesLevels[node.name] = reduceLevel([...(namesLevels[node.name] || []), parseInt(node.level, 10) || 1]);
32
+ }
33
+ }
34
+ return namesLevels;
35
+ };
36
+ const levelsMap = normalizeLevels(data);
37
+ const tocTree = [
38
+ [-1, { item: 'toc', level: 0, node: {} }]
39
+ ];
40
+ /**
41
+ // find nearest by level
42
+ const tocTree = [
43
+ [ -1, { item: 'toc', level:0 } ],
44
+ [ 0, { item: 'head', level:1 } ],
45
+ [ 1, { item: 'head2', level:2 } ],
46
+ [ 0, { item: 'head', level:1 } ],
47
+ [ 3, { item: 'item2', level:3 } ],
48
+ ];
49
+ const sq = getIndexByLevel(tocTree, 4)
50
+ */
51
+ const getRootIndexByLevel = (tocTree, level) => {
52
+ return tocTree.length - tocTree.slice().reverse().findIndex(e => e[1].level < level) - 1;
53
+ };
54
+ let currentLevel = 1;
55
+ // prepare normilized data
56
+ for (let i = 0; i < data.length; i++) {
57
+ const item = data[i];
58
+ // deafult level is 1 for all items
59
+ const normalizedLevel = levelsMap[item.name].findIndex(l => l === parseInt(item.level || 1)) + 1;
60
+ switch (item.name) {
61
+ case 'head':
62
+ {
63
+ const parent = getRootIndexByLevel(tocTree, normalizedLevel);
64
+ tocTree.push([parent, { item: item.name, level: normalizedLevel, node: item }]);
65
+ if (currentLevel != normalizedLevel) {
66
+ currentLevel = normalizedLevel;
67
+ }
68
+ }
69
+ break;
70
+ default:
71
+ {
72
+ const newlevel = currentLevel + normalizedLevel;
73
+ const parent = getRootIndexByLevel(tocTree, newlevel);
74
+ tocTree.push([parent, { item: item.name, level: newlevel, node: item }]);
75
+ }
76
+ break;
77
+ }
78
+ }
79
+ //Turns given flat arr into a tree and returns root..
80
+ //(Assumes that no child is declared before parent)
81
+ function makeTree(arr) {
82
+ //Array with all the children elements set correctly..
83
+ var treeArr = new Array(arr.length);
84
+ for (var i = 0, len = arr.length; i < len; i++) {
85
+ var arrI = arr[i];
86
+ var newNode = treeArr[i] = {
87
+ type: arrI[1].item,
88
+ level: arrI[1].level,
89
+ node: arrI[1].node,
90
+ content: []
91
+ };
92
+ var parentI = arrI[0];
93
+ if (parentI > -1) { //i.e. not the root..
94
+ treeArr[parentI].content.push(newNode);
95
+ }
96
+ }
97
+ return treeArr[0]; //return the root..
98
+ }
99
+ return makeTree(tocTree);
100
+ };
101
+ exports.prepareDataForToc = prepareDataForToc;
102
+ const getTocPod = (tocTree, tocTitle = "Table of contents") => {
103
+ let blocks = [];
104
+ const rules = {
105
+ ":toc": (node, _, visiter) => {
106
+ blocks.push(`=head1 ${tocTitle}`);
107
+ visiter(node.content);
108
+ },
109
+ ":head": (node, ctx, visiter) => {
110
+ const id = (0, schema_1.getNodeId)(node.node, ctx);
111
+ blocks.push(`=item${node.level} L<${(0, schema_1.getTextContentFromNode)(node.node).trim()} ${id ? `|#${id}` : ''}>`);
112
+ visiter(node.content);
113
+ },
114
+ ":item": (node, _, visiter) => {
115
+ blocks.push(`=item${node.level} ${(0, schema_1.getTextContentFromNode)(node.node).trim()}`);
116
+ visiter(node.content);
117
+ },
118
+ };
119
+ const transformer = (0, makeTransformer_1.default)(rules);
120
+ const res = transformer(tocTree, {});
121
+ return blocks.join('\n');
122
+ };
123
+ exports.getTocPod = getTocPod;
package/lib/index.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ import { Plugin } from '@podlite/schema';
2
+ import { PodNode } from '@podlite/schema';
3
+ export declare const getContentForToc: (node: PodNode) => string;
4
+ export declare const plugin: Plugin;
5
+ export default plugin;
package/lib/index.js ADDED
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.plugin = exports.getContentForToc = void 0;
7
+ const schema_1 = require("@podlite/schema");
8
+ const helpers_1 = require("./helpers");
9
+ const config_1 = __importDefault(require("pod6/built/helpers/config"));
10
+ const makeTransformer_1 = require("pod6/built/helpers/makeTransformer");
11
+ const getContentForToc = (node) => {
12
+ if (typeof node !== "string" && "type" in node) {
13
+ if (node.type === 'block') {
14
+ const conf = (0, config_1.default)(node, {});
15
+ if ((0, makeTransformer_1.isNamedBlock)(node.name)) {
16
+ const caption = ((conf, nodeName) => {
17
+ if (conf.exists('caption')) {
18
+ return conf.getFirstValue('caption');
19
+ }
20
+ else if (conf.exists('title')) {
21
+ return conf.getFirstValue('title');
22
+ }
23
+ else {
24
+ // try to find content child node
25
+ const [captionNode] = (0, schema_1.getFromTree)(node, 'caption');
26
+ if (captionNode) {
27
+ return (0, schema_1.getTextContentFromNode)(captionNode);
28
+ }
29
+ }
30
+ return `${nodeName} not have :caption`;
31
+ })(conf, node.name);
32
+ return caption;
33
+ }
34
+ if (node.name == 'image') {
35
+ const caption = (0, schema_1.getTextContentFromNode)(conf.getFirstValue('caption'));
36
+ return caption || 'image not have caption';
37
+ }
38
+ if (node.name == 'table') {
39
+ const caption = (0, schema_1.getTextContentFromNode)(conf.getFirstValue('caption'));
40
+ return caption || 'table not have :caption';
41
+ }
42
+ return (0, schema_1.getTextContentFromNode)(node);
43
+ }
44
+ }
45
+ return 'Not supported toc element';
46
+ };
47
+ exports.getContentForToc = getContentForToc;
48
+ exports.plugin = ({
49
+ toAstAfter: (writer, processor, fulltree) => {
50
+ return (node, ctx) => {
51
+ const content = (0, schema_1.getTextContentFromNode)(node);
52
+ const blocks = content.trim().split(/(?:\s*,\s*|\s+)/)
53
+ .filter(Boolean);
54
+ if (blocks.length == 0) {
55
+ blocks.push({ name: 'head' });
56
+ }
57
+ const nodes = (0, schema_1.getFromTree)(fulltree, ...blocks);
58
+ const tocTree = (0, helpers_1.prepareDataForToc)(nodes);
59
+ const createList = (items, level) => {
60
+ const resultList = [];
61
+ items.map(item => {
62
+ const { level, node, content } = item;
63
+ // create new node for each item
64
+ const text = (0, exports.getContentForToc)(node) || ' '; // ' ' needs to avoid lack of L<>
65
+ //TODO: getNodeId should use ctx of node, but using {} instead
66
+ const para = `L<${text}|#${(0, schema_1.getNodeId)(node, {})}>`;
67
+ const tocNode = processor(para)[0];
68
+ resultList.push((0, schema_1.mkTocItem)(tocNode));
69
+ if (Array.isArray(content) && content.length > 0) {
70
+ resultList.push(createList(content, level + 1));
71
+ }
72
+ ;
73
+ });
74
+ return (0, schema_1.mkTocList)(resultList, level);
75
+ };
76
+ const conf = (0, config_1.default)(node, ctx);
77
+ const tocTitle = conf.getFirstValue('title');
78
+ const makeToc = (tocTree, title) => {
79
+ return (0, schema_1.mkToc)(createList(tocTree.content, 1), title);
80
+ };
81
+ return makeToc(tocTree, tocTitle);
82
+ };
83
+ },
84
+ });
85
+ exports.default = exports.plugin;
package/package.json ADDED
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "@podlite/toc",
3
+ "version": "0.0.1",
4
+ "description": "Table of contents",
5
+ "main": "index.js",
6
+ "types": "./lib/index.d.ts",
7
+ "license": "MIT",
8
+ "scripts": {
9
+ "clean": "rm -rf dist lib tsconfig.tsbuildinfo",
10
+ "build": "tsc",
11
+ "test": "yarn g:jest --passWithNoTests"
12
+ },
13
+ "publishConfig": {
14
+ "access": "public",
15
+ "main": "index.js",
16
+ "types": "./lib/index.d.ts"
17
+ },
18
+ "devDependencies": {
19
+ "@podlite/to-jsx": "0.0.8",
20
+ "@types/node": "^16.11.9",
21
+ "@types/react": "^16.x",
22
+ "@types/react-dom": "^16.x",
23
+ "podlite": "0.0.12",
24
+ "typescript": "4.5.4"
25
+ },
26
+ "peerDependencies": {
27
+ "react": "*"
28
+ },
29
+ "dependencies": {
30
+ "@podlite/schema": "0.0.7",
31
+ "pod6": "0.0.43",
32
+ "react": "^16.12.0",
33
+ "react-dom": "^16.12.0",
34
+ "react-is": "^17.0.2"
35
+ }
36
+ }
package/src/helpers.ts ADDED
@@ -0,0 +1,119 @@
1
+ import { getFromTree, getNodeId, getTextContentFromNode } from "@podlite/schema"
2
+ import makeTransformer from 'pod6/built/helpers/makeTransformer'
3
+
4
+ export const prepareDataForToc = (data: any[]) => {
5
+
6
+ const isSemanticBlock = ( node ) => {
7
+ const name = node.name || ''
8
+ const isTypeBlock = ( node.type || '') === 'block'
9
+ return isTypeBlock && name === name.toUpperCase()
10
+ }
11
+ const reduceLevel = (arr) =>{
12
+ return arr.reduce((i,c)=>{
13
+ return (i.includes(c) ? [...i] : [...i,c]).sort((a,b)=>a-b)
14
+ },[])
15
+
16
+ }
17
+ const normalizeLevels = (data) => {
18
+ const namesLevels = {}
19
+ for ( const node of data ) {
20
+ if ( isSemanticBlock(node) ) {
21
+ const level = 1
22
+ node.level = level
23
+ namesLevels['head'] = reduceLevel([ ...(namesLevels['head'] || []) ,1 ])
24
+
25
+ } else {
26
+ // TODO: eliminate string level (=item)
27
+ // default level is 1 for all items
28
+ namesLevels[node.name] = reduceLevel([...(namesLevels[node.name] || []), parseInt(node.level,10) || 1 ])
29
+ }
30
+ }
31
+ return namesLevels
32
+ }
33
+ const levelsMap = normalizeLevels(data)
34
+ const tocTree = [
35
+ [ -1, { item: 'toc', level:0 , node:{} } ]
36
+ ];
37
+ /**
38
+ // find nearest by level
39
+ const tocTree = [
40
+ [ -1, { item: 'toc', level:0 } ],
41
+ [ 0, { item: 'head', level:1 } ],
42
+ [ 1, { item: 'head2', level:2 } ],
43
+ [ 0, { item: 'head', level:1 } ],
44
+ [ 3, { item: 'item2', level:3 } ],
45
+ ];
46
+ const sq = getIndexByLevel(tocTree, 4)
47
+ */
48
+ const getRootIndexByLevel = (tocTree, level) => {
49
+ return tocTree.length - tocTree.slice().reverse().findIndex(e => e[1].level < level) -1
50
+ }
51
+ let currentLevel = 1
52
+ // prepare normilized data
53
+ for (let i = 0; i < data.length; i++) {
54
+ const item = data[i]
55
+ // deafult level is 1 for all items
56
+ const normalizedLevel:number = levelsMap[item.name].findIndex(l => l === parseInt(item.level || 1)) +1
57
+ switch (item.name) {
58
+ case 'head': {
59
+ const parent = getRootIndexByLevel(tocTree, normalizedLevel)
60
+ tocTree.push([parent, {item:item.name,level:normalizedLevel, node:item }])
61
+ if (currentLevel != normalizedLevel) {
62
+ currentLevel = normalizedLevel
63
+ }
64
+ }
65
+ break;
66
+ default: {
67
+ const newlevel = currentLevel + normalizedLevel
68
+ const parent = getRootIndexByLevel(tocTree, newlevel)
69
+ tocTree.push([parent, {item:item.name, level:newlevel, node:item }])
70
+ }
71
+ break;
72
+ }
73
+ }
74
+ //Turns given flat arr into a tree and returns root..
75
+ //(Assumes that no child is declared before parent)
76
+ function makeTree(arr){
77
+ //Array with all the children elements set correctly..
78
+ var treeArr = new Array(arr.length);
79
+
80
+ for(var i = 0, len = arr.length; i < len; i++){
81
+ var arrI = arr[i];
82
+ var newNode = treeArr[i] = {
83
+ type: arrI[1].item,
84
+ level: arrI[1].level,
85
+ node: arrI[1].node,
86
+ content: []
87
+ };
88
+ var parentI = arrI[0];
89
+ if(parentI > -1){ //i.e. not the root..
90
+ treeArr[parentI].content.push(newNode);
91
+ }
92
+ }
93
+ return treeArr[0]; //return the root..
94
+ }
95
+ return makeTree(tocTree)
96
+ }
97
+
98
+ export const getTocPod = (tocTree: any, tocTitle = "Table of contents"):string => {
99
+ let blocks = []
100
+ const rules = {
101
+ ":toc": (node,_, visiter)=>{
102
+ blocks.push(`=head1 ${tocTitle}`)
103
+ visiter(node.content)
104
+ },
105
+ ":head": (node,ctx, visiter)=>{
106
+ const id = getNodeId(node.node, ctx)
107
+ blocks.push(`=item${node.level} L<${getTextContentFromNode(node.node).trim()} ${id ? `|#${id}`:''}>`)
108
+ visiter(node.content)
109
+ },
110
+ ":item": (node,_, visiter)=>{
111
+ blocks.push(`=item${node.level} ${getTextContentFromNode(node.node).trim()}`)
112
+ visiter(node.content)
113
+ },
114
+ }
115
+ const transformer = makeTransformer(rules)
116
+ const res = transformer(tocTree, {})
117
+ return blocks.join('\n')
118
+ }
119
+
package/src/index.tsx ADDED
@@ -0,0 +1,83 @@
1
+ import React from 'react'
2
+ import {Plugin, Location, mkBlock, PodliteDocument, getFromTree, getTextContentFromNode, mkItemBlock, mkTocItem, mkTocList, mkToc, TocList, Toc, getNodeId, BlockImage} from '@podlite/schema'
3
+ import { getTocPod, prepareDataForToc } from './helpers';
4
+ import makeAttrs from 'pod6/built/helpers/config'
5
+ import { isNamedBlock } from 'pod6/built/helpers/makeTransformer';
6
+ import { PodNode } from '@podlite/schema';
7
+ export const getContentForToc = (node: PodNode): string => {
8
+ if (typeof node !== "string" && "type" in node) {
9
+ if ( node.type === 'block') {
10
+ const conf = makeAttrs(node, {})
11
+ if (isNamedBlock(node.name)) {
12
+ const caption = ((conf, nodeName)=>{
13
+ if ( conf.exists('caption') ) {
14
+ return conf.getFirstValue('caption')
15
+ } else
16
+ if ( conf.exists('title') ) {
17
+ return conf.getFirstValue('title')
18
+ } else {
19
+ // try to find content child node
20
+ const [captionNode] = getFromTree(node, 'caption')
21
+ if (captionNode) {
22
+ return getTextContentFromNode(captionNode)
23
+ }
24
+ }
25
+ return `${nodeName} not have :caption`
26
+ })(conf, node.name)
27
+ return caption
28
+ }
29
+ if (node.name == 'image') {
30
+ const caption = getTextContentFromNode(conf.getFirstValue('caption'))
31
+ return caption || 'image not have caption'
32
+ }
33
+ if (node.name == 'table') {
34
+ const caption = getTextContentFromNode(conf.getFirstValue('caption'))
35
+ return caption || 'table not have :caption'
36
+ }
37
+ return getTextContentFromNode(node);
38
+ }
39
+ }
40
+ return 'Not supported toc element';
41
+ }
42
+ export const plugin:Plugin =({
43
+ toAstAfter:(writer, processor, fulltree) => {
44
+ return (node,ctx) => {
45
+ const content = getTextContentFromNode(node)
46
+ const blocks:Array<any> = content.trim().split(/(?:\s*,\s*|\s+)/)
47
+ .filter(Boolean)
48
+ if ( blocks.length == 0 ) {
49
+ blocks.push({name:'head'})
50
+ }
51
+ const nodes = getFromTree(fulltree, ...blocks)
52
+ const tocTree = prepareDataForToc(nodes)
53
+ const createList = (items:any[], level):TocList=>{
54
+ const resultList = []
55
+ items.map(item => {
56
+ const {level, node, content} = item
57
+ // create new node for each item
58
+ const text = getContentForToc(node) || ' ' // ' ' needs to avoid lack of L<>
59
+ //TODO: getNodeId should use ctx of node, but using {} instead
60
+ const para = `L<${text}|#${getNodeId(node,{})}>`
61
+ const tocNode = processor(para)[0];
62
+ resultList.push(mkTocItem(tocNode))
63
+ if ( Array.isArray(content) && content.length > 0) {
64
+ resultList.push(createList( content,level + 1) )
65
+ };
66
+ })
67
+ return mkTocList(resultList, level)
68
+ }
69
+ const conf = makeAttrs(node, ctx)
70
+ const tocTitle = conf.getFirstValue('title')
71
+ const makeToc = (tocTree: any, title):Toc => {
72
+
73
+ return mkToc(createList(tocTree.content, 1), title)
74
+ }
75
+
76
+ return makeToc(tocTree, tocTitle)
77
+ }
78
+ },
79
+
80
+ })
81
+ export default plugin
82
+
83
+
@@ -0,0 +1,63 @@
1
+ // import { getFromTree } from "@podlite/schema";
2
+ import makeTransformer, { isNamedBlock } from 'pod6/built/helpers/makeTransformer'
3
+ import {getFromTree, getTextContentFromNode, mkNode, mkToc, mkTocItem, mkTocList, PodliteDocument, PodNode, Toc, TocItem, TocList, makeInterator} from '@podlite/schema'
4
+ import {prepareDataForToc} from '../src/helpers'
5
+ import { podlite as podlite_core } from "podlite";
6
+ import {plugin} from '../src/index';
7
+ import makeAttrs from 'pod6/built/helpers/config';
8
+ export const parse = (str: string): PodliteDocument => {
9
+ let podlite = podlite_core({ importPlugins: true }).use({
10
+ // Toc: plugin,
11
+ });
12
+ let tree = podlite.parse(str);
13
+ const asAst = podlite.toAstResult(tree);
14
+ return asAst.interator;
15
+ };
16
+
17
+ const pod = `
18
+ =for Image :id(1)
19
+ https://example.com.image.png
20
+ test B<test>
21
+
22
+ `;
23
+ const tr1 = [{"text":"captionss for B<image>\n","type":"para","margin":"","content":["captionss for ",{"content":["image"],"type":"fcode","name":"B"},"\n"],"location":{"start":{"offset":0,"line":1,"column":1},"end":{"offset":23,"line":2,"column":1}}}]
24
+ const tree = parse(pod);
25
+ const caption = getFromTree(tree, 'caption');
26
+ const res = getTextContentFromNode(tr1);
27
+ console.log(JSON.stringify(res, null, 2))
28
+ // getTextContentFromNode
29
+
30
+ // const pod = `=for Toc :title<Table of Media>
31
+ // Image Diagram
32
+ // =for Image :caption<Image caption> :id(1)
33
+ // https://example.com.image.png
34
+ // =for Diagram :caption<Diagram caption> :id(2)
35
+ // User content
36
+ // `;
37
+ // const getContentForToc = (node: PodNode): string => {
38
+ // if (node.type === 'block') {
39
+ // if (isNamedBlock(node.name)) {
40
+ // const conf = makeAttrs(node, {})
41
+ // const caption = ((conf, nodeName)=>{
42
+ // if ( conf.exists('caption') ) {
43
+ // return conf.getFirstValue('caption')
44
+ // } else
45
+ // if ( conf.exists('title') ) {
46
+ // return conf.getFirstValue('title')
47
+ // }
48
+ // return `${nodeName} not have :caption`
49
+ // })(conf, node.name)
50
+ // return caption
51
+ // }
52
+ // return getTextContentFromNode(node.content[0]);
53
+ // }
54
+ // node.type
55
+ // return '';
56
+ // }
57
+ // const tree = parse(pod);
58
+ // // console.log(JSON.stringify(tree, null, 2))
59
+ // const toc = getFromTree(tree, 'Diagram');
60
+ // const title = getContentForToc(toc[0])
61
+ // title
62
+ // console.log(JSON.stringify(toc, null, 2))
63
+
@@ -0,0 +1,238 @@
1
+ import {
2
+ getFromTree,
3
+ PodliteDocument,
4
+ validatePodliteAst,
5
+ } from "@podlite/schema";
6
+ import { podlite as podlite_core } from "podlite";
7
+ import { plugin } from "../src/index";
8
+ import Image from "@podlite/image";
9
+ import { frozenIds } from "podlite/src";
10
+
11
+ export const parse = (str: string): PodliteDocument => {
12
+ let podlite = podlite_core({ importPlugins: false }).use({
13
+ Toc: plugin,
14
+ });
15
+ let tree = podlite.parse(str);
16
+ const asAst = podlite.toAstResult(tree);
17
+ return asAst.interator;
18
+ };
19
+
20
+ export const parseImage = (str: string): PodliteDocument => {
21
+ let podlite = podlite_core({ importPlugins: false }).use({
22
+ Toc: plugin,
23
+ Image,
24
+ });
25
+ let tree = podlite.parse(str);
26
+ const asAst = podlite.toAstResult(tree);
27
+ return asAst.interator;
28
+ };
29
+
30
+ const parseToHtml = (str: string): string => {
31
+ let podlite = podlite_core({ importPlugins: false }).use({
32
+ Toc: plugin,
33
+ Image,
34
+ });
35
+ let tree = podlite.parse(str);
36
+ const asAst = podlite.toAst(frozenIds()(tree));
37
+ return podlite.toHtml(asAst).toString();
38
+ };
39
+
40
+ const pod = `
41
+ =begin pod
42
+ =Toc head1 head3 item item2
43
+ =head2 test2
44
+ =end pod`;
45
+ // =head1 test1 I<test> L<ddd | test >
46
+
47
+ it("=Toc: toAst", () => {
48
+ const p = parse(pod);
49
+ // try to validate Formal AST
50
+ const r = validatePodliteAst(p);
51
+ expect(r).toEqual([]);
52
+ });
53
+
54
+ it("=para: parse to html", () => {
55
+ const pod = `=para head1 head3 item item2`;
56
+ expect(parseToHtml(pod)).toMatchInlineSnapshot(`
57
+ <p>
58
+ head1 head3 item item2
59
+ </p>
60
+ `);
61
+ });
62
+
63
+ it("=Toc: parse to html", () => {
64
+ const pod = `=Toc head1 head3 item item2`;
65
+ expect(parseToHtml(pod)).toMatchInlineSnapshot(`
66
+ <div classname="toc">
67
+ <ul class="toc-list listlevel1">
68
+ </ul>
69
+ </div>
70
+ `);
71
+ });
72
+
73
+ it("=Toc: head1 head2", () => {
74
+ const pod = `=Toc head1 head2
75
+ =for head1 :id<123>
76
+ Test head1
77
+ `;
78
+ expect(parseToHtml(pod)).toMatchInlineSnapshot(`
79
+ <div classname="toc">
80
+ <ul class="toc-list listlevel1">
81
+ <li class="toc-item">
82
+ <p>
83
+ <a href="#123">
84
+ Test head1
85
+ </a>
86
+ </p>
87
+ </li>
88
+ </ul>
89
+ </div>
90
+ <h1 id="123">
91
+ Test head1
92
+ </h1>
93
+ `);
94
+ });
95
+
96
+ it("[check default list]=Toc", () => {
97
+ const pod = `=Toc
98
+ =head1 head
99
+ =head2 head
100
+ =head3 head
101
+ =head4 head
102
+ =head5 head
103
+ =head6 head
104
+ `;
105
+ expect(parseToHtml(pod)).toMatchInlineSnapshot(`
106
+ <div classname="toc">
107
+ <ul class="toc-list listlevel1">
108
+ <li class="toc-item">
109
+ <p>
110
+ <a href="#id">
111
+ head
112
+ </a>
113
+ </p>
114
+ </li>
115
+ <ul class="toc-list listlevel2">
116
+ <li class="toc-item">
117
+ <p>
118
+ <a href="#id">
119
+ head
120
+ </a>
121
+ </p>
122
+ </li>
123
+ <ul class="toc-list listlevel3">
124
+ <li class="toc-item">
125
+ <p>
126
+ <a href="#id">
127
+ head
128
+ </a>
129
+ </p>
130
+ </li>
131
+ <ul class="toc-list listlevel4">
132
+ <li class="toc-item">
133
+ <p>
134
+ <a href="#id">
135
+ head
136
+ </a>
137
+ </p>
138
+ </li>
139
+ <ul class="toc-list listlevel5">
140
+ <li class="toc-item">
141
+ <p>
142
+ <a href="#id">
143
+ head
144
+ </a>
145
+ </p>
146
+ </li>
147
+ <ul class="toc-list listlevel6">
148
+ <li class="toc-item">
149
+ <p>
150
+ <a href="#id">
151
+ head
152
+ </a>
153
+ </p>
154
+ </li>
155
+ </ul>
156
+ </ul>
157
+ </ul>
158
+ </ul>
159
+ </ul>
160
+ </ul>
161
+ </div>
162
+ <h1 id="id">
163
+ head
164
+ </h1>
165
+ <h2 id="id">
166
+ head
167
+ </h2>
168
+ <h3 id="id">
169
+ head
170
+ </h3>
171
+ <h4 id="id">
172
+ head
173
+ </h4>
174
+ <h5 id="id">
175
+ head
176
+ </h5>
177
+ <h6 id="id">
178
+ head
179
+ </h6>
180
+ `);
181
+ });
182
+ it.skip("=Toc Image Diagram1", () => {
183
+ const pod = `=for Toc :title<Table of Media>
184
+ Image Diagram
185
+ =for Image :caption<Image caption> :id(1)
186
+ https://example.com.image.png
187
+ =Image https://example.com.image.png
188
+
189
+ =for Diagram :caption<Diagram caption> :id(2)
190
+ User content
191
+ `;
192
+ const nodes = getFromTree(parseImage(pod), ":image");
193
+ console.log(JSON.stringify(nodes, null, 2));
194
+ console.log(parseToHtml(nodes));
195
+ // expect(parseToHtml(pod)).toMatchInlineSnapshot()
196
+ });
197
+
198
+ it("=Toc Image Diagram", () => {
199
+ const pod = `=for Toc :title<Table of Media>
200
+ Image Diagram
201
+ =for Image :caption<Image caption> :id(1)
202
+ https://example.com.image.png
203
+ =for Diagram :caption<Diagram caption> :id(2)
204
+ User content
205
+ `;
206
+ expect(parseToHtml(pod)).toMatchInlineSnapshot(`
207
+ <div classname="toc">
208
+ <ul class="toc-list listlevel1">
209
+ <li class="toc-item">
210
+ <p>
211
+ <a href="#1">
212
+ Image caption
213
+ </a>
214
+ </p>
215
+ </li>
216
+ <li class="toc-item">
217
+ <p>
218
+ <a href="#2">
219
+ Diagram caption
220
+ </a>
221
+ </p>
222
+ </li>
223
+ </ul>
224
+ </div>
225
+ <div class="image_block"
226
+ id="1"
227
+ >
228
+ <img src="https://example.com.image.png"
229
+ alt="undefined"
230
+ >
231
+ <div class="caption">
232
+ <p>
233
+ Image caption
234
+ </p>
235
+ </div>
236
+ </div>
237
+ `);
238
+ });
package/tsconfig.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "extends": "../core/tsconfig.json",
3
+ "include": ["src/**/*"],
4
+ "compilerOptions": {
5
+ "outDir": "./lib",
6
+ "rootDir": "./src",
7
+ "baseUrl": ".",
8
+ "jsx": "react"
9
+ },
10
+ "references": [
11
+ {
12
+ "path": "../core"
13
+ },
14
+ {
15
+ "path": "../podlite-schema"
16
+ }
17
+ ]
18
+ }
@@ -0,0 +1 @@
1
+ {"program":{"fileNames":["../../node_modules/typescript/lib/lib.es5.d.ts","../../node_modules/typescript/lib/lib.es2015.d.ts","../../node_modules/typescript/lib/lib.es2016.d.ts","../../node_modules/typescript/lib/lib.es2017.d.ts","../../node_modules/typescript/lib/lib.es2018.d.ts","../../node_modules/typescript/lib/lib.es2019.d.ts","../../node_modules/typescript/lib/lib.es2020.d.ts","../../node_modules/typescript/lib/lib.dom.d.ts","../../node_modules/typescript/lib/lib.dom.iterable.d.ts","../../node_modules/typescript/lib/lib.webworker.importscripts.d.ts","../../node_modules/typescript/lib/lib.scripthost.d.ts","../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../node_modules/typescript/lib/lib.es2020.promise.d.ts","../../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2020.string.d.ts","../../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../node_modules/typescript/lib/lib.es2020.intl.d.ts","../../node_modules/typescript/lib/lib.esnext.intl.d.ts","../../node_modules/typescript/lib/lib.es2019.full.d.ts","../../node_modules/ajv/dist/compile/codegen/code.d.ts","../../node_modules/ajv/dist/compile/codegen/scope.d.ts","../../node_modules/ajv/dist/compile/codegen/index.d.ts","../../node_modules/ajv/dist/compile/rules.d.ts","../../node_modules/ajv/dist/compile/subschema.d.ts","../../node_modules/ajv/dist/compile/context.d.ts","../../node_modules/ajv/dist/compile/validate/datatype.d.ts","../../node_modules/ajv/dist/vocabularies/applicator/additionalitems.d.ts","../../node_modules/ajv/dist/vocabularies/applicator/contains.d.ts","../../node_modules/ajv/dist/vocabularies/applicator/dependencies.d.ts","../../node_modules/ajv/dist/vocabularies/applicator/propertynames.d.ts","../../node_modules/ajv/dist/vocabularies/applicator/additionalproperties.d.ts","../../node_modules/ajv/dist/vocabularies/applicator/not.d.ts","../../node_modules/ajv/dist/vocabularies/applicator/anyof.d.ts","../../node_modules/ajv/dist/vocabularies/applicator/oneof.d.ts","../../node_modules/ajv/dist/vocabularies/applicator/if.d.ts","../../node_modules/ajv/dist/vocabularies/applicator/index.d.ts","../../node_modules/ajv/dist/vocabularies/validation/limitnumber.d.ts","../../node_modules/ajv/dist/vocabularies/validation/multipleof.d.ts","../../node_modules/ajv/dist/vocabularies/validation/pattern.d.ts","../../node_modules/ajv/dist/vocabularies/validation/required.d.ts","../../node_modules/ajv/dist/vocabularies/validation/uniqueitems.d.ts","../../node_modules/ajv/dist/vocabularies/validation/const.d.ts","../../node_modules/ajv/dist/vocabularies/validation/enum.d.ts","../../node_modules/ajv/dist/vocabularies/validation/index.d.ts","../../node_modules/ajv/dist/vocabularies/format/format.d.ts","../../node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedproperties.d.ts","../../node_modules/ajv/dist/vocabularies/unevaluated/unevaluateditems.d.ts","../../node_modules/ajv/dist/vocabularies/validation/dependentrequired.d.ts","../../node_modules/ajv/dist/vocabularies/errors.d.ts","../../node_modules/ajv/dist/types/json-schema.d.ts","../../node_modules/ajv/dist/types/jtd-schema.d.ts","../../node_modules/ajv/dist/compile/error_classes.d.ts","../../node_modules/ajv/dist/core.d.ts","../../node_modules/uri-js/dist/es5/uri.all.d.ts","../../node_modules/ajv/dist/compile/resolve.d.ts","../../node_modules/ajv/dist/compile/index.d.ts","../../node_modules/ajv/dist/types/index.d.ts","../../node_modules/ajv/dist/ajv.d.ts","../podlite-schema/lib/types.d.ts","../podlite-schema/lib/blocks-helpers.d.ts","../podlite-schema/lib/query-helpers.d.ts","../podlite-schema/lib/ast-helpers.d.ts","../podlite-schema/lib/ast-inerator.d.ts","../podlite-schema/lib/index.d.ts","../../node_modules/pod6/built/helpers/maketransformer.d.ts","./src/helpers.ts","../../node_modules/@types/react/global.d.ts","../../node_modules/csstype/index.d.ts","../../node_modules/@types/prop-types/index.d.ts","../../node_modules/@types/scheduler/tracing.d.ts","../../node_modules/@types/react/index.d.ts","../../node_modules/pod6/built/helpers/config.d.ts","./src/index.tsx","./node_modules/@types/node/assert.d.ts","./node_modules/@types/node/assert/strict.d.ts","./node_modules/@types/node/globals.d.ts","./node_modules/@types/node/async_hooks.d.ts","./node_modules/@types/node/buffer.d.ts","./node_modules/@types/node/child_process.d.ts","./node_modules/@types/node/cluster.d.ts","./node_modules/@types/node/console.d.ts","./node_modules/@types/node/constants.d.ts","./node_modules/@types/node/crypto.d.ts","./node_modules/@types/node/dgram.d.ts","./node_modules/@types/node/diagnostics_channel.d.ts","./node_modules/@types/node/dns.d.ts","./node_modules/@types/node/dns/promises.d.ts","./node_modules/@types/node/domain.d.ts","./node_modules/@types/node/events.d.ts","./node_modules/@types/node/fs.d.ts","./node_modules/@types/node/fs/promises.d.ts","./node_modules/@types/node/http.d.ts","./node_modules/@types/node/http2.d.ts","./node_modules/@types/node/https.d.ts","./node_modules/@types/node/inspector.d.ts","./node_modules/@types/node/module.d.ts","./node_modules/@types/node/net.d.ts","./node_modules/@types/node/os.d.ts","./node_modules/@types/node/path.d.ts","./node_modules/@types/node/perf_hooks.d.ts","./node_modules/@types/node/process.d.ts","./node_modules/@types/node/punycode.d.ts","./node_modules/@types/node/querystring.d.ts","./node_modules/@types/node/readline.d.ts","./node_modules/@types/node/repl.d.ts","./node_modules/@types/node/stream.d.ts","./node_modules/@types/node/stream/promises.d.ts","./node_modules/@types/node/stream/consumers.d.ts","./node_modules/@types/node/stream/web.d.ts","./node_modules/@types/node/string_decoder.d.ts","./node_modules/@types/node/timers.d.ts","./node_modules/@types/node/timers/promises.d.ts","./node_modules/@types/node/tls.d.ts","./node_modules/@types/node/trace_events.d.ts","./node_modules/@types/node/tty.d.ts","./node_modules/@types/node/url.d.ts","./node_modules/@types/node/util.d.ts","./node_modules/@types/node/v8.d.ts","./node_modules/@types/node/vm.d.ts","./node_modules/@types/node/wasi.d.ts","./node_modules/@types/node/worker_threads.d.ts","./node_modules/@types/node/zlib.d.ts","./node_modules/@types/node/globals.global.d.ts","./node_modules/@types/node/index.d.ts","../../node_modules/@babel/types/lib/index.d.ts","../../node_modules/@types/babel__generator/index.d.ts","../../node_modules/@babel/parser/node_modules/@babel/types/lib/index.d.ts","../../node_modules/@babel/parser/typings/babel-parser.d.ts","../../node_modules/@types/babel__template/index.d.ts","../../node_modules/@types/babel__traverse/index.d.ts","../../node_modules/@types/babel__core/index.d.ts","../../node_modules/@types/graceful-fs/index.d.ts","../../node_modules/@types/istanbul-lib-coverage/index.d.ts","../../node_modules/@types/istanbul-lib-report/index.d.ts","../../node_modules/@types/istanbul-reports/index.d.ts","../../node_modules/@types/jest/node_modules/jest-diff/build/cleanupsemantic.d.ts","../../node_modules/@types/jest/node_modules/pretty-format/build/types.d.ts","../../node_modules/@types/jest/node_modules/pretty-format/build/index.d.ts","../../node_modules/@types/jest/node_modules/jest-diff/build/types.d.ts","../../node_modules/@types/jest/node_modules/jest-diff/build/difflines.d.ts","../../node_modules/@types/jest/node_modules/jest-diff/build/printdiffs.d.ts","../../node_modules/@types/jest/node_modules/jest-diff/build/index.d.ts","../../node_modules/@types/jest/index.d.ts","../../node_modules/@types/json-schema/index.d.ts","../../node_modules/@types/json5/index.d.ts","../../node_modules/@types/minimatch/index.d.ts","../../node_modules/@types/minimist/index.d.ts","../../node_modules/@types/normalize-package-data/index.d.ts","../../node_modules/@types/parse-json/index.d.ts","../../node_modules/@types/prettier/index.d.ts","../../node_modules/@types/react-dom/index.d.ts","../../node_modules/@types/scheduler/index.d.ts","../../node_modules/@types/stack-utils/index.d.ts","../../node_modules/@types/unist/index.d.ts","../../node_modules/@types/yargs-parser/index.d.ts","../../node_modules/@types/yargs/index.d.ts"],"fileInfos":[{"version":"89f78430e422a0f06d13019d60d5a45b37ec2d28e67eb647f73b1b0d19a46b72","affectsGlobalScope":true},"dc47c4fa66b9b9890cf076304de2a9c5201e94b740cffdf09f87296d877d71f6","7a387c58583dfca701b6c85e0adaf43fb17d590fb16d5b2dc0a2fbd89f35c467","8a12173c586e95f4433e0c6dc446bc88346be73ffe9ca6eec7aa63c8f3dca7f9","5f4e733ced4e129482ae2186aae29fde948ab7182844c3a5a51dd346182c7b06","e6b724280c694a9f588847f754198fb96c43d805f065c3a5b28bbc9594541c84","e21c071ca3e1b4a815d5f04a7475adcaeea5d64367e840dd0154096d705c3940",{"version":"abba1071bfd89e55e88a054b0c851ea3e8a494c340d0f3fab19eb18f6afb0c9e","affectsGlobalScope":true},{"version":"927cb2b60048e1395b183bf74b2b80a75bdb1dbe384e1d9fac654313ea2fb136","affectsGlobalScope":true},{"version":"7fac8cb5fc820bc2a59ae11ef1c5b38d3832c6d0dfaec5acdb5569137d09a481","affectsGlobalScope":true},{"version":"097a57355ded99c68e6df1b738990448e0bf170e606707df5a7c0481ff2427cd","affectsGlobalScope":true},{"version":"d8996609230d17e90484a2dd58f22668f9a05a3bfe00bfb1d6271171e54a31fb","affectsGlobalScope":true},{"version":"43fb1d932e4966a39a41b464a12a81899d9ae5f2c829063f5571b6b87e6d2f9c","affectsGlobalScope":true},{"version":"cdccba9a388c2ee3fd6ad4018c640a471a6c060e96f1232062223063b0a5ac6a","affectsGlobalScope":true},{"version":"4378fc8122ec9d1a685b01eb66c46f62aba6b239ca7228bb6483bcf8259ee493","affectsGlobalScope":true},{"version":"0d5f52b3174bee6edb81260ebcd792692c32c81fd55499d69531496f3f2b25e7","affectsGlobalScope":true},{"version":"810627a82ac06fb5166da5ada4159c4ec11978dfbb0805fe804c86406dab8357","affectsGlobalScope":true},{"version":"62d80405c46c3f4c527ee657ae9d43fda65a0bf582292429aea1e69144a522a6","affectsGlobalScope":true},{"version":"3013574108c36fd3aaca79764002b3717da09725a36a6fc02eac386593110f93","affectsGlobalScope":true},{"version":"75ec0bdd727d887f1b79ed6619412ea72ba3c81d92d0787ccb64bab18d261f14","affectsGlobalScope":true},{"version":"3be5a1453daa63e031d266bf342f3943603873d890ab8b9ada95e22389389006","affectsGlobalScope":true},{"version":"17bb1fc99591b00515502d264fa55dc8370c45c5298f4a5c2083557dccba5a2a","affectsGlobalScope":true},{"version":"7ce9f0bde3307ca1f944119f6365f2d776d281a393b576a18a2f2893a2d75c98","affectsGlobalScope":true},{"version":"6a6b173e739a6a99629a8594bfb294cc7329bfb7b227f12e1f7c11bc163b8577","affectsGlobalScope":true},{"version":"12a310447c5d23c7d0d5ca2af606e3bd08afda69100166730ab92c62999ebb9d","affectsGlobalScope":true},{"version":"b0124885ef82641903d232172577f2ceb5d3e60aed4da1153bab4221e1f6dd4e","affectsGlobalScope":true},{"version":"0eb85d6c590b0d577919a79e0084fa1744c1beba6fd0d4e951432fa1ede5510a","affectsGlobalScope":true},{"version":"da233fc1c8a377ba9e0bed690a73c290d843c2c3d23a7bd7ec5cd3d7d73ba1e0","affectsGlobalScope":true},{"version":"d154ea5bb7f7f9001ed9153e876b2d5b8f5c2bb9ec02b3ae0d239ec769f1f2ae","affectsGlobalScope":true},{"version":"bb2d3fb05a1d2ffbca947cc7cbc95d23e1d053d6595391bd325deb265a18d36c","affectsGlobalScope":true},{"version":"c80df75850fea5caa2afe43b9949338ce4e2de086f91713e9af1a06f973872b8","affectsGlobalScope":true},{"version":"9d57b2b5d15838ed094aa9ff1299eecef40b190722eb619bac4616657a05f951","affectsGlobalScope":true},{"version":"6c51b5dd26a2c31dbf37f00cfc32b2aa6a92e19c995aefb5b97a3a64f1ac99de","affectsGlobalScope":true},{"version":"6e7997ef61de3132e4d4b2250e75343f487903ddf5370e7ce33cf1b9db9a63ed","affectsGlobalScope":true},{"version":"2ad234885a4240522efccd77de6c7d99eecf9b4de0914adb9a35c0c22433f993","affectsGlobalScope":true},{"version":"1b3fe904465430e030c93239a348f05e1be80640d91f2f004c3512c2c2c89f34","affectsGlobalScope":true},{"version":"3787b83e297de7c315d55d4a7c546ae28e5f6c0a361b7a1dcec1f1f50a54ef11","affectsGlobalScope":true},{"version":"e7e8e1d368290e9295ef18ca23f405cf40d5456fa9f20db6373a61ca45f75f40","affectsGlobalScope":true},{"version":"faf0221ae0465363c842ce6aa8a0cbda5d9296940a8e26c86e04cc4081eea21e","affectsGlobalScope":true},{"version":"06393d13ea207a1bfe08ec8d7be562549c5e2da8983f2ee074e00002629d1871","affectsGlobalScope":true},{"version":"d071129cba6a5f2700be09c86c07ad2791ab67d4e5ed1eb301d6746c62745ea4","affectsGlobalScope":true},{"version":"10bbdc1981b8d9310ee75bfac28ee0477bb2353e8529da8cff7cb26c409cb5e8","affectsGlobalScope":true},"1f03b495671c3a1bd24510f38b8947f0991dfd6bf0278c68eca14af15b306e1f","2274b0f0e4f20a1af3309985337bd8a7f45610145db3c37485ea8697c0778eda","60bb0e47502bf8716d1230288b4e6387c1d34cded12752ab5338108e2e662e67","b250a278297e209148e3ee53c5f27b773a351618b0a0c5b8fe0397d2fbd08576","b3ae4ded82f27cabba780b9af9647f6e08c9a4cabe8fbb7a0cca69c7add9ef4b","b57d661f8123e266307b11fbf08ec29363f84f482622f99e42cf3fdf94059255","726416fd6b5f6d16c91fe5f2dee9ac722bceddd8f8e5d0fc9c3399c7c2efd9b1","1a23b521db8d7ec9e2b96c6fbd4c7e96d12f408b1e03661b3b9f7da7291103e6","1c68c3020dfada02f9e9671c7c13fb7adea15118f3acc2d21f02a7b3c632482c","ae0951e44973e928fe2e999b11960493835d094b16adac0b085a79cff181bcb9","9e8575c515e21e1b51ab7eb78cfd763ec857cfd7b4f985a4f394f9ea8c0ac36d","1609ad4d488c356ee91eba7d7aa87cc6fb59bc8ac05c1a8f08665285ba3b71ad","8add088f72326098d68d622ddb024c00ae56a912383efe96b03f0481db88f7c9","dd17fe6332567b8f13e33dd3ff8926553cdcea2ad32d4350ce0063a2addaa764","4091d56a4622480549350b8811ec64c7826cd41a70ce5d9c1cc20384bb144049","353c0125b9e50c2a71e18394d46be5ccb37161cc0f0e7c69216aa6932c8cdafb","9c5d5f167e86b6ddf7142559a17d13fd39c34e868ae947c40381db866eed6609","6539823527c9349664b239204197757434e287e9ef7c2c29afaad10a79f3348a","aae698ceead4edad0695b9ea87e43f274e698bdb302c8cb5fd2cab4dc496ccf0","51631e9a0c041e12479ab01f5801d8a237327d19e9ee37d5f1f66be912631425","c9d5d8adb1455f49182751ce885745dcc5f9697e9c260388bc3ae9d1860d5d10","f64289e3fa8d5719eaf5ba1bb02dd32dbbf7c603dda75c16770a6bc6e9c6b6d9","b1aa0e2e3511a8d10990f35866405c64c9e576258ef99eeb9ebafed980fd7506","2d255a5287f2fb5295688cb25bd18e1cd59866179f795f3f1fd6b71b7f0edf8f","43c1dbb78d5277a5fdd8fddce8b257f84ffa2b4253f58b95c04a310710d19e97","6c669d7e080344c1574aa276a89e57c3b9f0e97fab96a09427e7dfb19ca261bf","b71ac126853867d8e64c910f47d46d05c5ea797987d2604f63d401507dc43b6d","9a37238558d28b7ee06d08599e92eab30b90704541cc85e6448009d6d55fffa9","120b14d66a061910309ff97e7b06b5c6c09444218178b80b687a92af4d22d5dc","3de958065e3a44cbe0bfa667813bc59c63e63c9ce522af8dc1b64714910fa9ba","4dbd5a4e8c71e60af9af1d38d1ac5f6eedef3591afb556ed164f169061706f15","5db5754073f92ef99fef159a3415a733db507af67126b287daa51553cb9107d2","ac162509239b1a48ab6aa39a3fc34dd7d8cde209c59188f699b3ef78964165e0","44fa175d725f678ed47ee3cbaf2fcdf688559e672352ac24c721dd9ceef7d7c1","9556b6427e049169448398e1e59fb393e4de91852abda84dd569d0e7b038e641","9f3c5498245c38c9016a369795ec5ef1768d09db63643c8dba9656e5ab294825","8f35095ce6914b0e95d563adae6f2546dddd8f85c4034d9050530076d860b5b8","893edbff0dcaf7c4ef650c24cfcf87e6ad63d3e0457f7524d5706f8599e7bac3","06f6c325a4cec7589a46fb8c335b4da840b125bf20d514411fead13478b008b9","a3b6fafae3db815903c6ee13b8c77a43a89fba98fabf263a254f015b388cf190","d81220988a7f97fece26e808c7779fd97f7f424f723f7db1fab74786a912333b","b657fb93161f0d16f051b37f47c6ff64307866c9f346ad88cb034507f78848f9","b30fdd8d44300d4ace7f2de31e97ed7f310035978a4fd0f92c66631788f29215","6fa804112d574737638af24d452f3e4bed1a390b1dc6599a3036c6917a4d4418","16eea98e8cae4cf865f5102513430ed361c16973d431f6c3b77db95ad3493902","bfbd1bc7798f7171950d73a74e497dd045f662d73caab9de34b2a6f35e1e84a9","0b69226aac5cce5a2a9d25f95dea7986caf4d36952cabb6eb8b660219daf9356","d8fdf148e33da856cb03684e11e00fd745204469fc019dd4fdd2d8fd25838f3e",{"version":"ecf78e637f710f340ec08d5d92b3f31b134a46a4fcf2e758690d8c46ce62cba6","affectsGlobalScope":true},"381899b8d1d4c1be716f18cb5242ba39f66f4b1e31d45af62a32a99f8edcb39d","f7b46d22a307739c145e5fddf537818038fdfffd580d79ed717f4d4d37249380","f5a8b384f182b3851cec3596ccc96cb7464f8d3469f48c74bf2befb782a19de5",{"version":"9e3199a1f11557e3a2d89230e811bd006c9f42730058c031212b312383c98cea","affectsGlobalScope":true},"578ada4c8488a001c33301a3f4050ce7c567ffe942adaf52925026786046da5a","61f6258c5e8cfa801fcb6d5eed624a9a0b8a6ac2e3fe477d3638f2388d2a3682","0d5a2ee1fdfa82740e0103389b9efd6bfe145a20018a2da3c02b89666181f4d9","a69c09dbea52352f479d3e7ac949fde3d17b195abe90b045d619f747b38d6d1a",{"version":"92d63add669d18ebc349efbacd88966d6f2ccdddfb1b880b2db98ae3aa7bf7c4","affectsGlobalScope":true},"ccc94049a9841fe47abe5baef6be9a38fc6228807974ae675fb15dc22531b4be",{"version":"9acfe4d1ff027015151ce81d60797b04b52bffe97ad8310bb0ec2e8fd61e1303","affectsGlobalScope":true},"95843d5cfafced8f3f8a5ce57d2335f0bcd361b9483587d12a25e4bd403b8216","afc6e96061af46bcff47246158caee7e056f5288783f2d83d6858cd25be1c565",{"version":"34f5bcac12b36d70304b73de5f5aab3bb91bd9919f984be80579ebcad03a624e","affectsGlobalScope":true},"82408ed3e959ddc60d3e9904481b5a8dc16469928257af22a3f7d1a3bc7fd8c4","2f520601649a893e6a49a8851ebfcf4be8ce090dc1281c2a08a871cb04e8251f","f50c975ab7b50e25a69e3d8a3773894125b44e9698924105f23b812bf7488baf","2b8c764f856a1dd0a9a2bf23e5efddbff157de8138b0754010be561ae5fcaa90","76650408392bf49a8fbf3e2b6b302712a92d76af77b06e2da1cc8077359c4409","0af3121e68297b2247dd331c0d24dba599e50736a7517a5622d5591aae4a3122","6972fca26f6e9bd56197568d4379f99071a90766e06b4fcb5920a0130a9202be",{"version":"4a2628e95962c8ab756121faa3ac2ed348112ff7a87b5c286dd2cc3326546b4c","affectsGlobalScope":true},"6dfd135b38ab97c536d9c966fc5a5a879a19c6ed75c2c9633902be1ef0945ff7","a049a59a02009fc023684fcfaf0ac526fe36c35dcc5d2b7d620c1750ba11b083","5533392c50c51b1a5c32b89f13145db929c574ef1c5949cf67a074a05ea107d9","b287b810b5035d5685f1df6e1e418f1ca452a3ed4f59fd5cc081dbf2045f0d9b","4b9a003b5c556c96784132945bb41c655ea11273b1917f5c8d0c154dd5fd20dd","a458dc78104cc80048ac24fdc02fe6dce254838094c2f25641b3f954d9721241",{"version":"e8b18c6385ff784228a6f369694fcf1a6b475355ba89090a88de13587a9391d5","affectsGlobalScope":true},"902cd98bf46e95caf4118a0733fb801e9e90eec3edaed6abdad77124afec9ca2","abc1c425b2ad6720433f40f1877abfa4223f0f3dd486c9c28c492179ca183cb6","cd4854d38f4eb5592afd98ab95ca17389a7dfe38013d9079e802d739bdbcc939","94eed4cc2f5f658d5e229ff1ccd38860bddf4233e347bf78edd2154dee1f2b99",{"version":"bd1a08e30569b0fb2f0b21035eb9b039871f68faa9b98accf847e9c878c5e0a9","affectsGlobalScope":true},"9f1069b9e2c051737b1f9b4f1baf50e4a63385a6a89c32235549ae87fc3d5492","ee18f2da7a037c6ceeb112a084e485aead9ea166980bf433474559eac1b46553","29c2706fa0cc49a2bd90c83234da33d08bb9554ecec675e91c1f85087f5a5324","0acbf26bf958f9e80c1ffa587b74749d2697b75b484062d36e103c137c562bc3","d7838022c7dab596357a9604b9c6adffe37dc34085ce0779c958ce9545bd7139","1b952304137851e45bc009785de89ada562d9376177c97e37702e39e60c2f1ff",{"version":"806ef4cac3b3d9fa4a48d849c8e084d7c72fcd7b16d76e06049a9ed742ff79c0","affectsGlobalScope":true},"a279435e7813d1f061c0cab6ab77b1b9377e8d96851e5ed4a76a1ce6eb6e628f","c33a6ea7147af60d8e98f1ac127047f4b0d4e2ce28b8f08ff3de07ca7cc00637",{"version":"b42b47e17b8ece2424ae8039feb944c2e3ba4b262986aebd582e51efbdca93dc","affectsGlobalScope":true},"664d8f2d59164f2e08c543981453893bc7e003e4dfd29651ce09db13e9457980","2408611d9b4146e35d1dbd1f443ccd8e187c74614a54b80300728277529dbf11","998a3de5237518c0b3ac00a11b3b4417affb008aa20aedee52f3fdae3cb86151","ad41008ffe077206e1811fc873f4d9005b5fd7f6ab52bb6118fef600815a5cb4","d88ecca73348e7c337541c4b8b60a50aca5e87384f6b8a422fc6603c637e4c21","badae0df9a8016ac36994b0a0e7b82ba6aaa3528e175a8c3cb161e4683eec03e","c3db860bcaaaeb3bbc23f353bbda1f8ab82756c8d5e973bebb3953cb09ea68f2","235a53595bd20b0b0eeb1a29cb2887c67c48375e92f03749b2488fbd46d0b1a0","bc09393cd4cd13f69cf1366d4236fbae5359bb550f0de4e15767e9a91d63dfb1","9c266243b01545e11d2733a55ad02b4c00ecdbda99c561cd1674f96e89cdc958","c71155c05fc76ff948a4759abc1cb9feec036509f500174bc18dad4c7827a60c",{"version":"ab9b9a36e5284fd8d3bf2f7d5fcbc60052f25f27e4d20954782099282c60d23e","affectsGlobalScope":true},"1cdb8f094b969dcc183745dc88404e2d8fcf2a858c6e7cc2441011476573238e","b668b7fb7c52a05fb9233a27ba5099a73cd8e157b037d67399336635495ab483","b25c5f2970d06c729f464c0aeaa64b1a5b5f1355aa93554bb5f9c199b8624b1e","272c2dac4baaf7fdd2d7efeef0fa2547af54cc21883c5e138b8c4d1661697a54","069733dc220affbe58d9c1d1a93af3707bc515aaed761701d8741b57da4cb964","3051751533eee92572241b3cef28333212401408c4e7aa21718714b793c0f4ed","691aea9772797ca98334eb743e7686e29325b02c6931391bcee4cc7bf27a9f3b","6f1d39d26959517da3bd105c552eded4c34702705c64d75b03f54d864b6e41c2","3ebae8c00411116a66fca65b08228ea0cf0b72724701f9b854442100aab55aba","de18acda71730bac52f4b256ce7511bb56cc21f6f114c59c46782eff2f632857","7eb06594824ada538b1d8b48c3925a83e7db792f47a081a62cf3e5c4e23cf0ee","905c3e8f7ddaa6c391b60c05b2f4c3931d7127ad717a080359db3df510b7bdab","d8aab31ba8e618cc3eea10b0945de81cb93b7e8150a013a482332263b9305322","462bccdf75fcafc1ae8c30400c9425e1a4681db5d605d1a0edb4f990a54d8094","5923d8facbac6ecf7c84739a5c701a57af94a6f6648d6229a6c768cf28f0f8cb","7adecb2c3238794c378d336a8182d4c3dd2c4fa6fa1785e2797a3db550edea62","dc12dc0e5aa06f4e1a7692149b78f89116af823b9e1f1e4eae140cd3e0e674e6","1bfc6565b90c8771615cd8cfcf9b36efc0275e5e83ac7d9181307e96eb495161","8a8a96898906f065f296665e411f51010b51372fa260d5373bf9f64356703190",{"version":"6ff2ca51e2c9d88d6d904c481879b12ec0cad2a69b88e220859a52207444773b","affectsGlobalScope":true},"0359682c54e487c4cab2b53b2b4d35cc8dea4d9914bc6abcdb5701f8b8e745a4","96d14f21b7652903852eef49379d04dbda28c16ed36468f8c9fa08f7c14c9538","95c22bc19835e28e2e524a4bb8898eb5f2107b640d7279a6d3aade261916bbf2","e437d83044ba17246a861aa9691aa14223ff4a9d6f338ab1269c41c758586a88","c9ad058b2cc9ce6dc2ed92960d6d009e8c04bef46d3f5312283debca6869f613","2b8264b2fefd7367e0f20e2c04eed5d3038831fe00f5efbc110ff0131aab899b","08b428a44bc98005536a12456518797e9afe2a08e8b5d9785641713a54475881","c45d6f4d3a20be54e46237608f537a8d85397f87b9c3318d68ed925c2f1d0b51","74b0245c42990ed8a849df955db3f4362c81b13f799ebc981b7bec2d5b414a57","c6c4fea9acc55d5e38ff2b70d57ab0b5cdbd08f8bc5d7a226e322cea128c5b57","cddf5c26907c0b8378bc05543161c11637b830da9fadf59e02a11e675d11e180","3bdd93ec24853e61bfa4c63ebaa425ff3e474156e87a47d90122e1d8cc717c1f","5a2a25feca554a8f289ed62114771b8c63d89f2b58325e2f8b7043e4e0160d11"],"options":{"composite":true,"declaration":true,"esModuleInterop":true,"jsx":2,"module":1,"outDir":"./lib","rootDir":"./src","target":6},"fileIdsList":[[141],[141,151],[141,149,150,152,153,154],[141,149],[141,149,152],[114,141,148],[141,157],[141,158],[141,162,166],[141,160,163],[141,160,163,164,165],[141,162],[141,161],[95,141],[91,92,93,94,141],[141,179],[46,47,49,73,74,77,80,81,141],[44,45,141],[44,141],[46,47,48,80,81,141],[81,141],[46,47,77,79,81,141],[78,81,82,141],[46,47,80,81,141],[46,47,49,73,74,75,76,80,81,141],[46,47,49,77,80,141],[49,81,141],[51,52,53,54,55,56,57,58,59,81,141],[50,60,68,69,70,71,72,141],[53,81,141],[61,62,63,64,65,66,67,81,141],[83,141],[82,83,84,85,86,87,141],[98,141],[101,141],[102,107,141],[103,113,114,121,130,140,141],[103,104,113,121,141],[105,141],[106,107,114,122,141],[107,130,137,141],[108,110,113,121,141],[109,141],[110,111,141],[112,113,141],[113,141],[113,114,115,130,140,141],[113,114,115,130,141],[116,121,130,140,141],[113,114,116,117,121,130,137,140,141],[116,118,130,137,140,141],[98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147],[113,119,141],[120,140,141],[110,113,121,130,141],[122,141],[123,141],[101,124,141],[125,139,141,145],[126,141],[127,141],[113,128,141],[128,129,141,143],[113,130,131,132,141],[130,132,141],[130,131,141],[133,141],[134,141],[113,135,136,141],[135,136,141],[107,121,137,141],[138,141],[121,139,141],[102,116,127,140,141],[107,141],[130,141,142],[141,143],[141,144],[102,107,113,115,124,130,140,141,143,145],[130,141,146],[88,89,141],[88,89,90,95,96,141]],"referencedMap":[[151,1],[152,2],[149,1],[155,3],[150,4],[153,5],[154,4],[156,6],[157,1],[158,7],[159,8],[167,9],[160,1],[164,10],[166,11],[165,10],[163,12],[162,13],[161,1],[168,1],[169,1],[170,1],[171,1],[172,1],[173,1],[174,1],[93,1],[175,14],[91,1],[95,15],[176,1],[94,1],[177,1],[178,1],[179,1],[180,16],[82,17],[44,1],[46,18],[45,19],[49,20],[76,21],[80,22],[79,23],[47,21],[48,24],[50,24],[77,25],[81,26],[74,1],[75,1],[51,21],[55,21],[57,21],[52,21],[53,27],[59,21],[60,28],[56,21],[58,21],[54,21],[73,29],[69,21],[71,21],[70,21],[66,21],[72,30],[67,21],[68,31],[61,21],[62,21],[63,21],[64,21],[65,21],[92,1],[96,1],[89,1],[8,1],[9,1],[13,1],[12,1],[2,1],[14,1],[15,1],[16,1],[17,1],[18,1],[19,1],[20,1],[21,1],[3,1],[4,1],[25,1],[22,1],[23,1],[24,1],[26,1],[27,1],[28,1],[5,1],[29,1],[30,1],[31,1],[32,1],[6,1],[43,1],[33,1],[34,1],[35,1],[36,1],[7,1],[41,1],[37,1],[38,1],[39,1],[40,1],[1,1],[42,1],[11,1],[10,1],[78,1],[86,1],[87,1],[84,32],[88,33],[85,1],[83,1],[98,34],[99,34],[101,35],[102,36],[103,37],[104,38],[105,39],[106,40],[107,41],[108,42],[109,43],[110,44],[111,44],[112,45],[113,46],[114,47],[115,48],[100,1],[147,1],[116,49],[117,50],[118,51],[148,52],[119,53],[120,54],[121,55],[122,56],[123,57],[124,58],[125,59],[126,60],[127,61],[128,62],[129,63],[130,64],[132,65],[131,66],[133,67],[134,68],[135,69],[136,70],[137,71],[138,72],[139,73],[140,74],[141,75],[142,76],[143,77],[144,78],[145,79],[146,80],[90,81],[97,82]],"exportedModulesMap":[[151,1],[152,2],[149,1],[155,3],[150,4],[153,5],[154,4],[156,6],[157,1],[158,7],[159,8],[167,9],[160,1],[164,10],[166,11],[165,10],[163,12],[162,13],[161,1],[168,1],[169,1],[170,1],[171,1],[172,1],[173,1],[174,1],[93,1],[175,14],[91,1],[95,15],[176,1],[94,1],[177,1],[178,1],[179,1],[180,16],[82,17],[44,1],[46,18],[45,19],[49,20],[76,21],[80,22],[79,23],[47,21],[48,24],[50,24],[77,25],[81,26],[74,1],[75,1],[51,21],[55,21],[57,21],[52,21],[53,27],[59,21],[60,28],[56,21],[58,21],[54,21],[73,29],[69,21],[71,21],[70,21],[66,21],[72,30],[67,21],[68,31],[61,21],[62,21],[63,21],[64,21],[65,21],[92,1],[96,1],[89,1],[8,1],[9,1],[13,1],[12,1],[2,1],[14,1],[15,1],[16,1],[17,1],[18,1],[19,1],[20,1],[21,1],[3,1],[4,1],[25,1],[22,1],[23,1],[24,1],[26,1],[27,1],[28,1],[5,1],[29,1],[30,1],[31,1],[32,1],[6,1],[43,1],[33,1],[34,1],[35,1],[36,1],[7,1],[41,1],[37,1],[38,1],[39,1],[40,1],[1,1],[42,1],[11,1],[10,1],[78,1],[86,1],[87,1],[84,32],[88,33],[85,1],[83,1],[98,34],[99,34],[101,35],[102,36],[103,37],[104,38],[105,39],[106,40],[107,41],[108,42],[109,43],[110,44],[111,44],[112,45],[113,46],[114,47],[115,48],[100,1],[147,1],[116,49],[117,50],[118,51],[148,52],[119,53],[120,54],[121,55],[122,56],[123,57],[124,58],[125,59],[126,60],[127,61],[128,62],[129,63],[130,64],[132,65],[131,66],[133,67],[134,68],[135,69],[136,70],[137,71],[138,72],[139,73],[140,74],[141,75],[142,76],[143,77],[144,78],[145,79],[146,80],[90,81],[97,82]],"semanticDiagnosticsPerFile":[151,152,149,155,150,153,154,156,157,158,159,167,160,164,166,165,163,162,161,168,169,170,171,172,173,174,93,175,91,95,176,94,177,178,179,180,82,44,46,45,49,76,80,79,47,48,50,77,81,74,75,51,55,57,52,53,59,60,56,58,54,73,69,71,70,66,72,67,68,61,62,63,64,65,92,96,89,8,9,13,12,2,14,15,16,17,18,19,20,21,3,4,25,22,23,24,26,27,28,5,29,30,31,32,6,43,33,34,35,36,7,41,37,38,39,40,1,42,11,10,78,86,87,84,88,85,83,98,99,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,100,147,116,117,118,148,119,120,121,122,123,124,125,126,127,128,129,130,132,131,133,134,135,136,137,138,139,140,141,142,143,144,145,146,90,97]},"version":"4.5.4"}