New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@progfay/scrapbox-parser

Package Overview
Dependencies
Maintainers
1
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@progfay/scrapbox-parser - npm Package Compare versions

Comparing version 7.0.2 to 7.1.0

2

esm/block/CodeBlock.js
export const convertToCodeBlock = (pack) => {
const { rows: [head, ...body] } = pack;
const { indent, text } = head;
const { indent = 0, text = '' } = head !== null && head !== void 0 ? head : {};
const fileName = text.replace(/^\s*code:/, '');

@@ -5,0 +5,0 @@ return {

import { createNodeParser } from './creator';
const commandLineRegExp = /^[$%] .+$/;
const createCommandLineNode = (raw) => {
const symbol = raw[0];
var _a;
const symbol = (_a = raw[0]) !== null && _a !== void 0 ? _a : '';
const text = raw.substring(2);

@@ -6,0 +7,0 @@ return {

import { convertToNodes } from '.';
export const createNodeParser = (nodeCreator, { parseOnNested, parseOnQuoted, patterns }) => {
return (text, opts, next) => {
var _a, _b, _c;
var _a, _b, _c, _d, _e, _f;
if (!parseOnNested && opts.nested)

@@ -14,4 +14,4 @@ return (_a = next === null || next === void 0 ? void 0 : next()) !== null && _a !== void 0 ? _a : [];

const left = text.substring(0, match.index);
const right = text.substring(match.index + match[0].length);
const node = nodeCreator(match[0], opts);
const right = text.substring(match.index + ((_d = (_c = match[0]) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0));
const node = nodeCreator((_e = match[0]) !== null && _e !== void 0 ? _e : '', opts);
return [

@@ -23,5 +23,5 @@ ...convertToNodes(left, opts),

}
return (_c = next === null || next === void 0 ? void 0 : next()) !== null && _c !== void 0 ? _c : [];
return (_f = next === null || next === void 0 ? void 0 : next()) !== null && _f !== void 0 ? _f : [];
};
};
//# sourceMappingURL=creator.js.map
import { createNodeParser } from './creator';
import { convertToNodes } from '.';
const decorationRegExp = /\[[!"#%&'()*+,-./{|}<>_~]+ (?:\[[^[\]]+\]|[^\]])+\]/;
const decorationRegExp = /\[[!"#%&'()*+,\-./{|}<>_~]+ (?:\[[^[\]]+\]|[^\]])+\]/;
const createDecorationNode = (raw, opts) => {

@@ -5,0 +5,0 @@ const separatorIndex = raw.indexOf(' ');

import { createNodeParser } from './creator';
const hrefFirstUrlRegExp = /\[https?:\/\/[^\s\]]+(?:\s+[^[\]]*[^\s])?\]/;
const hrefFirstUrlRegExp = /\[https?:\/\/[^\s\]]+\s+[^\]]*[^\s]\]/;
const contentFirstUrlRegExp = /\[[^[\]]*[^\s]\s+https?:\/\/[^\s\]]+\]/;
const httpRegExp = /(?<=^| )https?:\/\/[^[\s\]]+/;
const bracketedUrlRegExp = /\[https?:\/\/[^\s\]]+\]/;
const httpRegExp = /https?:\/\/[^\s]+/;
const createExternalLinkNode = raw => {

@@ -9,6 +10,7 @@ const inner = raw.startsWith('[') && raw.endsWith(']') ? raw.substring(1, raw.length - 1) : raw;

const match = (isHrefFirst ? /^https?:\/\/[^\s\]]+/ : /https?:\/\/[^\s\]]+$/).exec(inner);
if (match === null) {
if ((match === null || match === void 0 ? void 0 : match[0]) === undefined)
return [];
}
const c = isHrefFirst ? inner.substring(match[0].length) : inner.substring(0, match.index - 1);
const content = isHrefFirst
? inner.substring(match[0].length)
: inner.substring(0, match.index - 1);
return {

@@ -19,3 +21,3 @@ type: 'link',

href: match[0],
content: c.trim()
content: content.trim()
};

@@ -26,4 +28,4 @@ };

parseOnQuoted: true,
patterns: [hrefFirstUrlRegExp, contentFirstUrlRegExp, httpRegExp]
patterns: [hrefFirstUrlRegExp, contentFirstUrlRegExp, bracketedUrlRegExp, httpRegExp]
});
//# sourceMappingURL=ExternalLinkNode.js.map

@@ -5,3 +5,3 @@ import { createNodeParser } from './creator';

const parseCoordinate = format => {
const [lat, lng, z] = format.split(',');
const [lat = '', lng = '', z = ''] = format.split(',');
const latitude = parseFloat(lat.replace(/^N/, '').replace(/^S/, '-'));

@@ -18,3 +18,3 @@ const longitude = parseFloat(lng.replace(/^E/, '').replace(/^W/, '-'));

const isCoordFirst = raw.startsWith('[N') || raw.startsWith('[S');
const [, coord, place = ''] = isCoordFirst ? match : [match[0], match[2], match[1]];
const [, coord = '', place = ''] = isCoordFirst ? match : [match[0], match[2], match[1]];
const { latitude, longitude, zoom } = parseCoordinate(coord);

@@ -21,0 +21,0 @@ const url = place !== ''

import { createNodeParser } from './creator';
const hashTagRegExp = /(?<=^| )#\S+/;
const createHashTagNode = raw => ({
type: 'hashTag',
raw,
href: raw.substring(1)
});
const hashTagRegExp = /(?:^|\s)#\S+/;
const createHashTagNode = raw => {
if (raw.startsWith('#')) {
return {
type: 'hashTag',
raw,
href: raw.substring(1)
};
}
const space = raw.substring(0, 1);
const tag = raw.substring(1);
return [
{
type: 'plain',
raw: space,
text: space
},
{
type: 'hashTag',
raw: tag,
href: tag.substring(1)
}
];
};
export const HashTagNodeParser = createNodeParser(createHashTagNode, {

@@ -9,0 +27,0 @@ parseOnNested: false,

import type { ParserOption } from '../parse';
import type { CodeBlockPack } from './CodeBlock';
import type { LinePack } from './Line';
import type { Row } from './Row';
import type { TablePack } from './Table';
import type { TitlePack } from './Title';
import type { CodeBlockPack } from './CodeBlock';
import type { TablePack } from './Table';
import type { LinePack } from './Line';
export declare type Pack = TitlePack | CodeBlockPack | TablePack | LinePack;
export declare const packRows: (rows: Row[], opts: ParserOption) => Pack[];
//# sourceMappingURL=Pack.d.ts.map

@@ -1,5 +0,6 @@

const isChildRowOfPack = (pack, row) => (pack.type === 'codeBlock' || pack.type === 'table') && row.indent > pack.rows[0].indent;
const isChildRowOfPack = (pack, row) => { var _a, _b; return (pack.type === 'codeBlock' || pack.type === 'table') && row.indent > ((_b = (_a = pack.rows[0]) === null || _a === void 0 ? void 0 : _a.indent) !== null && _b !== void 0 ? _b : 0); };
const packing = (packs, row) => {
if (packs.length > 0 && isChildRowOfPack(packs[packs.length - 1], row)) {
packs[packs.length - 1].rows.push(row);
const lastPack = packs[packs.length - 1];
if (lastPack !== undefined && isChildRowOfPack(lastPack, row)) {
lastPack.rows.push(row);
return packs;

@@ -17,2 +18,4 @@ }

const [title, ...body] = rows;
if (title === undefined)
return [];
return [

@@ -23,3 +26,3 @@ {

},
...packRows(body, { hasTitle: false })
...body.reduce(packing, [])
];

@@ -26,0 +29,0 @@ }

export const parseToRows = (input) => input.split('\n').map(text => {
var _a, _b;
var _a, _b, _c;
return ({
indent: (_b = (_a = /^\s+/.exec(text)) === null || _a === void 0 ? void 0 : _a[0].length) !== null && _b !== void 0 ? _b : 0,
indent: (_c = (_b = (_a = /^\s+/.exec(text)) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.length) !== null && _c !== void 0 ? _c : 0,
text

@@ -6,0 +6,0 @@ });

import { convertToNodes } from './node';
export const convertToTable = (pack) => {
const { rows: [head, ...body] } = pack;
const { indent, text } = head;
const { indent = 0, text = '' } = head !== null && head !== void 0 ? head : {};
const fileName = text.replace(/^\s*table:/, '');

@@ -6,0 +6,0 @@ return {

@@ -11,5 +11,6 @@ import { convertToBlock } from './block';

export const getTitle = (input) => {
const match = /^\s*\S.*\s*$/m.exec(input);
return match !== null ? match[0].trim() : 'Untitled';
var _a, _b;
const match = /^\s*\S.*$/m.exec(input);
return (_b = (_a = match === null || match === void 0 ? void 0 : match[0]) === null || _a === void 0 ? void 0 : _a.trim()) !== null && _b !== void 0 ? _b : 'Untitled';
};
//# sourceMappingURL=parse.js.map

@@ -6,3 +6,3 @@ "use strict";

const { rows: [head, ...body] } = pack;
const { indent, text } = head;
const { indent = 0, text = '' } = head !== null && head !== void 0 ? head : {};
const fileName = text.replace(/^\s*code:/, '');

@@ -9,0 +9,0 @@ return {

@@ -7,3 +7,4 @@ "use strict";

const createCommandLineNode = (raw) => {
const symbol = raw[0];
var _a;
const symbol = (_a = raw[0]) !== null && _a !== void 0 ? _a : '';
const text = raw.substring(2);

@@ -10,0 +11,0 @@ return {

@@ -7,3 +7,3 @@ "use strict";

return (text, opts, next) => {
var _a, _b, _c;
var _a, _b, _c, _d, _e, _f;
if (!parseOnNested && opts.nested)

@@ -18,4 +18,4 @@ return (_a = next === null || next === void 0 ? void 0 : next()) !== null && _a !== void 0 ? _a : [];

const left = text.substring(0, match.index);
const right = text.substring(match.index + match[0].length);
const node = nodeCreator(match[0], opts);
const right = text.substring(match.index + ((_d = (_c = match[0]) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0));
const node = nodeCreator((_e = match[0]) !== null && _e !== void 0 ? _e : '', opts);
return [

@@ -27,3 +27,3 @@ ..._1.convertToNodes(left, opts),

}
return (_c = next === null || next === void 0 ? void 0 : next()) !== null && _c !== void 0 ? _c : [];
return (_f = next === null || next === void 0 ? void 0 : next()) !== null && _f !== void 0 ? _f : [];
};

@@ -30,0 +30,0 @@ };

@@ -6,3 +6,3 @@ "use strict";

const _1 = require(".");
const decorationRegExp = /\[[!"#%&'()*+,-./{|}<>_~]+ (?:\[[^[\]]+\]|[^\]])+\]/;
const decorationRegExp = /\[[!"#%&'()*+,\-./{|}<>_~]+ (?:\[[^[\]]+\]|[^\]])+\]/;
const createDecorationNode = (raw, opts) => {

@@ -9,0 +9,0 @@ const separatorIndex = raw.indexOf(' ');

@@ -5,5 +5,6 @@ "use strict";

const creator_1 = require("./creator");
const hrefFirstUrlRegExp = /\[https?:\/\/[^\s\]]+(?:\s+[^[\]]*[^\s])?\]/;
const hrefFirstUrlRegExp = /\[https?:\/\/[^\s\]]+\s+[^\]]*[^\s]\]/;
const contentFirstUrlRegExp = /\[[^[\]]*[^\s]\s+https?:\/\/[^\s\]]+\]/;
const httpRegExp = /(?<=^| )https?:\/\/[^[\s\]]+/;
const bracketedUrlRegExp = /\[https?:\/\/[^\s\]]+\]/;
const httpRegExp = /https?:\/\/[^\s]+/;
const createExternalLinkNode = raw => {

@@ -13,6 +14,7 @@ const inner = raw.startsWith('[') && raw.endsWith(']') ? raw.substring(1, raw.length - 1) : raw;

const match = (isHrefFirst ? /^https?:\/\/[^\s\]]+/ : /https?:\/\/[^\s\]]+$/).exec(inner);
if (match === null) {
if ((match === null || match === void 0 ? void 0 : match[0]) === undefined)
return [];
}
const c = isHrefFirst ? inner.substring(match[0].length) : inner.substring(0, match.index - 1);
const content = isHrefFirst
? inner.substring(match[0].length)
: inner.substring(0, match.index - 1);
return {

@@ -23,3 +25,3 @@ type: 'link',

href: match[0],
content: c.trim()
content: content.trim()
};

@@ -30,4 +32,4 @@ };

parseOnQuoted: true,
patterns: [hrefFirstUrlRegExp, contentFirstUrlRegExp, httpRegExp]
patterns: [hrefFirstUrlRegExp, contentFirstUrlRegExp, bracketedUrlRegExp, httpRegExp]
});
//# sourceMappingURL=ExternalLinkNode.js.map

@@ -8,3 +8,3 @@ "use strict";

const parseCoordinate = format => {
const [lat, lng, z] = format.split(',');
const [lat = '', lng = '', z = ''] = format.split(',');
const latitude = parseFloat(lat.replace(/^N/, '').replace(/^S/, '-'));

@@ -21,3 +21,3 @@ const longitude = parseFloat(lng.replace(/^E/, '').replace(/^W/, '-'));

const isCoordFirst = raw.startsWith('[N') || raw.startsWith('[S');
const [, coord, place = ''] = isCoordFirst ? match : [match[0], match[2], match[1]];
const [, coord = '', place = ''] = isCoordFirst ? match : [match[0], match[2], match[1]];
const { latitude, longitude, zoom } = parseCoordinate(coord);

@@ -24,0 +24,0 @@ const url = place !== ''

@@ -5,8 +5,26 @@ "use strict";

const creator_1 = require("./creator");
const hashTagRegExp = /(?<=^| )#\S+/;
const createHashTagNode = raw => ({
type: 'hashTag',
raw,
href: raw.substring(1)
});
const hashTagRegExp = /(?:^|\s)#\S+/;
const createHashTagNode = raw => {
if (raw.startsWith('#')) {
return {
type: 'hashTag',
raw,
href: raw.substring(1)
};
}
const space = raw.substring(0, 1);
const tag = raw.substring(1);
return [
{
type: 'plain',
raw: space,
text: space
},
{
type: 'hashTag',
raw: tag,
href: tag.substring(1)
}
];
};
exports.HashTagNodeParser = creator_1.createNodeParser(createHashTagNode, {

@@ -13,0 +31,0 @@ parseOnNested: false,

import type { ParserOption } from '../parse';
import type { CodeBlockPack } from './CodeBlock';
import type { LinePack } from './Line';
import type { Row } from './Row';
import type { TablePack } from './Table';
import type { TitlePack } from './Title';
import type { CodeBlockPack } from './CodeBlock';
import type { TablePack } from './Table';
import type { LinePack } from './Line';
export declare type Pack = TitlePack | CodeBlockPack | TablePack | LinePack;
export declare const packRows: (rows: Row[], opts: ParserOption) => Pack[];
//# sourceMappingURL=Pack.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.packRows = void 0;
const isChildRowOfPack = (pack, row) => (pack.type === 'codeBlock' || pack.type === 'table') && row.indent > pack.rows[0].indent;
const isChildRowOfPack = (pack, row) => { var _a, _b; return (pack.type === 'codeBlock' || pack.type === 'table') && row.indent > ((_b = (_a = pack.rows[0]) === null || _a === void 0 ? void 0 : _a.indent) !== null && _b !== void 0 ? _b : 0); };
const packing = (packs, row) => {
if (packs.length > 0 && isChildRowOfPack(packs[packs.length - 1], row)) {
packs[packs.length - 1].rows.push(row);
const lastPack = packs[packs.length - 1];
if (lastPack !== undefined && isChildRowOfPack(lastPack, row)) {
lastPack.rows.push(row);
return packs;

@@ -20,2 +21,4 @@ }

const [title, ...body] = rows;
if (title === undefined)
return [];
return [

@@ -26,3 +29,3 @@ {

},
...exports.packRows(body, { hasTitle: false })
...body.reduce(packing, [])
];

@@ -29,0 +32,0 @@ }

@@ -5,5 +5,5 @@ "use strict";

const parseToRows = (input) => input.split('\n').map(text => {
var _a, _b;
var _a, _b, _c;
return ({
indent: (_b = (_a = /^\s+/.exec(text)) === null || _a === void 0 ? void 0 : _a[0].length) !== null && _b !== void 0 ? _b : 0,
indent: (_c = (_b = (_a = /^\s+/.exec(text)) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.length) !== null && _c !== void 0 ? _c : 0,
text

@@ -10,0 +10,0 @@ });

@@ -7,3 +7,3 @@ "use strict";

const { rows: [head, ...body] } = pack;
const { indent, text } = head;
const { indent = 0, text = '' } = head !== null && head !== void 0 ? head : {};
const fileName = text.replace(/^\s*table:/, '');

@@ -10,0 +10,0 @@ return {

@@ -15,6 +15,7 @@ "use strict";

const getTitle = (input) => {
const match = /^\s*\S.*\s*$/m.exec(input);
return match !== null ? match[0].trim() : 'Untitled';
var _a, _b;
const match = /^\s*\S.*$/m.exec(input);
return (_b = (_a = match === null || match === void 0 ? void 0 : match[0]) === null || _a === void 0 ? void 0 : _a.trim()) !== null && _b !== void 0 ? _b : 'Untitled';
};
exports.getTitle = getTitle;
//# sourceMappingURL=parse.js.map
{
"name": "@progfay/scrapbox-parser",
"version": "7.0.2",
"version": "7.1.0",
"description": "parse Scrapbox notation to JavaScript Object",

@@ -23,3 +23,4 @@ "files": [

"test:update": "jest --updateSnapshot --no-cache",
"lint": "npm run lint:eslint && npm run lint:cspell",
"lint": "npm run lint:prettier && npm run lint:eslint && npm run lint:cspell",
"lint:prettier": "prettier --check .",
"lint:eslint": "eslint -c ./.eslintrc.js .",

@@ -44,32 +45,27 @@ "lint:cspell": "cspell --no-summary '**/*'",

"devDependencies": {
"@babel/core": "7.12.16",
"@babel/preset-env": "7.12.16",
"@babel/core": "7.14.0",
"@babel/preset-env": "7.14.1",
"@types/core-js": "2.5.4",
"@types/jest": "26.0.20",
"@types/node": "14.14.28",
"@typescript-eslint/eslint-plugin": "4.15.1",
"@typescript-eslint/parser": "4.15.1",
"@types/jest": "26.0.23",
"@types/node": "14.14.44",
"@typescript-eslint/eslint-plugin": "4.22.1",
"@typescript-eslint/parser": "4.22.1",
"babel-loader": "8.2.2",
"cspell": "5.2.4",
"eslint": "7.20.0",
"eslint-config-prettier": "7.2.0",
"eslint-config-prettier-standard": "4.0.0",
"eslint-config-standard": "16.0.2",
"eslint-config-standard-with-typescript": "20.0.0",
"cspell": "5.4.0",
"eslint": "7.25.0",
"eslint-config-prettier": "8.3.0",
"eslint-plugin-import": "2.22.1",
"eslint-plugin-jest": "24.1.5",
"eslint-plugin-jest": "24.3.6",
"eslint-plugin-node": "11.1.0",
"eslint-plugin-prettier": "3.3.1",
"eslint-plugin-promise": "4.3.1",
"eslint-plugin-standard": "4.1.0",
"eslint-plugin-prettier": "3.4.0",
"eslint-plugin-promise": "5.1.0",
"jest": "26.6.3",
"jest-snapshot": "26.6.2",
"prettier": "2.2.1",
"prettier-config-standard": "4.0.0",
"rimraf": "3.0.2",
"ts-jest": "26.5.1",
"ts-loader": "8.0.17",
"typescript": "4.1.5",
"webpack": "5.22.0",
"webpack-cli": "4.5.0"
"ts-jest": "26.5.6",
"ts-loader": "9.1.2",
"typescript": "4.2.4",
"webpack": "5.36.2",
"webpack-cli": "4.6.0"
},

@@ -76,0 +72,0 @@ "publishConfig": {

# Scrapbox Parser
[![MIT License](http://img.shields.io/badge/license-MIT-blue.svg?style=for-the-badge&color=AC1500&labelColor=222222)](LICENSE)
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg?style=for-the-badge&labelColor=222222)](https://standardjs.com)
[![npm version](https://img.shields.io/npm/v/@progfay/scrapbox-parser?style=for-the-badge&message=NPM&color=CB3837&logo=NPM&labelColor=222222&label=npm)](https://www.npmjs.com/package/@progfay/scrapbox-parser)

@@ -6,0 +5,0 @@ [![Build Status](https://img.shields.io/travis/progfay/scrapbox-parser?style=for-the-badge&message=Travis+CI&color=3EAAAF&logo=Travis+CI&labelColor=222222&logoColor=FFFFFF)](https://travis-ci.org/progfay/scrapbox-parser)

@@ -1,1 +0,1 @@

!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.ScrapboxParser=e():t.ScrapboxParser=e()}(self,(function(){return(()=>{"use strict";var t={d:(e,r)=>{for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};function r(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function n(t){return function(t){if(Array.isArray(t))return a(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||o(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(t,e){if(t){if("string"==typeof t)return a(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?a(t,e):void 0}}function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}t.r(e),t.d(e,{convertToBlock:()=>B,getTitle:()=>J,packRows:()=>G,parse:()=>H,parseToRows:()=>R});var i=function(t,e){var r=e.parseOnNested,a=e.parseOnQuoted,i=e.patterns;return function(e,s,u){var c,l,p;if(!r&&s.nested)return null!==(c=null==u?void 0:u())&&void 0!==c?c:[];if(!a&&s.quoted)return null!==(l=null==u?void 0:u())&&void 0!==l?l:[];var f,d=function(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=o(t))){r&&(t=r);var n=0,a=function(){};return{s:a,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,s=!0,u=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return s=t.done,t},e:function(t){u=!0,i=t},f:function(){try{s||null==r.return||r.return()}finally{if(u)throw i}}}}(i);try{for(d.s();!(f=d.n()).done;){var y=f.value.exec(e);if(null!==y){var b=e.substring(0,y.index),g=e.substring(y.index+y[0].length),h=t(y[0],s);return[].concat(n(C(b,s)),n(Array.isArray(h)?h:[h]),n(C(g,s)))}}}catch(t){d.e(t)}finally{d.f()}return null!==(p=null==u?void 0:u())&&void 0!==p?p:[]}};function s(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function u(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?s(Object(r),!0).forEach((function(e){c(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):s(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function c(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var l=i((function(t,e){return{type:"quote",raw:t,nodes:C(t.substring(1),u(u({},e),{},{quoted:!0}))}}),{parseOnNested:!1,parseOnQuoted:!1,patterns:[/^>.*$/]}),p=i((function(t){return{type:"helpfeel",raw:t,text:t.substring(2)}}),{parseOnNested:!1,parseOnQuoted:!1,patterns:[/^\? .+$/]}),f=i((function(t){var e=t.substring(2,t.length-2);return{type:"strongImage",raw:t,src:/^https?:\/\/([0-9a-z-]\.)?gyazo\.com\/[0-9a-f]{32}$/.test(e)?"".concat(e,"/thumb/1000"):e}}),{parseOnNested:!1,parseOnQuoted:!0,patterns:[/\[\[https?:\/\/[^\s\]]+\.(?:png|jpe?g|gif|svg)\]\]/i,/\[\[https?:\/\/(?:[0-9a-z-]+\.)?gyazo\.com\/[0-9a-f]{32}\]\]/]});function d(t){return function(e){var r="icon"===t?e.substring(1,e.length-1):e.substring(2,e.length-2),n=r.lastIndexOf(".icon"),o=r.substring(0,n),a=o.startsWith("/")?"root":"relative",i=r.substring(n+5,r.length),s=i.startsWith("*")?parseInt(i.substring(1),10):1;return new Array(s).fill({}).map((function(){return{path:o,pathType:a,type:t,raw:e}}))}}var y=i(d("icon"),{parseOnNested:!1,parseOnQuoted:!0,patterns:[/\[[^[\]]*\.icon(?:\*[1-9]\d*)?\]/]}),b=i(d("strongIcon"),{parseOnNested:!1,parseOnQuoted:!0,patterns:[/\[\[[^[\]]*\.icon(?:\*\d+)?\]\]/]});function g(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function h(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?g(Object(r),!0).forEach((function(e){m(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):g(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function m(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var v=i((function(t,e){return{type:"strong",raw:t,nodes:C(t.substring(2,t.length-2),h(h({},e),{},{nested:!0}))}}),{parseOnNested:!1,parseOnQuoted:!0,patterns:[/\[\[(?:[^[]|\[[^[]).*?\]*\]\]/]}),O=i((function(t){return{type:"formula",raw:t,formula:t.substring(3,t.length-(t.endsWith(" ]")?2:1))}}),{parseOnNested:!1,parseOnQuoted:!0,patterns:[/\[\$ .+? \]/,/\[\$ [^\]]+\]/]});function w(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function j(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?w(Object(r),!0).forEach((function(e){S(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):w(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function S(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var A=i((function(t,e){var r=t.indexOf(" "),n=t.substring(1,r),o=t.substring(r+1,t.length-1),a=new Set(n);if(a.has("*")){var i=n.split("*").length-1;a.delete("*"),a.add("*-".concat(Math.min(i,10)))}return{type:"decoration",raw:t,rawDecos:n,decos:Array.from(a),nodes:C(o,j(j({},e),{},{nested:!0}))}}),{parseOnNested:!1,parseOnQuoted:!0,patterns:[/\[[!"#%&'()*+,-./{|}<>_~]+ (?:\[[^[\]]+\]|[^\]])+\]/]}),x=i((function(t){return{type:"code",raw:t,text:t.substring(1,t.length-1)}}),{parseOnNested:!1,parseOnQuoted:!0,patterns:[/`.*?`/]}),P=i((function(t){var e=t[0],r=t.substring(2);return{type:"commandLine",raw:t,symbol:e,text:r}}),{parseOnNested:!1,parseOnQuoted:!1,patterns:[/^[$%] .+$/]}),I=i((function(t){return{type:"blank",raw:t,text:t.substring(1,t.length-1)}}),{parseOnNested:!1,parseOnQuoted:!0,patterns:[/\[\s+\]/]});function N(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var T=i((function(t){var e,r,n,o=t.search(/\s/),a=-1!==o?t.substring(1,o):t.substring(1,t.length-1),i=-1!==o?t.substring(o,t.length-1).trimLeft():"",s=(r=/^https?:\/\/[^\s\]]+\.(png|jpe?g|gif|svg)(\?[^\]\s]+)?$/i.test(e=i)||function(t){return/^https?:\/\/([0-9a-z-]\.)?gyazo\.com\/[0-9a-f]{32}(\/raw)?$/.test(t)}(e)?[i,a]:[a,i],n=2,function(t){if(Array.isArray(t))return t}(r)||function(t,e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t)){var r=[],n=!0,o=!1,a=void 0;try{for(var i,s=t[Symbol.iterator]();!(n=(i=s.next()).done)&&(r.push(i.value),!e||r.length!==e);n=!0);}catch(t){o=!0,a=t}finally{try{n||null==s.return||s.return()}finally{if(o)throw a}}return r}}(r,n)||function(t,e){if(t){if("string"==typeof t)return N(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?N(t,e):void 0}}(r,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),u=s[0],c=s[1];return{type:"image",raw:t,src:/^https?:\/\/([0-9a-z-]\.)?gyazo\.com\/[0-9a-f]{32}$/.test(u)?"".concat(u,"/thumb/1000"):u,link:c}}),{parseOnNested:!0,parseOnQuoted:!0,patterns:[/\[https?:\/\/[^\s\]]+\.(?:png|jpe?g|gif|svg)(?:\?[^\]\s]+)?(?:\s+https?:\/\/[^\s\]]+)?\]/i,/\[https?:\/\/[^\s\]]+\s+https?:\/\/[^\s\]]+\.(?:png|jpe?g|gif|svg)(?:\?[^\]\s]+)?\]/i,/\[https?:\/\/(?:[0-9a-z-]+\.)?gyazo\.com\/[0-9a-f]{32}(?:\/raw)?(?:\s+https?:\/\/[^\s\]]+)?\]/,/\[https?:\/\/[^\s\]]+\s+https?:\/\/(?:[0-9a-z-]+\.)?gyazo\.com\/[0-9a-f]{32}(?:\/raw)?\]/]}),$=i((function(t){var e=t.startsWith("[")&&t.endsWith("]")?t.substring(1,t.length-1):t,r=/^https?:\/\/[^\s\]]/.test(e),n=(r?/^https?:\/\/[^\s\]]+/:/https?:\/\/[^\s\]]+$/).exec(e);if(null===n)return[];var o=r?e.substring(n[0].length):e.substring(0,n.index-1);return{type:"link",raw:t,pathType:"absolute",href:n[0],content:o.trim()}}),{parseOnNested:!0,parseOnQuoted:!0,patterns:[/\[https?:\/\/[^\s\]]+(?:\s+[^[\]]*[^\s])?\]/,/\[[^[\]]*[^\s]\s+https?:\/\/[^\s\]]+\]/,/(?<=^| )https?:\/\/[^[\s\]]+/]});function Q(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t)){var r=[],n=!0,o=!1,a=void 0;try{for(var i,s=t[Symbol.iterator]();!(n=(i=s.next()).done)&&(r.push(i.value),!e||r.length!==e);n=!0);}catch(t){o=!0,a=t}finally{try{n||null==s.return||s.return()}finally{if(o)throw a}}return r}}(t,e)||function(t,e){if(t){if("string"==typeof t)return z(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?z(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function z(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var E=/\[([^\]]*[^\s])\s+([NS]\d+(?:\.\d+)?,[EW]\d+(?:\.\d+)?(?:,Z\d+)?)\]/,k=/\[([NS]\d+(?:\.\d+)?,[EW]\d+(?:\.\d+)?(?:,Z\d+)?)(?:\s+([^\]]*[^\s]))?\]/,D=i((function(t){var e,r=null!==(e=t.match(E))&&void 0!==e?e:t.match(k);if(null===r)return[];var n,o,a,i,s=Q(t.startsWith("[N")||t.startsWith("[S")?r:[r[0],r[2],r[1]],3),u=s[1],c=s[2],l=void 0===c?"":c,p=(o=(n=Q(u.split(","),3))[0],a=n[1],i=n[2],{latitude:parseFloat(o.replace(/^N/,"").replace(/^S/,"-")),longitude:parseFloat(a.replace(/^E/,"").replace(/^W/,"-")),zoom:/^Z\d+$/.test(i)?parseInt(i.replace(/^Z/,""),10):14}),f=p.latitude,d=p.longitude,y=p.zoom;return{type:"googleMap",raw:t,latitude:f,longitude:d,zoom:y,place:l,url:""!==l?"https://www.google.com/maps/place/".concat(encodeURIComponent(l),"/@").concat(f,",").concat(d,",").concat(y,"z"):"https://www.google.com/maps/@".concat(f,",").concat(d,",").concat(y,"z")}}),{parseOnNested:!1,parseOnQuoted:!0,patterns:[E,k]}),W=i((function(t){var e=t.substring(1,t.length-1);return{type:"link",raw:t,pathType:e.startsWith("/")?"root":"relative",href:e,content:""}}),{parseOnNested:!0,parseOnQuoted:!0,patterns:[/\[\/?[^[\]]+\]/]}),M=i((function(t){return{type:"hashTag",raw:t,href:t.substring(1)}}),{parseOnNested:!1,parseOnQuoted:!0,patterns:[/(?<=^| )#\S+/]}),U=i((function(t){return{type:"plain",raw:t,text:t}}),{parseOnNested:!0,parseOnQuoted:!0,patterns:[/^()(.*)()$/]}),C=function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{nested:!1,quoted:!1};return e.reduceRight((function(e,n){return function(){return n(t,r,e)}}),(function(){return U(t,r)}))()}}((function(t,e,r){var n;return""===t?[]:null!==(n=null==r?void 0:r())&&void 0!==n?n:[]}),l,p,x,P,O,I,A,f,b,v,T,$,y,D,W,M);function q(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var B=function(t){switch(t.type){case"title":return function(t){return{type:"title",text:t.rows[0].text}}(t);case"codeBlock":return function(t){var e,n=function(t){if(Array.isArray(t))return t}(e=t.rows)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(e)||function(t,e){if(t){if("string"==typeof t)return r(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(t,e):void 0}}(e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),o=n[0],a=n.slice(1),i=o.indent,s=o.text.replace(/^\s*code:/,"");return{indent:i,type:"codeBlock",fileName:s,content:a.map((function(t){return t.text.substring(i+1)})).join("\n")}}(t);case"table":return function(t){var e,r=function(t){if(Array.isArray(t))return t}(e=t.rows)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(e)||function(t,e){if(t){if("string"==typeof t)return q(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?q(t,e):void 0}}(e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),n=r[0],o=r.slice(1),a=n.indent,i=n.text.replace(/^\s*table:/,"");return{indent:a,type:"table",fileName:i,cells:o.map((function(t){return t.text.substring(a+1)})).map((function(t){return t.split("\t").map((function(t){return C(t,{nested:!0,quoted:!1})}))}))}}(t);case"line":return function(t){var e=t.rows[0],r=e.indent,n=e.text;return{indent:r,type:"line",nodes:C(n.substring(r))}}(t)}},R=function(t){return t.split("\n").map((function(t){var e,r;return{indent:null!==(r=null===(e=/^\s+/.exec(t))||void 0===e?void 0:e[0].length)&&void 0!==r?r:0,text:t}}))};function Z(t,e){if(t){if("string"==typeof t)return _(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_(t,e):void 0}}function _(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function F(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}var L=function(t,e){return t.length>0&&function(t,e){return("codeBlock"===t.type||"table"===t.type)&&e.indent>t.rows[0].indent}(t[t.length-1],e)?(t[t.length-1].rows.push(e),t):(t.push({type:/^\s*code:/.test(e.text)?"codeBlock":/^\s*table:/.test(e.text)?"table":"line",rows:[e]}),t)},G=function t(e,r){var n,o;if(null===(n=r.hasTitle)||void 0===n||n){var a=function(t){if(Array.isArray(t))return t}(o=e)||F(o)||Z(o)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),i=a[0],s=a.slice(1);return[{type:"title",rows:[i]}].concat(function(t){return function(t){if(Array.isArray(t))return _(t)}(t)||F(t)||Z(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(t(s,{hasTitle:!1})))}return e.reduce(L,[])},H=function(t,e){var r,n=R(t);return G(n,{hasTitle:null===(r=null==e?void 0:e.hasTitle)||void 0===r||r}).map(B)},J=function(t){var e=/^\s*\S.*\s*$/m.exec(t);return null!==e?e[0].trim():"Untitled"};return e})()}));
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.ScrapboxParser=e():t.ScrapboxParser=e()}(self,(function(){return(()=>{"use strict";var t={d:(e,r)=>{for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};function r(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function n(t){return function(t){if(Array.isArray(t))return a(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||o(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(t,e){if(t){if("string"==typeof t)return a(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?a(t,e):void 0}}function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}t.r(e),t.d(e,{convertToBlock:()=>B,getTitle:()=>J,packRows:()=>G,parse:()=>H,parseToRows:()=>R});var i=function(t,e){var r=e.parseOnNested,a=e.parseOnQuoted,i=e.patterns;return function(e,u,s){var l,c,p,f,d,y;if(!r&&u.nested)return null!==(l=null==s?void 0:s())&&void 0!==l?l:[];if(!a&&u.quoted)return null!==(c=null==s?void 0:s())&&void 0!==c?c:[];var b,v=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=o(t))){r&&(t=r);var n=0,a=function(){};return{s:a,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,u=!0,s=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return u=t.done,t},e:function(t){s=!0,i=t},f:function(){try{u||null==r.return||r.return()}finally{if(s)throw i}}}}(i);try{for(v.s();!(b=v.n()).done;){var g=b.value.exec(e);if(null!==g){var h=e.substring(0,g.index),m=e.substring(g.index+(null!==(f=null===(p=g[0])||void 0===p?void 0:p.length)&&void 0!==f?f:0)),O=t(null!==(d=g[0])&&void 0!==d?d:"",u);return[].concat(n(C(h,u)),n(Array.isArray(O)?O:[O]),n(C(m,u)))}}}catch(t){v.e(t)}finally{v.f()}return null!==(y=null==s?void 0:s())&&void 0!==y?y:[]}};function u(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function s(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?u(Object(r),!0).forEach((function(e){l(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):u(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function l(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var c=i((function(t,e){return{type:"quote",raw:t,nodes:C(t.substring(1),s(s({},e),{},{quoted:!0}))}}),{parseOnNested:!1,parseOnQuoted:!1,patterns:[/^>.*$/]}),p=i((function(t){return{type:"helpfeel",raw:t,text:t.substring(2)}}),{parseOnNested:!1,parseOnQuoted:!1,patterns:[/^\? .+$/]}),f=i((function(t){var e=t.substring(2,t.length-2);return{type:"strongImage",raw:t,src:/^https?:\/\/([0-9a-z-]\.)?gyazo\.com\/[0-9a-f]{32}$/.test(e)?"".concat(e,"/thumb/1000"):e}}),{parseOnNested:!1,parseOnQuoted:!0,patterns:[/\[\[https?:\/\/[^\s\]]+\.(?:png|jpe?g|gif|svg)\]\]/i,/\[\[https?:\/\/(?:[0-9a-z-]+\.)?gyazo\.com\/[0-9a-f]{32}\]\]/]});function d(t){return function(e){var r="icon"===t?e.substring(1,e.length-1):e.substring(2,e.length-2),n=r.lastIndexOf(".icon"),o=r.substring(0,n),a=o.startsWith("/")?"root":"relative",i=r.substring(n+5,r.length),u=i.startsWith("*")?parseInt(i.substring(1),10):1;return new Array(u).fill({}).map((function(){return{path:o,pathType:a,type:t,raw:e}}))}}var y=i(d("icon"),{parseOnNested:!1,parseOnQuoted:!0,patterns:[/\[[^[\]]*\.icon(?:\*[1-9]\d*)?\]/]}),b=i(d("strongIcon"),{parseOnNested:!1,parseOnQuoted:!0,patterns:[/\[\[[^[\]]*\.icon(?:\*\d+)?\]\]/]});function v(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function g(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?v(Object(r),!0).forEach((function(e){h(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):v(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function h(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var m=i((function(t,e){return{type:"strong",raw:t,nodes:C(t.substring(2,t.length-2),g(g({},e),{},{nested:!0}))}}),{parseOnNested:!1,parseOnQuoted:!0,patterns:[/\[\[(?:[^[]|\[[^[]).*?\]*\]\]/]}),O=i((function(t){return{type:"formula",raw:t,formula:t.substring(3,t.length-(t.endsWith(" ]")?2:1))}}),{parseOnNested:!1,parseOnQuoted:!0,patterns:[/\[\$ .+? \]/,/\[\$ [^\]]+\]/]});function w(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function j(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?w(Object(r),!0).forEach((function(e){S(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):w(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function S(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var A=i((function(t,e){var r=t.indexOf(" "),n=t.substring(1,r),o=t.substring(r+1,t.length-1),a=new Set(n);if(a.has("*")){var i=n.split("*").length-1;a.delete("*"),a.add("*-".concat(Math.min(i,10)))}return{type:"decoration",raw:t,rawDecos:n,decos:Array.from(a),nodes:C(o,j(j({},e),{},{nested:!0}))}}),{parseOnNested:!1,parseOnQuoted:!0,patterns:[/\[[!"#%&'()*+,\-./{|}<>_~]+ (?:\[[^[\]]+\]|[^\]])+\]/]}),x=i((function(t){return{type:"code",raw:t,text:t.substring(1,t.length-1)}}),{parseOnNested:!1,parseOnQuoted:!0,patterns:[/`.*?`/]}),P=i((function(t){var e,r=null!==(e=t[0])&&void 0!==e?e:"",n=t.substring(2);return{type:"commandLine",raw:t,symbol:r,text:n}}),{parseOnNested:!1,parseOnQuoted:!1,patterns:[/^[$%] .+$/]}),I=i((function(t){return{type:"blank",raw:t,text:t.substring(1,t.length-1)}}),{parseOnNested:!1,parseOnQuoted:!0,patterns:[/\[\s+\]/]});function N(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var T=i((function(t){var e,r,n,o=t.search(/\s/),a=-1!==o?t.substring(1,o):t.substring(1,t.length-1),i=-1!==o?t.substring(o,t.length-1).trimLeft():"",u=(r=/^https?:\/\/[^\s\]]+\.(png|jpe?g|gif|svg)(\?[^\]\s]+)?$/i.test(e=i)||function(t){return/^https?:\/\/([0-9a-z-]\.)?gyazo\.com\/[0-9a-f]{32}(\/raw)?$/.test(t)}(e)?[i,a]:[a,i],n=2,function(t){if(Array.isArray(t))return t}(r)||function(t,e){var r=t&&("undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"]);if(null!=r){var n,o,a=[],i=!0,u=!1;try{for(r=r.call(t);!(i=(n=r.next()).done)&&(a.push(n.value),!e||a.length!==e);i=!0);}catch(t){u=!0,o=t}finally{try{i||null==r.return||r.return()}finally{if(u)throw o}}return a}}(r,n)||function(t,e){if(t){if("string"==typeof t)return N(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?N(t,e):void 0}}(r,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),s=u[0],l=u[1];return{type:"image",raw:t,src:/^https?:\/\/([0-9a-z-]\.)?gyazo\.com\/[0-9a-f]{32}$/.test(s)?"".concat(s,"/thumb/1000"):s,link:l}}),{parseOnNested:!0,parseOnQuoted:!0,patterns:[/\[https?:\/\/[^\s\]]+\.(?:png|jpe?g|gif|svg)(?:\?[^\]\s]+)?(?:\s+https?:\/\/[^\s\]]+)?\]/i,/\[https?:\/\/[^\s\]]+\s+https?:\/\/[^\s\]]+\.(?:png|jpe?g|gif|svg)(?:\?[^\]\s]+)?\]/i,/\[https?:\/\/(?:[0-9a-z-]+\.)?gyazo\.com\/[0-9a-f]{32}(?:\/raw)?(?:\s+https?:\/\/[^\s\]]+)?\]/,/\[https?:\/\/[^\s\]]+\s+https?:\/\/(?:[0-9a-z-]+\.)?gyazo\.com\/[0-9a-f]{32}(?:\/raw)?\]/]}),$=i((function(t){var e=t.startsWith("[")&&t.endsWith("]")?t.substring(1,t.length-1):t,r=/^https?:\/\/[^\s\]]/.test(e),n=(r?/^https?:\/\/[^\s\]]+/:/https?:\/\/[^\s\]]+$/).exec(e);if(void 0===(null==n?void 0:n[0]))return[];var o=r?e.substring(n[0].length):e.substring(0,n.index-1);return{type:"link",raw:t,pathType:"absolute",href:n[0],content:o.trim()}}),{parseOnNested:!0,parseOnQuoted:!0,patterns:[/\[https?:\/\/[^\s\]]+\s+[^\]]*[^\s]\]/,/\[[^[\]]*[^\s]\s+https?:\/\/[^\s\]]+\]/,/\[https?:\/\/[^\s\]]+\]/,/https?:\/\/[^\s]+/]});function Q(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=t&&("undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"]);if(null!=r){var n,o,a=[],i=!0,u=!1;try{for(r=r.call(t);!(i=(n=r.next()).done)&&(a.push(n.value),!e||a.length!==e);i=!0);}catch(t){u=!0,o=t}finally{try{i||null==r.return||r.return()}finally{if(u)throw o}}return a}}(t,e)||function(t,e){if(t){if("string"==typeof t)return z(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?z(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function z(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var E=/\[([^\]]*[^\s])\s+([NS]\d+(?:\.\d+)?,[EW]\d+(?:\.\d+)?(?:,Z\d+)?)\]/,k=/\[([NS]\d+(?:\.\d+)?,[EW]\d+(?:\.\d+)?(?:,Z\d+)?)(?:\s+([^\]]*[^\s]))?\]/,D=i((function(t){var e,r=null!==(e=t.match(E))&&void 0!==e?e:t.match(k);if(null===r)return[];var n,o,a,i,u,s,l,c=Q(t.startsWith("[N")||t.startsWith("[S")?r:[r[0],r[2],r[1]],3),p=c[1],f=void 0===p?"":p,d=c[2],y=void 0===d?"":d,b=(a=void 0===(o=(n=Q(f.split(","),3))[0])?"":o,u=void 0===(i=n[1])?"":i,l=void 0===(s=n[2])?"":s,{latitude:parseFloat(a.replace(/^N/,"").replace(/^S/,"-")),longitude:parseFloat(u.replace(/^E/,"").replace(/^W/,"-")),zoom:/^Z\d+$/.test(l)?parseInt(l.replace(/^Z/,""),10):14}),v=b.latitude,g=b.longitude,h=b.zoom;return{type:"googleMap",raw:t,latitude:v,longitude:g,zoom:h,place:y,url:""!==y?"https://www.google.com/maps/place/".concat(encodeURIComponent(y),"/@").concat(v,",").concat(g,",").concat(h,"z"):"https://www.google.com/maps/@".concat(v,",").concat(g,",").concat(h,"z")}}),{parseOnNested:!1,parseOnQuoted:!0,patterns:[E,k]}),W=i((function(t){var e=t.substring(1,t.length-1);return{type:"link",raw:t,pathType:e.startsWith("/")?"root":"relative",href:e,content:""}}),{parseOnNested:!0,parseOnQuoted:!0,patterns:[/\[\/?[^[\]]+\]/]}),M=i((function(t){if(t.startsWith("#"))return{type:"hashTag",raw:t,href:t.substring(1)};var e=t.substring(0,1),r=t.substring(1);return[{type:"plain",raw:e,text:e},{type:"hashTag",raw:r,href:r.substring(1)}]}),{parseOnNested:!1,parseOnQuoted:!0,patterns:[/(?:^|\s)#\S+/]}),U=i((function(t){return{type:"plain",raw:t,text:t}}),{parseOnNested:!0,parseOnQuoted:!0,patterns:[/^()(.*)()$/]}),C=function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{nested:!1,quoted:!1};return e.reduceRight((function(e,n){return function(){return n(t,r,e)}}),(function(){return U(t,r)}))()}}((function(t,e,r){var n;return""===t?[]:null!==(n=null==r?void 0:r())&&void 0!==n?n:[]}),c,p,x,P,O,I,A,f,b,m,T,$,y,D,W,M);function q(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var B=function(t){switch(t.type){case"title":return function(t){return{type:"title",text:t.rows[0].text}}(t);case"codeBlock":return function(t){var e,n=function(t){if(Array.isArray(t))return t}(e=t.rows)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(e)||function(t,e){if(t){if("string"==typeof t)return r(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(t,e):void 0}}(e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),o=n[0],a=n.slice(1),i=null!=o?o:{},u=i.indent,s=void 0===u?0:u,l=i.text,c=(void 0===l?"":l).replace(/^\s*code:/,"");return{indent:s,type:"codeBlock",fileName:c,content:a.map((function(t){return t.text.substring(s+1)})).join("\n")}}(t);case"table":return function(t){var e,r=function(t){if(Array.isArray(t))return t}(e=t.rows)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(e)||function(t,e){if(t){if("string"==typeof t)return q(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?q(t,e):void 0}}(e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),n=r[0],o=r.slice(1),a=null!=n?n:{},i=a.indent,u=void 0===i?0:i,s=a.text,l=(void 0===s?"":s).replace(/^\s*table:/,"");return{indent:u,type:"table",fileName:l,cells:o.map((function(t){return t.text.substring(u+1)})).map((function(t){return t.split("\t").map((function(t){return C(t,{nested:!0,quoted:!1})}))}))}}(t);case"line":return function(t){var e=t.rows[0],r=e.indent,n=e.text;return{indent:r,type:"line",nodes:C(n.substring(r))}}(t)}},R=function(t){return t.split("\n").map((function(t){var e,r,n;return{indent:null!==(n=null===(r=null===(e=/^\s+/.exec(t))||void 0===e?void 0:e[0])||void 0===r?void 0:r.length)&&void 0!==n?n:0,text:t}}))};function Z(t,e){if(t){if("string"==typeof t)return _(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_(t,e):void 0}}function _(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function F(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}var L=function(t,e){var r=t[t.length-1];return void 0!==r&&function(t,e){var r,n;return("codeBlock"===t.type||"table"===t.type)&&e.indent>(null!==(n=null===(r=t.rows[0])||void 0===r?void 0:r.indent)&&void 0!==n?n:0)}(r,e)?(r.rows.push(e),t):(t.push({type:/^\s*code:/.test(e.text)?"codeBlock":/^\s*table:/.test(e.text)?"table":"line",rows:[e]}),t)},G=function(t,e){var r,n;if(null===(r=e.hasTitle)||void 0===r||r){var o=function(t){if(Array.isArray(t))return t}(n=t)||F(n)||Z(n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),a=o[0],i=o.slice(1);return void 0===a?[]:[{type:"title",rows:[a]}].concat(function(t){return function(t){if(Array.isArray(t))return _(t)}(t)||F(t)||Z(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(i.reduce(L,[])))}return t.reduce(L,[])},H=function(t,e){var r,n=R(t);return G(n,{hasTitle:null===(r=null==e?void 0:e.hasTitle)||void 0===r||r}).map(B)},J=function(t){var e,r,n=/^\s*\S.*$/m.exec(t);return null!==(r=null===(e=null==n?void 0:n[0])||void 0===e?void 0:e.trim())&&void 0!==r?r:"Untitled"};return e})()}));

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc