@progfay/scrapbox-parser
Advanced tools
Comparing version 7.0.1 to 7.0.2
import { createNodeParser } from './creator'; | ||
const hrefFirstUrlRegExp = /\[https?:\/\/[^\s\]]+(?:\s+[^\]]*[^\s])?\]/; | ||
const contentFirstUrlRegExp = /\[[^\]]*[^\s]\s+https?:\/\/[^\s\]]+\]/; | ||
const httpRegExp = /(?<=^| )https?:\/\/[^\s\]]+/; | ||
const hrefFirstUrlRegExp = /\[https?:\/\/[^\s\]]+(?:\s+[^[\]]*[^\s])?\]/; | ||
const contentFirstUrlRegExp = /\[[^[\]]*[^\s]\s+https?:\/\/[^\s\]]+\]/; | ||
const httpRegExp = /(?<=^| )https?:\/\/[^[\s\]]+/; | ||
const createExternalLinkNode = raw => { | ||
@@ -6,0 +6,0 @@ const inner = raw.startsWith('[') && raw.endsWith(']') ? raw.substring(1, raw.length - 1) : raw; |
@@ -25,3 +25,3 @@ import { QuoteNodeParser } from './QuoteNode'; | ||
const combineNodeParsers = (...parsers) => (text = '', opts = { nested: false, quoted: false }) => parsers.reduceRight((acc, parser) => () => parser(text, opts, acc), () => PlainNodeParser(text, opts))(); | ||
export const convertToNodes = combineNodeParsers(FalsyEliminator, QuoteNodeParser, HelpfeelNodeParser, CodeNodeParser, CommandLineNodeParser, FormulaNodeParser, BlankNodeParser, StrongImageNodeParser, StrongIconNodeParser, StrongNodeParser, DecorationNodeParser, ImageNodeParser, ExternalLinkNodeParser, IconNodeParser, GoogleMapNodeParser, InternalLinkNodeParser, HashTagNodeParser); | ||
export const convertToNodes = combineNodeParsers(FalsyEliminator, QuoteNodeParser, HelpfeelNodeParser, CodeNodeParser, CommandLineNodeParser, FormulaNodeParser, BlankNodeParser, DecorationNodeParser, StrongImageNodeParser, StrongIconNodeParser, StrongNodeParser, ImageNodeParser, ExternalLinkNodeParser, IconNodeParser, GoogleMapNodeParser, InternalLinkNodeParser, HashTagNodeParser); | ||
//# sourceMappingURL=index.js.map |
import { createNodeParser } from './creator'; | ||
import { convertToNodes } from '.'; | ||
const strongRegExp = /\[\[.+?[\]]*\]\]/; | ||
const strongRegExp = /\[\[(?:[^[]|\[[^[]).*?\]*\]\]/; | ||
const createStrongNode = (raw, opts) => ({ | ||
@@ -5,0 +5,0 @@ type: 'strong', |
@@ -5,5 +5,5 @@ "use strict"; | ||
const creator_1 = require("./creator"); | ||
const hrefFirstUrlRegExp = /\[https?:\/\/[^\s\]]+(?:\s+[^\]]*[^\s])?\]/; | ||
const contentFirstUrlRegExp = /\[[^\]]*[^\s]\s+https?:\/\/[^\s\]]+\]/; | ||
const httpRegExp = /(?<=^| )https?:\/\/[^\s\]]+/; | ||
const hrefFirstUrlRegExp = /\[https?:\/\/[^\s\]]+(?:\s+[^[\]]*[^\s])?\]/; | ||
const contentFirstUrlRegExp = /\[[^[\]]*[^\s]\s+https?:\/\/[^\s\]]+\]/; | ||
const httpRegExp = /(?<=^| )https?:\/\/[^[\s\]]+/; | ||
const createExternalLinkNode = raw => { | ||
@@ -10,0 +10,0 @@ const inner = raw.startsWith('[') && raw.endsWith(']') ? raw.substring(1, raw.length - 1) : raw; |
@@ -28,3 +28,3 @@ "use strict"; | ||
const combineNodeParsers = (...parsers) => (text = '', opts = { nested: false, quoted: false }) => parsers.reduceRight((acc, parser) => () => parser(text, opts, acc), () => PlainNode_1.PlainNodeParser(text, opts))(); | ||
exports.convertToNodes = combineNodeParsers(FalsyEliminator, QuoteNode_1.QuoteNodeParser, HelpfeelNode_1.HelpfeelNodeParser, CodeNode_1.CodeNodeParser, CommandLineNode_1.CommandLineNodeParser, FormulaNode_1.FormulaNodeParser, BlankNode_1.BlankNodeParser, StrongImageNode_1.StrongImageNodeParser, StrongIconNode_1.StrongIconNodeParser, StrongNode_1.StrongNodeParser, DecorationNode_1.DecorationNodeParser, ImageNode_1.ImageNodeParser, ExternalLinkNode_1.ExternalLinkNodeParser, IconNode_1.IconNodeParser, GoogleMapNode_1.GoogleMapNodeParser, InternalLinkNode_1.InternalLinkNodeParser, HashTagNode_1.HashTagNodeParser); | ||
exports.convertToNodes = combineNodeParsers(FalsyEliminator, QuoteNode_1.QuoteNodeParser, HelpfeelNode_1.HelpfeelNodeParser, CodeNode_1.CodeNodeParser, CommandLineNode_1.CommandLineNodeParser, FormulaNode_1.FormulaNodeParser, BlankNode_1.BlankNodeParser, DecorationNode_1.DecorationNodeParser, StrongImageNode_1.StrongImageNodeParser, StrongIconNode_1.StrongIconNodeParser, StrongNode_1.StrongNodeParser, ImageNode_1.ImageNodeParser, ExternalLinkNode_1.ExternalLinkNodeParser, IconNode_1.IconNodeParser, GoogleMapNode_1.GoogleMapNodeParser, InternalLinkNode_1.InternalLinkNodeParser, HashTagNode_1.HashTagNodeParser); | ||
//# sourceMappingURL=index.js.map |
@@ -6,3 +6,3 @@ "use strict"; | ||
const _1 = require("."); | ||
const strongRegExp = /\[\[.+?[\]]*\]\]/; | ||
const strongRegExp = /\[\[(?:[^[]|\[[^[]).*?\]*\]\]/; | ||
const createStrongNode = (raw, opts) => ({ | ||
@@ -9,0 +9,0 @@ type: 'strong', |
{ | ||
"name": "@progfay/scrapbox-parser", | ||
"version": "7.0.1", | ||
"version": "7.0.2", | ||
"description": "parse Scrapbox notation to JavaScript Object", | ||
@@ -47,5 +47,5 @@ "files": [ | ||
"@types/jest": "26.0.20", | ||
"@types/node": "14.14.27", | ||
"@typescript-eslint/eslint-plugin": "4.15.0", | ||
"@typescript-eslint/parser": "4.15.0", | ||
"@types/node": "14.14.28", | ||
"@typescript-eslint/eslint-plugin": "4.15.1", | ||
"@typescript-eslint/parser": "4.15.1", | ||
"babel-loader": "8.2.2", | ||
@@ -59,3 +59,3 @@ "cspell": "5.2.4", | ||
"eslint-plugin-import": "2.22.1", | ||
"eslint-plugin-jest": "24.1.3", | ||
"eslint-plugin-jest": "24.1.5", | ||
"eslint-plugin-node": "11.1.0", | ||
@@ -73,3 +73,3 @@ "eslint-plugin-prettier": "3.3.1", | ||
"typescript": "4.1.5", | ||
"webpack": "5.21.2", | ||
"webpack": "5.22.0", | ||
"webpack-cli": "4.5.0" | ||
@@ -76,0 +76,0 @@ }, |
@@ -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={837:(t,e,r)=>{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}function o(t){return function(t){if(Array.isArray(t))return i(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||a(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 a(t,e){if(t){if("string"==typeof t)return i(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)?i(t,e):void 0}}function i(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}r.r(e),r.d(e,{convertToBlock:()=>R,getTitle:()=>K,packRows:()=>H,parse:()=>J,parseToRows:()=>Z});var s=function(t,e){var r=e.parseOnNested,n=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(!n&&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=a(t))){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}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(o(q(b,s)),o(Array.isArray(h)?h:[h]),o(q(g,s)))}}}catch(t){d.e(t)}finally{d.f()}return null!==(p=null==u?void 0:u())&&void 0!==p?p:[]}};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 c(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 p=s((function(t,e){return{type:"quote",raw:t,nodes:q(t.substring(1),c(c({},e),{},{quoted:!0}))}}),{parseOnNested:!1,parseOnQuoted:!1,patterns:[/^>.*$/]}),f=s((function(t){return{type:"helpfeel",raw:t,text:t.substring(2)}}),{parseOnNested:!1,parseOnQuoted:!1,patterns:[/^\? .+$/]}),d=s((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 y(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 b=s(y("icon"),{parseOnNested:!1,parseOnQuoted:!0,patterns:[/\[[^[\]]*\.icon(?:\*[1-9]\d*)?\]/]}),g=s(y("strongIcon"),{parseOnNested:!1,parseOnQuoted:!0,patterns:[/\[\[[^[\]]*\.icon(?:\*\d+)?\]\]/]});function h(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 m(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?h(Object(r),!0).forEach((function(e){v(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):h(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function v(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var O=s((function(t,e){return{type:"strong",raw:t,nodes:q(t.substring(2,t.length-2),m(m({},e),{},{nested:!0}))}}),{parseOnNested:!1,parseOnQuoted:!0,patterns:[/\[\[.+?[\]]*\]\]/]}),w=s((function(t){return{type:"formula",raw:t,formula:t.substring(3,t.length-(t.endsWith(" ]")?2:1))}}),{parseOnNested:!1,parseOnQuoted:!0,patterns:[/\[\$ .+? \]/,/\[\$ [^\]]+\]/]});function j(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?j(Object(r),!0).forEach((function(e){A(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):j(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function A(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var x=s((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:q(o,S(S({},e),{},{nested:!0}))}}),{parseOnNested:!1,parseOnQuoted:!0,patterns:[/\[[!"#%&'()*+,-./{|}<>_~]+ (?:\[[^[\]]+\]|[^\]])+\]/]}),P=s((function(t){return{type:"code",raw:t,text:t.substring(1,t.length-1)}}),{parseOnNested:!1,parseOnQuoted:!0,patterns:[/`.*?`/]}),I=s((function(t){var e=t[0],r=t.substring(2);return{type:"commandLine",raw:t,symbol:e,text:r}}),{parseOnNested:!1,parseOnQuoted:!1,patterns:[/^[$%] .+$/]}),N=s((function(t){return{type:"blank",raw:t,text:t.substring(1,t.length-1)}}),{parseOnNested:!1,parseOnQuoted:!0,patterns:[/\[\s+\]/]});function T(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 $=s((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 T(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(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)?\]/]}),Q=s((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 z(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 E(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)?E(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 E(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 k=/\[([^\]]*[^\s])\s+([NS]\d+(?:\.\d+)?,[EW]\d+(?:\.\d+)?(?:,Z\d+)?)\]/,D=/\[([NS]\d+(?:\.\d+)?,[EW]\d+(?:\.\d+)?(?:,Z\d+)?)(?:\s+([^\]]*[^\s]))?\]/,W=s((function(t){var e,r=null!==(e=t.match(k))&&void 0!==e?e:t.match(D);if(null===r)return[];var n,o,a,i,s=z(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=z(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:[k,D]}),M=s((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:[/\[\/?[^[\]]+\]/]}),U=s((function(t){return{type:"hashTag",raw:t,href:t.substring(1)}}),{parseOnNested:!1,parseOnQuoted:!0,patterns:[/(?<=^| )#\S+/]}),C=s((function(t){return{type:"plain",raw:t,text:t}}),{parseOnNested:!0,parseOnQuoted:!0,patterns:[/^()(.*)()$/]}),q=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 C(t,r)}))()}}((function(t,e,r){var n;return""===t?[]:null!==(n=null==r?void 0:r())&&void 0!==n?n:[]}),p,f,P,I,w,N,d,g,O,x,$,Q,b,W,M,U);function B(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 R=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,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 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}}(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=r[0],a=r.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 B(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)?B(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 q(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:q(n.substring(r))}}(t)}},Z=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 _(t,e){if(t){if("string"==typeof t)return F(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)?F(t,e):void 0}}function F(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 L(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}var G=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)},H=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)||L(o)||_(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 F(t)}(t)||L(t)||_(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(G,[])},J=function(t,e){var r,n=Z(t);return H(n,{hasTitle:null===(r=null==e?void 0:e.hasTitle)||void 0===r||r}).map(R)},K=function(t){var e=/^\s*\S.*\s*$/m.exec(t);return null!==e?e[0].trim():"Untitled"}}},e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={exports:{}};return t[n](o,o.exports,r),o.exports}return r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r(837)})()})); | ||
!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})()})); |
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
144540