id
stringlengths
1
6
tokens
sequence
labels
sequence
1300
[ "license", "import", "*", "as", "pathlib", "from", "'path'", ";", "import", "{", "posix", "as", "posix", "}", "from", "'path'", ";", "import", "pathIsInside", "=", "require", "(", "'path-is-inside'", ")", ";", "import", "{", "format", "as", "urlLibFormat", "}", "from", "'url'", ";", "import", "{", "parseUrl", "}", "from", "'../core/utils'", ";", "import", "{", "FileRelativeUrl", ",", "PackageRelativeUrl", "}", "from", "'../index'", ";", "import", "{", "ResolvedUrl", "}", "from", "'../model/url'", ";", "import", "{", "FsUrlResolver", "}", "from", "'./fs-url-resolver'", ";", "export", "interface", "PackageUrlResolverOptions", "{", "packageDir", "?", ":", "string", ";", "componentDir", "?", ":", "string", ";", "host", "?", ":", "string", ";", "protocol", "?", ":", "string", ";", "}", "/**\n * Resolves a URL to a canonical URL within a package.\n */", "export", "class", "PackageUrlResolver", "extends", "FsUrlResolver", "{", "readonly", "componentDir", ":", "string", ";", "private", "readonly", "resolvedComponentDir", ":", "string", ";", "constructor", "(", "options", "=", "{", "}", ")", "{", "super", "(", "options", ".", "packageDir", ",", "options", ".", "host", ",", "options", ".", "protocol", ")", ";", "this", ".", "componentDir", "=", "options", ".", "componentDir", "||", "'bower_components/'", ";", "this", ".", "resolvedComponentDir", "=", "pathlib", ".", "join", "(", "this", ".", "packageDir", ",", "this", ".", "componentDir", ")", ";", "}", "protected", "modifyFsPath", "(", "path", ")", "{", "const", "parentOfPackageDir", "=", "pathlib", ".", "dirname", "(", "this", ".", "packageDir", ")", ";", "if", "(", "pathIsInside", "(", "path", ",", "parentOfPackageDir", ")", "&&", "!", "pathIsInside", "(", "path", ",", "this", ".", "packageDir", ")", ")", "{", "path", "=", "pathlib", ".", "join", "(", "this", ".", "packageDir", ",", "this", ".", "componentDir", ",", "path", ".", "substring", "(", "parentOfPackageDir", ".", "length", ")", ")", ";", "}", "return", "path", ";", "}", "relative", "(", "to", ")", ";", "relative", "(", "from", ",", "to", ",", "_kind", "?", ")", ";", "relative", "(", "fromOrTo", ",", "maybeTo", "?", ",", "_kind", "?", ")", "{", "const", "[", "from", ",", "to", "]", "=", "(", "maybeTo", "!==", "undefined", ")", "?", "[", "fromOrTo", ",", "maybeTo", "]", ":", "[", "this", ".", "packageUrl", ",", "fromOrTo", "]", ";", "const", "result", "=", "this", ".", "relativeImpl", "(", "from", ",", "to", ")", ";", "if", "(", "maybeTo", "===", "undefined", ")", "{", "return", "this", ".", "brandAsPackageRelative", "(", "result", ")", ";", "}", "else", "{", "return", "result", ";", "}", "}", "private", "relativeImpl", "(", "from", ",", "to", ")", "{", "const", "pathnameInComponentDir", "=", "this", ".", "pathnameForComponentDirUrl", "(", "to", ")", ";", "if", "(", "pathnameInComponentDir", "!==", "undefined", ")", "{", "if", "(", "this", ".", "pathnameForComponentDirUrl", "(", "from", ")", "===", "undefined", ")", "{", "const", "componentDirPath", "=", "pathnameInComponentDir", ".", "slice", "(", "this", ".", "resolvedComponentDir", ".", "length", ")", ";", "const", "reresolved", "=", "this", ".", "simpleUrlResolve", "(", "this", ".", "packageUrl", ",", "(", "'../'", "+", "componentDirPath", ")", "as", "FileRelativeUrl", ",", "this", ".", "protocol", ")", ";", "if", "(", "reresolved", "!==", "undefined", ")", "{", "const", "reresolvedUrl", "=", "parseUrl", "(", "reresolved", ")", ";", "const", "toUrl", "=", "parseUrl", "(", "to", ")", ";", "reresolvedUrl", ".", "search", "=", "toUrl", ".", "search", ";", "reresolvedUrl", ".", "hash", "=", "toUrl", ".", "hash", ";", "to", "=", "this", ".", "brandAsResolved", "(", "urlLibFormat", "(", "reresolvedUrl", ")", ")", ";", "}", "}", "}", "return", "super", ".", "relative", "(", "from", ",", "to", ")", ";", "}", "/**\n * If the given URL is a file url inside our dependencies (e.g.\n * bower_components) then return a resolved posix path to its file.\n * Otherwise return undefined.\n */", "private", "pathnameForComponentDirUrl", "(", "resolvedUrl", ")", "{", "const", "url", "=", "parseUrl", "(", "resolvedUrl", ")", ";", "if", "(", "this", ".", "shouldHandleAsFileUrl", "(", "url", ")", "&&", "url", ".", "pathname", ")", "{", "let", "pathname", ";", "try", "{", "pathname", "=", "posix", ".", "normalize", "(", "decodeURIComponent", "(", "url", ".", "pathname", ")", ")", ";", "}", "catch", "{", "return", "undefined", ";", "}", "const", "path", "=", "this", ".", "filesystemPathForPathname", "(", "pathname", ")", ";", "if", "(", "path", "&&", "pathIsInside", "(", "path", ",", "this", ".", "resolvedComponentDir", ")", ")", "{", "return", "path", ";", "}", "}", "return", "undefined", ";", "}", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, 2, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 17964, null, 1462, null, null, 7135, null, 1462, null, 1462, null, 2, null, null, null, null, null, 1462, null, 1462, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7135, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7135, null, 1462, null, 1462, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, 1462, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3426, null, null, null, null, null, null, null, 3426, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, 1462, null, null, null, 3426, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1301
[ "license", "import", "{", "PackageRelativeUrl", ",", "ResolvedUrl", "}", "from", "'../model/url'", ";", "/**\n * An object that reads files.\n */", "export", "interface", "UrlLoader", "{", "/**\n * Returns `true` if this loader can load the given `url`.\n */", "canLoad", "(", "url", ")", ":", "boolean", ";", "/**\n * Reads a file from `url`.\n *\n * This should only be called if `canLoad` returns `true` for `url`.\n */", "load", "(", "url", ")", ":", "Promise", "<", "string", ">", ";", "param", "path", "param", "deep", "readDirectory", "?", "(", "path", ",", "deep", "?", ")", ":", "Promise", "<", "PackageRelativeUrl", "[", "]", ">", ";", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1462, null, null, null, null, null, null, null, 1462, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1462, null, 8, null, null, null, null, null, null, null, null, null, null, null ]
1302
[ "license", "import", "{", "isCancel", "}", "from", "'cancel-token'", ";", "import", "{", "MinimalCancelToken", ",", "neverCancels", "}", "from", "'./cancel-token'", ";", "/**\n * A map from keys to promises of values. Used for caching asynchronous work.\n */", "export", "class", "AsyncWorkCache", "<", "K", ",", "V", ">", "{", "private", "_keyToResultMap", ":", "Map", "<", "K", ",", "Promise", "<", "V", ">", ">", ";", "constructor", "(", "from", "?", ")", "{", "if", "(", "from", ")", "{", "this", ".", "_keyToResultMap", "=", "new", "Map", "(", "from", ".", "_keyToResultMap", ")", ";", "}", "else", "{", "this", ".", "_keyToResultMap", "=", "new", "Map", "(", ")", ";", "}", "}", "/**\n * If work has already begun to compute the given key, return a promise for\n * the result of that work.\n *\n * If not, compute it with the given function.\n *\n * This method ensures that, in the absence of cancellations, we will only try\n * to compute the value for `key` once, no matter how often or with what\n * timing getOrCompute is called, even recursively.\n *\n * This API is safe for multiple, independently cancellable callers. So long\n * as the given cancelToken is not cancelled, this function will not reject\n * with a Cancel exception.\n */", "async", "getOrCompute", "(", "key", ",", "compute", ",", "cancelToken", "=", "neverCancels", ")", "{", "cancelToken", ".", "throwIfRequested", "(", ")", ";", "while", "(", "true", ")", "{", "try", "{", "const", "result", "=", "await", "this", ".", "_getOrCompute", "(", "key", ",", "compute", ")", ";", "cancelToken", ".", "throwIfRequested", "(", ")", ";", "return", "result", ";", "}", "catch", "(", "err", ")", "{", "cancelToken", ".", "throwIfRequested", "(", ")", ";", "if", "(", "isCancel", "(", "err", ")", ")", "{", "continue", ";", "}", "throw", "err", ";", "}", "}", "}", "private", "async", "_getOrCompute", "(", "key", ",", "compute", ")", "{", "const", "cachedResult", "=", "this", ".", "_keyToResultMap", ".", "get", "(", "key", ")", ";", "if", "(", "cachedResult", ")", "{", "return", "cachedResult", ";", "}", "const", "promise", "=", "(", "async", "(", ")", "=>", "{", "await", "Promise", ".", "resolve", "(", ")", ";", "return", "compute", "(", ")", ";", "}", ")", "(", ")", ";", "this", ".", "_keyToResultMap", ".", "set", "(", "key", ",", "promise", ")", ";", "try", "{", "await", "promise", ";", "}", "catch", "(", "err", ")", "{", "if", "(", "isCancel", "(", "err", ")", ")", "{", "this", ".", "_keyToResultMap", ".", "delete", "(", "key", ")", ";", "}", "throw", "err", ";", "}", "return", "promise", ";", "}", "delete", "(", "key", ")", "{", "this", ".", "_keyToResultMap", ".", "delete", "(", "key", ")", ";", "}", "clear", "(", ")", "{", "this", ".", "_keyToResultMap", ".", "clear", "(", ")", ";", "}", "set", "(", "key", ",", "value", ")", "{", "this", ".", "_keyToResultMap", ".", "set", "(", "key", ",", "Promise", ".", "resolve", "(", "value", ")", ")", ";", "}", "has", "(", "key", ")", "{", "return", "this", ".", "_keyToResultMap", ".", "has", "(", "key", ")", ";", "}", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 68, null, 7, null, 46498, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 215, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 68, null, 7, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 68, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 68, null, 215, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, 68, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1303
[ "license", "import", "{", "Document", ",", "ScannedDocument", ",", "Warning", "}", "from", "'../model/model'", ";", "import", "{", "ResolvedUrl", "}", "from", "'../model/url'", ";", "import", "{", "ParsedDocument", "}", "from", "'../parser/document'", ";", "import", "{", "AsyncWorkCache", "}", "from", "'./async-work-cache'", ";", "import", "{", "DependencyGraph", "}", "from", "'./dependency-graph'", ";", "export", "class", "AnalysisCache", "{", "/**\n * These are maps from resolved URLs to Promises of various stages of the\n * analysis pipeline.\n */", "readonly", "parsedDocumentPromises", ":", "AsyncWorkCache", "<", "ResolvedUrl", ",", "ParsedDocument", ">", ";", "readonly", "scannedDocumentPromises", ":", "AsyncWorkCache", "<", "ResolvedUrl", ",", "ScannedDocument", ">", ";", "readonly", "dependenciesScannedPromises", ":", "AsyncWorkCache", "<", "ResolvedUrl", ",", "ScannedDocument", ">", ";", "readonly", "analyzedDocumentPromises", ":", "AsyncWorkCache", "<", "ResolvedUrl", ",", "Document", ">", ";", "/**\n * TODO(rictic): These synchronous caches need to be kept in sync with their\n * async work cache analogues above.\n */", "readonly", "scannedDocuments", ":", "Map", "<", "ResolvedUrl", ",", "ScannedDocument", ">", ";", "readonly", "analyzedDocuments", ":", "Map", "<", "ResolvedUrl", ",", "Document", ">", ";", "readonly", "failedDocuments", ":", "Map", "<", "ResolvedUrl", ",", "Warning", ">", ";", "readonly", "dependencyGraph", ":", "DependencyGraph", ";", "param", "from", "param", "newDependencyGraph", "constructor", "(", "from", "?", ",", "newDependencyGraph", "?", ")", "{", "const", "f", "=", "from", "||", "{", "}", ";", "this", ".", "parsedDocumentPromises", "=", "new", "AsyncWorkCache", "(", "f", ".", "parsedDocumentPromises", ")", ";", "this", ".", "scannedDocumentPromises", "=", "new", "AsyncWorkCache", "(", "f", ".", "scannedDocumentPromises", ")", ";", "this", ".", "analyzedDocumentPromises", "=", "new", "AsyncWorkCache", "(", "f", ".", "analyzedDocumentPromises", ")", ";", "this", ".", "dependenciesScannedPromises", "=", "new", "AsyncWorkCache", "(", "f", ".", "dependenciesScannedPromises", ")", ";", "this", ".", "failedDocuments", "=", "new", "Map", "(", "f", ".", "failedDocuments", "!", ")", ";", "this", ".", "scannedDocuments", "=", "new", "Map", "(", "f", ".", "scannedDocuments", "!", ")", ";", "this", ".", "analyzedDocuments", "=", "new", "Map", "(", "f", ".", "analyzedDocuments", "!", ")", ";", "this", ".", "dependencyGraph", "=", "newDependencyGraph", "||", "new", "DependencyGraph", "(", ")", ";", "}", "/**\n * Returns a copy of this cache, with the given document and all of its\n * transitive dependants invalidated.\n *\n * Must be called whenever a document changes.\n */", "invalidate", "(", "documentPaths", ")", "{", "const", "newCache", "=", "new", "AnalysisCache", "(", "this", ",", "this", ".", "dependencyGraph", ".", "invalidatePaths", "(", "documentPaths", ")", ")", ";", "for", "(", "const", "path", "of", "documentPaths", ")", "{", "const", "dependants", "=", "this", ".", "dependencyGraph", ".", "getAllDependantsOf", "(", "path", ")", ";", "newCache", ".", "parsedDocumentPromises", ".", "delete", "(", "path", ")", ";", "newCache", ".", "scannedDocumentPromises", ".", "delete", "(", "path", ")", ";", "newCache", ".", "dependenciesScannedPromises", ".", "delete", "(", "path", ")", ";", "newCache", ".", "scannedDocuments", ".", "delete", "(", "path", ")", ";", "newCache", ".", "analyzedDocuments", ".", "delete", "(", "path", ")", ";", "newCache", ".", "failedDocuments", ".", "delete", "(", "path", ")", ";", "for", "(", "const", "partiallyInvalidatedPath", "of", "dependants", ")", "{", "newCache", ".", "dependenciesScannedPromises", ".", "delete", "(", "partiallyInvalidatedPath", ")", ";", "newCache", ".", "analyzedDocuments", ".", "delete", "(", "partiallyInvalidatedPath", ")", ";", "}", "newCache", ".", "analyzedDocumentPromises", ".", "clear", "(", ")", ";", "for", "(", "const", "keyValue", "of", "newCache", ".", "analyzedDocuments", ")", "{", "newCache", ".", "analyzedDocumentPromises", ".", "set", "(", "keyValue", "[", "0", "]", ",", "keyValue", "[", "1", "]", ")", ";", "}", "}", "return", "newCache", ";", "}", "toString", "(", ")", "{", "let", "result", "=", "`<AnalysisCache`", ";", "if", "(", "this", ".", "scannedDocuments", ".", "size", ">", "0", ")", "{", "result", "+=", "`\n scannedDocuments:\n ${", "Array", ".", "from", "(", "this", ".", "scannedDocuments", ".", "keys", "(", ")", ")", ".", "join", "(", "'\\n '", ")", "}`", ";", "}", "if", "(", "this", ".", "analyzedDocuments", ".", "size", ">", "0", ")", "{", "result", "+=", "`\n analyzedDocuments:\n ${", "Array", ".", "from", "(", "this", ".", "analyzedDocuments", ".", "keys", "(", ")", ")", ".", "join", "(", "'\\n '", ")", "}`", ";", "}", "if", "(", "this", ".", "failedDocuments", ".", "size", ">", "0", ")", "{", "result", "+=", "`\n failedDocuments:\n ${", "Array", ".", "from", "(", "this", ".", "failedDocuments", ".", "keys", "(", ")", ")", ".", "join", "(", "'\\n '", ")", "}`", ";", "}", "result", "+=", "'>'", ";", "return", "result", ";", "}", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 24295, null, null, 10154, null, null, null, null, 20, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 24295, null, 5, null, null, null, 24295, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1462, null, null, null, null, null, 30, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1304
[ "license", "export", "interface", "LanguageAnalyzer", "<", "T", ">", "{", "analyze", "(", "url", ")", ":", "T", ";", "}" ]
[ null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null ]
1305
[ "license", "import", "*", "as", "path", "from", "'path'", ";", "import", "{", "ForkOptions", ",", "LazyEdgeMap", ",", "NoKnownParserError", ",", "Options", ",", "ScannerTable", "}", "from", "'../core/analyzer'", ";", "import", "{", "CssCustomPropertyScanner", "}", "from", "'../css/css-custom-property-scanner'", ";", "import", "{", "CssParser", "}", "from", "'../css/css-parser'", ";", "import", "{", "HtmlCustomElementReferenceScanner", "}", "from", "'../html/html-element-reference-scanner'", ";", "import", "{", "HtmlImportScanner", "}", "from", "'../html/html-import-scanner'", ";", "import", "{", "HtmlParser", "}", "from", "'../html/html-parser'", ";", "import", "{", "HtmlScriptScanner", "}", "from", "'../html/html-script-scanner'", ";", "import", "{", "HtmlStyleScanner", "}", "from", "'../html/html-style-scanner'", ";", "import", "{", "ClassScanner", "}", "from", "'../javascript/class-scanner'", ";", "import", "{", "FunctionScanner", "}", "from", "'../javascript/function-scanner'", ";", "import", "{", "InlineHtmlDocumentScanner", "}", "from", "'../javascript/html-template-literal-scanner'", ";", "import", "{", "JavaScriptExportScanner", "}", "from", "'../javascript/javascript-export-scanner'", ";", "import", "{", "JavaScriptImportScanner", "}", "from", "'../javascript/javascript-import-scanner'", ";", "import", "{", "JavaScriptParser", "}", "from", "'../javascript/javascript-parser'", ";", "import", "{", "NamespaceScanner", "}", "from", "'../javascript/namespace-scanner'", ";", "import", "{", "JsonParser", "}", "from", "'../json/json-parser'", ";", "import", "{", "Document", ",", "InlineDocInfo", ",", "LocationOffset", ",", "ScannedDocument", ",", "ScannedElement", ",", "ScannedImport", ",", "ScannedInlineDocument", ",", "Severity", ",", "Warning", ",", "WarningCarryingException", "}", "from", "'../model/model'", ";", "import", "{", "PackageRelativeUrl", ",", "ResolvedUrl", "}", "from", "'../model/url'", ";", "import", "{", "ParsedDocument", ",", "UnparsableParsedDocument", "}", "from", "'../parser/document'", ";", "import", "{", "Parser", "}", "from", "'../parser/parser'", ";", "import", "{", "BehaviorScanner", "}", "from", "'../polymer/behavior-scanner'", ";", "import", "{", "CssImportScanner", "}", "from", "'../polymer/css-import-scanner'", ";", "import", "{", "DomModuleScanner", "}", "from", "'../polymer/dom-module-scanner'", ";", "import", "{", "PolymerCoreFeatureScanner", "}", "from", "'../polymer/polymer-core-feature-scanner'", ";", "import", "{", "PolymerElementScanner", "}", "from", "'../polymer/polymer-element-scanner'", ";", "import", "{", "PseudoElementScanner", "}", "from", "'../polymer/pseudo-element-scanner'", ";", "import", "{", "scan", "}", "from", "'../scanning/scan'", ";", "import", "{", "Scanner", "}", "from", "'../scanning/scanner'", ";", "import", "{", "PackageUrlResolver", "}", "from", "'../url-loader/package-url-resolver'", ";", "import", "{", "UrlLoader", "}", "from", "'../url-loader/url-loader'", ";", "import", "{", "UrlResolver", "}", "from", "'../url-loader/url-resolver'", ";", "import", "{", "AnalysisCache", "}", "from", "'./analysis-cache'", ";", "import", "{", "MinimalCancelToken", "}", "from", "'./cancel-token'", ";", "import", "{", "LanguageAnalyzer", "}", "from", "'./language-analyzer'", ";", "export", "const", "analyzerVersion", "=", "require", "(", "'../../package.json'", ")", ".", "version", ";", "/**\n * An analysis of a set of files at a specific point-in-time with respect to\n * updates to those files. New files can be added to an existing context, but\n * updates to files will cause a fork of the context with new analysis results.\n *\n * All file contents and analysis results are consistent within a single\n * anaysis context. A context is forked via either the fileChanged or\n * clearCaches methods.\n *\n * For almost all purposes this is an entirely internal implementation detail.\n * An Analyzer instance has a reference to its current context, so it will\n * appear to be statefull with respect to file updates.\n */", "export", "class", "AnalysisContext", "{", "readonly", "parsers", "=", "new", "Map", "<", "string", ",", "Parser", "<", "ParsedDocument", ">", ">", "(", "[", "[", "'html'", ",", "new", "HtmlParser", "(", ")", "]", ",", "[", "'js'", ",", "new", "JavaScriptParser", "(", ")", "]", ",", "[", "'css'", ",", "new", "CssParser", "(", ")", "]", ",", "[", "'json'", ",", "new", "JsonParser", "(", ")", "]", ",", "]", ")", ";", "private", "readonly", "_languageAnalyzers", "=", "new", "Map", "<", "string", ",", "LanguageAnalyzer", "<", "any", ">", ">", "(", "[", "]", ")", ";", "/** A map from import url to urls that document lazily depends on. */", "private", "readonly", "_lazyEdges", ":", "LazyEdgeMap", "|", "undefined", ";", "private", "readonly", "_scanners", ":", "ScannerTable", ";", "readonly", "loader", ":", "UrlLoader", ";", "readonly", "resolver", ":", "UrlResolver", ";", "private", "readonly", "_cache", ":", "AnalysisCache", ";", "/** Incremented each time we fork. Useful for debugging. */", "private", "readonly", "_generation", ":", "number", ";", "/**\n * Resolves when the previous analysis has completed.\n *\n * Used to serialize analysis requests, not for correctness surprisingly\n * enough, but for performance, so that we can reuse AnalysisResults.\n */", "private", "_analysisComplete", ":", "Promise", "<", "void", ">", ";", "static", "getDefaultScanners", "(", "options", ")", "{", "return", "new", "Map", "<", "string", ",", "Scanner", "<", "any", ",", "any", ",", "any", ">", "[", "]", ">", "(", "[", "[", "'html'", ",", "[", "new", "HtmlImportScanner", "(", "options", ".", "lazyEdges", ")", ",", "new", "HtmlScriptScanner", "(", ")", ",", "new", "HtmlStyleScanner", "(", ")", ",", "new", "DomModuleScanner", "(", ")", ",", "new", "CssImportScanner", "(", ")", ",", "new", "HtmlCustomElementReferenceScanner", "(", ")", ",", "new", "PseudoElementScanner", "(", ")", ",", "]", "]", ",", "[", "'js'", ",", "[", "new", "PolymerElementScanner", "(", ")", ",", "new", "PolymerCoreFeatureScanner", "(", ")", ",", "new", "BehaviorScanner", "(", ")", ",", "new", "NamespaceScanner", "(", ")", ",", "new", "FunctionScanner", "(", ")", ",", "new", "ClassScanner", "(", ")", ",", "new", "JavaScriptImportScanner", "(", "{", "moduleResolution", ":", "options", ".", "moduleResolution", "}", ")", ",", "new", "JavaScriptExportScanner", "(", ")", ",", "new", "InlineHtmlDocumentScanner", "(", ")", ",", "]", "]", ",", "[", "'css'", ",", "[", "new", "CssCustomPropertyScanner", "(", ")", "]", "]", "]", ")", ";", "}", "constructor", "(", "options", ",", "cache", "?", ",", "generation", "?", ")", "{", "this", ".", "loader", "=", "options", ".", "urlLoader", ";", "this", ".", "resolver", "=", "options", ".", "urlResolver", "||", "new", "PackageUrlResolver", "(", ")", ";", "this", ".", "parsers", "=", "options", ".", "parsers", "||", "this", ".", "parsers", ";", "this", ".", "_lazyEdges", "=", "options", ".", "lazyEdges", ";", "this", ".", "_scanners", "=", "options", ".", "scanners", "||", "AnalysisContext", ".", "getDefaultScanners", "(", "options", ")", ";", "this", ".", "_cache", "=", "cache", "||", "new", "AnalysisCache", "(", ")", ";", "this", ".", "_generation", "=", "generation", "||", "0", ";", "this", ".", "_analysisComplete", "=", "Promise", ".", "resolve", "(", ")", ";", "}", "/**\n * Returns a copy of this cache context with proper cache invalidation.\n */", "filesChanged", "(", "urls", ")", "{", "const", "newCache", "=", "this", ".", "_cache", ".", "invalidate", "(", "this", ".", "resolveUserInputUrls", "(", "urls", ")", ")", ";", "return", "this", ".", "_fork", "(", "newCache", ")", ";", "}", "/**\n * Implements Analyzer#analyze, see its docs.\n */", "async", "analyze", "(", "urls", ",", "cancelToken", ")", "{", "const", "resolvedUrls", "=", "this", ".", "resolveUserInputUrls", "(", "urls", ")", ";", "await", "this", ".", "_analysisComplete", ";", "const", "hasAllDocuments", "=", "resolvedUrls", ".", "every", "(", "(", "url", ")", "=>", "this", ".", "_cache", ".", "analyzedDocuments", ".", "get", "(", "url", ")", "!=", "null", ")", ";", "if", "(", "hasAllDocuments", ")", "{", "return", "this", ";", "}", "const", "newCache", "=", "this", ".", "_cache", ".", "invalidate", "(", "[", "]", ")", ";", "const", "newContext", "=", "this", ".", "_fork", "(", "newCache", ")", ";", "return", "newContext", ".", "_analyze", "(", "resolvedUrls", ",", "cancelToken", ")", ";", "}", "/**\n * Internal analysis method called when we know we need to fork.\n */", "private", "async", "_analyze", "(", "resolvedUrls", ",", "cancelToken", ")", "{", "const", "analysisComplete", "=", "(", "async", "(", ")", "=>", "{", "const", "scannedDocumentsOrWarnings", "=", "await", "Promise", ".", "all", "(", "resolvedUrls", ".", "map", "(", "async", "(", "url", ")", "=>", "{", "try", "{", "const", "scannedResult", "=", "await", "this", ".", "scan", "(", "url", ",", "cancelToken", ")", ";", "this", ".", "_cache", ".", "failedDocuments", ".", "delete", "(", "url", ")", ";", "return", "scannedResult", ";", "}", "catch", "(", "e", ")", "{", "if", "(", "e", "instanceof", "WarningCarryingException", ")", "{", "this", ".", "_cache", ".", "failedDocuments", ".", "set", "(", "url", ",", "e", ".", "warning", ")", ";", "}", "}", "}", ")", ")", ";", "const", "scannedDocuments", "=", "scannedDocumentsOrWarnings", ".", "filter", "(", "(", "d", ")", "=>", "d", "!=", "null", ")", "as", "ScannedDocument", "[", "]", ";", "const", "documents", "=", "scannedDocuments", ".", "map", "(", "(", "d", ")", "=>", "this", ".", "getDocument", "(", "d", ".", "url", ")", ")", ";", "return", "documents", ";", "}", ")", "(", ")", ";", "this", ".", "_analysisComplete", "=", "analysisComplete", ".", "then", "(", "(", "_", ")", "=>", "{", "}", ")", ";", "await", "this", ".", "_analysisComplete", ";", "return", "this", ";", "}", "/**\n * Gets an analyzed Document from the document cache. This is only useful for\n * Analyzer plugins. You almost certainly want to use `analyze()` instead.\n *\n * If a document has been analyzed, it returns the analyzed Document. If not\n * the scanned document cache is used and a new analyzed Document is returned.\n * If a file is in neither cache, it returns `undefined`.\n */", "getDocument", "(", "resolvedUrl", ")", "{", "const", "cachedWarning", "=", "this", ".", "_cache", ".", "failedDocuments", ".", "get", "(", "resolvedUrl", ")", ";", "if", "(", "cachedWarning", ")", "{", "return", "cachedWarning", ";", "}", "const", "cachedResult", "=", "this", ".", "_cache", ".", "analyzedDocuments", ".", "get", "(", "resolvedUrl", ")", ";", "if", "(", "cachedResult", ")", "{", "return", "cachedResult", ";", "}", "const", "scannedDocument", "=", "this", ".", "_cache", ".", "scannedDocuments", ".", "get", "(", "resolvedUrl", ")", ";", "if", "(", "!", "scannedDocument", ")", "{", "return", "makeRequestedWithoutLoadingWarning", "(", "resolvedUrl", ")", ";", "}", "const", "extension", "=", "path", ".", "extname", "(", "resolvedUrl", ")", ".", "substring", "(", "1", ")", ";", "const", "languageAnalyzer", "=", "this", ".", "_languageAnalyzers", ".", "get", "(", "extension", ")", ";", "let", "analysisResult", ";", "if", "(", "languageAnalyzer", ")", "{", "analysisResult", "=", "languageAnalyzer", ".", "analyze", "(", "scannedDocument", ".", "url", ")", ";", "}", "const", "document", "=", "new", "Document", "(", "scannedDocument", ",", "this", ",", "analysisResult", ")", ";", "this", ".", "_cache", ".", "analyzedDocuments", ".", "set", "(", "resolvedUrl", ",", "document", ")", ";", "this", ".", "_cache", ".", "analyzedDocumentPromises", ".", "getOrCompute", "(", "resolvedUrl", ",", "async", "(", ")", "=>", "document", ")", ";", "document", ".", "resolve", "(", ")", ";", "return", "document", ";", "}", "/**\n * This is only useful for Analyzer plugins.\n *\n * If a url has been scanned, returns the ScannedDocument.\n */", "_getScannedDocument", "(", "resolvedUrl", ")", "{", "return", "this", ".", "_cache", ".", "scannedDocuments", ".", "get", "(", "resolvedUrl", ")", ";", "}", "/**\n * Clear all cached information from this analyzer instance.\n *\n * Note: if at all possible, instead tell the analyzer about the specific\n * files that changed rather than clearing caches like this. Caching provides\n * large performance gains.\n */", "clearCaches", "(", ")", "{", "return", "this", ".", "_fork", "(", "new", "AnalysisCache", "(", ")", ")", ";", "}", "/**\n * Returns a copy of the context but with optional replacements of cache or\n * constructor options.\n *\n * Note: this feature is experimental.\n */", "_fork", "(", "cache", "?", ",", "options", "?", ")", "{", "const", "contextOptions", "=", "{", "lazyEdges", ":", "this", ".", "_lazyEdges", ",", "parsers", ":", "this", ".", "parsers", ",", "scanners", ":", "this", ".", "_scanners", ",", "urlLoader", ":", "this", ".", "loader", ",", "urlResolver", ":", "this", ".", "resolver", ",", "}", ";", "if", "(", "options", "&&", "options", ".", "urlLoader", ")", "{", "contextOptions", ".", "urlLoader", "=", "options", ".", "urlLoader", ";", "}", "if", "(", "!", "cache", ")", "{", "cache", "=", "this", ".", "_cache", ".", "invalidate", "(", "[", "]", ")", ";", "}", "const", "copy", "=", "new", "AnalysisContext", "(", "contextOptions", ",", "cache", ",", "this", ".", "_generation", "+", "1", ")", ";", "return", "copy", ";", "}", "/**\n * Scans a file locally, that is for features that do not depend\n * on this files imports. Local features can be cached even when\n * imports are invalidated. This method does not trigger transitive\n * scanning, _scan() does that.\n *\n * TODO(justinfagnani): consider renaming this to something like\n * _preScan, since about the only useful things it can find are\n * imports, exports and other syntactic structures.\n */", "private", "async", "_scanLocal", "(", "resolvedUrl", ",", "cancelToken", ")", "{", "return", "this", ".", "_cache", ".", "scannedDocumentPromises", ".", "getOrCompute", "(", "resolvedUrl", ",", "async", "(", ")", "=>", "{", "try", "{", "const", "parsedDoc", "=", "await", "this", ".", "_parse", "(", "resolvedUrl", ",", "cancelToken", ")", ";", "const", "scannedDocument", "=", "await", "this", ".", "_scanDocument", "(", "parsedDoc", ")", ";", "const", "imports", "=", "scannedDocument", ".", "getNestedFeatures", "(", ")", ".", "filter", "(", "(", "e", ")", "=>", "e", "instanceof", "ScannedImport", ")", "as", "ScannedImport", "[", "]", ";", "const", "importUrls", "=", "filterOutUndefineds", "(", "imports", ".", "map", "(", "(", "i", ")", "=>", "i", ".", "url", "===", "undefined", "?", "undefined", ":", "this", ".", "resolver", ".", "resolve", "(", "parsedDoc", ".", "baseUrl", ",", "i", ".", "url", ",", "i", ")", ")", ")", ";", "this", ".", "_cache", ".", "dependencyGraph", ".", "addDocument", "(", "resolvedUrl", ",", "importUrls", ")", ";", "return", "scannedDocument", ";", "}", "catch", "(", "e", ")", "{", "this", ".", "_cache", ".", "dependencyGraph", ".", "rejectDocument", "(", "resolvedUrl", ",", "e", ")", ";", "throw", "e", ";", "}", "}", ",", "cancelToken", ")", ";", "}", "/**\n * Scan a toplevel document and all of its transitive dependencies.\n */", "async", "scan", "(", "resolvedUrl", ",", "cancelToken", ")", "{", "return", "this", ".", "_cache", ".", "dependenciesScannedPromises", ".", "getOrCompute", "(", "resolvedUrl", ",", "async", "(", ")", "=>", "{", "const", "scannedDocument", "=", "await", "this", ".", "_scanLocal", "(", "resolvedUrl", ",", "cancelToken", ")", ";", "const", "imports", "=", "scannedDocument", ".", "getNestedFeatures", "(", ")", ".", "filter", "(", "(", "e", ")", "=>", "e", "instanceof", "ScannedImport", ")", "as", "ScannedImport", "[", "]", ";", "for", "(", "const", "scannedImport", "of", "imports", ")", "{", "if", "(", "scannedImport", ".", "url", "===", "undefined", ")", "{", "continue", ";", "}", "const", "importUrl", "=", "this", ".", "resolver", ".", "resolve", "(", "scannedDocument", ".", "document", ".", "baseUrl", ",", "scannedImport", ".", "url", ",", "scannedImport", ")", ";", "if", "(", "importUrl", "===", "undefined", ")", "{", "continue", ";", "}", "this", ".", "scan", "(", "importUrl", ",", "cancelToken", ")", ".", "catch", "(", "(", "error", ")", "=>", "{", "if", "(", "error", "==", "null", "||", "error", ".", "message", "==", "null", ")", "{", "scannedImport", ".", "error", "=", "new", "Error", "(", "`Internal error.`", ")", ";", "}", "else", "{", "scannedImport", ".", "error", "=", "error", ";", "}", "}", ")", ";", "}", "await", "this", ".", "_cache", ".", "dependencyGraph", ".", "whenReady", "(", "resolvedUrl", ")", ";", "return", "scannedDocument", ";", "}", ",", "cancelToken", ")", ";", "}", "/**\n * Scans a ParsedDocument.\n */", "private", "async", "_scanDocument", "(", "document", ",", "maybeAttachedComment", "?", ",", "maybeContainingDocument", "?", ")", "{", "const", "{", "features", ":", "scannedFeatures", ",", "warnings", "}", "=", "await", "this", ".", "_getScannedFeatures", "(", "document", ")", ";", "const", "firstScannedFeature", "=", "scannedFeatures", "[", "0", "]", ";", "if", "(", "firstScannedFeature", "&&", "firstScannedFeature", "instanceof", "ScannedElement", ")", "{", "firstScannedFeature", ".", "applyHtmlComment", "(", "maybeAttachedComment", ",", "maybeContainingDocument", ")", ";", "}", "const", "scannedDocument", "=", "new", "ScannedDocument", "(", "document", ",", "scannedFeatures", ",", "warnings", ")", ";", "if", "(", "!", "scannedDocument", ".", "isInline", ")", "{", "if", "(", "this", ".", "_cache", ".", "scannedDocuments", ".", "has", "(", "scannedDocument", ".", "url", ")", ")", "{", "throw", "new", "Error", "(", "'Scanned document already in cache. This should never happen.'", ")", ";", "}", "this", ".", "_cache", ".", "scannedDocuments", ".", "set", "(", "scannedDocument", ".", "url", ",", "scannedDocument", ")", ";", "}", "await", "this", ".", "_scanInlineDocuments", "(", "scannedDocument", ")", ";", "return", "scannedDocument", ";", "}", "private", "async", "_getScannedFeatures", "(", "document", ")", "{", "const", "scanners", "=", "this", ".", "_scanners", ".", "get", "(", "document", ".", "type", ")", ";", "if", "(", "scanners", ")", "{", "try", "{", "return", "await", "scan", "(", "document", ",", "scanners", ")", ";", "}", "catch", "(", "e", ")", "{", "if", "(", "e", "instanceof", "WarningCarryingException", ")", "{", "throw", "e", ";", "}", "const", "message", "=", "e", "==", "null", "?", "`Unknown error while scanning.`", ":", "`Error while scanning: ${", "String", "(", "e", ")", "}`", ";", "throw", "new", "WarningCarryingException", "(", "new", "Warning", "(", "{", "code", ":", "'internal-scanning-error'", ",", "message", ",", "parsedDocument", ":", "document", ",", "severity", ":", "Severity", ".", "ERROR", ",", "sourceRange", ":", "{", "file", ":", "document", ".", "url", ",", "start", ":", "{", "column", ":", "0", ",", "line", ":", "0", "}", ",", "end", ":", "{", "column", ":", "0", ",", "line", ":", "0", "}", ",", "}", "}", ")", ")", ";", "}", "}", "return", "{", "features", ":", "[", "]", ",", "warnings", ":", "[", "]", "}", ";", "}", "private", "async", "_scanInlineDocuments", "(", "containingDocument", ")", "{", "for", "(", "const", "feature", "of", "containingDocument", ".", "features", ")", "{", "if", "(", "!", "(", "feature", "instanceof", "ScannedInlineDocument", ")", ")", "{", "continue", ";", "}", "const", "locationOffset", "=", "{", "line", ":", "feature", ".", "locationOffset", ".", "line", ",", "col", ":", "feature", ".", "locationOffset", ".", "col", ",", "filename", ":", "containingDocument", ".", "url", "}", ";", "try", "{", "const", "parsedDoc", "=", "this", ".", "_parseContents", "(", "feature", ".", "type", ",", "feature", ".", "contents", ",", "containingDocument", ".", "url", ",", "{", "locationOffset", ",", "astNode", ":", "feature", ".", "astNode", ",", "baseUrl", ":", "containingDocument", ".", "document", ".", "baseUrl", "}", ")", ";", "const", "scannedDoc", "=", "await", "this", ".", "_scanDocument", "(", "parsedDoc", ",", "feature", ".", "attachedComment", ",", "containingDocument", ".", "document", ")", ";", "feature", ".", "scannedDocument", "=", "scannedDoc", ";", "}", "catch", "(", "err", ")", "{", "if", "(", "err", "instanceof", "WarningCarryingException", ")", "{", "containingDocument", ".", "warnings", ".", "push", "(", "err", ".", "warning", ")", ";", "continue", ";", "}", "throw", "err", ";", "}", "}", "}", "/**\n * Returns `true` if the provided resolved URL can be loaded. Obeys the\n * semantics defined by `UrlLoader` and should only be used to check\n * resolved URLs.\n */", "canLoad", "(", "resolvedUrl", ")", "{", "return", "this", ".", "loader", ".", "canLoad", "(", "resolvedUrl", ")", ";", "}", "/**\n * Loads the content at the provided resolved URL. Obeys the semantics\n * defined by `UrlLoader` and should only be used to attempt to load resolved\n * URLs.\n *\n * Currently does no caching. If the provided contents are given then they\n * are used instead of hitting the UrlLoader (e.g. when you have in-memory\n * contents that should override disk).\n */", "async", "load", "(", "resolvedUrl", ")", "{", "if", "(", "!", "this", ".", "canLoad", "(", "resolvedUrl", ")", ")", "{", "throw", "new", "Error", "(", "`Can't load URL: ${", "resolvedUrl", "}`", ")", ";", "}", "return", "await", "this", ".", "loader", ".", "load", "(", "resolvedUrl", ")", ";", "}", "/**\n * Caching + loading wrapper around _parseContents.\n */", "private", "async", "_parse", "(", "resolvedUrl", ",", "cancelToken", ")", "{", "return", "this", ".", "_cache", ".", "parsedDocumentPromises", ".", "getOrCompute", "(", "resolvedUrl", ",", "async", "(", ")", "=>", "{", "const", "content", "=", "await", "this", ".", "load", "(", "resolvedUrl", ")", ";", "const", "extension", "=", "path", ".", "extname", "(", "resolvedUrl", ")", ".", "substring", "(", "1", ")", ";", "return", "this", ".", "_parseContents", "(", "extension", ",", "content", ",", "resolvedUrl", ")", ";", "}", ",", "cancelToken", ")", ";", "}", "/**\n * Parse the given string into the Abstract Syntax Tree (AST) corresponding\n * to its type.\n */", "private", "_parseContents", "(", "type", ",", "contents", ",", "url", ",", "inlineInfo", "?", ")", "{", "const", "parser", "=", "this", ".", "parsers", ".", "get", "(", "type", ")", ";", "if", "(", "parser", "==", "null", ")", "{", "throw", "new", "NoKnownParserError", "(", "`No parser for for file type ${", "type", "}`", ")", ";", "}", "try", "{", "return", "parser", ".", "parse", "(", "contents", ",", "url", ",", "this", ".", "resolver", ",", "inlineInfo", ")", ";", "}", "catch", "(", "error", ")", "{", "if", "(", "error", "instanceof", "WarningCarryingException", ")", "{", "throw", "error", ";", "}", "const", "parsedDocument", "=", "new", "UnparsableParsedDocument", "(", "url", ",", "contents", ")", ";", "const", "message", "=", "error", "==", "null", "?", "`Unable to parse as ${", "type", "}`", ":", "`Unable to parse as ${", "type", "}: ${", "error", "}`", ";", "throw", "new", "WarningCarryingException", "(", "new", "Warning", "(", "{", "parsedDocument", ",", "code", ":", "'parse-error'", ",", "message", ",", "severity", ":", "Severity", ".", "ERROR", ",", "sourceRange", ":", "{", "file", ":", "url", ",", "start", ":", "{", "line", ":", "0", ",", "column", ":", "0", "}", ",", "end", ":", "{", "line", ":", "0", ",", "column", ":", "0", "}", "}", "}", ")", ")", ";", "}", "}", "/**\n * Resolves all resolvable URLs in the list, removes unresolvable ones.\n */", "resolveUserInputUrls", "(", "urls", ")", "{", "return", "filterOutUndefineds", "(", "urls", ".", "map", "(", "(", "u", ")", "=>", "this", ".", "resolver", ".", "resolve", "(", "u", ")", ")", ")", ";", "}", "}", "function", "filterOutUndefineds", "<", "T", ">", "(", "arr", ")", "{", "return", "arr", ".", "filter", "(", "(", "t", ")", "=>", "t", "!==", "undefined", ")", "as", "T", "[", "]", ";", "}", "/**\n * A warning for a weird situation that should never happen.\n *\n * Before calling getDocument(), which is synchronous, a caller must first\n * have finished loading and scanning, as those phases are asynchronous.\n *\n * So we need to construct a warning, but we don't have a parsed document,\n * so we construct this weird fake one. This is such a rare case that it's\n * worth going out of our way here so that warnings can uniformly expect to\n * have documents.\n */", "function", "makeRequestedWithoutLoadingWarning", "(", "resolvedUrl", ")", "{", "const", "parsedDocument", "=", "new", "UnparsableParsedDocument", "(", "resolvedUrl", ",", "''", ")", ";", "return", "new", "Warning", "(", "{", "sourceRange", ":", "{", "file", ":", "resolvedUrl", ",", "start", ":", "{", "line", ":", "0", ",", "column", ":", "0", "}", ",", "end", ":", "{", "line", ":", "0", ",", "column", ":", "0", "}", "}", ",", "code", ":", "'unable-to-analyze'", ",", "message", ":", "`[Internal Error] Document was requested `", "+", "`before loading and scanning finished. This usually indicates an `", "+", "`anomalous error during loading or analysis. Please file a bug at `", "+", "`https://github.com/Polymer/polymer-analyzer/issues/new with info `", "+", "`on the source code that caused this. `", "+", "`Polymer Analyzer version: ${", "analyzerVersion", "}`", ",", "severity", ":", "Severity", ".", "ERROR", ",", "parsedDocument", "}", ")", ";", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 19, null, 74, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 74, null, 24295, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 10984, null, 5, null, null, null, 24295, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 5, null, 46498, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, 1462, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 24295, null, null, null, null, null, null, null, null, null, null, null, null, 10984, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 5, null, 46498, null, null, null, 7, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, 1462, null, null, null, null, null, null, 24294, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, 24294, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, 24294, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1462, null, null, null, 5893, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 91, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 24294, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 91, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 24294, null, 1462, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 10984, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 10984, null, 24295, null, null, 13021, null, null, null, null, 74, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 10984, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 1462, null, 46498, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 12625, null, null, null, null, null, null, null, null, null, null, null, null, 24294, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, 18800, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 1462, null, 46498, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 24294, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 18800, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1462, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 12625, null, 2, null, null, 12625, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 24293, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 24294, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 12625, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 24294, null, null, null, null, null, 24293, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 29923, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 12625, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 24294, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, 1462, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 1462, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 1462, null, 46498, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 12625, null, 2, null, 2, null, 1462, null, 0, null, null, null, null, 216, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, 5, null, null, null, null, null, null, null, null, null, null, 17964, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, 130, null, null, null, null, null, null, null, null, 11, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5893, null, 1462, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1306
[ "license", "import", "{", "resolve", "as", "resolveUrl", "}", "from", "'url'", ";", "import", "{", "UrlLoader", "}", "from", "'./url-loader'", ";", "declare", "const", "window", ";", "/**\n * Resolves requests via the the DOM fetch API.\n */", "export", "class", "FetchUrlLoader", "implements", "UrlLoader", "{", "baseUrl", ":", "string", ";", "constructor", "(", "baseUrl", ")", "{", "this", ".", "baseUrl", "=", "baseUrl", ";", "}", "_resolve", "(", "url", ")", "{", "return", "this", ".", "baseUrl", "?", "resolveUrl", "(", "this", ".", "baseUrl", ",", "url", ")", ":", "url", ";", "}", "canLoad", "(", "_", ")", "{", "return", "true", ";", "}", "load", "(", "url", ")", "{", "return", "window", ".", "fetch", "(", "this", ".", "_resolve", "(", "url", ")", ")", ".", "then", "(", "(", "response", ")", "=>", "{", "if", "(", "response", ".", "ok", ")", "{", "return", "response", ".", "text", "(", ")", ";", "}", "else", "{", "return", "response", ".", "text", "(", ")", ".", "then", "(", "(", "content", ")", "=>", "{", "throw", "new", "Error", "(", "`Response not ok: ${", "content", "}`", ")", ";", "}", ")", ";", "}", "}", ")", ";", "}", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, 2, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, 2, null, null, null, null, null, null, 7, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1307
[ "license", "import", "*", "as", "fs", "from", "'fs'", ";", "import", "*", "as", "pathlib", "from", "'path'", ";", "import", "pathIsInside", "=", "require", "(", "'path-is-inside'", ")", ";", "import", "Uri", "from", "'vscode-uri'", ";", "import", "{", "ResolvedUrl", "}", "from", "'../index'", ";", "import", "{", "Result", "}", "from", "'../model/analysis'", ";", "import", "{", "PackageRelativeUrl", "}", "from", "'../model/url'", ";", "import", "{", "UrlLoader", "}", "from", "'./url-loader'", ";", "/**\n * Resolves requests via the file system.\n */", "export", "class", "FsUrlLoader", "implements", "UrlLoader", "{", "root", ":", "string", ";", "constructor", "(", "root", "=", "''", ")", "{", "this", ".", "root", "=", "pathlib", ".", "resolve", "(", "root", ")", ";", "}", "canLoad", "(", "url", ")", "{", "const", "parsed", "=", "Uri", ".", "parse", "(", "url", ")", ";", "return", "parsed", ".", "scheme", "===", "'file'", "&&", "!", "parsed", ".", "authority", "&&", "pathIsInside", "(", "parsed", ".", "fsPath", ",", "this", ".", "root", ")", ";", "}", "load", "(", "url", ")", "{", "return", "new", "Promise", "(", "(", "resolve", ",", "reject", ")", "=>", "{", "const", "result", "=", "this", ".", "getFilePath", "(", "url", ")", ";", "if", "(", "!", "result", ".", "successful", ")", "{", "throw", "new", "Error", "(", "`FsUrlLoader can not load url ${", "JSON", ".", "stringify", "(", "url", ")", "} - ${", "result", ".", "error", "}`", ")", ";", "}", "fs", ".", "readFile", "(", "result", ".", "value", ",", "'utf8'", ",", "(", "error", ",", "contents", ")", "=>", "{", "if", "(", "error", ")", "{", "reject", "(", "error", ")", ";", "}", "else", "{", "resolve", "(", "contents", ")", ";", "}", "}", ")", ";", "}", ")", ";", "}", "/**\n * If successful, result.value will be the filesystem path that we would load\n * the given url from.\n *\n * If unsuccessful, result.value will be an error message as a string.\n */", "getFilePath", "(", "url", ")", "{", "if", "(", "!", "url", ".", "startsWith", "(", "'file://'", ")", ")", "{", "return", "{", "successful", ":", "false", ",", "error", ":", "'Not a local file:// url.'", "}", ";", "}", "if", "(", "!", "this", ".", "canLoad", "(", "url", ")", ")", "{", "return", "{", "successful", ":", "false", ",", "error", ":", "`Path is not inside root directory: ${", "JSON", ".", "stringify", "(", "this", ".", "root", ")", "}`", "}", ";", "}", "const", "path", "=", "Uri", ".", "parse", "(", "url", ")", ".", "fsPath", ";", "return", "{", "successful", ":", "true", ",", "value", ":", "path", "}", ";", "}", "async", "readDirectory", "(", "pathFromRoot", ",", "deep", "?", ")", "{", "const", "files", "=", "await", "new", "Promise", "<", "string", "[", "]", ">", "(", "(", "resolve", ",", "reject", ")", "=>", "{", "fs", ".", "readdir", "(", "pathlib", ".", "join", "(", "this", ".", "root", ",", "pathFromRoot", ")", ",", "(", "err", ",", "files", ")", "=>", "err", "?", "reject", "(", "err", ")", ":", "resolve", "(", "files", ")", ")", ";", "}", ")", ";", "const", "results", "=", "[", "]", ";", "const", "subDirResultPromises", "=", "[", "]", ";", "for", "(", "const", "basename", "of", "files", ")", "{", "const", "file", "=", "pathlib", ".", "join", "(", "pathFromRoot", ",", "basename", ")", ";", "const", "stat", "=", "await", "new", "Promise", "<", "fs", ".", "Stats", ">", "(", "(", "resolve", ",", "reject", ")", "=>", "fs", ".", "stat", "(", "pathlib", ".", "join", "(", "this", ".", "root", ",", "file", ")", ",", "(", "err", ",", "stat", ")", "=>", "err", "?", "reject", "(", "err", ")", ":", "resolve", "(", "stat", ")", ")", ")", ";", "if", "(", "stat", ".", "isDirectory", "(", ")", ")", "{", "if", "(", "deep", ")", "{", "subDirResultPromises", ".", "push", "(", "this", ".", "readDirectory", "(", "file", ",", "deep", ")", ")", ";", "}", "}", "else", "{", "results", ".", "push", "(", "file", "as", "PackageRelativeUrl", ")", ";", "}", "}", "const", "arraysOfFiles", "=", "await", "Promise", ".", "all", "(", "subDirResultPromises", ")", ";", "for", "(", "const", "dirResults", "of", "arraysOfFiles", ")", "{", "for", "(", "const", "file", "of", "dirResults", ")", "{", "results", ".", "push", "(", "file", "as", "PackageRelativeUrl", ")", ";", "}", "}", "return", "results", ";", "}", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, 1462, null, null, null, 322, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 1462, null, null, null, null, null, null, null, 4, null, 4, null, null, null, null, 123, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 25, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 123, null, 1462, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 2, null, 8, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, 4, null, 4, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 243, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, 5, null, null, null, null, null, null, null, 2, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, 235, null, null, null, null, null, null, null, null, null, null, null, 4, null, 4, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 243, null, 235, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1308
[ "license", "import", "{", "PackageRelativeUrl", ",", "ResolvedUrl", "}", "from", "'../model/url'", ";", "import", "{", "UrlLoader", "}", "from", "'./url-loader'", ";", "class", "FailUrlLoader", "implements", "UrlLoader", "{", "canLoad", "(", "_url", ")", "{", "return", "true", ";", "}", "load", "(", "url", ")", "{", "throw", "new", "Error", "(", "`${", "url", "} not known in InMemoryOverlayLoader`", ")", ";", "}", "}", "/**\n * Resolves requests first from an in-memory map of file contents, and if a\n * file isn't found there, defers to another url loader.\n *\n * Useful for the editor use case. An editor will have a number of files in open\n * buffers at any time. For these files, the editor's in-memory buffer is\n * canonical, so that their contents are read even when they have unsaved\n * changes. For all other files, we can load the files using another loader,\n * e.g. from disk.\n *\n * TODO(rictic): make this a mixin that mixes another loader.\n */", "export", "class", "InMemoryOverlayUrlLoader", "implements", "UrlLoader", "{", "private", "readonly", "_fallbackLoader", ":", "UrlLoader", ";", "urlContentsMap", "=", "new", "Map", "<", "ResolvedUrl", ",", "string", ">", "(", ")", ";", "constructor", "(", "fallbackLoader", "?", ")", "{", "this", ".", "_fallbackLoader", "=", "fallbackLoader", "||", "new", "FailUrlLoader", "(", ")", ";", "if", "(", "this", ".", "_fallbackLoader", ".", "readDirectory", ")", "{", "this", ".", "readDirectory", "=", "this", ".", "_fallbackLoader", ".", "readDirectory", ".", "bind", "(", "this", ".", "_fallbackLoader", ")", ";", "}", "}", "canLoad", "(", "url", ")", "{", "return", "this", ".", "urlContentsMap", ".", "has", "(", "url", ")", "||", "this", ".", "_fallbackLoader", ".", "canLoad", "(", "url", ")", ";", "}", "async", "load", "(", "url", ")", "{", "const", "contents", "=", "this", ".", "urlContentsMap", ".", "get", "(", "url", ")", ";", "if", "(", "typeof", "contents", "===", "'string'", ")", "{", "return", "contents", ";", "}", "return", "this", ".", "_fallbackLoader", ".", "load", "(", "url", ")", ";", "}", "readDirectory", "?", ":", "(", "pathFromRoot", ":", "string", ",", "deep", "?", ":", "boolean", ")", "=>", "Promise", "<", "PackageRelativeUrl", "[", "]", ">", ";", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, 2, null, null, null, null, null, null, 7, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 46499, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, 1462, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 1462, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1309
[ "license", "import", "{", "PackageRelativeUrl", "}", "from", "'../index'", ";", "import", "{", "ResolvedUrl", "}", "from", "'../model/url'", ";", "import", "{", "UrlLoader", "}", "from", "'./url-loader'", ";", "/**\n * Resolves requests via one of a sequence of loaders.\n */", "export", "class", "MultiUrlLoader", "implements", "UrlLoader", "{", "constructor", "(", "private", "_loaders", ")", "{", "for", "(", "const", "loader", "of", "_loaders", ")", "{", "if", "(", "loader", ".", "readDirectory", "!==", "undefined", ")", "{", "this", ".", "readDirectory", "=", "(", "path", ",", "deep", "?", ")", "=>", "{", "return", "loader", ".", "readDirectory", "!", "(", "path", ",", "deep", ")", ";", "}", ";", "break", ";", "}", "}", "}", "canLoad", "(", "url", ")", "{", "return", "this", ".", "_loaders", ".", "some", "(", "(", "loader", ")", "=>", "loader", ".", "canLoad", "(", "url", ")", ")", ";", "}", "async", "load", "(", "url", ")", "{", "for", "(", "const", "loader", "of", "this", ".", "_loaders", ")", "{", "if", "(", "loader", ".", "canLoad", "(", "url", ")", ")", "{", "return", "loader", ".", "load", "(", "url", ")", ";", "}", "}", "return", "Promise", ".", "reject", "(", "new", "Error", "(", "`Unable to load ${", "url", "}`", ")", ")", ";", "}", "readDirectory", "?", "(", "path", ",", "deep", "?", ")", ";", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, 46499, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1462, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, 1462, null, null, null, null, null, null, null, null, null, null, 46499, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 1462, null, null, null, null, null, 46499, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, 1462, null, 8, null, null, null, null ]
1310
[ "license", "import", "{", "FileRelativeUrl", ",", "PackageRelativeUrl", ",", "ResolvedUrl", ",", "ScannedImport", "}", "from", "'../model/model'", ";", "import", "{", "UrlResolver", "}", "from", "'./url-resolver'", ";", "/**\n * Resolves a URL using multiple resolvers.\n */", "export", "class", "MultiUrlResolver", "extends", "UrlResolver", "{", "constructor", "(", "private", "_resolvers", ")", "{", "super", "(", ")", ";", "}", "/**\n * Returns the first resolved URL (which is not undefined.)\n */", "resolve", "(", "firstUrl", ",", "secondUrl", "?", ",", "import_", "?", ")", "{", "for", "(", "const", "resolver", "of", "this", ".", "_resolvers", ")", "{", "const", "resolved", "=", "secondUrl", "===", "undefined", "?", "resolver", ".", "resolve", "(", "firstUrl", "as", "PackageRelativeUrl", ")", ":", "resolver", ".", "resolve", "(", "firstUrl", "as", "ResolvedUrl", ",", "secondUrl", "as", "FileRelativeUrl", ",", "import_", ")", ";", "if", "(", "resolved", "!==", "undefined", ")", "{", "return", "resolved", ";", "}", "}", "return", "undefined", ";", "}", "/**\n * Delegates to relative method on the first resolver which can resolve the\n * destination URL.\n */", "relative", "(", "to", ")", ";", "relative", "(", "from", ",", "to", ",", "kind", "?", ")", ";", "relative", "(", "fromOrTo", ",", "maybeTo", "?", ",", "kind", "?", ")", "{", "const", "[", "from", ",", "to", "]", "=", "(", "maybeTo", "===", "undefined", ")", "?", "[", "undefined", ",", "fromOrTo", "]", ":", "[", "fromOrTo", ",", "maybeTo", "]", ";", "for", "(", "const", "resolver", "of", "this", ".", "_resolvers", ")", "{", "if", "(", "resolver", ".", "resolve", "(", "this", ".", "brandAsPackageRelative", "(", "to", ")", ")", "===", "undefined", ")", "{", "continue", ";", "}", "if", "(", "from", "===", "undefined", ")", "{", "return", "resolver", ".", "relative", "(", "to", ")", ";", "}", "else", "{", "return", "resolver", ".", "relative", "(", "from", ",", "to", ",", "kind", ")", ";", "}", "}", "throw", "new", "Error", "(", "`Could not get relative url, with no configured url resolvers`", ")", ";", "}", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 130, null, null, null, null, null, null, null, null, 1462, null, null, null, 7135, null, null, 18800, null, null, null, null, null, null, 13912, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 17964, null, 1462, null, null, 7135, null, 1462, null, 1462, null, 2, null, null, null, null, null, 1462, null, 1462, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 13912, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1311
[ "license", "import", "{", "resolve", "as", "urlLibResolver", "}", "from", "'url'", ";", "import", "{", "FileRelativeUrl", ",", "PackageRelativeUrl", ",", "ResolvedUrl", ",", "ScannedImport", "}", "from", "'../model/model'", ";", "import", "{", "UrlResolver", "}", "from", "'./url-resolver'", ";", "/**\n * Resolves a URL having one prefix to another URL with a different prefix.\n */", "export", "class", "RedirectResolver", "extends", "UrlResolver", "{", "constructor", "(", "private", "readonly", "packageUrl", ",", "private", "readonly", "_redirectFrom", ",", "private", "readonly", "_redirectTo", ")", "{", "super", "(", ")", ";", "}", "resolve", "(", "firstUrl", ",", "secondUrl", "?", ",", "_import", "?", ")", "{", "const", "[", "baseUrl", "=", "this", ".", "packageUrl", ",", "unresolvedUrl", "]", "=", "this", ".", "getBaseAndUnresolved", "(", "firstUrl", ",", "secondUrl", ")", ";", "const", "packageRelativeUrl", "=", "this", ".", "brandAsResolved", "(", "urlLibResolver", "(", "baseUrl", ",", "unresolvedUrl", ")", ")", ";", "if", "(", "packageRelativeUrl", ".", "startsWith", "(", "this", ".", "_redirectFrom", ")", ")", "{", "return", "this", ".", "brandAsResolved", "(", "this", ".", "_redirectTo", "+", "packageRelativeUrl", ".", "slice", "(", "this", ".", "_redirectFrom", ".", "length", ")", ")", ";", "}", "if", "(", "packageRelativeUrl", ".", "startsWith", "(", "this", ".", "_redirectTo", ")", ")", "{", "return", "packageRelativeUrl", ";", "}", "return", "undefined", ";", "}", "relative", "(", "to", ")", ";", "relative", "(", "from", ",", "to", ",", "kind", "?", ")", ";", "relative", "(", "fromOrTo", ",", "maybeTo", "?", ",", "_kind", "?", ")", "{", "let", "from", ",", "to", ";", "if", "(", "maybeTo", "===", "undefined", ")", "{", "from", "=", "this", ".", "packageUrl", ";", "to", "=", "fromOrTo", ";", "}", "else", "{", "from", "=", "fromOrTo", ";", "to", "=", "maybeTo", ";", "}", "if", "(", "!", "from", ".", "startsWith", "(", "this", ".", "_redirectTo", ")", "&&", "to", ".", "startsWith", "(", "this", ".", "_redirectTo", ")", ")", "{", "to", "=", "this", ".", "brandAsResolved", "(", "this", ".", "_redirectFrom", "+", "to", ".", "slice", "(", "this", ".", "_redirectTo", ".", "length", ")", ")", ";", "}", "const", "result", "=", "this", ".", "simpleUrlRelative", "(", "from", ",", "to", ")", ";", "if", "(", "maybeTo", "===", "undefined", ")", "{", "return", "this", ".", "brandAsPackageRelative", "(", "result", ")", ";", "}", "else", "{", "return", "result", ";", "}", "}", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1462, null, null, null, 2, null, null, null, 2, null, null, null, null, null, null, null, 1462, null, null, null, 7135, null, null, 18800, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1462, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 17964, null, 1462, null, null, 7135, null, 1462, null, 1462, null, 2, null, null, null, null, null, 1462, null, 1462, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7135, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1312
[ "license", "import", "{", "isCancel", "}", "from", "'cancel-token'", ";", "import", "{", "assert", "}", "from", "'chai'", ";", "import", "*", "as", "path", "from", "'path'", ";", "import", "URI", "from", "'vscode-uri'", ";", "import", "{", "Analyzer", "}", "from", "'../core/analyzer'", ";", "import", "{", "neverCancels", "}", "from", "'../core/cancel-token'", ";", "import", "{", "FileRelativeUrl", ",", "PackageRelativeUrl", ",", "ParsedDocument", ",", "ResolvedUrl", ",", "ScannedFeature", ",", "UrlResolver", "}", "from", "'../index'", ";", "import", "{", "makeParseLoader", ",", "SourceRange", ",", "Warning", "}", "from", "'../model/model'", ";", "import", "{", "scan", "}", "from", "'../scanning/scan'", ";", "import", "{", "Scanner", "}", "from", "'../scanning/scanner'", ";", "import", "{", "FsUrlLoader", "}", "from", "'../url-loader/fs-url-loader'", ";", "import", "{", "InMemoryOverlayUrlLoader", "}", "from", "'../url-loader/overlay-loader'", ";", "import", "{", "PackageUrlResolver", "}", "from", "'../url-loader/package-url-resolver'", ";", "import", "{", "UrlLoader", "}", "from", "'../url-loader/url-loader'", ";", "import", "{", "underlineCode", "}", "from", "'../warning/code-printer'", ";", "export", "class", "UnexpectedResolutionError", "extends", "Error", "{", "resolvedValue", ":", "any", ";", "constructor", "(", "message", ",", "resolvedValue", ")", "{", "super", "(", "message", ")", ";", "this", ".", "resolvedValue", "=", "resolvedValue", ";", "}", "}", "export", "async", "function", "invertPromise", "(", "promise", ")", "{", "let", "value", ";", "try", "{", "value", "=", "await", "promise", ";", "}", "catch", "(", "e", ")", "{", "return", "e", ";", "}", "throw", "new", "UnexpectedResolutionError", "(", "'Inverted Promise resolved'", ",", "value", ")", ";", "}", "export", "type", "Reference", "=", "Warning", "|", "SourceRange", "|", "undefined", ";", "/**\n * Used for asserting that warnings or source ranges correspond to the right\n * parts of the source code.\n *\n * Non-test code probably wants WarningPrinter instead.\n */", "export", "class", "CodeUnderliner", "{", "private", "_parsedDocumentGetter", ":", "(", "url", ":", "string", ")", "=>", "Promise", "<", "ParsedDocument", ">", ";", "constructor", "(", "urlLoader", ",", "urlResolver", "?", ")", "{", "const", "analyzer", "=", "new", "Analyzer", "(", "{", "urlLoader", ",", "urlResolver", "}", ")", ";", "this", ".", "_parsedDocumentGetter", "=", "makeParseLoader", "(", "analyzer", ")", ";", "}", "static", "withMapping", "(", "url", ",", "contents", ")", "{", "const", "urlLoader", "=", "new", "InMemoryOverlayUrlLoader", "(", ")", ";", "urlLoader", ".", "urlContentsMap", ".", "set", "(", "url", ",", "contents", ")", ";", "return", "new", "CodeUnderliner", "(", "urlLoader", ",", "new", "class", "extends", "UrlResolver", "{", "resolve", "(", "firstUrl", ",", "secondUrl", "?", ")", "{", "return", "this", ".", "brandAsResolved", "(", "secondUrl", "||", "firstUrl", ")", ";", "}", "relative", "(", "to", ")", ";", "relative", "(", "from", ",", "to", ",", "kind", "?", ")", ";", "relative", "(", ")", "{", "throw", "new", "Error", "(", "'does not do relative'", ")", ";", "}", "}", "(", ")", ")", ";", "}", "/**\n * Converts one or more warnings/source ranges into underlined text.\n * ~~~~~~~~~~ ~~~~\n *\n * This has a loose set of types that it will accept in order to make\n * writing tests simple and legible.\n */", "async", "underline", "(", "reference", ")", ";", "async", "underline", "(", "references", ")", ";", "async", "underline", "(", "reference", ")", "{", "if", "(", "isReadonlyArray", "(", "reference", ")", ")", "{", "return", "Promise", ".", "all", "(", "reference", ".", "map", "(", "(", "ref", ")", "=>", "this", ".", "underline", "(", "ref", ")", ")", ")", ";", "}", "if", "(", "reference", "===", "undefined", ")", "{", "return", "'No source range given.'", ";", "}", "if", "(", "isWarning", "(", "reference", ")", ")", "{", "return", "'\\n'", "+", "reference", ".", "toString", "(", "{", "verbosity", ":", "'code-only'", ",", "color", ":", "false", "}", ")", ";", "}", "const", "parsedDocument", "=", "await", "this", ".", "_parsedDocumentGetter", "(", "reference", ".", "file", ")", ";", "return", "'\\n'", "+", "underlineCode", "(", "reference", ",", "parsedDocument", ")", ";", "}", "}", "function", "isReadonlyArray", "(", "maybeArr", ")", "{", "return", "Array", ".", "isArray", "(", "maybeArr", ")", ";", "}", "function", "isWarning", "(", "wOrS", ")", "{", "return", "'code'", "in", "wOrS", ";", "}", "/**\n * Run the given scanner on the given package relative url.\n *\n * The url must be loadable with the given analyzer.\n */", "export", "async", "function", "runScanner", "(", "analyzer", ",", "scanner", ",", "url", ")", "{", "const", "context", "=", "await", "analyzer", "[", "'_analysisComplete'", "]", ";", "const", "resolvedUrl", "=", "analyzer", ".", "resolveUrl", "(", "url", ")", "!", ";", "const", "parsedDocument", "=", "await", "context", "[", "'_parse'", "]", "(", "resolvedUrl", ",", "neverCancels", ")", ";", "return", "scan", "(", "parsedDocument", ",", "[", "scanner", "]", ")", ";", "}", "/**\n * Run the given scanner on some file contents as a string.\n *\n * Note that the url's file extension is relevant, because it will affect how\n * the file is parsed.\n */", "export", "async", "function", "runScannerOnContents", "(", "scanner", ",", "url", ",", "contents", ")", "{", "const", "overlayLoader", "=", "new", "InMemoryOverlayUrlLoader", "(", ")", ";", "const", "analyzer", "=", "new", "Analyzer", "(", "{", "urlLoader", ":", "overlayLoader", "}", ")", ";", "overlayLoader", ".", "urlContentsMap", ".", "set", "(", "analyzer", ".", "resolveUrl", "(", "url", ")", "!", ",", "contents", ")", ";", "const", "{", "features", ",", "warnings", "}", "=", "await", "runScanner", "(", "analyzer", ",", "scanner", ",", "url", ")", ";", "return", "{", "features", ",", "warnings", ",", "analyzer", ",", "urlLoader", ":", "overlayLoader", "}", ";", "}", "export", "const", "noOpTag", "=", "(", "strings", ",", "...", "values", ")", ":", "string", "=>", "values", ".", "reduce", "(", "(", "r", ",", "v", ",", "i", ")", "=>", "r", "+", "String", "(", "v", ")", "+", "strings", "[", "i", "+", "1", "]", ",", "strings", "[", "0", "]", ")", ";", "export", "function", "fileRelativeUrl", "(", "strings", ",", "...", "values", ")", "{", "return", "noOpTag", "(", "strings", ",", "...", "values", ")", "as", "FileRelativeUrl", ";", "}", "export", "function", "packageRelativeUrl", "(", "strings", ",", "...", "values", ")", "{", "return", "noOpTag", "(", "strings", ",", "...", "values", ")", "as", "PackageRelativeUrl", ";", "}", "export", "function", "resolvedUrl", "(", "strings", ",", "...", "values", ")", "{", "return", "noOpTag", "(", "strings", ",", "...", "values", ")", "as", "ResolvedUrl", ";", "}", "/**\n * On posix systems file urls look like:\n * file:///path/to/foo\n * On windows they look like:\n * file:///c%3A/path/to/foo\n *\n * This will produce an OS-correct file url. Pretty much only useful for testing\n * url resolvers.\n */", "export", "function", "rootedFileUrl", "(", "strings", ",", "...", "values", ")", "{", "const", "root", "=", "URI", ".", "file", "(", "path", ".", "resolve", "(", "'/'", ")", ")", ".", "toString", "(", ")", ";", "const", "text", "=", "noOpTag", "(", "strings", ",", "...", "values", ")", "as", "FileRelativeUrl", ";", "return", "(", "root", "+", "text", ")", "as", "ResolvedUrl", ";", "}", "export", "const", "fixtureDir", "=", "path", ".", "join", "(", "__dirname", ",", "'../../src/test/static'", ")", ";", "export", "async", "function", "assertIsCancelled", "(", "promise", ")", "{", "const", "rejection", "=", "await", "invertPromise", "(", "promise", ")", ";", "assert", ".", "isTrue", "(", "isCancel", "(", "rejection", ")", ",", "`Expected ${", "rejection", "} to be a Cancel.`", ")", ";", "}", "/**\n * Returns an analyzer with configuration inferred for the given directory.\n *\n * Currently this just creates a simple analyzer with a Fs loader rooted\n * at the given directory, but in the future it may take configuration from\n * files including polymer.json or similar.\n */", "export", "async", "function", "createForDirectory", "(", "dirname", ")", "{", "const", "urlLoader", "=", "new", "FsUrlLoader", "(", "dirname", ")", ";", "const", "urlResolver", "=", "new", "PackageUrlResolver", "(", "{", "packageDir", ":", "dirname", "}", ")", ";", "const", "analyzer", "=", "new", "Analyzer", "(", "{", "urlLoader", ",", "urlResolver", "}", ")", ";", "const", "underliner", "=", "new", "CodeUnderliner", "(", "analyzer", ")", ";", "return", "{", "urlLoader", ",", "urlResolver", ",", "analyzer", ",", "underliner", "}", ";", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 46499, null, 13912, null, null, null, null, 1344, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 27934, null, 1462, null, 2, null, null, null, 21744, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1462, null, null, null, 7135, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 17964, null, 1462, null, null, 7135, null, 1462, null, 1462, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 491, null, null, null, 7, null, 130, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 491, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 12625, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 1344, null, 1381, null, 2, null, null, null, 10984, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 12625, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 1381, null, 2, null, 2, null, null, null, 21744, null, null, null, null, null, null, null, 1344, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, 960, null, null, 5, null, null, null, null, null, null, null, null, null, 2, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7135, null, 960, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 17964, null, 960, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1462, null, 960, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1462, null, 960, null, null, 5, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7135, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 2, null, null, null, 0, null, null, null, null, null, null, null, null, 20795, null, null, null, null, null, null, null, null, null, null, null, null, 1344, null, null, null, null, null, null, null, null, null, null, null, null, 27934, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1313
[ "license", "import", "{", "assert", "}", "from", "'chai'", ";", "import", "{", "AnalysisCache", "}", "from", "'../../core/analysis-cache'", ";", "import", "{", "ResolvedUrl", "}", "from", "'../../model/url'", ";", "import", "{", "resolvedUrl", "}", "from", "'../test-utils'", ";", "suite", "(", "'AnalysisCache'", ",", "(", ")", "=>", "{", "test", "(", "'it can be constructed'", ",", "(", ")", "=>", "{", "new", "AnalysisCache", "(", ")", ";", "}", ")", ";", "function", "addFakeDocumentToCache", "(", "cache", ",", "path", ",", "dependencies", ")", "{", "const", "resolvedPath", "=", "path", "as", "ResolvedUrl", ";", "const", "resolvedDependencies", "=", "dependencies", "as", "ResolvedUrl", "[", "]", ";", "cache", ".", "parsedDocumentPromises", ".", "set", "(", "resolvedPath", ",", "`parsed ${", "resolvedPath", "} promise`", "as", "any", ")", ";", "cache", ".", "scannedDocumentPromises", ".", "set", "(", "resolvedPath", ",", "`scanned ${", "resolvedPath", "} promise`", "as", "any", ")", ";", "cache", ".", "analyzedDocumentPromises", ".", "set", "(", "resolvedPath", ",", "`analyzed ${", "resolvedPath", "} promise`", "as", "any", ")", ";", "cache", ".", "scannedDocuments", ".", "set", "(", "resolvedPath", ",", "`scanned ${", "resolvedPath", "}`", "as", "any", ")", ";", "cache", ".", "analyzedDocuments", ".", "set", "(", "resolvedPath", ",", "`analyzed ${", "resolvedPath", "}`", "as", "any", ")", ";", "cache", ".", "dependencyGraph", ".", "addDocument", "(", "resolvedPath", ",", "resolvedDependencies", ")", ";", "}", "async", "function", "assertHasDocument", "(", "cache", ",", "path", ")", "{", "const", "resolvedPath", "=", "path", "as", "ResolvedUrl", ";", "assert", ".", "equal", "(", "await", "cache", ".", "parsedDocumentPromises", ".", "getOrCompute", "(", "resolvedPath", ",", "null", "as", "any", ")", "as", "any", ",", "`parsed ${", "resolvedPath", "} promise`", ")", ";", "assert", ".", "equal", "(", "await", "cache", ".", "scannedDocumentPromises", ".", "getOrCompute", "(", "resolvedPath", ",", "null", "as", "any", ")", "as", "any", ",", "`scanned ${", "resolvedPath", "} promise`", ")", ";", "assert", ".", "equal", "(", "cache", ".", "scannedDocuments", ".", "get", "(", "resolvedPath", ")", "as", "any", ",", "`scanned ${", "resolvedPath", "}`", ")", ";", "assert", ".", "equal", "(", "cache", ".", "analyzedDocuments", ".", "get", "(", "resolvedPath", ")", "as", "any", ",", "`analyzed ${", "resolvedPath", "}`", ")", ";", "}", "function", "assertNotHasDocument", "(", "cache", ",", "p", ")", "{", "const", "path", "=", "p", "as", "ResolvedUrl", ";", "assert", ".", "isFalse", "(", "cache", ".", "parsedDocumentPromises", ".", "has", "(", "path", ")", ")", ";", "assert", ".", "isFalse", "(", "cache", ".", "scannedDocumentPromises", ".", "has", "(", "path", ")", ")", ";", "assert", ".", "isFalse", "(", "cache", ".", "scannedDocuments", ".", "has", "(", "path", ")", ")", ";", "assert", ".", "isFalse", "(", "cache", ".", "analyzedDocuments", ".", "has", "(", "path", ")", ")", ";", "}", "async", "function", "assertDocumentScannedButNotResolved", "(", "cache", ",", "p", ")", "{", "const", "path", "=", "p", "as", "ResolvedUrl", ";", "assert", ".", "equal", "(", "await", "cache", ".", "parsedDocumentPromises", ".", "getOrCompute", "(", "path", ",", "null", "as", "any", ")", "as", "any", ",", "`parsed ${", "path", "} promise`", ")", ";", "assert", ".", "equal", "(", "await", "cache", ".", "scannedDocumentPromises", ".", "getOrCompute", "(", "path", ",", "null", "as", "any", ")", "as", "any", ",", "`scanned ${", "path", "} promise`", ")", ";", "assert", ".", "equal", "(", "cache", ".", "scannedDocuments", ".", "get", "(", "path", ")", "as", "any", ",", "`scanned ${", "path", "}`", ")", ";", "assert", ".", "isFalse", "(", "cache", ".", "analyzedDocuments", ".", "has", "(", "path", ")", ")", ";", "assert", ".", "isFalse", "(", "cache", ".", "analyzedDocumentPromises", ".", "has", "(", "path", ")", ")", ";", "}", "test", "(", "'it invalidates a path when asked to'", ",", "async", "(", ")", "=>", "{", "const", "cache", "=", "new", "AnalysisCache", "(", ")", ";", "addFakeDocumentToCache", "(", "cache", ",", "'index.html'", ",", "[", "]", ")", ";", "addFakeDocumentToCache", "(", "cache", ",", "'unrelated.html'", ",", "[", "]", ")", ";", "await", "assertHasDocument", "(", "cache", ",", "'index.html'", ")", ";", "await", "assertHasDocument", "(", "cache", ",", "'unrelated.html'", ")", ";", "const", "forkedCache", "=", "cache", ".", "invalidate", "(", "[", "'index.html'", "]", "as", "ResolvedUrl", "[", "]", ")", ";", "await", "assertHasDocument", "(", "cache", ",", "'index.html'", ")", ";", "await", "assertHasDocument", "(", "cache", ",", "'unrelated.html'", ")", ";", "assertNotHasDocument", "(", "forkedCache", ",", "'index.html'", ")", ";", "await", "assertHasDocument", "(", "forkedCache", ",", "'unrelated.html'", ")", ";", "assert", ".", "equal", "(", "await", "forkedCache", ".", "analyzedDocumentPromises", ".", "getOrCompute", "(", "resolvedUrl", "`unrelated.html`", ",", "null", "as", "any", ")", "as", "any", ",", "`analyzed unrelated.html`", ")", ";", "}", ")", ";", "test", "(", "'it invalidates the dependants of a path when asked to'", ",", "async", "(", ")", "=>", "{", "const", "cache", "=", "new", "AnalysisCache", "(", ")", ";", "addFakeDocumentToCache", "(", "cache", ",", "'index.html'", ",", "[", "'element.html'", "]", ")", ";", "addFakeDocumentToCache", "(", "cache", ",", "'element.html'", ",", "[", "'behavior.html'", "]", ")", ";", "addFakeDocumentToCache", "(", "cache", ",", "'behavior.html'", ",", "[", "]", ")", ";", "addFakeDocumentToCache", "(", "cache", ",", "'unrelated.html'", ",", "[", "]", ")", ";", "await", "assertHasDocument", "(", "cache", ",", "'index.html'", ")", ";", "await", "assertHasDocument", "(", "cache", ",", "'unrelated.html'", ")", ";", "await", "assertHasDocument", "(", "cache", ",", "'behavior.html'", ")", ";", "await", "assertHasDocument", "(", "cache", ",", "'unrelated.html'", ")", ";", "const", "forkedCache", "=", "cache", ".", "invalidate", "(", "[", "'behavior.html'", "]", "as", "ResolvedUrl", "[", "]", ")", ";", "await", "assertHasDocument", "(", "cache", ",", "'index.html'", ")", ";", "await", "assertHasDocument", "(", "cache", ",", "'unrelated.html'", ")", ";", "await", "assertHasDocument", "(", "cache", ",", "'behavior.html'", ")", ";", "await", "assertHasDocument", "(", "cache", ",", "'unrelated.html'", ")", ";", "assertNotHasDocument", "(", "forkedCache", ",", "'behavior.html'", ")", ";", "await", "assertDocumentScannedButNotResolved", "(", "forkedCache", ",", "'index.html'", ")", ";", "await", "assertDocumentScannedButNotResolved", "(", "forkedCache", ",", "'element.html'", ")", ";", "await", "assertHasDocument", "(", "forkedCache", ",", "'unrelated.html'", ")", ";", "}", ")", ";", "}", ")", ";" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 24295, null, 2, null, 5, null, null, null, 1462, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 24295, null, 2, null, null, null, 1462, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 24295, null, 2, null, null, null, 1462, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 24295, null, 2, null, null, null, 1462, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 24295, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 24295, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 24295, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 24295, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1314
[ "license", "import", "*", "as", "babel", "from", "'@babel/types'", ";", "import", "{", "assert", ",", "use", "}", "from", "'chai'", ";", "import", "*", "as", "clone", "from", "'clone'", ";", "import", "*", "as", "path", "from", "'path'", ";", "import", "*", "as", "shady", "from", "'shady-css-parser'", ";", "import", "{", "Analyzer", ",", "Options", "}", "from", "'../../core/analyzer'", ";", "import", "{", "Deferred", "}", "from", "'../../core/utils'", ";", "import", "{", "ParsedCssDocument", "}", "from", "'../../css/css-document'", ";", "import", "{", "ParsedHtmlDocument", "}", "from", "'../../html/html-document'", ";", "import", "{", "HtmlParser", "}", "from", "'../../html/html-parser'", ";", "import", "{", "ScriptTagImport", "}", "from", "'../../html/html-script-tag'", ";", "import", "{", "JavaScriptDocument", "}", "from", "'../../javascript/javascript-document'", ";", "import", "{", "Document", ",", "ScannedImport", ",", "ScannedInlineDocument", ",", "Severity", ",", "Warning", "}", "from", "'../../model/model'", ";", "import", "{", "FsUrlLoader", "}", "from", "'../../url-loader/fs-url-loader'", ";", "import", "{", "InMemoryOverlayUrlLoader", "}", "from", "'../../url-loader/overlay-loader'", ";", "import", "{", "UrlLoader", "}", "from", "'../../url-loader/url-loader'", ";", "import", "{", "CodeUnderliner", ",", "createForDirectory", ",", "fixtureDir", ",", "invertPromise", ",", "resolvedUrl", "}", "from", "'../test-utils'", ";", "import", "chaiAsPromised", "=", "require", "(", "'chai-as-promised'", ")", ";", "import", "chaiSubset", "=", "require", "(", "'chai-subset'", ")", ";", "import", "stripIndent", "=", "require", "(", "'strip-indent'", ")", ";", "import", "{", "ResolvedUrl", ",", "FileRelativeUrl", "}", "from", "'../../model/url'", ";", "import", "{", "PackageUrlResolver", "}", "from", "'../../url-loader/package-url-resolver'", ";", "import", "{", "AnalysisContext", "}", "from", "'../../core/analysis-context'", ";", "import", "{", "HtmlScanner", "}", "from", "'../../html/html-scanner'", ";", "import", "{", "ScannedFeature", "}", "from", "'../../index'", ";", "import", "Uri", "from", "'vscode-uri'", ";", "import", "{", "neverCancels", "}", "from", "'../../core/cancel-token'", ";", "use", "(", "chaiSubset", ")", ";", "use", "(", "chaiAsPromised", ")", ";", "function", "getOnly", "<", "V", ">", "(", "iter", ")", "{", "const", "arr", "=", "Array", ".", "from", "(", "iter", ")", ";", "assert", ".", "equal", "(", "arr", ".", "length", ",", "1", ")", ";", "return", "arr", "[", "0", "]", "!", ";", "}", "const", "testDir", "=", "path", ".", "join", "(", "fixtureDir", ",", "'..'", ")", ";", "suite", "(", "'Analyzer'", ",", "(", ")", "=>", "{", "let", "analyzer", ";", "let", "inMemoryOverlay", ";", "let", "underliner", ";", "async", "function", "analyzeDocument", "(", "url", ",", "localAnalyzer", "?", ")", "{", "localAnalyzer", "=", "localAnalyzer", "||", "analyzer", ";", "const", "result", "=", "(", "await", "localAnalyzer", ".", "analyze", "(", "[", "url", "]", ")", ")", ".", "getDocument", "(", "url", ")", ";", "if", "(", "!", "result", ".", "successful", ")", "{", "throw", "new", "Error", "(", "`Could not get document for url: ${", "url", "}`", ")", ";", "}", "return", "result", ".", "value", ";", "}", ";", "setup", "(", "(", ")", "=>", "{", "const", "underlyingUrlLoader", "=", "new", "FsUrlLoader", "(", "testDir", ")", ";", "inMemoryOverlay", "=", "new", "InMemoryOverlayUrlLoader", "(", "underlyingUrlLoader", ")", ";", "analyzer", "=", "new", "Analyzer", "(", "{", "urlLoader", ":", "inMemoryOverlay", ",", "urlResolver", ":", "new", "PackageUrlResolver", "(", "{", "packageDir", ":", "testDir", "}", ")", "}", ")", ";", "underliner", "=", "new", "CodeUnderliner", "(", "inMemoryOverlay", ")", ";", "}", ")", ";", "test", "(", "'canLoad delegates to the urlLoader canLoad method'", ",", "(", ")", "=>", "{", "assert", ".", "isTrue", "(", "analyzer", ".", "canLoad", "(", "Uri", ".", "file", "(", "testDir", ")", ".", "toString", "(", ")", "as", "ResolvedUrl", ")", ")", ";", "assert", ".", "isFalse", "(", "analyzer", ".", "canLoad", "(", "Uri", ".", "file", "(", "path", ".", "resolve", "(", "testDir", ",", "'../outside'", ")", ")", ".", "toString", "(", ")", "as", "ResolvedUrl", ")", ")", ";", "assert", ".", "isFalse", "(", "analyzer", ".", "canLoad", "(", "resolvedUrl", "`file://hostname/path`", ")", ")", ";", "assert", ".", "isFalse", "(", "analyzer", ".", "canLoad", "(", "resolvedUrl", "`http://host/`", ")", ")", ";", "assert", ".", "isFalse", "(", "analyzer", ".", "canLoad", "(", "resolvedUrl", "`http://host/path`", ")", ")", ";", "}", ")", ";", "suite", "(", "'analyze()'", ",", "(", ")", "=>", "{", "let", "testName", "=", "'analyzes a document with an inline Polymer element feature'", ";", "test", "(", "testName", ",", "async", "(", ")", "=>", "{", "const", "document", "=", "await", "analyzeDocument", "(", "'static/analysis/simple/simple-element.html'", ")", ";", "const", "elements", "=", "Array", ".", "from", "(", "document", ".", "getFeatures", "(", "{", "kind", ":", "'element'", ",", "imported", ":", "false", "}", ")", ")", ";", "assert", ".", "deepEqual", "(", "elements", ".", "map", "(", "(", "e", ")", "=>", "e", ".", "tagName", ")", ",", "[", "'simple-element'", "]", ")", ";", "}", ")", ";", "testName", "=", "'analyzes a document with an external Polymer element feature'", ";", "test", "(", "testName", ",", "async", "(", ")", "=>", "{", "const", "document", "=", "await", "analyzeDocument", "(", "'static/analysis/separate-js/element.html'", ")", ";", "const", "elements", "=", "Array", ".", "from", "(", "document", ".", "getFeatures", "(", "{", "kind", ":", "'element'", ",", "imported", ":", "true", "}", ")", ")", ";", "assert", ".", "deepEqual", "(", "elements", ".", "map", "(", "(", "e", ")", "=>", "e", ".", "tagName", ")", ",", "[", "'my-element'", "]", ")", ";", "}", ")", ";", "test", "(", "'gets source ranges of documents correct'", ",", "async", "(", ")", "=>", "{", "const", "document", "=", "await", "analyzeDocument", "(", "'static/dependencies/root.html'", ")", ";", "assert", ".", "deepEqual", "(", "await", "underliner", ".", "underline", "(", "document", ".", "sourceRange", ")", ",", "`\n<link rel=\"import\" href=\"inline-only.html\">\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n<link rel=\"import\" href=\"leaf.html\">\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n<link rel=\"import\" href=\"inline-and-imports.html\">\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n<link rel=\"import\" href=\"subfolder/in-folder.html\">\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n<link rel=\"lazy-import\" href=\"lazy.html\">\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n`", ")", ";", "}", ")", ";", "test", "(", "'analyzes inline scripts correctly'", ",", "async", "(", ")", "=>", "{", "const", "document", "=", "await", "analyzeDocument", "(", "'static/inline-documents/inline-documents.html'", ")", ";", "const", "jsDocuments", "=", "document", ".", "getFeatures", "(", "{", "kind", ":", "'js-document'", "}", ")", ";", "assert", ".", "equal", "(", "jsDocuments", ".", "size", ",", "1", ")", ";", "const", "jsDocument", "=", "getOnly", "(", "jsDocuments", ")", ";", "assert", ".", "isObject", "(", "jsDocument", ".", "astNode", ")", ";", "const", "astNode", "=", "jsDocument", ".", "astNode", "!", ";", "if", "(", "astNode", ".", "language", "!==", "'html'", ")", "{", "throw", "new", "Error", "(", "'Expected inline js doc to have an HTML containing node.'", ")", ";", "}", "assert", ".", "equal", "(", "astNode", ".", "node", ".", "tagName", ",", "'script'", ")", ";", "assert", ".", "deepEqual", "(", "await", "underliner", ".", "underline", "(", "jsDocument", ".", "sourceRange", ")", ",", "`\n <script>\n ~\n console.log('hi');\n~~~~~~~~~~~~~~~~~~~~~~\n </script>\n~~`", ")", ";", "}", ")", ";", "test", "(", "'analyzes inline styles correctly'", ",", "async", "(", ")", "=>", "{", "const", "document", "=", "await", "analyzeDocument", "(", "'static/inline-documents/inline-documents.html'", ")", ";", "const", "cssDocuments", "=", "document", ".", "getFeatures", "(", "{", "kind", ":", "'css-document'", "}", ")", ";", "const", "cssDocument", "=", "getOnly", "(", "cssDocuments", ")", ";", "const", "astNode", "=", "cssDocument", ".", "astNode", "!", ";", "assert", ".", "isObject", "(", "astNode", ")", ";", "if", "(", "astNode", ".", "language", "!==", "'html'", ")", "{", "throw", "new", "Error", "(", "'Expected inline css doc to have an HTML containing node.'", ")", ";", "}", "assert", ".", "equal", "(", "astNode", ".", "node", ".", "tagName", ",", "'style'", ")", ";", "assert", ".", "deepEqual", "(", "await", "underliner", ".", "underline", "(", "cssDocument", ".", "sourceRange", ")", ",", "`\n <style>\n ~\n body {\n~~~~~~~~~~\n color: red;\n~~~~~~~~~~~~~~~~~\n }\n~~~~~\n </style>\n~~`", ")", ";", "}", ")", ";", "test", "(", "'analyzes a document with an import'", ",", "async", "(", ")", "=>", "{", "const", "document", "=", "await", "analyzeDocument", "(", "'static/analysis/behaviors/behavior.html'", ")", ";", "const", "behaviors", "=", "Array", ".", "from", "(", "document", ".", "getFeatures", "(", "{", "kind", ":", "'behavior'", ",", "imported", ":", "true", "}", ")", ")", ";", "assert", ".", "deepEqual", "(", "behaviors", ".", "map", "(", "(", "b", ")", "=>", "b", ".", "className", ")", ",", "[", "'MyNamespace.SubBehavior'", ",", "'MyNamespace.SimpleBehavior'", "]", ")", ";", "}", ")", ";", "testName", "=", "`creates \"missing behavior\" warnings on imported `", "+", "`documents without elements`", ";", "test", "(", "testName", ",", "async", "(", ")", "=>", "{", "const", "document", "=", "await", "analyzeDocument", "(", "'static/chained-missing-behavior/index.html'", ")", ";", "const", "chainedDocument", "=", "getOnly", "(", "document", ".", "getFeatures", "(", "{", "kind", ":", "'document'", ",", "id", ":", "analyzer", ".", "resolveUrl", "(", "'static/chained-missing-behavior/chained.html'", ")", ",", "imported", ":", "true", "}", ")", ")", ";", "const", "expectedWarning", "=", "{", "code", ":", "'could-not-resolve-reference'", ",", "message", ":", "'Could not resolve reference to behavior. Is it annotated with'", "+", "' @polymerBehavior?'", ",", "severity", ":", "1", ",", "sourceRange", ":", "{", "end", ":", "{", "column", ":", "55", ",", "line", ":", "2", "}", ",", "start", ":", "{", "column", ":", "39", ",", "line", ":", "2", "}", ",", "file", ":", "analyzer", ".", "resolveUrl", "(", "'static/chained-missing-behavior/chained.html'", ")", "}", ",", "}", ";", "assert", ".", "deepEqual", "(", "document", ".", "getWarnings", "(", "{", "imported", ":", "false", "}", ")", ",", "[", "]", ")", ";", "assert", ".", "deepEqual", "(", "document", ".", "getWarnings", "(", "{", "imported", ":", "true", "}", ")", ".", "map", "(", "(", "w", ")", "=>", "w", ".", "toJSON", "(", ")", ")", ",", "[", "expectedWarning", "]", ")", ";", "assert", ".", "deepEqual", "(", "chainedDocument", ".", "getWarnings", "(", "{", "imported", ":", "false", "}", ")", ".", "map", "(", "(", "w", ")", "=>", "w", ".", "toJSON", "(", ")", ")", ",", "[", "expectedWarning", "]", ")", ";", "}", ")", ";", "testName", "=", "'an inline document can find features from its container document'", ";", "test", "(", "testName", ",", "async", "(", ")", "=>", "{", "const", "document", "=", "await", "analyzeDocument", "(", "'static/analysis/behaviors/behavior.html'", ")", ";", "const", "localDocuments", "=", "document", ".", "getFeatures", "(", "{", "kind", ":", "'document'", ",", "imported", ":", "false", "}", ")", ";", "assert", ".", "equal", "(", "localDocuments", ".", "size", ",", "2", ")", ";", "const", "allDocuments", "=", "document", ".", "getFeatures", "(", "{", "kind", ":", "'document'", ",", "imported", ":", "true", "}", ")", ";", "assert", ".", "equal", "(", "allDocuments", ".", "size", ",", "4", ")", ";", "const", "inlineDocuments", "=", "Array", ".", "from", "(", "document", ".", "getFeatures", "(", "{", "kind", ":", "'document'", ",", "imported", ":", "false", "}", ")", ")", ".", "filter", "(", "(", "d", ")", "=>", "d", "instanceof", "Document", "&&", "d", ".", "isInline", ")", ";", "assert", ".", "equal", "(", "inlineDocuments", ".", "length", ",", "1", ")", ";", "const", "behaviorJsDocument", "=", "inlineDocuments", "[", "0", "]", ";", "const", "subBehavior", "=", "getOnly", "(", "behaviorJsDocument", ".", "getFeatures", "(", "{", "kind", ":", "'behavior'", ",", "id", ":", "'MyNamespace.SubBehavior'", ",", "imported", ":", "true", "}", ")", ")", ";", "assert", ".", "equal", "(", "subBehavior", "!", ".", "className", ",", "'MyNamespace.SubBehavior'", ")", ";", "}", ")", ";", "testName", "=", "'an inline script can find features from its container document'", ";", "test", "(", "testName", ",", "async", "(", ")", "=>", "{", "const", "document", "=", "await", "analyzeDocument", "(", "'static/script-tags/inline/test-element.html'", ")", ";", "const", "inlineDocuments", "=", "Array", ".", "from", "(", "document", ".", "getFeatures", "(", "{", "kind", ":", "'document'", ",", "imported", ":", "false", "}", ")", ")", ".", "filter", "(", "(", "d", ")", "=>", "d", ".", "isInline", ")", ";", "assert", ".", "equal", "(", "inlineDocuments", ".", "length", ",", "1", ")", ";", "const", "inlineJsDocument", "=", "inlineDocuments", "[", "0", "]", ";", "const", "subBehavior", "=", "getOnly", "(", "inlineJsDocument", ".", "getFeatures", "(", "{", "kind", ":", "'behavior'", ",", "id", ":", "'TestBehavior'", ",", "imported", ":", "true", "}", ")", ")", ";", "assert", ".", "equal", "(", "subBehavior", "!", ".", "className", ",", "'TestBehavior'", ")", ";", "}", ")", ";", "testName", "=", "'an inline feature can narrow down its containing document'", ";", "test", "(", "testName", ",", "async", "(", ")", "=>", "{", "const", "url", "=", "'static/script-tags/inline/test-element.html'", ";", "const", "result", "=", "(", "await", "analyzer", ".", "analyze", "(", "[", "url", "]", ")", ")", ";", "const", "document", "=", "result", ".", "getDocument", "(", "url", ")", ";", "if", "(", "!", "document", ".", "successful", ")", "{", "throw", "new", "Error", "(", "`Could not get document for url: ${", "url", "}`", ")", ";", "}", "const", "inlineDocuments", "=", "Array", ".", "from", "(", "document", ".", "value", ".", "getFeatures", "(", "{", "kind", ":", "'document'", ",", "imported", ":", "false", "}", ")", ")", ".", "filter", "(", "(", "d", ")", "=>", "d", ".", "isInline", ")", ";", "assert", ".", "equal", "(", "inlineDocuments", ".", "length", ",", "1", ")", ";", "const", "inlineJsDocument", "=", "inlineDocuments", "[", "0", "]", ";", "const", "subBehavior", "=", "getOnly", "(", "document", ".", "value", ".", "getFeatures", "(", "{", "kind", ":", "'polymer-element'", ",", "id", ":", "'test-element'", ",", "imported", ":", "true", "}", ")", ")", ";", "const", "narrowedDocument", "=", "result", ".", "getDocumentContaining", "(", "subBehavior", ".", "sourceRange", ")", ";", "assert", ".", "equal", "(", "narrowedDocument", ",", "inlineJsDocument", ")", ";", "}", ")", ";", "testName", "=", "'a feature in the top level document narrows down to the full document'", ";", "test", "(", "testName", ",", "async", "(", ")", "=>", "{", "const", "url", "=", "'static/script-tags/inline/test-element.html'", ";", "const", "result", "=", "(", "await", "analyzer", ".", "analyze", "(", "[", "url", "]", ")", ")", ";", "const", "document", "=", "result", ".", "getDocument", "(", "url", ")", ";", "if", "(", "!", "document", ".", "successful", ")", "{", "throw", "new", "Error", "(", "`Could not get document for url: ${", "url", "}`", ")", ";", "}", "const", "HTMLImport", "=", "getOnly", "(", "document", ".", "value", ".", "getFeatures", "(", "{", "kind", ":", "'html-import'", "}", ")", ")", ";", "const", "narrowedDocument", "=", "result", ".", "getDocumentContaining", "(", "HTMLImport", ".", "sourceRange", ")", ";", "assert", ".", "equal", "(", "narrowedDocument", ",", "document", ".", "value", ")", ";", "}", ")", ";", "testName", "=", "'an external script can find features from its container document'", ";", "test", "(", "testName", ",", "async", "(", ")", "=>", "{", "const", "document", "=", "await", "analyzeDocument", "(", "'static/script-tags/external/test-element.html'", ")", ";", "const", "htmlScriptTags", "=", "Array", ".", "from", "(", "document", ".", "getFeatures", "(", "{", "kind", ":", "'html-script'", ",", "imported", ":", "false", "}", ")", ")", ";", "assert", ".", "equal", "(", "htmlScriptTags", ".", "length", ",", "1", ")", ";", "const", "htmlScriptTag", "=", "htmlScriptTags", "[", "0", "]", "as", "ScriptTagImport", ";", "const", "scriptDocument", "=", "htmlScriptTag", ".", "document", ";", "const", "subBehavior", "=", "getOnly", "(", "scriptDocument", "!", ".", "getFeatures", "(", "{", "kind", ":", "'behavior'", ",", "id", ":", "'TestBehavior'", ",", "imported", ":", "true", "}", ")", ")", "!", ";", "assert", ".", "equal", "(", "subBehavior", ".", "className", ",", "'TestBehavior'", ")", ";", "}", ")", ";", "testName", "=", "'an inline document can find behaviors from its container document'", ";", "test", "(", "testName", ",", "async", "(", ")", "=>", "{", "const", "document", "=", "await", "analyzeDocument", "(", "'static/analysis/behaviors/elementdir/element.html'", ")", ";", "const", "documents", "=", "document", ".", "getFeatures", "(", "{", "kind", ":", "'document'", ",", "imported", ":", "false", "}", ")", ";", "assert", ".", "equal", "(", "documents", ".", "size", ",", "2", ")", ";", "const", "inlineDocuments", "=", "Array", ".", "from", "(", "documents", ")", ".", "filter", "(", "(", "d", ")", "=>", "d", "instanceof", "Document", "&&", "d", ".", "isInline", ")", ";", "assert", ".", "equal", "(", "inlineDocuments", ".", "length", ",", "1", ")", ";", "const", "behaviorJsDocument", "=", "inlineDocuments", "[", "0", "]", ";", "const", "subBehavior", "=", "getOnly", "(", "behaviorJsDocument", ".", "getFeatures", "(", "{", "kind", ":", "'behavior'", ",", "id", ":", "'MyNamespace.SubBehavior'", ",", "imported", ":", "true", "}", ")", ")", ";", "assert", ".", "equal", "(", "subBehavior", ".", "className", ",", "'MyNamespace.SubBehavior'", ")", ";", "}", ")", ";", "test", "(", "'returns a Document with warnings for malformed files'", ",", "async", "(", ")", "=>", "{", "const", "document", "=", "await", "analyzeDocument", "(", "'static/malformed.html'", ")", ";", "assert", "(", "document", ".", "getWarnings", "(", "{", "imported", ":", "false", "}", ")", ".", "length", ">=", "1", ")", ";", "}", ")", ";", "test", "(", "'analyzes transitive dependencies'", ",", "async", "(", ")", "=>", "{", "const", "root", "=", "await", "analyzeDocument", "(", "'static/dependencies/root.html'", ")", ";", "const", "strictlyReachableDocuments", "=", "[", "[", "'static/dependencies/root.html'", ",", "'html'", ",", "false", "]", ",", "[", "'static/dependencies/inline-only.html'", ",", "'html'", ",", "false", "]", ",", "[", "'static/dependencies/inline-only.html'", ",", "'js'", ",", "true", "]", ",", "[", "'static/dependencies/inline-only.html'", ",", "'css'", ",", "true", "]", ",", "[", "'static/dependencies/leaf.html'", ",", "'html'", ",", "false", "]", ",", "[", "'static/dependencies/inline-and-imports.html'", ",", "'html'", ",", "false", "]", ",", "[", "'static/dependencies/inline-and-imports.html'", ",", "'js'", ",", "true", "]", ",", "[", "'static/dependencies/subfolder/in-folder.html'", ",", "'html'", ",", "false", "]", ",", "[", "'static/dependencies/subfolder/subfolder-sibling.html'", ",", "'html'", ",", "false", "]", ",", "[", "'static/dependencies/inline-and-imports.html'", ",", "'css'", ",", "true", "]", ",", "]", ".", "map", "(", "(", "[", "u", ",", "t", ",", "i", "]", ")", "=>", "[", "analyzer", ".", "resolveUrl", "(", "u", "as", "string", ")", ",", "t", ",", "i", "]", ")", ";", "assert", ".", "deepEqual", "(", "Array", ".", "from", "(", "root", ".", "getFeatures", "(", "{", "kind", ":", "'document'", ",", "imported", ":", "true", ",", "noLazyImports", ":", "true", "}", ")", ")", ".", "map", "(", "(", "d", ")", "=>", "[", "d", ".", "url", ",", "d", ".", "parsedDocument", ".", "type", ",", "d", ".", "isInline", "]", ")", ",", "strictlyReachableDocuments", ")", ";", "assert", ".", "deepEqual", "(", "Array", ".", "from", "(", "root", ".", "getFeatures", "(", "{", "kind", ":", "'document'", ",", "imported", ":", "true", "}", ")", ")", ".", "map", "(", "(", "d", ")", "=>", "[", "d", ".", "url", ",", "d", ".", "parsedDocument", ".", "type", ",", "d", ".", "isInline", "]", ")", ",", "strictlyReachableDocuments", ".", "concat", "(", "[", "[", "analyzer", ".", "resolveUrl", "(", "'static/dependencies/lazy.html'", ")", ",", "'html'", ",", "false", "]", "]", ")", ")", ";", "assert", ".", "deepEqual", "(", "Array", ".", "from", "(", "root", ".", "getFeatures", "(", "{", "kind", ":", "'import'", ",", "imported", ":", "true", "}", ")", ")", ".", "map", "(", "(", "d", ")", "=>", "d", ".", "url", ")", ",", "[", "'static/dependencies/inline-only.html'", ",", "'static/dependencies/leaf.html'", ",", "'static/dependencies/inline-and-imports.html'", ",", "'static/dependencies/subfolder/in-folder.html'", ",", "'static/dependencies/subfolder/subfolder-sibling.html'", ",", "'static/dependencies/subfolder/in-folder.html'", ",", "'static/dependencies/lazy.html'", ",", "]", ".", "map", "(", "(", "u", ")", "=>", "analyzer", ".", "resolveUrl", "(", "u", ")", ")", ")", ";", "const", "inlineOnly", "=", "getOnly", "(", "root", ".", "getFeatures", "(", "{", "kind", ":", "'document'", ",", "id", ":", "analyzer", ".", "resolveUrl", "(", "'static/dependencies/inline-only.html'", ")", ",", "imported", ":", "true", "}", ")", ")", ";", "assert", ".", "deepEqual", "(", "Array", ".", "from", "(", "inlineOnly", "!", ".", "getFeatures", "(", "{", "kind", ":", "'document'", ",", "imported", ":", "true", "}", ")", ")", ".", "map", "(", "(", "d", ")", "=>", "d", ".", "parsedDocument", ".", "type", ")", ",", "[", "'html'", ",", "'js'", ",", "'css'", "]", ")", ";", "const", "leaf", "=", "getOnly", "(", "root", ".", "getFeatures", "(", "{", "kind", ":", "'document'", ",", "id", ":", "analyzer", ".", "resolveUrl", "(", "'static/dependencies/leaf.html'", ")", ",", "imported", ":", "true", "}", ")", ")", ";", "assert", ".", "deepEqual", "(", "Array", ".", "from", "(", "leaf", ".", "getFeatures", "(", "{", "kind", ":", "'document'", ",", "imported", ":", "true", "}", ")", ")", ",", "[", "leaf", "]", ")", ";", "const", "inlineAndImports", "=", "getOnly", "(", "root", ".", "getFeatures", "(", "{", "kind", ":", "'document'", ",", "id", ":", "analyzer", ".", "resolveUrl", "(", "'static/dependencies/inline-and-imports.html'", ")", ",", "imported", ":", "true", "}", ")", ")", ";", "assert", ".", "deepEqual", "(", "Array", ".", "from", "(", "inlineAndImports", ".", "getFeatures", "(", "{", "kind", ":", "'document'", ",", "imported", ":", "true", "}", ")", ")", ".", "map", "(", "(", "d", ")", "=>", "d", ".", "parsedDocument", ".", "type", ")", ",", "[", "'html'", ",", "'js'", ",", "'html'", ",", "'html'", ",", "'css'", "]", ")", ";", "const", "inFolder", "=", "getOnly", "(", "root", ".", "getFeatures", "(", "{", "kind", ":", "'document'", ",", "id", ":", "analyzer", ".", "resolveUrl", "(", "'static/dependencies/subfolder/in-folder.html'", ")", ",", "imported", ":", "true", "}", ")", ")", ";", "assert", ".", "deepEqual", "(", "Array", ".", "from", "(", "inFolder", ".", "getFeatures", "(", "{", "kind", ":", "'document'", ",", "imported", ":", "true", "}", ")", ")", ".", "map", "(", "(", "d", ")", "=>", "d", ".", "url", ")", ",", "[", "'static/dependencies/subfolder/in-folder.html'", ",", "'static/dependencies/subfolder/subfolder-sibling.html'", "]", ".", "map", "(", "(", "u", ")", "=>", "analyzer", ".", "resolveUrl", "(", "u", ")", ")", ")", ";", "assert", ".", "equal", "(", "getOnly", "(", "inlineAndImports", "!", ".", "getFeatures", "(", "{", "kind", ":", "'document'", ",", "id", ":", "analyzer", ".", "resolveUrl", "(", "'static/dependencies/subfolder/in-folder.html'", ")", ",", "imported", ":", "true", "}", ")", ")", ",", "inFolder", ")", ";", "}", ")", ";", "test", "(", "`warns for files that don't exist`", ",", "async", "(", ")", "=>", "{", "const", "url", "=", "'/static/does_not_exist'", ";", "const", "analysis", "=", "await", "analyzer", ".", "analyze", "(", "[", "url", "]", ")", ";", "const", "result", "=", "analysis", ".", "getDocument", "(", "url", ")", ";", "if", "(", "result", ".", "successful", ")", "{", "throw", "new", "Error", "(", "'Expected a failed result from getDocument'", ")", ";", "}", "assert", ".", "isTrue", "(", "result", ".", "error", "instanceof", "Warning", ")", ";", "}", ")", ";", "test", "(", "'handles documents from multiple calls to analyze()'", ",", "async", "(", ")", "=>", "{", "await", "analyzer", ".", "analyze", "(", "[", "'static/caching/file1.html'", "]", ")", ";", "await", "analyzer", ".", "analyze", "(", "[", "'static/caching/file2.html'", "]", ")", ";", "}", ")", ";", "test", "(", "'handles mutually recursive documents'", ",", "async", "(", ")", "=>", "{", "const", "document", "=", "await", "analyzeDocument", "(", "'static/circular/mutual-a.html'", ")", ";", "assert", ".", "deepEqual", "(", "[", "...", "document", ".", "getFeatures", "(", "{", "kind", ":", "'document'", "}", ")", "]", ".", "map", "(", "(", "f", ")", "=>", "f", ".", "url", ")", ",", "[", "analyzer", ".", "resolveUrl", "(", "'static/circular/mutual-a.html'", ")", "]", ")", ";", "assert", ".", "deepEqual", "(", "[", "...", "document", ".", "getFeatures", "(", "{", "kind", ":", "'import'", "}", ")", "]", ".", "map", "(", "(", "f", ")", "=>", "f", ".", "url", ")", ",", "[", "analyzer", ".", "resolveUrl", "(", "'static/circular/mutual-b.html'", ")", "]", ")", ";", "assert", ".", "deepEqual", "(", "[", "...", "document", ".", "getFeatures", "(", "{", "kind", ":", "'document'", ",", "imported", ":", "true", "}", ")", "]", ".", "map", "(", "(", "f", ")", "=>", "f", ".", "url", ")", ",", "[", "'static/circular/mutual-a.html'", ",", "'static/circular/mutual-b.html'", "]", ".", "map", "(", "(", "u", ")", "=>", "analyzer", ".", "resolveUrl", "(", "u", ")", ")", ")", ";", "assert", ".", "deepEqual", "(", "[", "...", "document", ".", "getFeatures", "(", "{", "kind", ":", "'import'", ",", "imported", ":", "true", "}", ")", "]", ".", "map", "(", "(", "f", ")", "=>", "f", ".", "url", ")", ",", "[", "'static/circular/mutual-b.html'", ",", "'static/circular/mutual-a.html'", "]", ".", "map", "(", "(", "u", ")", "=>", "analyzer", ".", "resolveUrl", "(", "u", ")", ")", ")", ";", "}", ")", ";", "testName", "=", "'handles parallel analyses of mutually recursive documents'", ";", "test", "(", "testName", ",", "async", "(", ")", "=>", "{", "await", "Promise", ".", "all", "(", "[", "analyzer", ".", "analyze", "(", "[", "'static/circular/mutual-a.html'", "]", ")", ",", "analyzer", ".", "analyze", "(", "[", "'static/circular/mutual-b.html'", "]", ")", "]", ")", ";", "}", ")", ";", "test", "(", "'handles a document importing itself'", ",", "async", "(", ")", "=>", "{", "const", "document", "=", "await", "analyzeDocument", "(", "'static/circular/self-import.html'", ")", ";", "assert", ".", "deepEqual", "(", "[", "...", "document", ".", "getFeatures", "(", "{", "kind", ":", "'document'", ",", "imported", ":", "true", "}", ")", "]", ".", "map", "(", "(", "f", ")", "=>", "f", ".", "url", ")", ",", "[", "'static/circular/self-import.html'", "]", ".", "map", "(", "(", "u", ")", "=>", "analyzer", ".", "resolveUrl", "(", "u", ")", ")", ")", ";", "assert", ".", "deepEqual", "(", "[", "...", "document", ".", "getFeatures", "(", "{", "kind", ":", "'import'", ",", "imported", ":", "true", "}", ")", "]", ".", "map", "(", "(", "f", ")", "=>", "f", ".", "url", ")", ",", "[", "'static/circular/self-import.html'", ",", "'static/circular/self-import.html'", "]", ".", "map", "(", "(", "u", ")", "=>", "analyzer", ".", "resolveUrl", "(", "u", ")", ")", ")", ";", "}", ")", ";", "suite", "(", "'handles documents with spaces in filename'", ",", "(", ")", "=>", "{", "test", "(", "'given a url with unencoded spaces to analyze'", ",", "async", "(", ")", "=>", "{", "const", "document", "=", "await", "analyzeDocument", "(", "'static/spaces in file.html'", ")", ";", "assert", ".", "deepEqual", "(", "[", "...", "document", ".", "getFeatures", "(", "{", "kind", ":", "'document'", ",", "imported", ":", "true", "}", ")", "]", ".", "map", "(", "(", "f", ")", "=>", "f", ".", "url", ")", ",", "[", "'static/spaces in file.html'", ",", "'static/dependencies/spaces in import.html'", "]", ".", "map", "(", "(", "u", ")", "=>", "analyzer", ".", "resolveUrl", "(", "u", ")", ")", ")", ";", "assert", ".", "deepEqual", "(", "[", "...", "document", ".", "getFeatures", "(", "{", "kind", ":", "'import'", ",", "imported", ":", "true", "}", ")", "]", ".", "map", "(", "(", "f", ")", "=>", "f", ".", "url", ")", ",", "[", "'static/dependencies/spaces in import.html'", "]", ".", "map", "(", "(", "u", ")", "=>", "analyzer", ".", "resolveUrl", "(", "u", ")", ")", ")", ";", "}", ")", ";", "test", "(", "'given a url with encoded spaces to analyze'", ",", "async", "(", ")", "=>", "{", "const", "document", "=", "await", "analyzeDocument", "(", "'static/spaces%20in%20file.html'", ")", ";", "assert", ".", "deepEqual", "(", "[", "...", "document", ".", "getFeatures", "(", "{", "kind", ":", "'document'", ",", "imported", ":", "true", "}", ")", "]", ".", "map", "(", "(", "f", ")", "=>", "f", ".", "url", ")", ",", "[", "'static/spaces in file.html'", ",", "'static/dependencies/spaces in import.html'", "]", ".", "map", "(", "(", "u", ")", "=>", "analyzer", ".", "resolveUrl", "(", "u", ")", ")", ")", ";", "assert", ".", "deepEqual", "(", "[", "...", "document", ".", "getFeatures", "(", "{", "kind", ":", "'import'", ",", "imported", ":", "true", "}", ")", "]", ".", "map", "(", "(", "f", ")", "=>", "f", ".", "url", ")", ",", "[", "'static/dependencies/spaces in import.html'", "]", ".", "map", "(", "(", "u", ")", "=>", "analyzer", ".", "resolveUrl", "(", "u", ")", ")", ")", ";", "}", ")", ";", "test", "(", "'gracefully handles a scanner that throws'", ",", "async", "(", ")", "=>", "{", "const", "options", "=", "{", "urlResolver", ":", "analyzer", ".", "urlResolver", ",", "urlLoader", ":", "inMemoryOverlay", "}", ";", "const", "scanners", "=", "AnalysisContext", ".", "getDefaultScanners", "(", "options", ")", ";", "class", "FailingScanner", "implements", "HtmlScanner", "{", "async", "scan", "(", ")", "{", "throw", "new", "Error", "(", "'Method not implemented.'", ")", ";", "}", "}", "options", ".", "scanners", "=", "scanners", ";", "scanners", ".", "get", "(", "'html'", ")", "!", ".", "push", "(", "new", "FailingScanner", "(", ")", ")", ";", "const", "localAnalyzer", "=", "new", "Analyzer", "(", "options", ")", ";", "const", "url", "=", "localAnalyzer", ".", "resolveUrl", "(", "`foo.html`", ")", "!", ";", "inMemoryOverlay", ".", "urlContentsMap", ".", "set", "(", "url", ",", "`\n <dom-module id=\"foo-bar\"></dom-module>\n `", ")", ";", "const", "analysis", "=", "await", "localAnalyzer", ".", "analyze", "(", "[", "url", "]", ")", ";", "const", "result", "=", "analysis", ".", "getDocument", "(", "url", ")", ";", "if", "(", "result", ".", "successful", ")", "{", "throw", "new", "Error", "(", "`Got document with crashing scanner.`", ")", ";", "}", "if", "(", "!", "result", ".", "error", ")", "{", "throw", "new", "Error", "(", "`No warning message for document with crashing scanner`", ")", ";", "}", "assert", ".", "deepEqual", "(", "result", ".", "error", ".", "message", ",", "'Error while scanning: Error: Method not implemented.'", ")", ";", "}", ")", ";", "}", ")", ";", "}", ")", ";", "suite", "(", "'_parse()'", ",", "(", ")", "=>", "{", "test", "(", "'loads and parses an HTML document'", ",", "async", "(", ")", "=>", "{", "const", "context", "=", "await", "getContext", "(", "analyzer", ")", ";", "const", "doc", "=", "await", "context", "[", "'_parse'", "]", "(", "analyzer", ".", "resolveUrl", "(", "`static/html-parse-target.html`", ")", "!", ",", "neverCancels", ")", ";", "assert", ".", "instanceOf", "(", "doc", ",", "ParsedHtmlDocument", ")", ";", "assert", ".", "equal", "(", "doc", ".", "url", ",", "analyzer", ".", "resolveUrl", "(", "`static/html-parse-target.html`", ")", "!", ")", ";", "}", ")", ";", "test", "(", "'loads and parses a JavaScript document'", ",", "async", "(", ")", "=>", "{", "const", "context", "=", "await", "getContext", "(", "analyzer", ")", ";", "const", "doc", "=", "await", "context", "[", "'_parse'", "]", "(", "analyzer", ".", "resolveUrl", "(", "`static/js-elements.js`", ")", "!", ",", "neverCancels", ")", ";", "assert", ".", "instanceOf", "(", "doc", ",", "JavaScriptDocument", ")", ";", "assert", ".", "equal", "(", "doc", ".", "url", ",", "analyzer", ".", "resolveUrl", "(", "`static/js-elements.js`", ")", ")", ";", "}", ")", ";", "test", "(", "'returns a Promise that rejects for non-existant files'", ",", "async", "(", ")", "=>", "{", "const", "context", "=", "await", "getContext", "(", "analyzer", ")", ";", "await", "invertPromise", "(", "context", "[", "'_parse'", "]", "(", "analyzer", ".", "resolveUrl", "(", "`static/not-found`", ")", "!", ",", "neverCancels", ")", ")", ";", "}", ")", ";", "}", ")", ";", "suite", "(", "'_getScannedFeatures()'", ",", "(", ")", "=>", "{", "test", "(", "'default import scanners'", ",", "async", "(", ")", "=>", "{", "const", "contents", "=", "`<html><head>\n <link rel=\"import\" href=\"polymer.html\">\n <script src=\"foo.js\"></script>\n <link rel=\"stylesheet\" href=\"foo.css\"></link>\n </head></html>`", ";", "const", "document", "=", "new", "HtmlParser", "(", ")", ".", "parse", "(", "contents", ",", "resolvedUrl", "`test.html`", ",", "new", "PackageUrlResolver", "(", ")", ")", ";", "const", "context", "=", "await", "getContext", "(", "analyzer", ")", ";", "const", "features", "=", "(", "(", "await", "context", "[", "'_getScannedFeatures'", "]", "(", "document", ")", ")", ".", "features", "as", "ScannedImport", "[", "]", ")", ";", "assert", ".", "deepEqual", "(", "features", ".", "map", "(", "(", "e", ")", "=>", "e", ".", "type", ")", ",", "[", "'html-import'", ",", "'html-script'", ",", "'html-style'", "]", ")", ";", "assert", ".", "deepEqual", "(", "features", ".", "map", "(", "(", "e", ")", "=>", "e", ".", "url", ")", ",", "[", "'polymer.html'", ",", "'foo.js'", ",", "'foo.css'", "]", "as", "FileRelativeUrl", "[", "]", ")", ";", "}", ")", ";", "test", "(", "'polymer css import scanner'", ",", "async", "(", ")", "=>", "{", "const", "contents", "=", "`<html><head>\n <link rel=\"import\" type=\"css\" href=\"foo.css\">\n </head>\n <body>\n <dom-module>\n <link rel=\"import\" type=\"css\" href=\"bar.css\">\n </dom-module>\n </body></html>`", ";", "const", "document", "=", "new", "HtmlParser", "(", ")", ".", "parse", "(", "contents", ",", "resolvedUrl", "`test.html`", ",", "new", "PackageUrlResolver", "(", ")", ")", ";", "const", "context", "=", "await", "getContext", "(", "analyzer", ")", ";", "const", "features", "=", "(", "await", "context", "[", "'_getScannedFeatures'", "]", "(", "document", ")", ")", ".", "features", ".", "filter", "(", "(", "e", ")", "=>", "e", "instanceof", "ScannedImport", ")", "as", "ScannedImport", "[", "]", ";", "assert", ".", "equal", "(", "features", ".", "length", ",", "1", ")", ";", "assert", ".", "equal", "(", "features", "[", "0", "]", ".", "type", ",", "'css-import'", ")", ";", "assert", ".", "equal", "(", "features", "[", "0", "]", ".", "url", ",", "'bar.css'", "as", "FileRelativeUrl", ")", ";", "}", ")", ";", "test", "(", "'HTML inline document scanners'", ",", "async", "(", ")", "=>", "{", "const", "contents", "=", "`<html><head>\n <script>console.log('hi')</script>\n <style>body { color: red; }</style>\n </head></html>`", ";", "const", "context", "=", "await", "getContext", "(", "analyzer", ")", ";", "const", "document", "=", "new", "HtmlParser", "(", ")", ".", "parse", "(", "contents", ",", "resolvedUrl", "`test.html`", ",", "new", "PackageUrlResolver", "(", ")", ")", ";", "const", "features", "=", "(", "(", "await", "context", "[", "'_getScannedFeatures'", "]", "(", "document", ")", ")", ".", "features", ")", "as", "ScannedInlineDocument", "[", "]", ";", "assert", ".", "equal", "(", "features", ".", "length", ",", "2", ")", ";", "assert", ".", "instanceOf", "(", "features", "[", "0", "]", ",", "ScannedInlineDocument", ")", ";", "assert", ".", "instanceOf", "(", "features", "[", "1", "]", ",", "ScannedInlineDocument", ")", ";", "}", ")", ";", "const", "testName", "=", "'HTML inline documents can be cloned, modified, and stringified'", ";", "test", "(", "testName", ",", "async", "(", ")", "=>", "{", "const", "contents", "=", "stripIndent", "(", "`\n <div>\n <script>\n console.log(\"foo\");\n </script>\n <style>\n body {\n color: blue;\n }\n </style>\n </div>\n `", ")", ".", "trim", "(", ")", ";", "const", "modifiedContents", "=", "stripIndent", "(", "`\n <div>\n <script>\n console.log(\"bar\");\n </script>\n <style>\n body {\n color: red;\n }\n </style>\n </div>\n `", ")", ".", "trim", "(", ")", ";", "inMemoryOverlay", ".", "urlContentsMap", ".", "set", "(", "analyzer", ".", "resolveUrl", "(", "'test-doc.html'", ")", "!", ",", "contents", ")", ";", "const", "origDocument", "=", "await", "analyzeDocument", "(", "'test-doc.html'", ")", ";", "const", "document", "=", "clone", "(", "origDocument", ")", ";", "const", "jsDocs", "=", "document", ".", "getFeatures", "(", "{", "kind", ":", "'js-document'", ",", "imported", ":", "true", "}", ")", ";", "assert", ".", "equal", "(", "1", ",", "jsDocs", ".", "size", ")", ";", "const", "jsDoc", "=", "getOnly", "(", "jsDocs", ")", ";", "(", "jsDoc", ".", "parsedDocument", "as", "JavaScriptDocument", ")", ".", "visit", "(", "[", "{", "enterCallExpression", "(", "node", ")", "{", "node", ".", "arguments", "=", "[", "{", "type", ":", "'StringLiteral'", ",", "value", ":", "'bar'", "}", "]", "as", "babel", ".", "StringLiteral", "[", "]", ";", "}", "}", "]", ")", ";", "const", "cssDocs", "=", "document", ".", "getFeatures", "(", "{", "kind", ":", "'css-document'", ",", "imported", ":", "true", "}", ")", ";", "assert", ".", "equal", "(", "1", ",", "cssDocs", ".", "size", ")", ";", "const", "cssDoc", "=", "getOnly", "(", "cssDocs", ")", ";", "(", "cssDoc", ".", "parsedDocument", "as", "ParsedCssDocument", ")", ".", "visit", "(", "[", "{", "visit", "(", "node", ")", "{", "if", "(", "node", ".", "type", "===", "'expression'", "&&", "node", ".", "text", "===", "'blue'", ")", "{", "node", ".", "text", "=", "'red'", ";", "}", "}", "}", "]", ")", ";", "assert", ".", "deepEqual", "(", "document", ".", "stringify", "(", ")", ",", "modifiedContents", ")", ";", "assert", ".", "deepEqual", "(", "origDocument", ".", "stringify", "(", ")", ",", "contents", ")", ";", "}", ")", ";", "}", ")", ";", "suite", "(", "'documentation extraction'", ",", "(", ")", "=>", "{", "test", "(", "'we get the wrong description for paper-input'", ",", "async", "(", ")", "=>", "{", "const", "document", "=", "await", "analyzeDocument", "(", "'static/paper-input.html'", ")", ";", "const", "[", "element", "]", "=", "document", ".", "getFeatures", "(", "{", "kind", ":", "'element'", ",", "id", ":", "'paper-input'", "}", ")", ";", "assert", "(", "!", "/fresh new hell/", ".", "test", "(", "element", ".", "description", ")", ",", "`Doesn't pick up on unexpected html comments.`", ")", ";", "assert", "(", "element", ".", "description", ".", "startsWith", "(", "'Material design: [Text fields]'", ")", ",", "`Does get the message right.`", ")", ";", "}", ")", ";", "}", ")", ";", "test", "(", "'analyzes a document with a namespace'", ",", "async", "(", ")", "=>", "{", "const", "document", "=", "await", "analyzeDocument", "(", "'static/namespaces/import-all.html'", ")", ";", "const", "namespaces", "=", "Array", ".", "from", "(", "document", ".", "getFeatures", "(", "{", "kind", ":", "'namespace'", ",", "imported", ":", "true", "}", ")", ")", ";", "assert", ".", "deepEqual", "(", "namespaces", ".", "map", "(", "(", "b", ")", "=>", "b", ".", "name", ")", ",", "[", "'ExplicitlyNamedNamespace'", ",", "'ExplicitlyNamedNamespace.NestedNamespace'", ",", "'ImplicitlyNamedNamespace'", ",", "'ImplicitlyNamedNamespace.NestedNamespace'", ",", "'ParentNamespace.FooNamespace'", ",", "'ParentNamespace.BarNamespace'", ",", "'DynamicNamespace.ComputedProperty'", ",", "'DynamicNamespace.UnanalyzableComputedProperty'", ",", "'DynamicNamespace.Aliased'", ",", "'DynamicNamespace.InferredComputedProperty'", ",", "]", ")", ";", "}", ")", ";", "const", "testName", "=", "'creates warnings when duplicate namespaces are analyzed'", ";", "test", ".", "skip", "(", "testName", ",", "async", "(", ")", "=>", "{", "const", "document", "=", "await", "analyzer", ".", "analyze", "(", "[", "'static/namespaces/import-duplicates.html'", "]", ")", ";", "const", "namespaces", "=", "Array", ".", "from", "(", "document", ".", "getFeatures", "(", "{", "kind", ":", "'namespace'", "}", ")", ")", ";", "assert", ".", "deepEqual", "(", "namespaces", ".", "map", "(", "(", "b", ")", "=>", "b", ".", "name", ")", ",", "[", "'ExplicitlyNamedNamespace'", ",", "'ExplicitlyNamedNamespace.NestedNamespace'", ",", "]", ")", ";", "const", "warnings", "=", "document", ".", "getWarnings", "(", ")", ";", "assert", ".", "containSubset", "(", "warnings", ",", "[", "{", "message", ":", "'Found more than one namespace named ExplicitlyNamedNamespace.'", ",", "severity", ":", "Severity", ".", "WARNING", ",", "code", ":", "'multiple-javascript-namespaces'", ",", "}", "]", ")", ";", "assert", ".", "deepEqual", "(", "await", "underliner", ".", "underline", "(", "warnings", ")", ",", "[", "`\nvar DuplicateNamespace = {};\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~`", "]", ")", ";", "}", ")", ";", "suite", "(", "'analyzePackage'", ",", "(", ")", "=>", "{", "test", "(", "'produces a package with the right documents'", ",", "async", "(", ")", "=>", "{", "const", "{", "analyzer", "}", "=", "await", "createForDirectory", "(", "path", ".", "join", "(", "fixtureDir", ",", "'project'", ")", ")", ";", "const", "pckage", "=", "await", "analyzer", ".", "analyzePackage", "(", ")", ";", "assert", ".", "deepEqual", "(", "Array", ".", "from", "(", "pckage", "[", "'_searchRoots'", "]", ")", ".", "map", "(", "(", "d", ")", "=>", "d", ".", "url", ")", ".", "sort", "(", ")", ",", "[", "'build/output.html'", ",", "'cyclic-a.html'", ",", "'root.html'", ",", "'subdir/root-in-subdir.html'", "]", ".", "map", "(", "(", "u", ")", "=>", "analyzer", ".", "resolveUrl", "(", "u", ")", ")", ".", "sort", "(", ")", ")", ";", "assert", ".", "deepEqual", "(", "Array", ".", "from", "(", "pckage", ".", "getFeatures", "(", "{", "kind", ":", "'document'", "}", ")", ")", ".", "filter", "(", "(", "d", ")", "=>", "!", "d", ".", "isInline", ")", ".", "map", "(", "(", "d", ")", "=>", "d", ".", "url", ")", ".", "sort", "(", ")", ",", "[", "'build/output.html'", ",", "'cyclic-a.html'", ",", "'cyclic-b.html'", ",", "'root.html'", ",", "'leaf.html'", ",", "'subdir/subdir-leaf.html'", ",", "'subdir/root-in-subdir.html'", "]", ".", "map", "(", "(", "u", ")", "=>", "analyzer", ".", "resolveUrl", "(", "u", ")", ")", ".", "sort", "(", ")", ")", ";", "assert", ".", "deepEqual", "(", "Array", ".", "from", "(", "pckage", ".", "getFeatures", "(", "{", "kind", ":", "'document'", ",", "externalPackages", ":", "true", "}", ")", ")", ".", "filter", "(", "(", "d", ")", "=>", "!", "d", ".", "isInline", ")", ".", "map", "(", "(", "d", ")", "=>", "d", ".", "url", ")", ".", "sort", "(", ")", ",", "[", "'build/output.html'", ",", "'cyclic-a.html'", ",", "'cyclic-b.html'", ",", "'root.html'", ",", "'leaf.html'", ",", "'subdir/subdir-leaf.html'", ",", "'subdir/root-in-subdir.html'", ",", "'bower_components/imported.html'", ",", "]", ".", "map", "(", "(", "u", ")", "=>", "analyzer", ".", "resolveUrl", "(", "u", ")", ")", ".", "sort", "(", ")", ")", ";", "const", "packageElements", "=", "[", "'build-output'", ",", "'root-root'", ",", "'leaf-leaf'", ",", "'cyclic-a'", ",", "'cyclic-b'", ",", "'root-in-subdir'", ",", "'subdir-leaf'", "]", ";", "assert", ".", "deepEqual", "(", "Array", ".", "from", "(", "pckage", ".", "getFeatures", "(", "{", "kind", ":", "'element'", "}", ")", ")", ".", "map", "(", "(", "e", ")", "=>", "e", ".", "tagName", ")", ".", "sort", "(", ")", ",", "packageElements", ".", "sort", "(", ")", ")", ";", "assert", ".", "deepEqual", "(", "Array", ".", "from", "(", "pckage", ".", "getFeatures", "(", "{", "kind", ":", "'element'", ",", "externalPackages", ":", "true", "}", ")", ")", ".", "map", "(", "(", "e", ")", "=>", "e", ".", "tagName", ")", ".", "sort", "(", ")", ",", "packageElements", ".", "concat", "(", "[", "'imported-dependency'", "]", ")", ".", "sort", "(", ")", ")", ";", "}", ")", ";", "test", "(", "'can get warnings from within and without the package'", ",", "async", "(", ")", "=>", "{", "const", "{", "analyzer", "}", "=", "await", "createForDirectory", "(", "path", ".", "join", "(", "fixtureDir", ",", "'project-with-errors'", ")", ")", ";", "const", "pckage", "=", "await", "analyzer", ".", "analyzePackage", "(", ")", ";", "assert", ".", "deepEqual", "(", "Array", ".", "from", "(", "pckage", "[", "'_searchRoots'", "]", ")", ".", "map", "(", "(", "d", ")", "=>", "d", ".", "url", ")", ",", "[", "'index.html'", ",", "'build/output.html'", "]", ".", "map", "(", "(", "u", ")", "=>", "analyzer", ".", "resolveUrl", "(", "u", ")", ")", ")", ";", "assert", ".", "deepEqual", "(", "pckage", ".", "getWarnings", "(", ")", ".", "map", "(", "(", "w", ")", "=>", "w", ".", "sourceRange", ".", "file", ")", ",", "[", "analyzer", ".", "resolveUrl", "(", "'index.html'", ")", ",", "analyzer", ".", "resolveUrl", "(", "'build/output.html'", ")", "]", ")", ";", "assert", ".", "deepEqual", "(", "pckage", ".", "getWarnings", "(", "{", "externalPackages", ":", "true", "}", ")", ".", "map", "(", "(", "w", ")", "=>", "w", ".", "sourceRange", ".", "file", ")", ".", "sort", "(", ")", ",", "[", "'bower_components/external-with-warnings.html'", ",", "'build/output.html'", ",", "'index.html'", ",", "]", ".", "map", "(", "(", "u", ")", "=>", "analyzer", ".", "resolveUrl", "(", "u", ")", ")", ")", ";", "}", ")", ";", "}", ")", ";", "suite", "(", "'_fork'", ",", "(", ")", "=>", "{", "test", "(", "'returns an independent copy of Analyzer'", ",", "async", "(", ")", "=>", "{", "inMemoryOverlay", ".", "urlContentsMap", ".", "set", "(", "analyzer", ".", "resolveUrl", "(", "'a.html'", ")", "!", ",", "'a is shared'", ")", ";", "await", "analyzer", ".", "analyze", "(", "[", "'a.html'", "]", ")", ";", "inMemoryOverlay", ".", "urlContentsMap", ".", "delete", "(", "analyzer", ".", "resolveUrl", "(", "'a.html'", ")", "!", ")", ";", "const", "analyzer2", "=", "await", "analyzer", ".", "_fork", "(", ")", ";", "inMemoryOverlay", ".", "urlContentsMap", ".", "set", "(", "analyzer", ".", "resolveUrl", "(", "'b.html'", ")", "!", ",", "'b for analyzer'", ")", ";", "await", "analyzer", ".", "analyze", "(", "[", "'b.html'", "]", ")", ";", "inMemoryOverlay", ".", "urlContentsMap", ".", "set", "(", "analyzer", ".", "resolveUrl", "(", "'b.html'", ")", "!", ",", "'b for analyzer2'", ")", ";", "await", "analyzer2", ".", "analyze", "(", "[", "'b.html'", "]", ")", ";", "inMemoryOverlay", ".", "urlContentsMap", ".", "delete", "(", "analyzer", ".", "resolveUrl", "(", "'b.html'", ")", "!", ")", ";", "const", "a1", "=", "await", "analyzeDocument", "(", "'a.html'", ",", "analyzer", ")", ";", "const", "a2", "=", "await", "analyzeDocument", "(", "'a.html'", ",", "analyzer2", ")", ";", "const", "b1", "=", "await", "analyzeDocument", "(", "'b.html'", ",", "analyzer", ")", ";", "const", "b2", "=", "await", "analyzeDocument", "(", "'b.html'", ",", "analyzer2", ")", ";", "assert", ".", "equal", "(", "a1", ".", "parsedDocument", ".", "contents", ",", "'a is shared'", ")", ";", "assert", ".", "equal", "(", "a2", ".", "parsedDocument", ".", "contents", ",", "'a is shared'", ")", ";", "assert", ".", "equal", "(", "b1", ".", "parsedDocument", ".", "contents", ",", "'b for analyzer'", ")", ";", "assert", ".", "equal", "(", "b2", ".", "parsedDocument", ".", "contents", ",", "'b for analyzer2'", ")", ";", "}", ")", ";", "test", "(", "'supports overriding of urlLoader'", ",", "async", "(", ")", "=>", "{", "const", "loader1", "=", "{", "canLoad", ":", "(", ")", "=>", "true", ",", "load", ":", "async", "(", "u", ")", "=>", "`${", "u", "} 1`", "}", ";", "const", "loader2", "=", "{", "canLoad", ":", "(", ")", "=>", "true", ",", "load", ":", "async", "(", "u", ")", "=>", "`${", "u", "} 2`", "}", ";", "const", "analyzer1", "=", "new", "Analyzer", "(", "{", "urlLoader", ":", "loader1", "}", ")", ";", "const", "a1", "=", "await", "analyzeDocument", "(", "'a.html'", ",", "analyzer1", ")", ";", "const", "analyzer2", "=", "await", "analyzer1", ".", "_fork", "(", "{", "urlLoader", ":", "loader2", "}", ")", ";", "const", "a2", "=", "await", "analyzeDocument", "(", "'a.html'", ",", "analyzer2", ")", ";", "const", "b1", "=", "await", "analyzeDocument", "(", "'b.html'", ",", "analyzer1", ")", ";", "const", "b2", "=", "await", "analyzeDocument", "(", "'b.html'", ",", "analyzer2", ")", ";", "assert", ".", "isTrue", "(", "a1", ".", "parsedDocument", ".", "contents", ".", "endsWith", "(", "'a.html 1'", ")", ",", "'a.html, loader 1'", ")", ";", "assert", ".", "isTrue", "(", "a2", ".", "parsedDocument", ".", "contents", ".", "endsWith", "(", "'a.html 1'", ")", ",", "'a.html, in cache'", ")", ";", "assert", ".", "isTrue", "(", "b1", ".", "parsedDocument", ".", "contents", ".", "endsWith", "(", "'b.html 1'", ")", ",", "'b.html, loader 1'", ")", ";", "assert", ".", "isTrue", "(", "b2", ".", "parsedDocument", ".", "contents", ".", "endsWith", "(", "'b.html 2'", ")", ",", "'b.html, loader 2'", ")", ";", "}", ")", ";", "}", ")", ";", "suite", "(", "'race conditions and caching'", ",", "(", ")", "=>", "{", "test", "(", "'maintain caches across multiple edits'", ",", "async", "(", ")", "=>", "{", "inMemoryOverlay", ".", "urlContentsMap", ".", "set", "(", "analyzer", ".", "resolveUrl", "(", "'base.js'", ")", "!", ",", "`\n class BaseElement extends HTMLElement {}\n customElements.define('base-elem', BaseElement);\n `", ")", ";", "inMemoryOverlay", ".", "urlContentsMap", ".", "set", "(", "analyzer", ".", "resolveUrl", "(", "'user.html'", ")", "!", ",", "`\n <script src=\"./base.js\"></script>\n <script>\n class UserElem extends BaseElement {}\n customElements.define('user-elem', UserElem);\n </script>\n `", ")", ";", "const", "b1Doc", "=", "await", "analyzer", ".", "analyze", "(", "[", "'base.js'", "]", ")", ";", "assert", ".", "deepEqual", "(", "b1Doc", ".", "getWarnings", "(", ")", ",", "[", "]", ")", ";", "const", "u1Doc", "=", "await", "analyzer", ".", "analyze", "(", "[", "'user.html'", "]", ")", ";", "assert", ".", "deepEqual", "(", "u1Doc", ".", "getWarnings", "(", ")", ",", "[", "]", ")", ";", "inMemoryOverlay", ".", "urlContentsMap", ".", "set", "(", "analyzer", ".", "resolveUrl", "(", "'base.js'", ")", "!", ",", "`\n class NewSpelling extends HTMLElement {}\n customElements.define('base-elem', NewSpelling);\n `", ")", ";", "analyzer", ".", "filesChanged", "(", "[", "'base.js'", "]", ")", ";", "const", "b2Doc", "=", "await", "analyzer", ".", "analyze", "(", "[", "'base.js'", "]", ")", ";", "assert", ".", "deepEqual", "(", "b2Doc", ".", "getWarnings", "(", ")", ",", "[", "]", ")", ";", "const", "u2Doc", "=", "await", "analyzer", ".", "analyze", "(", "[", "'user.html'", "]", ")", ";", "assert", ".", "notEqual", "(", "u1Doc", ",", "u2Doc", ")", ";", "assert", ".", "equal", "(", "u2Doc", ".", "getWarnings", "(", ")", "[", "0", "]", ".", "message", ",", "'Could not resolve reference to class'", ")", ";", "inMemoryOverlay", ".", "urlContentsMap", ".", "set", "(", "analyzer", ".", "resolveUrl", "(", "'base.js'", ")", "!", ",", "`\n class BaseElement extends HTMLElement {}\n customElements.define('base-elem', BaseElement);\n `", ")", ";", "analyzer", ".", "filesChanged", "(", "[", "'base.js'", "]", ")", ";", "const", "b3Doc", "=", "await", "analyzer", ".", "analyze", "(", "[", "'base.js'", "]", ")", ";", "assert", ".", "deepEqual", "(", "b3Doc", ".", "getWarnings", "(", ")", ",", "[", "]", ")", ";", "const", "u3Doc", "=", "await", "analyzer", ".", "analyze", "(", "[", "'user.html'", "]", ")", ";", "assert", ".", "equal", "(", "u3Doc", ".", "getWarnings", "(", ")", ".", "length", ",", "0", ")", ";", "}", ")", ";", "class", "RacyUrlLoader", "implements", "UrlLoader", "{", "constructor", "(", "public", "pathToContentsMap", ",", "private", "waitFunction", ")", "{", "}", "canLoad", "(", ")", "{", "return", "true", ";", "}", "async", "load", "(", "path", ")", "{", "await", "this", ".", "waitFunction", "(", ")", ";", "const", "contents", "=", "this", ".", "pathToContentsMap", ".", "get", "(", "path", ")", ";", "if", "(", "contents", "!=", "null", ")", "{", "return", "contents", ";", "}", "throw", "new", "Error", "(", "`no known contents for ${", "path", "}`", ")", ";", "}", "}", "const", "editorSimulator", "=", "async", "(", "waitFn", ")", "=>", "{", "const", "urlResolver", "=", "new", "PackageUrlResolver", "(", ")", ";", "const", "entries", "=", "[", "[", "'base.html'", ",", "`<link rel=\"import\" href=\"a.html\">\\n<link rel=\"import\" href=\"b.html\">`", "]", ",", "[", "'a.html'", ",", "`<link rel=\"import\" href=\"common.html\">`", "]", ",", "[", "'b.html'", ",", "`<link rel=\"import\" href=\"common.html\">`", "]", ",", "[", "'common.html'", ",", "`<custom-el></custom-el>`", "]", ",", "]", ";", "const", "contentsMap", "=", "new", "Map", "<", "ResolvedUrl", ",", "string", ">", "(", ")", ";", "const", "analyzer", "=", "new", "Analyzer", "(", "{", "urlLoader", ":", "new", "RacyUrlLoader", "(", "contentsMap", ",", "waitFn", ")", ",", "urlResolver", "}", ")", ";", "for", "(", "const", "[", "key", ",", "value", "]", "of", "entries", ")", "{", "contentsMap", ".", "set", "(", "analyzer", ".", "resolveUrl", "(", "key", ")", "!", ",", "value", ")", ";", "}", "const", "promises", "=", "[", "]", ";", "const", "intermediatePromises", "=", "[", "]", ";", "for", "(", "let", "i", "=", "0", ";", "i", "<", "1", ";", "i", "++", ")", "{", "await", "waitFn", "(", ")", ";", "for", "(", "const", "entry", "of", "contentsMap", ")", "{", "const", "path", "=", "entry", "[", "0", "]", ";", "if", "(", "Math", ".", "random", "(", ")", ">", "0.5", ")", "{", "analyzer", ".", "filesChanged", "(", "[", "path", "]", ")", ";", "analyzer", ".", "analyze", "(", "[", "path", "]", ")", ";", "if", "(", "Math", ".", "random", "(", ")", ">", "0.5", ")", "{", "analyzer", ".", "filesChanged", "(", "[", "path", "]", ")", ";", "const", "p", "=", "analyzer", ".", "analyze", "(", "[", "path", "]", ")", ";", "const", "cacheContext", "=", "await", "getContext", "(", "analyzer", ")", ";", "intermediatePromises", ".", "push", "(", "(", "async", "(", ")", "=>", "{", "await", "p", ";", "const", "docs", "=", "Array", ".", "from", "(", "cacheContext", "[", "'_cache'", "]", ".", "analyzedDocuments", ".", "values", "(", ")", ")", ";", "assert", ".", "isTrue", "(", "new", "Set", "(", "docs", ".", "map", "(", "(", "d", ")", "=>", "d", ".", "url", ")", ".", "sort", "(", ")", ")", ".", "has", "(", "path", "as", "ResolvedUrl", ")", ")", ";", "}", ")", "(", ")", ")", ";", "}", "}", "promises", ".", "push", "(", "analyzeDocument", "(", "'base.html'", ",", "analyzer", ")", ")", ";", "await", "Promise", ".", "all", "(", "promises", ")", ";", "}", "promises", ".", "push", "(", "analyzeDocument", "(", "'base.html'", ",", "analyzer", ")", ")", ";", "await", "Promise", ".", "all", "(", "promises", ")", ";", "}", "await", "Promise", ".", "all", "(", "intermediatePromises", ")", ";", "const", "documents", "=", "await", "Promise", ".", "all", "(", "promises", ")", ";", "for", "(", "const", "document", "of", "documents", ")", "{", "assert", ".", "deepEqual", "(", "document", ".", "url", ",", "analyzer", ".", "resolveUrl", "(", "'base.html'", ")", ")", ";", "const", "localFeatures", "=", "document", ".", "getFeatures", "(", "{", "imported", ":", "false", "}", ")", ";", "const", "kinds", "=", "Array", ".", "from", "(", "localFeatures", ")", ".", "map", "(", "(", "f", ")", "=>", "Array", ".", "from", "(", "f", ".", "kinds", ")", ")", ";", "const", "message", "=", "`localFeatures: ${", "JSON", ".", "stringify", "(", "Array", ".", "from", "(", "localFeatures", ")", ".", "map", "(", "(", "f", ")", "=>", "(", "{", "kinds", ":", "Array", ".", "from", "(", "f", ".", "kinds", ")", ",", "ids", ":", "Array", ".", "from", "(", "f", ".", "identifiers", ")", "}", ")", ")", ")", "}`", ";", "assert", ".", "deepEqual", "(", "kinds", ",", "[", "[", "'document'", ",", "'html-document'", "]", ",", "[", "'import'", ",", "'html-import'", "]", ",", "[", "'import'", ",", "'html-import'", "]", "]", ",", "message", ")", ";", "const", "imports", "=", "Array", ".", "from", "(", "document", ".", "getFeatures", "(", "{", "kind", ":", "'import'", ",", "imported", ":", "true", "}", ")", ")", ";", "assert", ".", "sameMembers", "(", "imports", ".", "map", "(", "(", "m", ")", "=>", "m", ".", "url", ")", ",", "[", "'a.html'", ",", "'b.html'", ",", "'common.html'", ",", "'common.html'", "]", ".", "map", "(", "(", "u", ")", "=>", "analyzer", ".", "resolveUrl", "(", "u", ")", ")", ")", ";", "const", "docs", "=", "Array", ".", "from", "(", "document", ".", "getFeatures", "(", "{", "kind", ":", "'document'", ",", "imported", ":", "true", "}", ")", ")", ";", "assert", ".", "sameMembers", "(", "docs", ".", "map", "(", "(", "d", ")", "=>", "d", ".", "url", ")", ",", "[", "'a.html'", ",", "'b.html'", ",", "'base.html'", ",", "'common.html'", "]", ".", "map", "(", "(", "u", ")", "=>", "analyzer", ".", "resolveUrl", "(", "u", ")", ")", ")", ";", "const", "refs", "=", "Array", ".", "from", "(", "document", ".", "getFeatures", "(", "{", "kind", ":", "'element-reference'", ",", "imported", ":", "true", "}", ")", ")", ";", "assert", ".", "sameMembers", "(", "refs", ".", "map", "(", "(", "ref", ")", "=>", "ref", ".", "tagName", ")", ",", "[", "'custom-el'", "]", ")", ";", "}", "}", ";", "test", "(", "'editor simulator of imports that import a common dep'", ",", "async", "(", ")", "=>", "{", "const", "waitTimes", "=", "[", "]", ";", "const", "randomWait", "=", "(", ")", "=>", "new", "Promise", "<", "void", ">", "(", "(", "resolve", ")", "=>", "{", "const", "waitTime", "=", "Math", ".", "random", "(", ")", "*", "30", ";", "waitTimes", ".", "push", "(", "waitTime", ")", ";", "setTimeout", "(", "resolve", ",", "waitTime", ")", ";", "}", ")", ";", "try", "{", "await", "editorSimulator", "(", "randomWait", ")", ";", "}", "catch", "(", "err", ")", "{", "console", ".", "error", "(", "'Wait times to reproduce this failure:'", ")", ";", "console", ".", "error", "(", "JSON", ".", "stringify", "(", "waitTimes", ")", ")", ";", "throw", "err", ";", "}", "}", ")", ";", "/**\n * This is a tool for reproducing and debugging a failure of the\n * editor\n * simulator test above, but only at the exact same commit, as\n * it's\n * sensitive to the order of internal operations of the analyzer.\n * So this\n * code with a defined list of wait times should not be checked\n * in.\n *\n * It's also worth noting that this code will be dependent on many\n * other\n * system factors, so it's only somewhat more reproducible, and\n * may not\n * end\n * up being very useful. If it isn't, we should delete it.\n */", "test", ".", "skip", "(", "'somewhat more reproducable editor simulator'", ",", "async", "(", ")", "=>", "{", "const", "waitTimes", "=", "[", "]", ";", "const", "reproducableWait", "=", "(", ")", "=>", "new", "Promise", "<", "void", ">", "(", "(", "resolve", ")", "=>", "{", "const", "waitTime", "=", "waitTimes", ".", "shift", "(", ")", ";", "if", "(", "waitTime", "==", "null", ")", "{", "throw", "new", "Error", "(", "'Was asked for more random waits than the '", "+", "'given array of wait times'", ")", ";", "}", "setTimeout", "(", "resolve", ",", "waitTime", ")", ";", "}", ")", ";", "await", "editorSimulator", "(", "reproducableWait", ")", ";", "}", ")", ";", "suite", "(", "'deterministic tests'", ",", "(", ")", "=>", "{", "/**\n * This is an asynchronous keyed queue, useful for controlling\n * the\n * order\n * of results in order to make tests more deterministic.\n *\n * It's intended to be used in fake loaders, scanners, etc,\n * where the\n * test\n * provides the intended result on a file by file basis, with\n * control\n * over\n * the order in which the results come in.\n */", "class", "KeyedQueue", "<", "Key", ",", "Result", ">", "{", "private", "_requests", "=", "new", "Map", "<", "Key", ",", "Deferred", "<", "Result", ">", "[", "]", ">", "(", ")", ";", "private", "_results", "=", "new", "Map", "<", "Key", ",", "Result", "[", "]", ">", "(", ")", ";", "async", "request", "(", "key", ")", "{", "const", "results", "=", "this", ".", "_results", ".", "get", "(", "key", ")", "||", "[", "]", ";", "if", "(", "results", ".", "length", ">", "0", ")", "{", "return", "results", ".", "shift", "(", ")", "!", ";", "}", "const", "deferred", "=", "new", "Deferred", "<", "Result", ">", "(", ")", ";", "const", "deferreds", "=", "this", ".", "_requests", ".", "get", "(", "key", ")", "||", "[", "]", ";", "this", ".", "_requests", ".", "set", "(", "key", ",", "deferreds", ")", ";", "deferreds", ".", "push", "(", "deferred", ")", ";", "return", "deferred", ".", "promise", ";", "}", "/**\n * Resolves the next unfulfilled request for the given key\n * with the\n * given value.\n */", "resolve", "(", "key", ",", "value", ")", "{", "const", "requests", "=", "this", ".", "_requests", ".", "get", "(", "key", ")", "||", "[", "]", ";", "if", "(", "requests", ".", "length", ">", "0", ")", "{", "const", "request", "=", "requests", ".", "shift", "(", ")", "!", ";", "request", ".", "resolve", "(", "value", ")", ";", "return", ";", "}", "const", "results", "=", "this", ".", "_results", ".", "get", "(", "key", ")", "||", "[", "]", ";", "this", ".", "_results", ".", "set", "(", "key", ",", "results", ")", ";", "results", ".", "push", "(", "value", ")", ";", "}", "toString", "(", ")", "{", "return", "JSON", ".", "stringify", "(", "{", "openRequests", ":", "Array", ".", "from", "(", "this", ".", "_requests", ".", "keys", "(", ")", ")", ",", "openResponses", ":", "Array", ".", "from", "(", "this", ".", "_results", ".", "keys", "(", ")", ")", "}", ")", ";", "}", "}", "class", "DeterministicUrlLoader", "implements", "UrlLoader", "{", "queue", "=", "new", "KeyedQueue", "<", "ResolvedUrl", ",", "string", ">", "(", ")", ";", "canLoad", "(", "_url", ")", "{", "return", "true", ";", "}", "async", "load", "(", "url", ")", "{", "return", "this", ".", "queue", ".", "request", "(", "url", ")", ";", "}", "}", "class", "NoopUrlLoader", "implements", "UrlLoader", "{", "canLoad", "(", ")", "{", "return", "true", ";", "}", "async", "load", "(", ")", "{", "throw", "new", "Error", "(", "`Noop Url Loader isn't supposed to be actually called.`", ")", ";", "}", "}", "/**\n * This crashed the analyzer as there was a race to\n * _makeDocument,\n * violating its constraint that there not already be a resolved\n * Document\n * for a given path.\n *\n * This test came out of debugging this issue:\n * https://github.com/Polymer/polymer-analyzer/issues/406\n */", "test", "(", "'two edits of the same file back to back'", ",", "async", "(", ")", "=>", "{", "const", "overlay", "=", "new", "InMemoryOverlayUrlLoader", "(", "new", "NoopUrlLoader", ")", ";", "const", "analyzer", "=", "new", "Analyzer", "(", "{", "urlLoader", ":", "overlay", "}", ")", ";", "overlay", ".", "urlContentsMap", ".", "set", "(", "analyzer", ".", "resolveUrl", "(", "'leaf.html'", ")", "!", ",", "'Hello'", ")", ";", "const", "p1", "=", "analyzer", ".", "analyze", "(", "[", "'leaf.html'", "]", ")", ";", "overlay", ".", "urlContentsMap", ".", "set", "(", "analyzer", ".", "resolveUrl", "(", "'leaf.html'", ")", "!", ",", "'World'", ")", ";", "analyzer", ".", "filesChanged", "(", "[", "'leaf.html'", "]", ")", ";", "const", "p2", "=", "analyzer", ".", "analyze", "(", "[", "'leaf.html'", "]", ")", ";", "await", "Promise", ".", "all", "(", "[", "p1", ",", "p2", "]", ")", ";", "}", ")", ";", "test", "(", "'handles a shared dependency'", ",", "async", "(", ")", "=>", "{", "const", "initialPaths", "=", "[", "'static/diamond/a.html'", ",", "'static/diamond/root.html'", "]", ";", "let", "result", "=", "await", "analyzer", ".", "analyze", "(", "initialPaths", ")", ";", "const", "resultA", "=", "result", ".", "getDocument", "(", "initialPaths", "[", "0", "]", ")", ";", "if", "(", "!", "resultA", ".", "successful", ")", "{", "throw", "new", "Error", "(", "`Could not get document a`", ")", ";", "}", "inMemoryOverlay", ".", "urlContentsMap", ".", "set", "(", "analyzer", ".", "resolveUrl", "(", "'static/diamond/a.html'", ")", "!", ",", "resultA", ".", "value", ".", "parsedDocument", ".", "contents", ")", ";", "await", "analyzer", ".", "filesChanged", "(", "[", "'static/diamond/a.html'", "]", ")", ";", "result", "=", "await", "analyzer", ".", "analyze", "(", "initialPaths", ")", ";", "const", "rootResult", "=", "result", ".", "getDocument", "(", "initialPaths", "[", "1", "]", ")", ";", "if", "(", "!", "rootResult", ".", "successful", ")", "{", "throw", "new", "Error", "(", "`Could not get root document`", ")", ";", "}", "const", "localFeatures", "=", "rootResult", ".", "value", ".", "getFeatures", "(", "{", "imported", ":", "false", "}", ")", ";", "const", "kinds", "=", "Array", ".", "from", "(", "localFeatures", ")", ".", "map", "(", "(", "f", ")", "=>", "Array", ".", "from", "(", "f", ".", "kinds", ")", ")", ";", "assert", ".", "deepEqual", "(", "kinds", ",", "[", "[", "'document'", ",", "'html-document'", "]", ",", "[", "'import'", ",", "'html-import'", "]", ",", "[", "'import'", ",", "'html-import'", "]", "]", ")", ";", "}", ")", ";", "test", "(", "'all files in a cycle wait for the whole cycle'", ",", "async", "(", ")", "=>", "{", "const", "loader", "=", "new", "DeterministicUrlLoader", "(", ")", ";", "const", "analyzer", "=", "new", "Analyzer", "(", "{", "urlLoader", ":", "loader", "}", ")", ";", "const", "aAnalyzed", "=", "analyzer", ".", "analyze", "(", "[", "'a.html'", "]", ")", ";", "const", "bAnalyzed", "=", "analyzer", ".", "analyze", "(", "[", "'b.html'", "]", ")", ";", "loader", ".", "queue", ".", "resolve", "(", "analyzer", ".", "resolveUrl", "(", "'a.html'", ")", "!", ",", "`<link rel=\"import\" href=\"b.html\">\n <link rel=\"import\" href=\"c.html\">`", ")", ";", "loader", ".", "queue", ".", "resolve", "(", "analyzer", ".", "resolveUrl", "(", "'b.html'", ")", "!", ",", "`<link rel=\"import\" href=\"a.html\">`", ")", ";", "let", "cResolved", "=", "false", ";", "const", "aAnalyzedDone", "=", "aAnalyzed", ".", "then", "(", "(", ")", "=>", "{", "assert", ".", "isTrue", "(", "cResolved", ")", ";", "}", ")", ";", "const", "bAnalyzedDone", "=", "bAnalyzed", ".", "then", "(", "(", ")", "=>", "{", "assert", ".", "isTrue", "(", "cResolved", ")", ";", "}", ")", ";", "await", "Promise", ".", "resolve", "(", ")", ";", "cResolved", "=", "true", ";", "loader", ".", "queue", ".", "resolve", "(", "analyzer", ".", "resolveUrl", "(", "'c.html'", ")", "!", ",", "''", ")", ";", "await", "Promise", ".", "all", "(", "[", "aAnalyzedDone", ",", "bAnalyzedDone", "]", ")", ";", "}", ")", ";", "test", "(", "'analyzes multiple imports of the same behavior'", ",", "async", "(", ")", "=>", "{", "const", "documentA", "=", "await", "analyzer", ".", "analyze", "(", "[", "'static/multiple-behavior-imports/element-a.html'", "]", ")", ";", "const", "documentB", "=", "await", "analyzer", ".", "analyze", "(", "[", "'static/multiple-behavior-imports/element-b.html'", "]", ")", ";", "assert", ".", "deepEqual", "(", "documentA", ".", "getWarnings", "(", "{", "imported", ":", "true", "}", ")", ",", "[", "]", ")", ";", "assert", ".", "deepEqual", "(", "documentB", ".", "getWarnings", "(", "{", "imported", ":", "true", "}", ")", ",", "[", "]", ")", ";", "}", ")", ";", "const", "testName", "=", "'analyzes multiple imports of the same behavior simultaneously'", ";", "test", "(", "testName", ",", "async", "(", ")", "=>", "{", "const", "result", "=", "await", "Promise", ".", "all", "(", "[", "analyzer", ".", "analyze", "(", "[", "'static/multiple-behavior-imports/element-a.html'", "]", ")", ",", "analyzer", ".", "analyze", "(", "[", "'static/multiple-behavior-imports/element-b.html'", "]", ")", "]", ")", ";", "const", "documentA", "=", "result", "[", "0", "]", ";", "const", "documentB", "=", "result", "[", "1", "]", ";", "assert", ".", "deepEqual", "(", "documentA", ".", "getWarnings", "(", "{", "imported", ":", "true", "}", ")", ",", "[", "]", ")", ";", "assert", ".", "deepEqual", "(", "documentB", ".", "getWarnings", "(", "{", "imported", ":", "true", "}", ")", ",", "[", "]", ")", ";", "}", ")", ";", "}", ")", ";", "}", ")", ";", "}", ")", ";", "async", "function", "getContext", "(", "analyzer", ")", "{", "return", "await", "analyzer", "[", "'_analysisComplete'", "]", ";", "}", ";" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 215, null, null, null, null, 114, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1344, null, null, 21744, null, null, 27934, null, null, null, 7, null, 2, null, 1344, null, null, null, null, null, null, null, null, null, null, 123, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, 91, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 91, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 91, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 91, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 91, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 91, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 91, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5893, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 91, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 91, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, 1519, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 123, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, 1519, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 123, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 91, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, 91, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 91, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 91, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 91, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, 1519, null, null, null, null, null, null, null, null, null, null, null, null, 123, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 91, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 91, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 91, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 91, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 74, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 19, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1344, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1519, null, null, null, null, null, null, null, null, null, null, null, null, 123, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 10984, null, null, null, null, null, null, null, null, 12625, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 10984, null, null, null, null, null, null, null, null, 12625, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 10984, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, 5827, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 10984, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 18800, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 18800, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, 5827, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 10984, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 24293, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, 10984, null, null, null, null, null, null, null, null, 5827, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 91, null, null, null, null, null, null, null, null, 91, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 91, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 91, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1519, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1180, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1344, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 91, null, null, null, null, null, null, null, null, null, null, 91, null, null, null, null, null, null, null, null, null, null, 91, null, null, null, null, null, null, null, null, null, null, 91, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, 1344, null, null, null, null, null, null, null, null, null, null, null, null, 91, null, null, null, null, null, null, null, null, null, null, 1344, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 91, null, null, null, null, null, null, null, null, null, null, 91, null, null, null, null, null, null, null, null, null, null, 91, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1519, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1519, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1519, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1519, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1519, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1519, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 19, null, null, 7, null, null, null, 8, null, null, null, null, null, null, null, null, 7, null, 2, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, 7, null, null, null, null, 20795, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 19, null, null, null, null, null, null, null, null, null, null, null, null, 1344, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, 5, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, 1462, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, 10984, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 91, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, 91, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 30, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, 536, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 536, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, 4, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, 4, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 267, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 887, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 267, null, 123, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 887, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, 1462, null, null, null, null, null, null, null, 7, null, 1462, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 21744, null, null, null, null, null, null, null, null, null, 1344, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, 1519, null, null, null, null, null, null, null, null, null, null, 123, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 123, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 30, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, 536, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, 1344, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1519, null, null, null, null, null, null, null, null, null, null, null, null, 1519, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1519, null, null, null, null, null, null, null, 1519, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 1344, null, null, null, null, null, null, null, null, null, null, null ]
1315
[ "license", "import", "{", "CancelToken", "}", "from", "'cancel-token'", ";", "import", "{", "assert", "}", "from", "'chai'", ";", "import", "{", "AsyncWorkCache", "}", "from", "'../../core/async-work-cache'", ";", "import", "{", "assertIsCancelled", ",", "invertPromise", "}", "from", "'../test-utils'", ";", "suite", "(", "'AsyncWorkCache'", ",", "(", ")", "=>", "{", "let", "cache", ";", "setup", "(", "(", ")", "=>", "{", "cache", "=", "new", "AsyncWorkCache", "<", "string", ",", "string", ">", "(", ")", ";", "}", ")", ";", "test", "(", "'it works for the simple happy case'", ",", "async", "(", ")", "=>", "{", "assert", ".", "equal", "(", "await", "cache", ".", "getOrCompute", "(", "'key'", ",", "async", "(", ")", "=>", "'cool'", ")", ",", "'cool'", ")", ";", "assert", ".", "equal", "(", "await", "cache", ".", "getOrCompute", "(", "'key'", ",", "async", "(", ")", "=>", "'neat'", ")", ",", "'cool'", ")", ";", "}", ")", ";", "test", "(", "'it handles parallel calls'", ",", "async", "(", ")", "=>", "{", "const", "promises", "=", "[", "cache", ".", "getOrCompute", "(", "'key'", ",", "async", "(", ")", "=>", "'good'", ")", ",", "cache", ".", "getOrCompute", "(", "'key'", ",", "async", "(", ")", "=>", "{", "throw", "new", "Error", "(", "'Should not be called'", ")", ";", "}", ")", ",", "cache", ".", "getOrCompute", "(", "'key'", ",", "async", "(", ")", "=>", "{", "throw", "new", "Error", "(", "'Should not be called'", ")", ";", "}", ")", ",", "]", ";", "assert", ".", "deepEqual", "(", "await", "Promise", ".", "all", "(", "promises", ")", ",", "[", "'good'", ",", "'good'", ",", "'good'", "]", ")", ";", "const", "failurePromises", "=", "[", "cache", ".", "getOrCompute", "(", "'badkey'", ",", "async", "(", ")", "=>", "{", "throw", "'failed'", ";", "}", ")", ",", "cache", ".", "getOrCompute", "(", "'badkey'", ",", "async", "(", ")", "=>", "'good'", ")", ",", "cache", ".", "getOrCompute", "(", "'badkey'", ",", "async", "(", ")", "=>", "'good'", ")", ",", "]", ".", "map", "(", "invertPromise", ")", ";", "assert", ".", "deepEqual", "(", "await", "Promise", ".", "all", "(", "failurePromises", ")", ",", "[", "'failed'", ",", "'failed'", ",", "'failed'", "]", ")", ";", "}", ")", ";", "test", "(", "'it handles a cancellation followed by a new request'", ",", "async", "(", ")", "=>", "{", "const", "source", "=", "CancelToken", ".", "source", "(", ")", ";", "const", "promise1", "=", "cache", ".", "getOrCompute", "(", "'key'", ",", "async", "(", ")", "=>", "{", "while", "(", "true", ")", "{", "await", "Promise", ".", "resolve", "(", ")", ";", "source", ".", "token", ".", "throwIfRequested", "(", ")", ";", "}", "}", ",", "source", ".", "token", ")", ";", "source", ".", "cancel", "(", ")", ";", "await", "assertIsCancelled", "(", "promise1", ")", ";", "const", "source2", "=", "CancelToken", ".", "source", "(", ")", ";", "const", "promise2", "=", "cache", ".", "getOrCompute", "(", "'key'", ",", "async", "(", ")", "=>", "{", "await", "Promise", ".", "resolve", "(", ")", ";", "return", "'finished!'", ";", "}", ",", "source2", ".", "token", ")", ";", "assert", ".", "equal", "(", "await", "promise2", ",", "'finished!'", ")", ";", "}", ")", ";", "const", "testName", "=", "`many parallel calls to getOrCompute, some that cancel,`", "+", "` some that don't`", ";", "test", "(", "testName", ",", "async", "(", ")", "=>", "{", "const", "cancelledPromises", "=", "[", "]", ";", "for", "(", "let", "i", "=", "0", ";", "i", "<", "10", ";", "i", "++", ")", "{", "const", "source", "=", "CancelToken", ".", "source", "(", ")", ";", "cancelledPromises", ".", "push", "(", "cache", ".", "getOrCompute", "(", "'key'", ",", "async", "(", ")", "=>", "{", "while", "(", "true", ")", "{", "await", "Promise", ".", "resolve", "(", ")", ";", "source", ".", "token", ".", "throwIfRequested", "(", ")", ";", "}", "}", ",", "source", ".", "token", ")", ")", ";", "source", ".", "cancel", "(", ")", ";", "}", "assert", ".", "equal", "(", "await", "cache", ".", "getOrCompute", "(", "'key'", ",", "async", "(", ")", "=>", "{", "return", "'cool'", ";", "}", ")", ",", "'cool'", ")", ";", "for", "(", "const", "cancelled", "of", "cancelledPromises", ")", "{", "await", "assertIsCancelled", "(", "cancelled", ")", ";", "}", "}", ")", ";", "}", ")", ";" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1316
[ "license", "import", "{", "CancelToken", "}", "from", "'cancel-token'", ";", "import", "{", "createForDirectory", ",", "fixtureDir", "}", "from", "'../test-utils'", ";", "suite", "(", "'cancelling analysis midway through'", ",", "(", ")", "=>", "{", "test", "(", "`analyze() does not complete when cancelled`", ",", "async", "(", ")", "=>", "{", "const", "{", "analyzer", "}", "=", "await", "createForDirectory", "(", "fixtureDir", ")", ";", "const", "cancelSource", "=", "CancelToken", ".", "source", "(", ")", ";", "const", "analysisPromise", "=", "analyzer", ".", "analyze", "(", "[", "'vanilla-elements.js'", "]", ",", "{", "cancelToken", ":", "cancelSource", ".", "token", "}", ")", ";", "cancelSource", ".", "cancel", "(", ")", ";", "const", "analysis", "=", "await", "analysisPromise", ";", "const", "result", "=", "analysis", ".", "getDocument", "(", "'vanilla-element.js'", ")", ";", "if", "(", "result", ".", "successful", ")", "{", "throw", "new", "Error", "(", "`Did not expect analysis to succeed when cancelled.`", ")", ";", "}", "}", ")", ";", "test", "(", "'we can handle parallel requests, one canceled one not'", ",", "async", "(", ")", "=>", "{", "const", "{", "analyzer", "}", "=", "await", "createForDirectory", "(", "fixtureDir", ")", ";", "const", "cancelSource", "=", "CancelToken", ".", "source", "(", ")", ";", "const", "url", "=", "'vanilla-elements.js'", ";", "const", "cancelledAnalysisPromise", "=", "analyzer", ".", "analyze", "(", "[", "url", "]", ",", "{", "cancelToken", ":", "cancelSource", ".", "token", "}", ")", ";", "const", "goodAnalysisPromise", "=", "analyzer", ".", "analyze", "(", "[", "url", "]", ")", ";", "cancelSource", ".", "cancel", "(", ")", ";", "const", "cancelledAnalysis", "=", "await", "cancelledAnalysisPromise", ";", "const", "cancelledResult", "=", "cancelledAnalysis", ".", "getDocument", "(", "url", ")", ";", "if", "(", "cancelledResult", ".", "successful", ")", "{", "throw", "new", "Error", "(", "`Expected cancelled analysis not to yield a document.`", ")", ";", "}", "const", "goodAnalysis", "=", "await", "goodAnalysisPromise", ";", "const", "goodResult", "=", "goodAnalysis", ".", "getDocument", "(", "url", ")", ";", "if", "(", "!", "goodResult", ".", "successful", ")", "{", "throw", "new", "Error", "(", "`Expected non-cancelled analysis to yield a document.`", ")", ";", "}", "}", ")", ";", "}", ")", ";" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1519, null, null, null, null, null, 123, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, 2, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1519, null, null, null, null, null, 123, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1519, null, null, null, null, null, 123, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1317
[ "license", "import", "{", "assert", ",", "use", "}", "from", "'chai'", ";", "import", "{", "Analyzer", "}", "from", "'../../core/analyzer'", ";", "import", "{", "DependencyGraph", "}", "from", "'../../core/dependency-graph'", ";", "import", "chaiAsPromised", "=", "require", "(", "'chai-as-promised'", ")", ";", "import", "{", "ResolvedUrl", "}", "from", "'../../model/url'", ";", "import", "{", "resolvedUrl", ",", "fixtureDir", ",", "createForDirectory", "}", "from", "'../test-utils'", ";", "use", "(", "chaiAsPromised", ")", ";", "suite", "(", "'DependencyGraph'", ",", "(", ")", "=>", "{", "function", "assertStringSetsEqual", "(", "actual", ",", "expected", ",", "message", "?", ")", "{", "assert", ".", "deepEqual", "(", "Array", ".", "from", "(", "actual", ")", ".", "sort", "(", ")", ",", "Array", ".", "from", "(", "expected", ")", ".", "sort", "(", ")", ",", "message", ")", ";", "}", "test", "(", "'can calculate dependants'", ",", "(", ")", "=>", "{", "let", "graph", "=", "new", "DependencyGraph", "(", ")", ";", "assertStringSetsEqual", "(", "graph", ".", "getAllDependantsOf", "(", "resolvedUrl", "`common.html`", ")", ",", "[", "]", ")", ";", "graph", ".", "addDocument", "(", "resolvedUrl", "`a.html`", ",", "[", "resolvedUrl", "`common.html`", "]", ")", ";", "assertStringSetsEqual", "(", "graph", ".", "getAllDependantsOf", "(", "resolvedUrl", "`common.html`", ")", ",", "[", "'a.html'", "]", ")", ";", "graph", ".", "addDocument", "(", "resolvedUrl", "`b.html`", ",", "[", "resolvedUrl", "`common.html`", "]", ")", ";", "assertStringSetsEqual", "(", "graph", ".", "getAllDependantsOf", "(", "resolvedUrl", "`common.html`", ")", ",", "[", "'a.html'", ",", "'b.html'", "]", ")", ";", "graph", ".", "addDocument", "(", "resolvedUrl", "`base.html`", ",", "[", "'a.html'", ",", "'b.html'", "]", "as", "ResolvedUrl", "[", "]", ")", ";", "assertStringSetsEqual", "(", "graph", ".", "getAllDependantsOf", "(", "resolvedUrl", "`common.html`", ")", ",", "[", "'a.html'", ",", "'b.html'", ",", "'base.html'", "]", ")", ";", "graph", "=", "graph", ".", "invalidatePaths", "(", "[", "resolvedUrl", "`a.html`", "]", ")", ";", "assertStringSetsEqual", "(", "graph", ".", "getAllDependantsOf", "(", "resolvedUrl", "`common.html`", ")", ",", "[", "'b.html'", ",", "'base.html'", "]", ")", ";", "graph", "=", "graph", ".", "invalidatePaths", "(", "[", "resolvedUrl", "`b.html`", "]", ")", ";", "assertStringSetsEqual", "(", "graph", ".", "getAllDependantsOf", "(", "resolvedUrl", "`common.html`", ")", ",", "[", "]", ")", ";", "assertIsValidGraph", "(", "graph", ")", ";", "}", ")", ";", "/**\n * Like many integration tests this is a bit dirty, but it catches many\n * interesting bugs in the way that we construct the dependency graph in\n * practice.\n */", "suite", "(", "'as used in the Analyzer'", ",", "(", ")", "=>", "{", "let", "analyzer", ";", "setup", "(", "async", "(", ")", "=>", "{", "const", "created", "=", "await", "createForDirectory", "(", "fixtureDir", ")", ";", "analyzer", "=", "created", ".", "analyzer", ";", "}", ")", ";", "async", "function", "assertImportersOf", "(", "path", ",", "expectedDependants", ")", "{", "const", "graph", "=", "await", "getLatestDependencyGraph", "(", "analyzer", ")", ";", "assertStringSetsEqual", "(", "graph", ".", "getAllDependantsOf", "(", "analyzer", ".", "resolveUrl", "(", "path", ")", "!", ")", ",", "expectedDependants", ".", "map", "(", "(", "u", ")", "=>", "analyzer", ".", "resolveUrl", "(", "u", ")", "!", ")", ")", ";", "}", ";", "test", "(", "'works with a basic document with no dependencies'", ",", "async", "(", ")", "=>", "{", "await", "analyzer", ".", "analyze", "(", "[", "'dependencies/leaf.html'", "]", ")", ";", "await", "assertImportersOf", "(", "'dependencies/leaf.html'", ",", "[", "]", ")", ";", "const", "graph", "=", "await", "getLatestDependencyGraph", "(", "analyzer", ")", ";", "assertGraphIsSettled", "(", "graph", ")", ";", "assertIsValidGraph", "(", "graph", ")", ";", "}", ")", ";", "test", "(", "'works with a simple tree of dependencies'", ",", "async", "(", ")", "=>", "{", "await", "analyzer", ".", "analyze", "(", "[", "'dependencies/root.html'", "]", ")", ";", "await", "assertImportersOf", "(", "'dependencies/root.html'", ",", "[", "]", ")", ";", "await", "assertImportersOf", "(", "'dependencies/leaf.html'", ",", "[", "'dependencies/root.html'", "]", ")", ";", "await", "assertImportersOf", "(", "'dependencies/subfolder/subfolder-sibling.html'", ",", "[", "'dependencies/subfolder/in-folder.html'", ",", "'dependencies/inline-and-imports.html'", ",", "'dependencies/root.html'", "]", ")", ";", "const", "graph", "=", "await", "getLatestDependencyGraph", "(", "analyzer", ")", ";", "assertGraphIsSettled", "(", "graph", ")", ";", "assertIsValidGraph", "(", "graph", ")", ";", "}", ")", ";", "}", ")", ";", "suite", "(", "'whenReady'", ",", "(", ")", "=>", "{", "test", "(", "'resolves for a single added document'", ",", "async", "(", ")", "=>", "{", "const", "graph", "=", "new", "DependencyGraph", "(", ")", ";", "const", "done", "=", "graph", ".", "whenReady", "(", "resolvedUrl", "`a`", ")", ";", "graph", ".", "addDocument", "(", "resolvedUrl", "`a`", ",", "[", "]", ")", ";", "assertGraphIsSettled", "(", "graph", ")", ";", "assertIsValidGraph", "(", "graph", ")", ";", "await", "done", ";", "}", ")", ";", "test", "(", "'resolves for a single rejected document'", ",", "async", "(", ")", "=>", "{", "const", "graph", "=", "new", "DependencyGraph", "(", ")", ";", "const", "done", "=", "graph", ".", "whenReady", "(", "resolvedUrl", "`a`", ")", ";", "graph", ".", "rejectDocument", "(", "resolvedUrl", "`a`", ",", "new", "Error", "(", "'because'", ")", ")", ";", "assertGraphIsSettled", "(", "graph", ")", ";", "assertIsValidGraph", "(", "graph", ")", ";", "await", "done", ";", "}", ")", ";", "test", "(", "'resolves for a document with an added dependency'", ",", "async", "(", ")", "=>", "{", "const", "graph", "=", "new", "DependencyGraph", "(", ")", ";", "const", "done", "=", "graph", ".", "whenReady", "(", "resolvedUrl", "`a`", ")", ";", "graph", ".", "addDocument", "(", "resolvedUrl", "`a`", ",", "[", "resolvedUrl", "`b`", "]", ")", ";", "graph", ".", "addDocument", "(", "resolvedUrl", "`b`", ",", "[", "]", ")", ";", "assertGraphIsSettled", "(", "graph", ")", ";", "assertIsValidGraph", "(", "graph", ")", ";", "await", "done", ";", "}", ")", ";", "test", "(", "'resolves for a document with a rejected dependency'", ",", "async", "(", ")", "=>", "{", "const", "graph", "=", "new", "DependencyGraph", "(", ")", ";", "const", "done", "=", "graph", ".", "whenReady", "(", "resolvedUrl", "`a`", ")", ";", "graph", ".", "addDocument", "(", "resolvedUrl", "`a`", ",", "[", "resolvedUrl", "`b`", "]", ")", ";", "graph", ".", "rejectDocument", "(", "resolvedUrl", "`b`", ",", "new", "Error", "(", "'because'", ")", ")", ";", "assertGraphIsSettled", "(", "graph", ")", ";", "assertIsValidGraph", "(", "graph", ")", ";", "await", "done", ";", "}", ")", ";", "test", "(", "'resolves for a simple cycle'", ",", "async", "(", ")", "=>", "{", "const", "graph", "=", "new", "DependencyGraph", "(", ")", ";", "const", "promises", "=", "[", "graph", ".", "whenReady", "(", "resolvedUrl", "`a`", ")", ",", "graph", ".", "whenReady", "(", "resolvedUrl", "`b`", ")", "]", ";", "graph", ".", "addDocument", "(", "resolvedUrl", "`a`", ",", "[", "'b'", "]", "as", "ResolvedUrl", "[", "]", ")", ";", "graph", ".", "addDocument", "(", "resolvedUrl", "`b`", ",", "[", "'a'", "]", "as", "ResolvedUrl", "[", "]", ")", ";", "await", "Promise", ".", "all", "(", "promises", ")", ";", "assertGraphIsSettled", "(", "graph", ")", ";", "assertIsValidGraph", "(", "graph", ")", ";", "}", ")", ";", "test", "(", "'does not resolve early for a cycle with a leg'", ",", "async", "(", ")", "=>", "{", "const", "graph", "=", "new", "DependencyGraph", "(", ")", ";", "let", "cResolved", "=", "false", ";", "const", "aReady", "=", "graph", ".", "whenReady", "(", "resolvedUrl", "`a`", ")", ".", "then", "(", "(", ")", "=>", "{", "assert", ".", "isTrue", "(", "cResolved", ")", ";", "}", ")", ";", "const", "bReady", "=", "graph", ".", "whenReady", "(", "resolvedUrl", "`b`", ")", ".", "then", "(", "(", ")", "=>", "{", "assert", ".", "isTrue", "(", "cResolved", ")", ";", "}", ")", ";", "graph", ".", "addDocument", "(", "resolvedUrl", "`a`", ",", "[", "'b'", ",", "'c'", "]", "as", "ResolvedUrl", "[", "]", ")", ";", "graph", ".", "addDocument", "(", "resolvedUrl", "`b`", ",", "[", "'a'", "]", "as", "ResolvedUrl", "[", "]", ")", ";", "await", "Promise", ".", "resolve", "(", ")", ";", "cResolved", "=", "true", ";", "graph", ".", "addDocument", "(", "resolvedUrl", "`c`", ",", "[", "]", ")", ";", "await", "Promise", ".", "all", "(", "[", "aReady", ",", "bReady", "]", ")", ";", "assertGraphIsSettled", "(", "graph", ")", ";", "assertIsValidGraph", "(", "graph", ")", ";", "}", ")", ";", "}", ")", ";", "}", ")", ";", "/**\n * Asserts that all records in the graph have had all of their dependencies\n * resolved or rejected.\n */", "function", "assertGraphIsSettled", "(", "graph", ")", "{", "for", "(", "const", "record", "of", "graph", "[", "'_documents'", "]", ".", "values", "(", ")", ")", "{", "if", "(", "!", "(", "record", ".", "dependenciesDeferred", ".", "resolved", "||", "record", ".", "dependenciesDeferred", ".", "rejected", ")", ")", "{", "assert", ".", "fail", "(", "false", ",", "true", ",", "`found unsettled record for url '${", "record", ".", "url", "}' in graph that should be settled`", ")", ";", "}", "}", "}", "/**\n * Asserts that for every record in the graph, each outgoing link is matched\n * by an incoming link on the other side, and vice versa.\n *\n * Since DependencyGraph tracks both incoming and outgoing links (dependencies\n * and dependants), when there is a dependency A -> B, both A and B should be\n * aware of that dependency link.\n */", "function", "assertIsValidGraph", "(", "graph", ")", "{", "for", "(", "const", "record", "of", "graph", "[", "'_documents'", "]", ".", "values", "(", ")", ")", "{", "for", "(", "const", "dependency", "of", "record", ".", "dependencies", ")", "{", "const", "dependencyRecord", "=", "graph", "[", "'_documents'", "]", ".", "get", "(", "dependency", ")", ";", "assert", ".", "isTrue", "(", "dependencyRecord", "!==", "undefined", ",", "`dependency record for ${", "dependency", "} should exist,`", "+", "` as it is referenced by ${", "record", ".", "url", "}.`", ")", ";", "assert", ".", "isTrue", "(", "dependencyRecord", "!", ".", "dependants", ".", "has", "(", "record", ".", "url", ")", ",", "`${", "dependency", "} should know about its dependant ${", "record", ".", "url", "}`", ")", ";", "}", "for", "(", "const", "dependant", "of", "record", ".", "dependants", ")", "{", "const", "dependantRecord", "=", "graph", "[", "'_documents'", "]", ".", "get", "(", "dependant", ")", ";", "assert", ".", "isTrue", "(", "dependantRecord", "!==", "undefined", ",", "`dependant record for ${", "dependant", "} should exist,`", "+", "` as it is referenced by ${", "record", ".", "url", "}.`", ")", ";", "assert", ".", "isTrue", "(", "dependantRecord", "!", ".", "dependencies", ".", "has", "(", "record", ".", "url", ")", ",", "`${", "dependant", "} should know about its dependency ${", "record", ".", "url", "}`", ")", ";", "}", "}", "}", "async", "function", "getLatestDependencyGraph", "(", "analyzer", ")", "{", "const", "context", "=", "await", "analyzer", "[", "'_analysisComplete'", "]", ";", "return", "context", "[", "'_cache'", "]", ".", "dependencyGraph", ";", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 30, null, 114, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 10154, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1344, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 2, null, 5, null, null, null, 10154, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 10154, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 10154, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 10154, null, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 10154, null, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 10154, null, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 10154, null, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 10154, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 10154, null, null, null, null, null, null, null, 8, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 10154, null, null, null, null, null, 19660, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 10154, null, null, null, null, null, 19660, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1462, null, null, null, null, null, null, null, 19660, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1462, null, null, null, null, null, null, null, 19660, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 1344, null, null, null, 10984, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1318
[ "license", "import", "{", "assert", "}", "from", "'chai'", ";", "import", "{", "createForDirectory", ",", "fixtureDir", "}", "from", "'../test-utils'", ";", "suite", "(", "'CssCustomPropertyScanner'", ",", "async", "(", ")", "=>", "{", "const", "{", "analyzer", ",", "underliner", "}", "=", "await", "createForDirectory", "(", "fixtureDir", ")", ";", "test", "(", "'finds custom property assignments'", ",", "async", "(", ")", "=>", "{", "const", "result", "=", "await", "analyzer", ".", "analyze", "(", "[", "'some-styles.html'", "]", ")", ";", "const", "assignments", "=", "[", "...", "result", ".", "getFeatures", "(", "{", "kind", ":", "'css-custom-property-assignment'", "}", ")", "]", ";", "assert", ".", "deepEqual", "(", "await", "Promise", ".", "all", "(", "assignments", ".", "map", "(", "(", "a", ")", "=>", "underliner", ".", "underline", "(", "a", ".", "sourceRange", ")", ")", ")", ",", "[", "`\n --primary-text-color: var(--light-theme-text-color);\n ~~~~~~~~~~~~~~~~~~~~`", ",", "`\n --primary-background-color: var(--light-theme-background-color, --orange);\n ~~~~~~~~~~~~~~~~~~~~~~~~~~`", ",", "`\n --light-theme-background-color: #ffffff;\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`", "]", ")", ";", "assert", ".", "deepEqual", "(", "assignments", ".", "map", "(", "(", "a", ")", "=>", "a", ".", "name", ")", ",", "[", "'--primary-text-color'", ",", "'--primary-background-color'", ",", "'--light-theme-background-color'", "]", ")", ";", "}", ")", ";", "test", "(", "'finds custom property uses'", ",", "async", "(", ")", "=>", "{", "const", "result", "=", "await", "analyzer", ".", "analyze", "(", "[", "'some-styles.html'", "]", ")", ";", "const", "assignments", "=", "[", "...", "result", ".", "getFeatures", "(", "{", "kind", ":", "'css-custom-property-use'", "}", ")", "]", ";", "assert", ".", "deepEqual", "(", "await", "Promise", ".", "all", "(", "assignments", ".", "map", "(", "(", "a", ")", "=>", "underliner", ".", "underline", "(", "a", ".", "sourceRange", ")", ")", ")", ",", "[", "`\n @apply(--layout-inline);\n ~~~~~~~~~~~~~~~`", ",", "`\n @apply --layout-center-center;\n ~~~~~~~~~~~~~~~~~~~~~~`", ",", "`\n --primary-text-color: var(--light-theme-text-color);\n ~~~~~~~~~~~~~~~~~~~~~~~~`", ",", "`\n --primary-background-color: var(--light-theme-background-color, --orange);\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`", ",", "`\n --primary-background-color: var(--light-theme-background-color, --orange);\n ~~~~~~~~`", ",", "]", ")", ";", "assert", ".", "deepEqual", "(", "assignments", ".", "map", "(", "(", "a", ")", "=>", "a", ".", "name", ")", ",", "[", "'--layout-inline'", ",", "'--layout-center-center'", ",", "'--light-theme-text-color'", ",", "'--light-theme-background-color'", ",", "'--orange'", "]", ")", ";", "}", ")", ";", "}", ")", ";" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1519, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1519, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1319
[ "license", "import", "{", "assert", "}", "from", "'chai'", ";", "import", "*", "as", "fs", "from", "'fs'", ";", "import", "*", "as", "path", "from", "'path'", ";", "import", "{", "ParsedCssDocument", "}", "from", "'../../css/css-document'", ";", "import", "{", "CssParser", "}", "from", "'../../css/css-parser'", ";", "import", "{", "PackageUrlResolver", "}", "from", "'../../index'", ";", "import", "{", "fixtureDir", ",", "resolvedUrl", "}", "from", "'../test-utils'", ";", "suite", "(", "'CssParser'", ",", "(", ")", "=>", "{", "suite", "(", "'parse()'", ",", "(", ")", "=>", "{", "const", "fileContents", "=", "fs", ".", "readFileSync", "(", "path", ".", "join", "(", "fixtureDir", ",", "'stylesheet.css'", ")", ",", "'utf8'", ")", ";", "let", "parser", ";", "setup", "(", "(", ")", "=>", "{", "parser", "=", "new", "CssParser", "(", ")", ";", "}", ")", ";", "test", "(", "'parses css'", ",", "(", ")", "=>", "{", "const", "document", "=", "parser", ".", "parse", "(", "fileContents", ",", "resolvedUrl", "`/static/stylesheet.css`", ",", "new", "PackageUrlResolver", "(", ")", ")", ";", "assert", ".", "instanceOf", "(", "document", ",", "ParsedCssDocument", ")", ";", "assert", ".", "equal", "(", "document", ".", "url", ",", "'/static/stylesheet.css'", ")", ";", "assert", "(", "document", ".", "ast", "!=", "null", ")", ";", "}", ")", ";", "test", "(", "'stringifies css'", ",", "(", ")", "=>", "{", "const", "document", "=", "parser", ".", "parse", "(", "fileContents", ",", "resolvedUrl", "`/static/stylesheet.css`", ",", "new", "PackageUrlResolver", "(", ")", ")", ";", "assert", ".", "deepEqual", "(", "document", ".", "stringify", "(", ")", ",", "fileContents", ")", ";", "}", ")", ";", "}", ")", ";", "}", ")", ";" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 24296, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 29924, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 29924, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1320
[ "license", "import", "{", "assert", "}", "from", "'chai'", ";", "import", "*", "as", "dom5", "from", "'dom5/lib/index-next'", ";", "import", "*", "as", "fs", "from", "'fs'", ";", "import", "*", "as", "parse5", "from", "'parse5'", ";", "import", "*", "as", "path", "from", "'path'", ";", "import", "{", "ParsedHtmlDocument", "}", "from", "'../../html/html-document'", ";", "import", "{", "HtmlParser", "}", "from", "'../../html/html-parser'", ";", "import", "{", "PackageUrlResolver", "}", "from", "'../../url-loader/package-url-resolver'", ";", "import", "{", "createForDirectory", ",", "fixtureDir", "}", "from", "'../test-utils'", ";", "suite", "(", "'ParsedHtmlDocument'", ",", "async", "(", ")", "=>", "{", "const", "parser", "=", "new", "HtmlParser", "(", ")", ";", "const", "url", "=", "`./source-ranges/html-complicated.html`", ";", "const", "file", "=", "fs", ".", "readFileSync", "(", "path", ".", "join", "(", "fixtureDir", ",", "url", ")", ",", "'utf8'", ")", ";", "const", "{", "analyzer", ",", "underliner", "}", "=", "await", "createForDirectory", "(", "fixtureDir", ")", ";", "let", "document", ";", "setup", "(", "(", ")", "=>", "{", "document", "=", "parser", ".", "parse", "(", "file", ",", "analyzer", ".", "resolveUrl", "(", "url", ")", "!", ",", "analyzer", ".", "urlResolver", ")", ";", "}", ")", ";", "suite", "(", "'sourceRangeForNode()'", ",", "(", ")", "=>", "{", "test", "(", "'works for comments'", ",", "async", "(", ")", "=>", "{", "const", "comments", "=", "[", "...", "dom5", ".", "depthFirst", "(", "document", ".", "ast", ")", "]", ".", "filter", "(", "parse5", ".", "treeAdapters", ".", "default", ".", "isCommentNode", ")", ";", "assert", ".", "equal", "(", "comments", ".", "length", ",", "2", ")", ";", "assert", ".", "deepEqual", "(", "await", "underliner", ".", "underline", "(", "document", ".", "sourceRangeForNode", "(", "comments", "!", "[", "0", "]", ")", ")", ",", "`\n <!-- Single Line Comment -->\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~`", ")", ";", "assert", ".", "deepEqual", "(", "await", "underliner", ".", "underline", "(", "document", ".", "sourceRangeForNode", "(", "comments", "!", "[", "1", "]", ")", ")", ",", "`\n <!-- Multiple\n ~~~~~~~~~~~~~\n Line\n~~~~~~~~~~~~~\n Comment -->\n~~~~~~~~~~~~~~~~~~~~`", ")", ";", "}", ")", ";", "test", "(", "'works for elements'", ",", "async", "(", ")", "=>", "{", "const", "liTags", "=", "[", "...", "dom5", ".", "queryAll", "(", "document", ".", "ast", ",", "dom5", ".", "predicates", ".", "hasTagName", "(", "'li'", ")", ")", "]", ";", "assert", ".", "equal", "(", "liTags", ".", "length", ",", "4", ")", ";", "assert", ".", "deepEqual", "(", "await", "underliner", ".", "underline", "(", "document", ".", "sourceRangeForNode", "(", "liTags", "[", "0", "]", "!", ")", "!", ")", ",", "`\n <li>1\n ~~~~~\n <li>2</li>\n~~~~~~~~`", ")", ";", "assert", ".", "deepEqual", "(", "await", "underliner", ".", "underline", "(", "document", ".", "sourceRangeForNode", "(", "liTags", "[", "1", "]", "!", ")", "!", ")", ",", "`\n <li>2</li>\n ~~~~~~~~~~`", ")", ";", "assert", ".", "deepEqual", "(", "await", "underliner", ".", "underline", "(", "document", ".", "sourceRangeForNode", "(", "liTags", "[", "2", "]", "!", ")", ")", ",", "`\n <li><li>\n ~~~~`", ")", ";", "assert", ".", "deepEqual", "(", "await", "underliner", ".", "underline", "(", "document", ".", "sourceRangeForNode", "(", "liTags", "[", "3", "]", "!", ")", ")", ",", "`\n <li><li>\n ~~~~\n </ul>\n~~~~~~`", ")", ";", "const", "pTags", "=", "[", "...", "dom5", ".", "queryAll", "(", "document", ".", "ast", ",", "dom5", ".", "predicates", ".", "hasTagName", "(", "'p'", ")", ")", "]", ";", "assert", ".", "equal", "(", "pTags", ".", "length", ",", "2", ")", ";", "assert", ".", "deepEqual", "(", "await", "underliner", ".", "underline", "(", "document", ".", "sourceRangeForNode", "(", "pTags", "[", "0", "]", "!", ")", ")", ",", "`\n <p>\n ~~~\n This is a paragraph without a closing tag.\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n <p>This is a paragraph with a closing tag.</p>\n~~~~`", ")", ";", "assert", ".", "deepEqual", "(", "await", "underliner", ".", "underline", "(", "document", ".", "sourceRangeForNode", "(", "pTags", "[", "1", "]", "!", ")", ")", ",", "`\n <p>This is a paragraph with a closing tag.</p>\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`", ")", ";", "}", ")", ";", "const", "testName", "=", "'works for unclosed tags with attributes and no text content'", ";", "test", "(", "testName", ",", "async", "(", ")", "=>", "{", "const", "url", "=", "analyzer", ".", "resolveUrl", "(", "`unclosed-tag-attributes.html`", ")", "!", ";", "const", "document", "=", "parser", ".", "parse", "(", "await", "analyzer", ".", "load", "(", "url", ")", ",", "url", ",", "new", "PackageUrlResolver", "(", "{", "packageDir", ":", "fixtureDir", "}", ")", ")", ";", "const", "tag", "=", "dom5", ".", "query", "(", "document", ".", "ast", ",", "dom5", ".", "predicates", ".", "hasTagName", "(", "'tag'", ")", ")", "!", ";", "assert", ".", "deepEqual", "(", "await", "underliner", ".", "underline", "(", "document", ".", "sourceRangeForNode", "(", "tag", ")", ")", ",", "`\n<tag attr>\n~~~~~~~~~~`", ")", ";", "}", ")", ";", "test", "(", "'works for void elements'", ",", "async", "(", ")", "=>", "{", "const", "linkTags", "=", "[", "...", "dom5", ".", "queryAll", "(", "document", ".", "ast", ",", "dom5", ".", "predicates", ".", "hasTagName", "(", "'link'", ")", ")", "]", ";", "assert", ".", "equal", "(", "linkTags", ".", "length", ",", "2", ")", ";", "assert", ".", "deepEqual", "(", "await", "underliner", ".", "underline", "(", "document", ".", "sourceRangeForNode", "(", "linkTags", "[", "0", "]", "!", ")", ")", ",", "`\n <link rel=\"has attributes\">\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~`", ")", ";", "assert", ".", "deepEqual", "(", "await", "underliner", ".", "underline", "(", "document", ".", "sourceRangeForNode", "(", "linkTags", "[", "1", "]", "!", ")", ")", ",", "`\n <link rel=\"multiline ones too\"\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n foo=bar>\n~~~~~~~~~~~~~~~~~~`", ")", ";", "}", ")", ";", "test", "(", "'works for text nodes'", ",", "async", "(", ")", "=>", "{", "const", "titleTag", "=", "dom5", ".", "query", "(", "document", ".", "ast", ",", "dom5", ".", "predicates", ".", "hasTagName", "(", "'title'", ")", ")", "!", ";", "assert", ".", "deepEqual", "(", "await", "underliner", ".", "underline", "(", "document", ".", "sourceRangeForNode", "(", "titleTag", "!", ".", "childNodes", "!", "[", "0", "]", "!", ")", ")", ",", "`\n <title>\n ~\n This title is a little\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n complicated.\n~~~~~~~~~~~~~~~~~~\n </title>\n~~~~~~~~`", ")", ";", "const", "pTags", "=", "[", "...", "dom5", ".", "queryAll", "(", "document", ".", "ast", ",", "dom5", ".", "predicates", ".", "hasTagName", "(", "'p'", ")", ")", "]", ";", "assert", ".", "equal", "(", "pTags", ".", "length", ",", "2", ")", ";", "assert", ".", "deepEqual", "(", "await", "underliner", ".", "underline", "(", "document", ".", "sourceRangeForNode", "(", "pTags", "[", "0", "]", "!", ".", "childNodes", "!", "[", "0", "]", "!", ")", ")", ",", "`\n <p>\n ~\n This is a paragraph without a closing tag.\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n <p>This is a paragraph with a closing tag.</p>\n~~~~`", ")", ";", "assert", ".", "deepEqual", "(", "await", "underliner", ".", "underline", "(", "document", ".", "sourceRangeForNode", "(", "pTags", "[", "1", "]", "!", ".", "childNodes", "!", "[", "0", "]", "!", ")", ")", ",", "`\n <p>This is a paragraph with a closing tag.</p>\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`", ")", ";", "}", ")", ";", "}", ")", ";", "suite", "(", "'sourceRangeForStartTag'", ",", "(", ")", "=>", "{", "test", "(", "'it works for tags with no attributes'", ",", "async", "(", ")", "=>", "{", "const", "liTags", "=", "[", "...", "dom5", ".", "queryAll", "(", "document", ".", "ast", ",", "dom5", ".", "predicates", ".", "hasTagName", "(", "'li'", ")", ")", "]", ";", "assert", ".", "deepEqual", "(", "await", "underliner", ".", "underline", "(", "document", ".", "sourceRangeForStartTag", "(", "liTags", "[", "0", "]", "!", ")", ")", ",", "`\n <li>1\n ~~~~`", ")", ";", "assert", ".", "deepEqual", "(", "await", "underliner", ".", "underline", "(", "document", ".", "sourceRangeForStartTag", "(", "liTags", "[", "1", "]", "!", ")", ")", ",", "`\n <li>2</li>\n ~~~~`", ")", ";", "assert", ".", "deepEqual", "(", "await", "underliner", ".", "underline", "(", "document", ".", "sourceRangeForStartTag", "(", "liTags", "[", "2", "]", "!", ")", ")", ",", "`\n <li><li>\n ~~~~`", ")", ";", "assert", ".", "deepEqual", "(", "await", "underliner", ".", "underline", "(", "document", ".", "sourceRangeForStartTag", "(", "liTags", "[", "3", "]", "!", ")", ")", ",", "`\n <li><li>\n ~~~~`", ")", ";", "}", ")", ";", "test", "(", "'it works for void tags with no attributes'", ",", "async", "(", ")", "=>", "{", "const", "brTags", "=", "[", "...", "dom5", ".", "queryAll", "(", "document", ".", "ast", ",", "dom5", ".", "predicates", ".", "hasTagName", "(", "'br'", ")", ")", "]", ";", "assert", ".", "equal", "(", "brTags", ".", "length", ",", "1", ")", ";", "assert", ".", "deepEqual", "(", "await", "underliner", ".", "underline", "(", "document", ".", "sourceRangeForStartTag", "(", "brTags", "[", "0", "]", "!", ")", ")", ",", "`\n <br>\n ~~~~`", ")", ";", "}", ")", ";", "test", "(", "'it works for void tags with attributes'", ",", "async", "(", ")", "=>", "{", "const", "linkTags", "=", "[", "...", "dom5", ".", "queryAll", "(", "document", ".", "ast", ",", "dom5", ".", "predicates", ".", "hasTagName", "(", "'link'", ")", ")", "]", ";", "assert", ".", "equal", "(", "linkTags", ".", "length", ",", "2", ")", ";", "assert", ".", "deepEqual", "(", "await", "underliner", ".", "underline", "(", "document", ".", "sourceRangeForStartTag", "(", "linkTags", "[", "0", "]", "!", ")", ")", ",", "`\n <link rel=\"has attributes\">\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~`", ")", ";", "assert", ".", "deepEqual", "(", "await", "underliner", ".", "underline", "(", "document", ".", "sourceRangeForStartTag", "(", "linkTags", "[", "1", "]", "!", ")", ")", ",", "`\n <link rel=\"multiline ones too\"\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n foo=bar>\n~~~~~~~~~~~~~~~~~~`", ")", ";", "}", ")", ";", "test", "(", "'it works for normal elements with attributes'", ",", "async", "(", ")", "=>", "{", "const", "h1Tags", "=", "[", "...", "dom5", ".", "queryAll", "(", "document", ".", "ast", ",", "dom5", ".", "predicates", ".", "hasTagName", "(", "'h1'", ")", ")", "]", ";", "assert", ".", "equal", "(", "h1Tags", ".", "length", ",", "2", ")", ";", "assert", ".", "deepEqual", "(", "await", "underliner", ".", "underline", "(", "document", ".", "sourceRangeForStartTag", "(", "h1Tags", "[", "1", "]", "!", ")", ")", ",", "`\n <h1 class=\"foo\" id=\"bar\">\n ~~~~~~~~~~~~~~~~~~~~~~~~~`", ")", ";", "const", "complexTags", "=", "[", "...", "dom5", ".", "queryAll", "(", "document", ".", "ast", ",", "dom5", ".", "predicates", ".", "hasTagName", "(", "'complex-tag'", ")", ")", "]", ";", "assert", ".", "equal", "(", "complexTags", ".", "length", ",", "1", ")", ";", "assert", ".", "deepEqual", "(", "await", "underliner", ".", "underline", "(", "document", ".", "sourceRangeForStartTag", "(", "complexTags", "[", "0", "]", "!", ")", ")", ",", "`\n <complex-tag boolean-attr\n ~~~~~~~~~~~~~~~~~~~~~~~~~\n string-attr=\"like this\"\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n multi-line-attr=\"\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n can go on\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n for multiple lines\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n \"\n~~~~~~~~~~~~~~~~~\n whitespace-around-equals\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n =\n~~~~~~~~~~~~~~~~~\n \"yes this is legal\">\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`", ")", ";", "}", ")", ";", "}", ")", ";", "suite", "(", "'sourceRangeForEndTag'", ",", "(", ")", "=>", "{", "test", "(", "'it works for normal elements'", ",", "async", "(", ")", "=>", "{", "const", "h1Tags", "=", "[", "...", "dom5", ".", "queryAll", "(", "document", ".", "ast", ",", "dom5", ".", "predicates", ".", "hasTagName", "(", "'h1'", ")", ")", "]", ";", "assert", ".", "equal", "(", "h1Tags", ".", "length", ",", "2", ")", ";", "assert", ".", "deepEqual", "(", "await", "underliner", ".", "underline", "(", "document", ".", "sourceRangeForEndTag", "(", "h1Tags", "[", "1", "]", "!", ")", ")", ",", "`\n </h1>\n ~~~~~`", ")", ";", "const", "complexTags", "=", "[", "...", "dom5", ".", "queryAll", "(", "document", ".", "ast", ",", "dom5", ".", "predicates", ".", "hasTagName", "(", "'complex-tag'", ")", ")", "]", ";", "assert", ".", "equal", "(", "complexTags", ".", "length", ",", "1", ")", ";", "assert", ".", "deepEqual", "(", "await", "underliner", ".", "underline", "(", "document", ".", "sourceRangeForEndTag", "(", "complexTags", "[", "0", "]", "!", ")", ")", ",", "`\n </complex-tag\n ~~~~~~~~~~~~~\n >\n~~~~~~~`", ")", ";", "}", ")", ";", "}", ")", ";", "suite", "(", "'sourceRangeForAttribute'", ",", "(", ")", "=>", "{", "let", "complexTags", ";", "setup", "(", "(", ")", "=>", "{", "complexTags", "=", "[", "...", "dom5", ".", "queryAll", "(", "document", ".", "ast", ",", "dom5", ".", "predicates", ".", "hasTagName", "(", "'complex-tag'", ")", ")", "]", ";", "assert", ".", "equal", "(", "complexTags", ".", "length", ",", "1", ")", ";", "}", ")", ";", "test", "(", "'works for boolean attributes'", ",", "async", "(", ")", "=>", "{", "assert", ".", "deepEqual", "(", "await", "underliner", ".", "underline", "(", "document", ".", "sourceRangeForAttribute", "(", "complexTags", "[", "0", "]", "!", ",", "'boolean-attr'", ")", ")", ",", "`\n <complex-tag boolean-attr\n ~~~~~~~~~~~~`", ")", ";", "}", ")", ";", "test", "(", "'works for one line string attributes'", ",", "async", "(", ")", "=>", "{", "assert", ".", "deepEqual", "(", "await", "underliner", ".", "underline", "(", "document", ".", "sourceRangeForAttribute", "(", "complexTags", "[", "0", "]", "!", ",", "'string-attr'", ")", ")", ",", "`\n string-attr=\"like this\"\n ~~~~~~~~~~~~~~~~~~~~~~~`", ")", ";", "}", ")", ";", "test", "(", "'works for multiline string attributes'", ",", "async", "(", ")", "=>", "{", "assert", ".", "deepEqual", "(", "await", "underliner", ".", "underline", "(", "document", ".", "sourceRangeForAttribute", "(", "complexTags", "[", "0", "]", "!", ",", "'multi-line-attr'", ")", ")", ",", "`\n multi-line-attr=\"\n ~~~~~~~~~~~~~~~~~\n can go on\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n for multiple lines\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n \"\n~~~~~~~~~~~~~~~~~`", ")", ";", "}", ")", ";", "test", "(", "'works for attributes with whitespace around the equals sign'", ",", "async", "(", ")", "=>", "{", "assert", ".", "deepEqual", "(", "await", "underliner", ".", "underline", "(", "document", ".", "sourceRangeForAttribute", "(", "complexTags", "[", "0", "]", "!", ",", "'whitespace-around-equals'", ")", ")", ",", "`\n whitespace-around-equals\n ~~~~~~~~~~~~~~~~~~~~~~~~\n =\n~~~~~~~~~~~~~~~~~\n \"yes this is legal\">\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`", ")", ";", "}", ")", ";", "suite", "(", "'for a void element'", ",", "async", "(", ")", "=>", "{", "test", "(", "'works for a string attribute'", ",", "async", "(", ")", "=>", "{", "const", "linkTags", "=", "[", "...", "dom5", ".", "queryAll", "(", "document", ".", "ast", ",", "dom5", ".", "predicates", ".", "hasTagName", "(", "'link'", ")", ")", "]", ";", "assert", ".", "equal", "(", "linkTags", ".", "length", ",", "2", ")", ";", "assert", ".", "deepEqual", "(", "await", "underliner", ".", "underline", "(", "document", ".", "sourceRangeForAttribute", "(", "linkTags", "[", "0", "]", "!", ",", "'rel'", ")", ")", ",", "`\n <link rel=\"has attributes\">\n ~~~~~~~~~~~~~~~~~~~~`", ")", ";", "assert", ".", "deepEqual", "(", "await", "underliner", ".", "underline", "(", "document", ".", "sourceRangeForAttribute", "(", "linkTags", "[", "1", "]", "!", ",", "'foo'", ")", ")", ",", "`\n foo=bar>\n ~~~~~~~`", ")", ";", "}", ")", ";", "}", ")", ";", "}", ")", ";", "suite", "(", "'sourceRangeForAttributeName'", ",", "(", ")", "=>", "{", "let", "complexTags", ";", "setup", "(", "(", ")", "=>", "{", "complexTags", "=", "[", "...", "dom5", ".", "queryAll", "(", "document", ".", "ast", ",", "dom5", ".", "predicates", ".", "hasTagName", "(", "'complex-tag'", ")", ")", "]", ";", "assert", ".", "equal", "(", "complexTags", ".", "length", ",", "1", ")", ";", "}", ")", ";", "test", "(", "'works for boolean attributes'", ",", "async", "(", ")", "=>", "{", "assert", ".", "deepEqual", "(", "await", "underliner", ".", "underline", "(", "document", ".", "sourceRangeForAttributeName", "(", "complexTags", "[", "0", "]", "!", ",", "'boolean-attr'", ")", ")", ",", "`\n <complex-tag boolean-attr\n ~~~~~~~~~~~~`", ")", ";", "}", ")", ";", "test", "(", "'works for one line string attributes'", ",", "async", "(", ")", "=>", "{", "assert", ".", "deepEqual", "(", "await", "underliner", ".", "underline", "(", "document", ".", "sourceRangeForAttributeName", "(", "complexTags", "[", "0", "]", "!", ",", "'string-attr'", ")", ")", ",", "`\n string-attr=\"like this\"\n ~~~~~~~~~~~`", ")", ";", "}", ")", ";", "test", "(", "'works for multiline string attributes'", ",", "async", "(", ")", "=>", "{", "assert", ".", "deepEqual", "(", "await", "underliner", ".", "underline", "(", "document", ".", "sourceRangeForAttributeName", "(", "complexTags", "[", "0", "]", "!", ",", "'multi-line-attr'", ")", ")", ",", "`\n multi-line-attr=\"\n ~~~~~~~~~~~~~~~`", ")", ";", "}", ")", ";", "test", "(", "'works for attributes with whitespace around the equals sign'", ",", "async", "(", ")", "=>", "{", "assert", ".", "deepEqual", "(", "await", "underliner", ".", "underline", "(", "document", ".", "sourceRangeForAttributeName", "(", "complexTags", "[", "0", "]", "!", ",", "'whitespace-around-equals'", ")", ")", ",", "`\n whitespace-around-equals\n ~~~~~~~~~~~~~~~~~~~~~~~~`", ")", ";", "}", ")", ";", "suite", "(", "'for a void element'", ",", "async", "(", ")", "=>", "{", "test", "(", "'works for a string attribute'", ",", "async", "(", ")", "=>", "{", "const", "linkTags", "=", "[", "...", "dom5", ".", "queryAll", "(", "document", ".", "ast", ",", "dom5", ".", "predicates", ".", "hasTagName", "(", "'link'", ")", ")", "]", ";", "assert", ".", "equal", "(", "linkTags", ".", "length", ",", "2", ")", ";", "assert", ".", "deepEqual", "(", "await", "underliner", ".", "underline", "(", "document", ".", "sourceRangeForAttributeName", "(", "linkTags", "[", "0", "]", "!", ",", "'rel'", ")", ")", ",", "`\n <link rel=\"has attributes\">\n ~~~`", ")", ";", "assert", ".", "deepEqual", "(", "await", "underliner", ".", "underline", "(", "document", ".", "sourceRangeForAttributeName", "(", "linkTags", "[", "1", "]", "!", ",", "'foo'", ")", ")", ",", "`\n foo=bar>\n ~~~`", ")", ";", "}", ")", ";", "}", ")", ";", "}", ")", ";", "suite", "(", "'sourceRangeForAttributeValue'", ",", "(", ")", "=>", "{", "let", "complexTags", ";", "setup", "(", "(", ")", "=>", "{", "complexTags", "=", "[", "...", "dom5", ".", "queryAll", "(", "document", ".", "ast", ",", "dom5", ".", "predicates", ".", "hasTagName", "(", "'complex-tag'", ")", ")", "]", ";", "assert", ".", "equal", "(", "complexTags", ".", "length", ",", "1", ")", ";", "}", ")", ";", "test", "(", "'returns undefined for boolean attributes'", ",", "async", "(", ")", "=>", "{", "assert", ".", "deepEqual", "(", "document", ".", "sourceRangeForAttributeValue", "(", "complexTags", "[", "0", "]", "!", ",", "'boolean-attr'", ")", ",", "undefined", ")", ";", "}", ")", ";", "test", "(", "'works for one line string attributes'", ",", "async", "(", ")", "=>", "{", "assert", ".", "deepEqual", "(", "await", "underliner", ".", "underline", "(", "document", ".", "sourceRangeForAttributeValue", "(", "complexTags", "[", "0", "]", "!", ",", "'string-attr'", ")", ")", ",", "`\n string-attr=\"like this\"\n ~~~~~~~~~~~`", ")", ";", "}", ")", ";", "test", "(", "'works for multiline string attributes'", ",", "async", "(", ")", "=>", "{", "assert", ".", "deepEqual", "(", "await", "underliner", ".", "underline", "(", "document", ".", "sourceRangeForAttributeValue", "(", "complexTags", "[", "0", "]", "!", ",", "'multi-line-attr'", ")", ")", ",", "`\n multi-line-attr=\"\n ~\n can go on\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n for multiple lines\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n \"\n~~~~~~~~~~~~~~~~~`", ")", ";", "}", ")", ";", "test", "(", "'works for attributes with whitespace around the equals sign'", ",", "async", "(", ")", "=>", "{", "assert", ".", "deepEqual", "(", "await", "underliner", ".", "underline", "(", "document", ".", "sourceRangeForAttributeValue", "(", "complexTags", "[", "0", "]", "!", ",", "'whitespace-around-equals'", ")", ")", ",", "`\n \"yes this is legal\">\n ~~~~~~~~~~~~~~~~~~~`", ")", ";", "}", ")", ";", "suite", "(", "'for a void element'", ",", "async", "(", ")", "=>", "{", "test", "(", "'works for a string attribute'", ",", "async", "(", ")", "=>", "{", "const", "linkTags", "=", "[", "...", "dom5", ".", "queryAll", "(", "document", ".", "ast", ",", "dom5", ".", "predicates", ".", "hasTagName", "(", "'link'", ")", ")", "]", ";", "assert", ".", "equal", "(", "linkTags", ".", "length", ",", "2", ")", ";", "assert", ".", "deepEqual", "(", "await", "underliner", ".", "underline", "(", "document", ".", "sourceRangeForAttributeValue", "(", "linkTags", "[", "0", "]", "!", ",", "'rel'", ")", ")", ",", "`\n <link rel=\"has attributes\">\n ~~~~~~~~~~~~~~~~`", ")", ";", "assert", ".", "deepEqual", "(", "await", "underliner", ".", "underline", "(", "document", ".", "sourceRangeForAttributeValue", "(", "linkTags", "[", "1", "]", "!", ",", "'foo'", ")", ")", ",", "`\n foo=bar>\n ~~~`", ")", ";", "}", ")", ";", "}", ")", ";", "}", ")", ";", "}", ")", ";" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 42383, null, null, null, null, null, null, null, 2, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5827, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5827, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1321
[ "license", "import", "{", "assert", "}", "from", "'chai'", ";", "import", "{", "HtmlCustomElementReferenceScanner", ",", "HtmlElementReferenceScanner", "}", "from", "'../../html/html-element-reference-scanner'", ";", "import", "{", "ScannedElementReference", "}", "from", "'../../model/element-reference'", ";", "import", "{", "CodeUnderliner", ",", "runScannerOnContents", "}", "from", "'../test-utils'", ";", "suite", "(", "'HtmlElementReferenceScanner'", ",", "(", ")", "=>", "{", "test", "(", "'finds element references'", ",", "async", "(", ")", "=>", "{", "const", "contents", "=", "`<html><head></head>\n <body>\n <div>Foo</div>\n <x-foo></x-foo>\n <div>\n <x-bar></x-bar>\n </div>\n </body></html>`", ";", "const", "{", "features", "}", "=", "await", "runScannerOnContents", "(", "new", "HtmlElementReferenceScanner", "(", ")", ",", "'test-document.html'", ",", "contents", ")", ";", "assert", ".", "deepEqual", "(", "features", ".", "map", "(", "(", "f", ")", "=>", "f", ".", "tagName", ")", ",", "[", "'html'", ",", "'head'", ",", "'body'", ",", "'div'", ",", "'x-foo'", ",", "'div'", ",", "'x-bar'", "]", ")", ";", "}", ")", ";", "}", ")", ";", "suite", "(", "'HtmlCustomElementReferenceScanner'", ",", "(", ")", "=>", "{", "test", "(", "'finds custom element references'", ",", "async", "(", ")", "=>", "{", "const", "contents", "=", "`<html><body>\n <div>Foo</div>\n <x-foo a=5 b=\"test\" c></x-foo>\n <div>\n <x-bar></x-bar>\n </div>\n <h1>Bar</h1>\n <template>\n <x-baz></x-baz>\n </template>\n </body></html>`", ";", "const", "{", "features", ":", "untypedFeatures", ",", "analyzer", "}", "=", "await", "runScannerOnContents", "(", "new", "HtmlCustomElementReferenceScanner", "(", ")", ",", "'test-document.html'", ",", "contents", ")", ";", "const", "features", "=", "untypedFeatures", "as", "ScannedElementReference", "[", "]", ";", "const", "underliner", "=", "new", "CodeUnderliner", "(", "analyzer", ")", ";", "assert", ".", "deepEqual", "(", "features", ".", "map", "(", "(", "f", ")", "=>", "f", ".", "tagName", ")", ",", "[", "'x-foo'", ",", "'x-bar'", ",", "'x-baz'", "]", ")", ";", "assert", ".", "deepEqual", "(", "Array", ".", "from", "(", "features", "[", "0", "]", ".", "attributes", ".", "values", "(", ")", ")", ".", "map", "(", "(", "a", ")", "=>", "[", "a", ".", "name", ",", "a", ".", "value", "]", ")", ",", "[", "[", "'a'", ",", "'5'", "]", ",", "[", "'b'", ",", "'test'", "]", ",", "[", "'c'", ",", "''", "]", "]", ")", ";", "const", "sourceRanges", "=", "await", "Promise", ".", "all", "(", "features", ".", "map", "(", "async", "(", "f", ")", "=>", "await", "underliner", ".", "underline", "(", "f", ".", "sourceRange", ")", ")", ")", ";", "assert", ".", "deepEqual", "(", "sourceRanges", ",", "[", "`\n <x-foo a=5 b=\"test\" c></x-foo>\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`", ",", "`\n <x-bar></x-bar>\n ~~~~~~~~~~~~~~~`", ",", "`\n <x-baz></x-baz>\n ~~~~~~~~~~~~~~~`", "]", ")", ";", "const", "attrRanges", "=", "await", "Promise", ".", "all", "(", "features", ".", "map", "(", "async", "(", "f", ")", "=>", "await", "Promise", ".", "all", "(", "Array", ".", "from", "(", "f", ".", "attributes", ".", "values", "(", ")", ")", ".", "map", "(", "async", "(", "a", ")", "=>", "await", "underliner", ".", "underline", "(", "a", ".", "sourceRange", ")", ")", ")", ")", ")", ";", "assert", ".", "deepEqual", "(", "attrRanges", ",", "[", "[", "`\n <x-foo a=5 b=\"test\" c></x-foo>\n ~~~`", ",", "`\n <x-foo a=5 b=\"test\" c></x-foo>\n ~~~~~~~~`", ",", "`\n <x-foo a=5 b=\"test\" c></x-foo>\n ~`", "]", ",", "[", "]", ",", "[", "]", "]", ")", ";", "const", "attrNameRanges", "=", "await", "Promise", ".", "all", "(", "features", ".", "map", "(", "async", "(", "f", ")", "=>", "await", "underliner", ".", "underline", "(", "Array", ".", "from", "(", "f", ".", "attributes", ".", "values", "(", ")", ")", ".", "map", "(", "(", "a", ")", "=>", "a", ".", "nameSourceRange", ")", ")", ")", ")", ";", "assert", ".", "deepEqual", "(", "attrNameRanges", ",", "[", "[", "`\n <x-foo a=5 b=\"test\" c></x-foo>\n ~`", ",", "`\n <x-foo a=5 b=\"test\" c></x-foo>\n ~`", ",", "`\n <x-foo a=5 b=\"test\" c></x-foo>\n ~`", "]", ",", "[", "]", ",", "[", "]", "]", ")", ";", "const", "attrValueRanges", "=", "await", "Promise", ".", "all", "(", "features", ".", "map", "(", "async", "(", "f", ")", "=>", "await", "Promise", ".", "all", "(", "Array", ".", "from", "(", "f", ".", "attributes", ".", "values", "(", ")", ")", ".", "map", "(", "async", "(", "a", ")", "=>", "await", "underliner", ".", "underline", "(", "a", ".", "valueSourceRange", ")", ")", ")", ")", ")", ";", "assert", ".", "deepEqual", "(", "attrValueRanges", ",", "[", "[", "`\n <x-foo a=5 b=\"test\" c></x-foo>\n ~`", ",", "`\n <x-foo a=5 b=\"test\" c></x-foo>\n ~~~~~~`", ",", "`No source range given.`", "]", ",", "[", "]", ",", "[", "]", "]", ")", ";", "}", ")", ";", "}", ")", ";" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 46497, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, 27934, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 46497, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 529, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, 46497, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, 46497, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 529, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, 46497, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 529, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, 46497, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 529, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1322
[ "license", "import", "{", "assert", "}", "from", "'chai'", ";", "import", "{", "HtmlImportScanner", "}", "from", "'../../html/html-import-scanner'", ";", "import", "{", "Analyzer", ",", "FileRelativeUrl", ",", "InMemoryOverlayUrlLoader", ",", "ScannedImport", "}", "from", "'../../index'", ";", "import", "{", "PackageRelativeUrl", ",", "ResolvedUrl", "}", "from", "'../../model/url'", ";", "import", "{", "runScanner", ",", "runScannerOnContents", "}", "from", "'../test-utils'", ";", "suite", "(", "'HtmlImportScanner'", ",", "(", ")", "=>", "{", "test", "(", "'finds HTML Imports'", ",", "async", "(", ")", "=>", "{", "const", "contents", "=", "`<html><head>\n <link rel=\"import\" href=\"polymer.html\">\n <link rel=\"import\" type=\"css\" href=\"polymer.css\">\n <script src=\"foo.js\"></script>\n <link rel=\"stylesheet\" href=\"foo.css\"></link>\n </head></html>`", ";", "const", "{", "features", "}", "=", "await", "runScannerOnContents", "(", "new", "HtmlImportScanner", "(", ")", ",", "'test.html'", ",", "contents", ")", ";", "const", "importFeatures", "=", "features", "as", "ScannedImport", "[", "]", ";", "assert", ".", "deepEqual", "(", "importFeatures", ".", "map", "(", "(", "imp", ")", "=>", "[", "imp", ".", "type", ",", "imp", ".", "url", "]", ")", ",", "[", "[", "'html-import'", ",", "'polymer.html'", "]", "]", ")", ";", "}", ")", ";", "test", "(", "'resolves HTML Import URLs relative to baseUrl'", ",", "async", "(", ")", "=>", "{", "const", "contents", "=", "`<html><head><base href=\"/aybabtu/\">\n <link rel=\"import\" href=\"polymer.html\">\n <link rel=\"import\" type=\"css\" href=\"polymer.css\">\n <script src=\"foo.js\"></script>\n <link rel=\"stylesheet\" href=\"foo.css\"></link>\n </head></html>`", ";", "const", "{", "features", ",", "analyzer", ",", "urlLoader", "}", "=", "await", "runScannerOnContents", "(", "new", "HtmlImportScanner", "(", ")", ",", "'test.html'", ",", "contents", ")", ";", "const", "importFeatures", "=", "features", "as", "ScannedImport", "[", "]", ";", "assert", ".", "deepEqual", "(", "importFeatures", ".", "map", "(", "(", "imp", ")", "=>", "[", "imp", ".", "type", ",", "imp", ".", "url", "]", ")", ",", "[", "[", "'html-import'", ",", "'polymer.html'", "]", "]", ")", ";", "urlLoader", ".", "urlContentsMap", ".", "set", "(", "analyzer", ".", "resolveUrl", "(", "'aybabtu/polymer.html'", ")", "!", ",", "''", ")", ";", "const", "[", "import_", "]", "=", "(", "await", "analyzer", ".", "analyze", "(", "[", "'test.html'", "]", ")", ")", ".", "getFeatures", "(", "{", "kind", ":", "'html-import'", "}", ")", ";", "assert", ".", "equal", "(", "import_", ".", "originalUrl", ",", "'polymer.html'", ")", ";", "assert", ".", "equal", "(", "import_", ".", "url", ",", "analyzer", ".", "resolveUrl", "(", "'aybabtu/polymer.html'", ")", ")", ";", "}", ")", ";", "test", "(", "'finds lazy HTML Imports'", ",", "async", "(", ")", "=>", "{", "const", "contents", "=", "`<html><head>\n <link rel=\"import\" href=\"polymer.html\">\n <dom-module>\n <link rel=\"lazy-import\" href=\"lazy-polymer.html\">\n </dom-module>\n <link rel=\"stylesheet\" href=\"foo.css\"></link>\n </head></html>`", ";", "const", "{", "features", "}", "=", "await", "runScannerOnContents", "(", "new", "HtmlImportScanner", "(", ")", ",", "'test.html'", ",", "contents", ")", ";", "const", "importFeatures", "=", "features", "as", "ScannedImport", "[", "]", ";", "assert", ".", "deepEqual", "(", "importFeatures", ".", "map", "(", "(", "imp", ")", "=>", "[", "imp", ".", "type", ",", "imp", ".", "url", ",", "imp", ".", "lazy", "]", ")", ",", "[", "[", "'html-import'", ",", "'polymer.html'", ",", "false", "]", ",", "[", "'html-import'", ",", "'lazy-polymer.html'", ",", "true", "]", "]", ")", ";", "}", ")", ";", "suite", "(", "'scan() with lazy import map'", ",", "(", ")", "=>", "{", "test", "(", "'injects synthetic lazy html imports'", ",", "async", "(", ")", "=>", "{", "const", "contents", "=", "`<html><head>\n <link rel=\"import\" href=\"polymer.html\">\n <link rel=\"import\" type=\"css\" href=\"polymer.css\">\n <script src=\"foo.js\"></script>\n <link rel=\"stylesheet\" href=\"foo.css\"></link>\n </head></html>`", ";", "const", "overlayLoader", "=", "new", "InMemoryOverlayUrlLoader", "(", ")", ";", "const", "analyzer", "=", "new", "Analyzer", "(", "{", "urlLoader", ":", "overlayLoader", "}", ")", ";", "overlayLoader", ".", "urlContentsMap", ".", "set", "(", "analyzer", ".", "resolveUrl", "(", "'test.html'", ")", "!", ",", "contents", ")", ";", "const", "lazyEdges", "=", "new", "Map", "<", "ResolvedUrl", ",", "PackageRelativeUrl", "[", "]", ">", "(", "[", "[", "analyzer", ".", "resolveUrl", "(", "'test.html'", ")", "!", ",", "[", "'lazy1.html'", ",", "'lazy2.html'", ",", "'lazy3.html'", "]", "as", "PackageRelativeUrl", "[", "]", "]", "]", ")", ";", "const", "{", "features", "}", "=", "await", "runScanner", "(", "analyzer", ",", "new", "HtmlImportScanner", "(", "lazyEdges", ")", ",", "'test.html'", ")", ";", "const", "importFeatures", "=", "features", "as", "ScannedImport", "[", "]", ";", "assert", ".", "deepEqual", "(", "importFeatures", ".", "map", "(", "(", "f", ")", "=>", "f", ".", "type", ")", ",", "[", "'html-import'", ",", "'html-import'", ",", "'html-import'", ",", "'html-import'", "]", ")", ";", "assert", ".", "deepEqual", "(", "importFeatures", ".", "map", "(", "(", "i", ")", "=>", "i", ".", "lazy", ")", ",", "[", "false", ",", "true", ",", "true", ",", "true", "]", ")", ";", "assert", ".", "deepEqual", "(", "importFeatures", ".", "map", "(", "(", "f", ")", "=>", "f", ".", "url", ")", ",", "[", "'polymer.html'", ",", "'lazy1.html'", ",", "'lazy2.html'", ",", "'lazy3.html'", "]", "as", "FileRelativeUrl", "[", "]", ")", ";", "}", ")", ";", "}", ")", ";", "}", ")", ";" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 18800, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 18800, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 18800, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, 21744, null, null, null, null, null, null, null, 1344, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 19, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 18800, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 18800, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 18800, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1323
[ "license", "import", "{", "assert", "}", "from", "'chai'", ";", "import", "*", "as", "fs", "from", "'fs'", ";", "import", "*", "as", "path", "from", "'path'", ";", "import", "{", "HtmlParser", "}", "from", "'../../html/html-parser'", ";", "import", "{", "PackageUrlResolver", "}", "from", "'../../url-loader/package-url-resolver'", ";", "import", "{", "createForDirectory", ",", "fixtureDir", ",", "resolvedUrl", "}", "from", "'../test-utils'", ";", "suite", "(", "'HtmlParser'", ",", "(", ")", "=>", "{", "suite", "(", "'parse()'", ",", "(", ")", "=>", "{", "let", "parser", ";", "setup", "(", "(", ")", "=>", "{", "parser", "=", "new", "HtmlParser", "(", ")", ";", "}", ")", ";", "suite", "(", "'on a well-formed document'", ",", "(", ")", "=>", "{", "const", "file", "=", "fs", ".", "readFileSync", "(", "path", ".", "resolve", "(", "fixtureDir", ",", "'html-parse-target.html'", ")", ",", "'utf8'", ")", ";", "test", "(", "'parses a well-formed document'", ",", "(", ")", "=>", "{", "const", "document", "=", "parser", ".", "parse", "(", "file", ",", "resolvedUrl", "`/static/html-parse-target.html`", ",", "new", "PackageUrlResolver", "(", ")", ")", ";", "assert", ".", "equal", "(", "document", ".", "url", ",", "'/static/html-parse-target.html'", ")", ";", "}", ")", ";", "test", "(", "'can stringify back a well-formed document'", ",", "(", ")", "=>", "{", "const", "document", "=", "parser", ".", "parse", "(", "file", ",", "resolvedUrl", "`/static/html-parse-target.html`", ",", "new", "PackageUrlResolver", "(", ")", ")", ";", "assert", ".", "deepEqual", "(", "document", ".", "stringify", "(", ")", ",", "file", ")", ";", "}", ")", ";", "}", ")", ";", "test", "(", "'can properly determine the base url of a document'", ",", "async", "(", ")", "=>", "{", "const", "{", "analyzer", "}", "=", "await", "createForDirectory", "(", "path", ".", "resolve", "(", "fixtureDir", ",", "'../'", ")", ")", ";", "const", "resolvedPath", "=", "analyzer", ".", "resolveUrl", "(", "`static/base-href/doc-with-base.html`", ")", "!", ";", "const", "file", "=", "await", "analyzer", ".", "load", "(", "resolvedPath", ")", ";", "const", "document", "=", "parser", ".", "parse", "(", "file", ",", "resolvedPath", ",", "new", "PackageUrlResolver", "(", ")", ")", ";", "assert", ".", "equal", "(", "document", ".", "url", ",", "resolvedPath", ")", ";", "assert", ".", "equal", "(", "document", ".", "baseUrl", ",", "analyzer", ".", "resolveUrl", "(", "'static/'", ")", ")", ";", "}", ")", ";", "}", ")", ";", "}", ")", ";" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 42383, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5827, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5827, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, 5827, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1324
[ "license", "import", "{", "assert", "}", "from", "'chai'", ";", "import", "{", "ClassScanner", "}", "from", "'../../javascript/class-scanner'", ";", "import", "{", "Class", ",", "Element", ",", "ElementMixin", ",", "Method", ",", "ScannedClass", "}", "from", "'../../model/model'", ";", "import", "{", "createForDirectory", ",", "fixtureDir", ",", "runScanner", "}", "from", "'../test-utils'", ";", "suite", "(", "'Class'", ",", "async", "(", ")", "=>", "{", "const", "{", "analyzer", ",", "underliner", "}", "=", "await", "createForDirectory", "(", "fixtureDir", ")", ";", "async", "function", "getScannedFeatures", "(", "filename", ")", "{", "const", "{", "features", "}", "=", "await", "runScanner", "(", "analyzer", ",", "new", "ClassScanner", "(", ")", ",", "filename", ")", ";", "return", "features", ";", "}", ";", "async", "function", "getScannedClasses", "(", "filename", ")", "{", "const", "features", "=", "await", "getScannedFeatures", "(", "filename", ")", ";", "return", "features", ".", "filter", "(", "(", "e", ")", "=>", "e", "instanceof", "ScannedClass", ")", "as", "ScannedClass", "[", "]", ";", "}", ";", "async", "function", "getClasses", "(", "filename", ")", "{", "const", "analysis", "=", "await", "analyzer", ".", "analyze", "(", "[", "filename", "]", ")", ";", "const", "classes", "=", "Array", ".", "from", "(", "analysis", ".", "getFeatures", "(", "{", "kind", ":", "'class'", "}", ")", ")", ";", "return", "{", "classes", ",", "analysis", "}", ";", "}", ";", "async", "function", "getTestProps", "(", "class_", ")", "{", "type", "TestPropsType", "=", "{", "name", ":", "string", "|", "undefined", ";", "description", ":", "string", ";", "privacy", ":", "string", ";", "properties", "?", ":", "any", "[", "]", ";", "methods", "?", ":", "any", "[", "]", ";", "warnings", "?", ":", "ReadonlyArray", "<", "string", ">", ";", "mixins", "?", ":", "any", "[", "]", ";", "superClass", "?", ":", "string", ";", "}", ";", "const", "result", "=", "{", "name", ":", "class_", ".", "name", ",", "description", ":", "class_", ".", "description", ",", "privacy", ":", "class_", ".", "privacy", "}", ";", "if", "(", "class_", ".", "properties", ".", "size", ">", "0", ")", "{", "result", ".", "properties", "=", "[", "]", ";", "for", "(", "const", "{", "name", "}", "of", "class_", ".", "properties", ".", "values", "(", ")", ")", "{", "result", ".", "properties", ".", "push", "(", "{", "name", "}", ")", ";", "}", "}", "if", "(", "class_", ".", "methods", ".", "size", ">", "0", ")", "{", "result", ".", "methods", "=", "[", "]", ";", "for", "(", "const", "m", "of", "class_", ".", "methods", ".", "values", "(", ")", ")", "{", "const", "method", "=", "{", "name", ":", "m", ".", "name", ",", "description", ":", "m", ".", "description", "}", ";", "if", "(", "m", ".", "params", "&&", "m", ".", "params", ".", "length", ">", "0", ")", "{", "method", ".", "params", "=", "m", ".", "params", ".", "map", "(", "(", "p", ")", "=>", "{", "const", "param", "=", "{", "name", ":", "p", ".", "name", "}", ";", "if", "(", "p", ".", "description", "!=", "null", ")", "{", "param", ".", "description", "=", "p", ".", "description", ";", "}", "if", "(", "p", ".", "type", "!=", "null", ")", "{", "param", ".", "type", "=", "p", ".", "type", ";", "}", "if", "(", "p", ".", "defaultValue", "!=", "null", ")", "{", "param", ".", "defaultValue", "=", "p", ".", "defaultValue", ";", "}", "if", "(", "p", ".", "rest", "!=", "null", ")", "{", "param", ".", "rest", "=", "p", ".", "rest", ";", "}", "return", "param", ";", "}", ")", ";", "}", "if", "(", "m", ".", "return", ")", "{", "method", ".", "return", "=", "m", ".", "return", ";", "}", "const", "maybeMethod", "=", "m", "as", "Partial", "<", "Method", ">", ";", "if", "(", "maybeMethod", ".", "inheritedFrom", ")", "{", "method", ".", "inheritedFrom", "=", "maybeMethod", ".", "inheritedFrom", ";", "}", "result", ".", "methods", ".", "push", "(", "method", ")", ";", "}", "}", "if", "(", "class_", ".", "mixins", ".", "length", ">", "0", ")", "{", "result", ".", "mixins", "=", "[", "]", ";", "for", "(", "const", "{", "identifier", "}", "of", "class_", ".", "mixins", ")", "{", "result", ".", "mixins", ".", "push", "(", "{", "identifier", "}", ")", ";", "}", "}", "if", "(", "class_", ".", "warnings", ".", "length", ">", "0", ")", "{", "result", ".", "warnings", "=", "await", "underliner", ".", "underline", "(", "class_", ".", "warnings", ")", ";", "}", "if", "(", "class_", ".", "superClass", ")", "{", "result", ".", "superClass", "=", "class_", ".", "superClass", ".", "identifier", ";", "}", "return", "result", ";", "}", ";", "suite", "(", "'scanning'", ",", "(", ")", "=>", "{", "test", "(", "'finds classes and their names and comment blocks'", ",", "async", "(", ")", "=>", "{", "const", "classes", "=", "await", "getScannedClasses", "(", "'class/class-names.js'", ")", ";", "assert", ".", "deepEqual", "(", "classes", ".", "map", "(", "(", "c", ")", "=>", "c", ".", "name", ")", ",", "[", "'Declaration'", ",", "'VarDeclaration'", ",", "'Assignment'", ",", "'Namespace.AlsoAssignment'", ",", "'Declared.AnotherAssignment'", ",", "'ClassWithNoJsDoc'", ",", "'ExportedClass'", ",", "undefined", ",", "'ExportedConstClass'", ",", "]", ")", ";", "assert", ".", "deepEqual", "(", "await", "Promise", ".", "all", "(", "classes", ".", "map", "(", "(", "c", ")", "=>", "getTestProps", "(", "c", ")", ")", ")", ",", "[", "{", "name", ":", "'Declaration'", ",", "description", ":", "'A simple declaration'", ",", "privacy", ":", "'public'", ",", "}", ",", "{", "description", ":", "'The variable\\'s name is used.'", ",", "name", ":", "'VarDeclaration'", ",", "privacy", ":", "'public'", ",", "}", ",", "{", "description", ":", "'The left hand side of the assignment is used.'", ",", "name", ":", "'Assignment'", ",", "privacy", ":", "'public'", ",", "}", ",", "{", "description", ":", "'Namespaced assignments work too'", ",", "name", ":", "'Namespace.AlsoAssignment'", ",", "privacy", ":", "'public'", ",", "}", ",", "{", "description", ":", "'Declared namespace works too'", ",", "name", ":", "'Declared.AnotherAssignment'", ",", "privacy", ":", "'public'", ",", "}", ",", "{", "description", ":", "''", ",", "name", ":", "'ClassWithNoJsDoc'", ",", "privacy", ":", "'public'", ",", "}", ",", "{", "description", ":", "'An exported class.'", ",", "name", ":", "'ExportedClass'", ",", "privacy", ":", "'public'", ",", "methods", ":", "[", "{", "description", ":", "''", ",", "name", ":", "'method1'", ",", "return", ":", "{", "type", ":", "'void'", "}", "}", "]", "}", ",", "{", "description", ":", "'A default exported class.'", ",", "name", ":", "undefined", ",", "privacy", ":", "'public'", ",", "methods", ":", "[", "{", "description", ":", "''", ",", "name", ":", "'method2'", ",", "return", ":", "{", "type", ":", "'void'", "}", "}", "]", "}", ",", "{", "description", ":", "''", ",", "name", ":", "'ExportedConstClass'", ",", "privacy", ":", "'public'", ",", "methods", ":", "[", "{", "description", ":", "''", ",", "name", ":", "'method3'", ",", "return", ":", "{", "type", ":", "'void'", "}", "}", "]", "}", "]", ")", ";", "}", ")", ";", "test", "(", "'finds properties'", ",", "async", "(", ")", "=>", "{", "const", "cls", "=", "(", "await", "getScannedClasses", "(", "'class/class-properties.js'", ")", ")", "[", "0", "]", ";", "assert", ".", "deepInclude", "(", "cls", ".", "properties", ".", "get", "(", "'customPropertyGetterType'", ")", ",", "{", "name", ":", "'customPropertyGetterType'", ",", "type", ":", "'boolean'", ",", "description", ":", "'A boolean getter'", ",", "readOnly", ":", "true", "}", ")", ";", "assert", ".", "deepInclude", "(", "cls", ".", "properties", ".", "get", "(", "'customPropertyWithGetterSetter'", ")", ",", "{", "name", ":", "'customPropertyWithGetterSetter'", ",", "description", ":", "'a property with a getter/setter'", ",", "readOnly", ":", "false", "}", ")", ";", "assert", ".", "deepInclude", "(", "cls", ".", "properties", ".", "get", "(", "'customPropertyWithReadOnlyGetter'", ")", ",", "{", "name", ":", "'customPropertyWithReadOnlyGetter'", ",", "readOnly", ":", "true", "}", ")", ";", "assert", ".", "deepInclude", "(", "cls", ".", "properties", ".", "get", "(", "'customPropertyOnProto'", ")", ",", "{", "name", ":", "'customPropertyOnProto'", ",", "type", ":", "'string'", "}", ")", ";", "assert", ".", "deepInclude", "(", "cls", ".", "properties", ".", "get", "(", "'customPropertyOnProtoValue'", ")", ",", "{", "name", ":", "'customPropertyOnProtoValue'", ",", "type", ":", "'number'", "}", ")", ";", "assert", ".", "deepInclude", "(", "cls", ".", "properties", ".", "get", "(", "'customPropertyOnProtoDoc'", ")", ",", "{", "name", ":", "'customPropertyOnProtoDoc'", ",", "description", ":", "'A property'", ",", "type", ":", "'(boolean | number)'", ",", "privacy", ":", "'private'", ",", "readOnly", ":", "true", "}", ")", ";", "assert", ".", "deepInclude", "(", "cls", ".", "properties", ".", "get", "(", "'__customPropertyOnProtoPrivate'", ")", ",", "{", "name", ":", "'__customPropertyOnProtoPrivate'", ",", "privacy", ":", "'private'", "}", ")", ";", "assert", ".", "deepEqual", "(", "await", "getTestProps", "(", "cls", ")", ",", "{", "name", ":", "'Class'", ",", "description", ":", "''", ",", "privacy", ":", "'public'", ",", "properties", ":", "[", "{", "name", ":", "'customPropertyWithValue'", "}", ",", "{", "name", ":", "'customPropertyWithJSDoc'", "}", ",", "{", "name", ":", "'customPropertyGetter'", "}", ",", "{", "name", ":", "'customPropertyGetterType'", "}", ",", "{", "name", ":", "'customPropertyWithGetterSetter'", "}", ",", "{", "name", ":", "'customPropertyWithSetterFirst'", "}", ",", "{", "name", ":", "'customPropertyWithReadOnlyGetter'", "}", ",", "{", "name", ":", "'customPropertyOnProto'", "}", ",", "{", "name", ":", "'customPropertyOnProtoValue'", "}", ",", "{", "name", ":", "'customPropertyOnProtoDoc'", "}", ",", "{", "name", ":", "'__customPropertyOnProtoPrivate'", "}", "]", "}", ")", ";", "}", ")", ";", "test", "(", "'finds methods'", ",", "async", "(", ")", "=>", "{", "const", "classes", "=", "await", "getScannedClasses", "(", "'class/class-methods.js'", ")", ";", "assert", ".", "deepEqual", "(", "await", "Promise", ".", "all", "(", "classes", ".", "map", "(", "(", "c", ")", "=>", "getTestProps", "(", "c", ")", ")", ")", ",", "[", "{", "name", ":", "'Class'", ",", "description", ":", "''", ",", "privacy", ":", "'public'", ",", "properties", ":", "[", "{", "name", ":", "'customInstanceGetter'", "}", "]", ",", "methods", ":", "[", "{", "name", ":", "'customInstanceFunction'", ",", "description", ":", "''", ",", "}", ",", "{", "name", ":", "'customInstanceFunctionWithJSDoc'", ",", "description", ":", "'This is the description for '", "+", "'customInstanceFunctionWithJSDoc.'", ",", "return", ":", "{", "desc", ":", "'The number 5, always.'", ",", "type", ":", "'Number'", ",", "}", ",", "}", ",", "{", "name", ":", "'customInstanceFunctionWithParams'", ",", "description", ":", "''", ",", "params", ":", "[", "{", "name", ":", "'a'", "}", ",", "{", "name", ":", "'b'", "}", ",", "{", "name", ":", "'c'", "}", "]", ",", "}", ",", "{", "name", ":", "'customInstanceFunctionWithParamsAndJSDoc'", ",", "description", ":", "'This is the description for '", "+", "'customInstanceFunctionWithParamsAndJSDoc.'", ",", "params", ":", "[", "{", "name", ":", "'a'", ",", "type", ":", "'Number'", ",", "description", ":", "'The first argument'", ",", "}", ",", "{", "name", ":", "'b'", ",", "type", ":", "'Number'", ",", "}", ",", "{", "name", ":", "'c'", ",", "type", ":", "'Number'", ",", "description", ":", "'The third argument'", ",", "}", "]", ",", "return", ":", "{", "desc", ":", "'The number 7, always.'", ",", "type", ":", "'Number'", ",", "}", ",", "}", ",", "{", "name", ":", "'customInstanceFunctionWithParamsAndPrivateJSDoc'", ",", "description", ":", "'This is the description for\\n'", "+", "'customInstanceFunctionWithParamsAndPrivateJSDoc.'", ",", "}", ",", "{", "name", ":", "'customInstanceFunctionWithRestParam'", ",", "description", ":", "'This is the description for '", "+", "'customInstanceFunctionWithRestParam.'", ",", "params", ":", "[", "{", "name", ":", "'a'", ",", "type", ":", "'Number'", ",", "description", ":", "'The first argument.'", ",", "}", ",", "{", "name", ":", "'b'", ",", "type", ":", "'...Number'", ",", "rest", ":", "true", ",", "description", ":", "'The second argument.'", ",", "}", "]", ",", "return", ":", "{", "desc", ":", "'The number 9, always.'", ",", "type", ":", "'Number'", ",", "}", ",", "}", ",", "{", "name", ":", "'customInstanceFunctionWithParamDefault'", ",", "description", ":", "'This is the description for '", "+", "'customInstanceFunctionWithParamDefault.'", ",", "params", ":", "[", "{", "name", ":", "'a'", ",", "type", ":", "'Number'", ",", "description", ":", "'The first argument.'", ",", "}", ",", "{", "name", ":", "'b'", ",", "type", ":", "'Number'", ",", "defaultValue", ":", "'0'", ",", "description", ":", "'The second argument.'", ",", "}", "]", ",", "return", ":", "{", "desc", ":", "'The number 10, always.'", ",", "type", ":", "'Number'", ",", "}", ",", "}", ",", "{", "description", ":", "undefined", ",", "name", ":", "'customInstanceFunctionOnProto'", ",", "params", ":", "[", "{", "description", ":", "'a bool'", ",", "name", ":", "'foo'", ",", "type", ":", "'boolean'", "}", "]", ",", "return", ":", "{", "type", ":", "'void'", "}", "}", ",", "{", "description", ":", "undefined", ",", "name", ":", "'__customInstanceFunctionOnProtoPrivate'", "}", ",", "{", "description", ":", "undefined", ",", "name", ":", "'customInstanceFunctionOnProtoWithBody'", "}", ",", "{", "description", ":", "'Returns the sum of two numbers'", ",", "name", ":", "'customInstanceFunctionOnProtoWithBodyDoc'", ",", "params", ":", "[", "{", "description", ":", "'some number'", ",", "name", ":", "'a'", ",", "type", ":", "'number'", "}", ",", "{", "description", ":", "'another number'", ",", "name", ":", "'b'", ",", "type", ":", "'number'", "}", "]", ",", "return", ":", "{", "type", ":", "'number'", "}", "}", ",", "]", "}", ",", "]", ")", ";", "}", ")", ";", "test", "(", "'deals with super classes correctly'", ",", "async", "(", ")", "=>", "{", "const", "classes", "=", "await", "getScannedClasses", "(", "'class/super-class.js'", ")", ";", "assert", ".", "deepEqual", "(", "classes", ".", "map", "(", "(", "f", ")", "=>", "f", ".", "name", ")", ",", "[", "'Base'", ",", "'Subclass'", "]", ")", ";", "assert", ".", "deepEqual", "(", "await", "Promise", ".", "all", "(", "classes", ".", "map", "(", "(", "c", ")", "=>", "getTestProps", "(", "c", ")", ")", ")", ",", "[", "{", "name", ":", "'Base'", ",", "description", ":", "''", ",", "privacy", ":", "'public'", ",", "methods", ":", "[", "{", "description", ":", "'This is a base method.'", ",", "name", ":", "'baseMethod'", ",", "return", ":", "{", "type", ":", "'void'", "}", ",", "}", ",", "{", "description", ":", "'Will be overriden by Subclass.'", ",", "name", ":", "'overriddenMethod'", ",", "return", ":", "{", "type", ":", "'void'", "}", ",", "}", "]", "}", ",", "{", "name", ":", "'Subclass'", ",", "description", ":", "''", ",", "privacy", ":", "'public'", ",", "superClass", ":", "'Base'", ",", "methods", ":", "[", "{", "description", ":", "'Overrides the method on Base.'", ",", "name", ":", "'overriddenMethod'", ",", "return", ":", "{", "type", ":", "'void'", "}", ",", "}", ",", "{", "description", ":", "'This method only exists on Subclass.'", ",", "name", ":", "'subMethod'", ",", "return", ":", "{", "type", ":", "'void'", "}", ",", "}", "]", "}", "]", ")", ";", "}", ")", ";", "const", "testName", "=", "'does not produce duplicate classes for elements or mixins'", ";", "test", "(", "testName", ",", "async", "(", ")", "=>", "{", "const", "scannedFeatures", "=", "await", "getScannedFeatures", "(", "'class/more-specific-classes.js'", ")", ";", "assert", ".", "deepEqual", "(", "scannedFeatures", ".", "map", "(", "(", "f", ")", "=>", "(", "f", "as", "any", ")", ".", "name", ")", ",", "[", "'Element'", ",", "'AnnotatedElement'", ",", "'Mixin'", ",", "'AnnotatedMixin'", "]", ")", ";", "assert", ".", "deepEqual", "(", "scannedFeatures", ".", "map", "(", "(", "f", ")", "=>", "f", ".", "constructor", ".", "name", ")", ",", "[", "'ScannedPolymerElement'", ",", "'ScannedPolymerElement'", ",", "'ScannedPolymerElementMixin'", ",", "'ScannedPolymerElementMixin'", "]", ")", ";", "}", ")", ";", "}", ")", ";", "suite", "(", "'resolving'", ",", "(", ")", "=>", "{", "test", "(", "'finds classes and their names and descriptions'", ",", "async", "(", ")", "=>", "{", "const", "{", "classes", "}", "=", "await", "getClasses", "(", "'class/class-names.js'", ")", ";", "assert", ".", "deepEqual", "(", "classes", ".", "map", "(", "(", "c", ")", "=>", "c", ".", "name", ")", ",", "[", "'Declaration'", ",", "'VarDeclaration'", ",", "'Assignment'", ",", "'Namespace.AlsoAssignment'", ",", "'Declared.AnotherAssignment'", ",", "'ClassWithNoJsDoc'", ",", "'ExportedClass'", ",", "undefined", ",", "'ExportedConstClass'", ",", "]", ")", ";", "assert", ".", "deepEqual", "(", "await", "Promise", ".", "all", "(", "classes", ".", "map", "(", "(", "c", ")", "=>", "getTestProps", "(", "c", ")", ")", ")", ",", "[", "{", "name", ":", "'Declaration'", ",", "description", ":", "'A simple declaration'", ",", "privacy", ":", "'public'", ",", "}", ",", "{", "description", ":", "'The variable\\'s name is used.'", ",", "name", ":", "'VarDeclaration'", ",", "privacy", ":", "'public'", ",", "}", ",", "{", "description", ":", "'The left hand side of the assignment is used.'", ",", "name", ":", "'Assignment'", ",", "privacy", ":", "'public'", ",", "}", ",", "{", "description", ":", "'Namespaced assignments work too'", ",", "name", ":", "'Namespace.AlsoAssignment'", ",", "privacy", ":", "'public'", ",", "}", ",", "{", "description", ":", "'Declared namespace works too'", ",", "name", ":", "'Declared.AnotherAssignment'", ",", "privacy", ":", "'public'", ",", "}", ",", "{", "description", ":", "''", ",", "name", ":", "'ClassWithNoJsDoc'", ",", "privacy", ":", "'public'", ",", "}", ",", "{", "description", ":", "'An exported class.'", ",", "name", ":", "'ExportedClass'", ",", "privacy", ":", "'public'", ",", "methods", ":", "[", "{", "description", ":", "''", ",", "name", ":", "'method1'", ",", "return", ":", "{", "type", ":", "'void'", "}", "}", "]", "}", ",", "{", "description", ":", "'A default exported class.'", ",", "name", ":", "undefined", ",", "privacy", ":", "'public'", ",", "methods", ":", "[", "{", "description", ":", "''", ",", "name", ":", "'method2'", ",", "return", ":", "{", "type", ":", "'void'", "}", "}", "]", "}", ",", "{", "description", ":", "''", ",", "name", ":", "'ExportedConstClass'", ",", "privacy", ":", "'public'", ",", "methods", ":", "[", "{", "description", ":", "''", ",", "name", ":", "'method3'", ",", "return", ":", "{", "type", ":", "'void'", "}", "}", "]", "}", "]", ")", ";", "}", ")", ";", "test", "(", "'finds methods'", ",", "async", "(", ")", "=>", "{", "const", "{", "classes", "}", "=", "await", "getClasses", "(", "'class/class-methods.js'", ")", ";", "assert", ".", "deepEqual", "(", "await", "Promise", ".", "all", "(", "classes", ".", "map", "(", "(", "c", ")", "=>", "getTestProps", "(", "c", ")", ")", ")", ",", "[", "{", "name", ":", "'Class'", ",", "description", ":", "''", ",", "privacy", ":", "'public'", ",", "properties", ":", "[", "{", "name", ":", "'customInstanceGetter'", "}", "]", ",", "methods", ":", "[", "{", "name", ":", "'customInstanceFunction'", ",", "description", ":", "''", ",", "}", ",", "{", "name", ":", "'customInstanceFunctionWithJSDoc'", ",", "description", ":", "'This is the description for '", "+", "'customInstanceFunctionWithJSDoc.'", ",", "return", ":", "{", "desc", ":", "'The number 5, always.'", ",", "type", ":", "'Number'", ",", "}", ",", "}", ",", "{", "name", ":", "'customInstanceFunctionWithParams'", ",", "description", ":", "''", ",", "params", ":", "[", "{", "name", ":", "'a'", "}", ",", "{", "name", ":", "'b'", "}", ",", "{", "name", ":", "'c'", "}", "]", ",", "}", ",", "{", "name", ":", "'customInstanceFunctionWithParamsAndJSDoc'", ",", "description", ":", "'This is the description for '", "+", "'customInstanceFunctionWithParamsAndJSDoc.'", ",", "params", ":", "[", "{", "name", ":", "'a'", ",", "type", ":", "'Number'", ",", "description", ":", "'The first argument'", ",", "}", ",", "{", "name", ":", "'b'", ",", "type", ":", "'Number'", ",", "}", ",", "{", "name", ":", "'c'", ",", "type", ":", "'Number'", ",", "description", ":", "'The third argument'", ",", "}", "]", ",", "return", ":", "{", "desc", ":", "'The number 7, always.'", ",", "type", ":", "'Number'", ",", "}", ",", "}", ",", "{", "name", ":", "'customInstanceFunctionWithParamsAndPrivateJSDoc'", ",", "description", ":", "'This is the description for\\n'", "+", "'customInstanceFunctionWithParamsAndPrivateJSDoc.'", ",", "}", ",", "{", "name", ":", "'customInstanceFunctionWithRestParam'", ",", "description", ":", "'This is the description for '", "+", "'customInstanceFunctionWithRestParam.'", ",", "params", ":", "[", "{", "name", ":", "'a'", ",", "type", ":", "'Number'", ",", "description", ":", "'The first argument.'", ",", "}", ",", "{", "name", ":", "'b'", ",", "type", ":", "'...Number'", ",", "rest", ":", "true", ",", "description", ":", "'The second argument.'", ",", "}", "]", ",", "return", ":", "{", "desc", ":", "'The number 9, always.'", ",", "type", ":", "'Number'", ",", "}", ",", "}", ",", "{", "name", ":", "'customInstanceFunctionWithParamDefault'", ",", "description", ":", "'This is the description for '", "+", "'customInstanceFunctionWithParamDefault.'", ",", "params", ":", "[", "{", "name", ":", "'a'", ",", "type", ":", "'Number'", ",", "description", ":", "'The first argument.'", ",", "}", ",", "{", "name", ":", "'b'", ",", "type", ":", "'Number'", ",", "defaultValue", ":", "'0'", ",", "description", ":", "'The second argument.'", ",", "}", "]", ",", "return", ":", "{", "desc", ":", "'The number 10, always.'", ",", "type", ":", "'Number'", ",", "}", ",", "}", ",", "{", "description", ":", "undefined", ",", "name", ":", "'customInstanceFunctionOnProto'", ",", "params", ":", "[", "{", "description", ":", "'a bool'", ",", "name", ":", "'foo'", ",", "type", ":", "'boolean'", "}", "]", ",", "return", ":", "{", "type", ":", "'void'", "}", "}", ",", "{", "description", ":", "undefined", ",", "name", ":", "'__customInstanceFunctionOnProtoPrivate'", "}", ",", "{", "description", ":", "undefined", ",", "name", ":", "'customInstanceFunctionOnProtoWithBody'", "}", ",", "{", "description", ":", "'Returns the sum of two numbers'", ",", "name", ":", "'customInstanceFunctionOnProtoWithBodyDoc'", ",", "params", ":", "[", "{", "description", ":", "'some number'", ",", "name", ":", "'a'", ",", "type", ":", "'number'", "}", ",", "{", "description", ":", "'another number'", ",", "name", ":", "'b'", ",", "type", ":", "'number'", "}", "]", ",", "return", ":", "{", "type", ":", "'number'", "}", "}", ",", "]", "}", ",", "]", ")", ";", "}", ")", ";", "test", "(", "'deals with super classes correctly'", ",", "async", "(", ")", "=>", "{", "const", "{", "classes", "}", "=", "await", "getClasses", "(", "'class/super-class.js'", ")", ";", "assert", ".", "deepEqual", "(", "classes", ".", "map", "(", "(", "f", ")", "=>", "f", ".", "name", ")", ",", "[", "'Base'", ",", "'Subclass'", "]", ")", ";", "assert", ".", "deepEqual", "(", "await", "Promise", ".", "all", "(", "classes", ".", "map", "(", "(", "c", ")", "=>", "getTestProps", "(", "c", ")", ")", ")", ",", "[", "{", "name", ":", "'Base'", ",", "description", ":", "''", ",", "privacy", ":", "'public'", ",", "methods", ":", "[", "{", "description", ":", "'This is a base method.'", ",", "name", ":", "'baseMethod'", ",", "return", ":", "{", "type", ":", "'void'", "}", ",", "}", ",", "{", "description", ":", "'Will be overriden by Subclass.'", ",", "name", ":", "'overriddenMethod'", ",", "return", ":", "{", "type", ":", "'void'", "}", ",", "}", "]", "}", ",", "{", "name", ":", "'Subclass'", ",", "description", ":", "''", ",", "privacy", ":", "'public'", ",", "superClass", ":", "'Base'", ",", "methods", ":", "[", "{", "description", ":", "'This is a base method.'", ",", "name", ":", "'baseMethod'", ",", "inheritedFrom", ":", "'Base'", ",", "return", ":", "{", "type", ":", "'void'", "}", ",", "}", ",", "{", "description", ":", "'Overrides the method on Base.'", ",", "name", ":", "'overriddenMethod'", ",", "return", ":", "{", "type", ":", "'void'", "}", ",", "}", ",", "{", "description", ":", "'This method only exists on Subclass.'", ",", "name", ":", "'subMethod'", ",", "return", ":", "{", "type", ":", "'void'", "}", ",", "}", ",", "]", "}", "]", ")", ";", "}", ")", ";", "const", "testName", "=", "'does not produce duplicate classes for elements or mixins'", ";", "test", "(", "testName", ",", "async", "(", ")", "=>", "{", "const", "features", "=", "(", "await", "analyzer", ".", "analyze", "(", "[", "'class/more-specific-classes.js'", "]", ")", ")", ".", "getFeatures", "(", ")", ";", "const", "interestingFeatures", "=", "Array", ".", "from", "(", "features", ")", ".", "filter", "(", "(", "f", ")", "=>", "f", "instanceof", "Element", "||", "f", "instanceof", "ElementMixin", "||", "f", "instanceof", "Class", ")", "as", "Array", "<", "Element", "|", "ElementMixin", "|", "Class", ">", ";", "assert", ".", "deepEqual", "(", "interestingFeatures", ".", "map", "(", "(", "f", ")", "=>", "f", ".", "name", ")", ",", "[", "'Element'", ",", "'AnnotatedElement'", ",", "'Mixin'", ",", "'AnnotatedMixin'", "]", ")", ";", "assert", ".", "deepEqual", "(", "interestingFeatures", ".", "map", "(", "(", "f", ")", "=>", "f", ".", "constructor", ".", "name", ")", ",", "[", "'PolymerElement'", ",", "'PolymerElement'", ",", "'PolymerElementMixin'", ",", "'PolymerElementMixin'", "]", ")", ";", "}", ")", ";", "test", "(", "'we index classes by their canonical statements'", ",", "async", "(", ")", "=>", "{", "const", "filename", "=", "'class/class-names.js'", ";", "const", "{", "classes", ",", "analysis", "}", "=", "await", "getClasses", "(", "filename", ")", ";", "assert", ".", "deepEqual", "(", "classes", ".", "map", "(", "(", "c", ")", "=>", "c", ".", "statementAst", "&&", "c", ".", "statementAst", ".", "type", ")", ",", "[", "'ClassDeclaration'", ",", "'VariableDeclaration'", ",", "'ExpressionStatement'", ",", "'ExpressionStatement'", ",", "'ExpressionStatement'", ",", "'ClassDeclaration'", ",", "'ExportNamedDeclaration'", ",", "'ExportDefaultDeclaration'", ",", "'ExportNamedDeclaration'", "]", ")", ";", "const", "result", "=", "analysis", ".", "getDocument", "(", "filename", ")", ";", "if", "(", "result", ".", "successful", "===", "false", ")", "{", "throw", "new", "Error", "(", "'Could not get document'", ")", ";", "}", "const", "document", "=", "result", ".", "value", ";", "for", "(", "const", "class_", "of", "classes", ")", "{", "const", "features", "=", "document", ".", "getFeatures", "(", "{", "statement", ":", "class_", ".", "statementAst", ",", "kind", ":", "'class'", "}", ")", ";", "assert", ".", "deepEqual", "(", "[", "...", "features", "]", ".", "map", "(", "(", "c", ")", "=>", "c", ".", "name", ")", ",", "[", "class_", ".", "name", "]", ")", ";", "}", "}", ")", ";", "test", "(", "'we resolve superclasses by scope when possible'", ",", "async", "(", ")", "=>", "{", "const", "filename", "=", "'class/super-class-scoped.js'", ";", "const", "{", "classes", "}", "=", "await", "getClasses", "(", "filename", ")", ";", "assert", ".", "deepEqual", "(", "classes", ".", "map", "(", "(", "c", ")", "=>", "c", ".", "name", ")", ",", "[", "'Foo'", ",", "'Foo'", ",", "'One'", ",", "'Foo'", ",", "'Two'", ",", "'Three'", ",", "]", ")", ";", "const", "subclasses", "=", "classes", ".", "filter", "(", "(", "c", ")", "=>", "c", ".", "superClass", "!==", "undefined", ")", ";", "assert", ".", "deepEqual", "(", "subclasses", ".", "map", "(", "(", "(", "c", ")", "=>", "c", ".", "name", ")", ")", ",", "[", "'One'", ",", "'Two'", ",", "'Three'", "]", ")", ";", "assert", ".", "deepEqual", "(", "subclasses", ".", "map", "(", "(", "c", ")", "=>", "[", "...", "c", ".", "methods", ".", "keys", "(", ")", "]", ")", ",", "[", "[", "'method1'", "]", ",", "[", "'method2'", "]", ",", "[", "'method3'", "]", "]", ")", ";", "}", ")", ";", "test", "(", "'we resolve imported super classes'", ",", "async", "(", ")", "=>", "{", "const", "filename", "=", "'class/super-class-imported.js'", ";", "const", "analysis", "=", "await", "analyzer", ".", "analyze", "(", "[", "filename", "]", ")", ";", "const", "result", "=", "analysis", ".", "getDocument", "(", "filename", ")", ";", "if", "(", "result", ".", "successful", "===", "false", ")", "{", "throw", "new", "Error", "(", "'Could not get document'", ")", ";", "}", "const", "document", "=", "result", ".", "value", ";", "const", "classes", "=", "Array", ".", "from", "(", "document", ".", "getFeatures", "(", "{", "kind", ":", "'class'", "}", ")", ")", ";", "assert", ".", "deepEqual", "(", "classes", ".", "map", "(", "(", "c", ")", "=>", "c", ".", "name", ")", ",", "[", "'CL1'", ",", "'CL2'", ",", "'CL3'", ",", "'CL4'", ",", "'CL5'", ",", "'CL6'", ",", "]", ")", ";", "assert", ".", "deepEqual", "(", "classes", ".", "map", "(", "(", "c", ")", "=>", "[", "...", "c", ".", "methods", ".", "keys", "(", ")", "]", ")", ",", "[", "[", "'method1'", "]", ",", "[", "'method2'", "]", ",", "[", "'method3'", "]", ",", "[", "'method1'", "]", ",", "[", "'method1'", "]", ",", "[", "'method1'", "]", "]", ")", ";", "}", ")", ";", "}", ")", ";", "}", ")", ";" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 2, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, 24293, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 2, null, null, null, 1519, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 31919, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 20, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 37613, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 37613, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 37613, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 37613, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 37613, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 37613, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 24293, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 24293, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 428, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 428, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 428, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 428, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 428, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 428, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 123, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 91, null, null, null, null, null, null, null, null, 428, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 428, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, 428, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 428, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 428, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, 1519, null, null, null, null, null, null, null, null, null, null, null, null, 123, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 91, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1325
[ "license", "import", "{", "assert", "}", "from", "'chai'", ";", "import", "*", "as", "path", "from", "'path'", ";", "import", "{", "ScannedFunction", "}", "from", "'../../javascript/function'", ";", "import", "{", "FunctionScanner", "}", "from", "'../../javascript/function-scanner'", ";", "import", "{", "createForDirectory", ",", "fixtureDir", ",", "runScanner", "}", "from", "'../test-utils'", ";", "suite", "(", "'FunctionScanner'", ",", "async", "(", ")", "=>", "{", "const", "testFilesDir", "=", "path", ".", "resolve", "(", "fixtureDir", ",", "'namespaces/'", ")", ";", "const", "{", "analyzer", ",", "underliner", "}", "=", "await", "createForDirectory", "(", "testFilesDir", ")", ";", "async", "function", "getNamespaceFunctions", "(", "filename", ")", "{", "const", "{", "features", "}", "=", "await", "runScanner", "(", "analyzer", ",", "new", "FunctionScanner", "(", ")", ",", "filename", ")", ";", "const", "scannedFunctions", "=", "[", "]", ";", "for", "(", "const", "feature", "of", "features", ")", "{", "if", "(", "feature", "instanceof", "ScannedFunction", ")", "{", "scannedFunctions", ".", "push", "(", "feature", ")", ";", "}", "}", "return", "scannedFunctions", ";", "}", ";", "async", "function", "getTestProps", "(", "fn", ")", "{", "return", "{", "name", ":", "fn", ".", "name", ",", "description", ":", "fn", ".", "description", ",", "summary", ":", "fn", ".", "summary", ",", "warnings", ":", "fn", ".", "warnings", ",", "params", ":", "fn", ".", "params", ",", "return", ":", "fn", ".", "return", ",", "codeSnippet", ":", "await", "underliner", ".", "underline", "(", "fn", ".", "sourceRange", ")", ",", "privacy", ":", "fn", ".", "privacy", "}", ";", "}", "test", "(", "'handles @memberof annotation'", ",", "async", "(", ")", "=>", "{", "const", "namespaceFunctions", "=", "await", "getNamespaceFunctions", "(", "'memberof-functions.js'", ")", ";", "const", "functionData", "=", "await", "Promise", ".", "all", "(", "namespaceFunctions", ".", "map", "(", "getTestProps", ")", ")", ";", "assert", ".", "deepEqual", "(", "functionData", ",", "[", "{", "name", ":", "'Polymer.aaa'", ",", "description", ":", "'aaa'", ",", "summary", ":", "''", ",", "warnings", ":", "[", "]", ",", "params", ":", "[", "{", "desc", ":", "'This is the first argument'", ",", "name", ":", "'a'", ",", "type", ":", "'Number'", ",", "}", "]", ",", "privacy", ":", "'public'", ",", "return", ":", "undefined", ",", "codeSnippet", ":", "`\nfunction aaa(a) {\n~~~~~~~~~~~~~~~~~\n return a;\n~~~~~~~~~~~\n}\n~`", ",", "}", ",", "{", "name", ":", "'Polymer.bbb'", ",", "description", ":", "'bbb'", ",", "summary", ":", "''", ",", "warnings", ":", "[", "]", ",", "params", ":", "[", "]", ",", "return", ":", "{", "type", ":", "'void'", "}", ",", "privacy", ":", "'public'", ",", "codeSnippet", ":", "`\nPolymer.bbb = function bbb() {\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n\n};\n~~`", ",", "}", ",", "{", "name", ":", "'Polymer.ccc'", ",", "description", ":", "'ccc'", ",", "summary", ":", "''", ",", "warnings", ":", "[", "]", ",", "params", ":", "[", "]", ",", "return", ":", "{", "type", ":", "'void'", "}", ",", "privacy", ":", "'protected'", ",", "codeSnippet", ":", "`\n function ccc() {\n ~~~~~~~~~~~~~~~~\n }\n~~~`", ",", "}", ",", "{", "name", ":", "'Polymer._ddd'", ",", "description", ":", "'ddd'", ",", "summary", ":", "''", ",", "warnings", ":", "[", "]", ",", "privacy", ":", "'protected'", ",", "params", ":", "[", "]", ",", "return", ":", "{", "type", ":", "'void'", "}", ",", "codeSnippet", ":", "`\n _ddd: function() {\n ~~~~~~~~~~~~~~~~~~\n\n\n },\n~~~`", ",", "}", ",", "{", "name", ":", "'Polymer.eee'", ",", "description", ":", "'eee'", ",", "summary", ":", "''", ",", "warnings", ":", "[", "]", ",", "params", ":", "[", "]", ",", "return", ":", "{", "type", ":", "'void'", "}", ",", "privacy", ":", "'private'", ",", "codeSnippet", ":", "`\n eee: () => {},\n ~~~~~~~~~~~~~`", ",", "}", ",", "{", "name", ":", "'Polymer.fff'", ",", "description", ":", "'fff'", ",", "summary", ":", "''", ",", "warnings", ":", "[", "]", ",", "params", ":", "[", "]", ",", "return", ":", "{", "type", ":", "'void'", "}", ",", "privacy", ":", "'public'", ",", "codeSnippet", ":", "`\n fff() {\n ~~~~~~~\n\n\n },\n~~~`", ",", "}", ",", "{", "name", ":", "'Polymer.ggg'", ",", "description", ":", "'ggg'", ",", "summary", ":", "''", ",", "warnings", ":", "[", "]", ",", "params", ":", "[", "]", ",", "return", ":", "undefined", ",", "privacy", ":", "'public'", ",", "codeSnippet", ":", "`\n ggg: someFunction,\n ~~~~~~~~~~~~~~~~~`", ",", "}", ",", "{", "name", ":", "'Polymer.hhh_'", ",", "description", ":", "'hhh_ should be private'", ",", "summary", ":", "''", ",", "warnings", ":", "[", "]", ",", "params", ":", "[", "]", ",", "return", ":", "undefined", ",", "privacy", ":", "'private'", ",", "codeSnippet", ":", "`\n hhh_: someOtherFunc,\n ~~~~~~~~~~~~~~~~~~~`", ",", "}", ",", "{", "name", ":", "'Polymer.__iii'", ",", "description", ":", "'__iii should be private too'", ",", "summary", ":", "''", ",", "warnings", ":", "[", "]", ",", "params", ":", "[", "]", ",", "return", ":", "{", "type", ":", "'void'", "}", ",", "privacy", ":", "'private'", ",", "codeSnippet", ":", "`\n __iii() { },\n ~~~~~~~~~~~`", ",", "}", ",", "{", "name", ":", "'Polymer.jjj'", ",", "description", ":", "'jjj'", ",", "summary", ":", "''", ",", "warnings", ":", "[", "]", ",", "params", ":", "[", "]", ",", "return", ":", "{", "type", ":", "'void'", "}", ",", "privacy", ":", "'public'", ",", "codeSnippet", ":", "`\nvar jjj = function() {\n~~~~~~~~~~~~~~~~~~~~~~\n\n\n};\n~~`", ",", "}", ",", "]", ")", ";", "}", ")", ";", "test", "(", "'handles @global, @memberof, @function annotations'", ",", "async", "(", ")", "=>", "{", "const", "functions", "=", "await", "getNamespaceFunctions", "(", "'annotated-functions.js'", ")", ";", "assert", ".", "deepEqual", "(", "functions", ".", "map", "(", "(", "fn", ")", "=>", "fn", ".", "name", ")", ",", "[", "'globalFn'", ",", "'SomeNamespace.memberofFn'", ",", "'overrideNameFn'", ",", "]", ")", ";", "}", ")", ";", "test", "(", "'handles @template annotation'", ",", "async", "(", ")", "=>", "{", "const", "functions", "=", "await", "getNamespaceFunctions", "(", "'templated-functions.js'", ")", ";", "assert", ".", "deepEqual", "(", "functions", ".", "map", "(", "(", "fn", ")", "=>", "[", "fn", ".", "name", ",", "fn", ".", "templateTypes", "]", ")", ",", "[", "[", "'templateFn'", ",", "[", "'T'", "]", "]", ",", "[", "'multiTemplateFn'", ",", "[", "'A'", ",", "'B'", ",", "'C'", "]", "]", ",", "]", ")", ";", "}", ")", ";", "test", "(", "'does return void inference'", ",", "async", "(", ")", "=>", "{", "const", "functions", "=", "await", "getNamespaceFunctions", "(", "'function-return-inference.js'", ")", ";", "assert", ".", "deepEqual", "(", "functions", ".", "map", "(", "(", "fn", ")", "=>", "[", "fn", ".", "name", ",", "fn", ".", "return", "]", ")", ",", "[", "[", "'noReturn'", ",", "{", "type", ":", "'void'", "}", "]", ",", "[", "'returnWithNoArgument'", ",", "{", "type", ":", "'void'", "}", "]", ",", "[", "'returnValue'", ",", "undefined", "]", ",", "[", "'mixedReturnStyle'", ",", "undefined", "]", ",", "[", "'voidWithNonVoidInside'", ",", "{", "type", ":", "'void'", "}", "]", ",", "[", "'isAsync'", ",", "undefined", "]", ",", "[", "'isGenerator'", ",", "undefined", "]", ",", "[", "'annotationOverride'", ",", "{", "type", ":", "'string'", "}", "]", ",", "[", "'arrowNoReturn'", ",", "{", "type", ":", "'void'", "}", "]", ",", "[", "'arrowReturnWithNoArgument'", ",", "{", "type", ":", "'void'", "}", "]", ",", "[", "'arrowReturnValueConcise'", ",", "undefined", "]", ",", "]", ")", ";", "}", ")", ";", "}", ")", ";" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, 24293, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1326
[ "license", "import", "{", "assert", "}", "from", "'chai'", ";", "import", "{", "createForDirectory", ",", "fixtureDir", "}", "from", "'../test-utils'", ";", "suite", "(", "'JavaScriptExportScanner'", ",", "async", "(", ")", "=>", "{", "const", "{", "analyzer", "}", "=", "await", "createForDirectory", "(", "fixtureDir", ")", ";", "async", "function", "getExports", "(", "filename", ")", "{", "const", "analysis", "=", "await", "analyzer", ".", "analyze", "(", "[", "filename", "]", ")", ";", "const", "result", "=", "analysis", ".", "getDocument", "(", "filename", ")", ";", "if", "(", "!", "result", ".", "successful", ")", "{", "throw", "new", "Error", "(", "'could not get document'", ")", ";", "}", "assert", ".", "deepEqual", "(", "result", ".", "value", ".", "getWarnings", "(", ")", ".", "map", "(", "(", "w", ")", "=>", "w", ".", "toString", "(", ")", ")", ",", "[", "]", ")", ";", "return", "result", ".", "value", ".", "getFeatures", "(", "{", "kind", ":", "'export'", "}", ")", ";", "}", "test", "(", "'identifies the names that of exports'", ",", "async", "(", ")", "=>", "{", "const", "features", "=", "await", "getExports", "(", "'javascript/all-export-types.js'", ")", ";", "assert", ".", "deepEqual", "(", "[", "...", "features", "]", ".", "map", "(", "(", "f", ")", "=>", "[", "...", "f", ".", "identifiers", "]", ")", ",", "[", "[", "'namedConstIdentifier'", "]", ",", "[", "'default'", "]", ",", "[", "'ClassName'", "]", ",", "[", "'functionName'", "]", ",", "[", "'identifierAssignedFunction'", "]", ",", "[", "'a'", ",", "'b'", ",", "'c'", ",", "'d'", "]", ",", "[", "'g'", ",", "'i'", ",", "'k'", "]", ",", "[", "'anotherValue'", "]", ",", "[", "'someValue'", "]", "]", ")", ";", "}", ")", ";", "test", "(", "'re-exports across multiple files correctly'", ",", "async", "(", ")", "=>", "{", "const", "features", "=", "await", "getExports", "(", "'javascript/re-export-all.js'", ")", ";", "assert", ".", "deepEqual", "(", "[", "...", "features", "]", ".", "map", "(", "(", "f", ")", "=>", "[", "...", "f", ".", "identifiers", "]", ")", ",", "[", "[", "'namedConstIdentifier'", ",", "'ClassName'", ",", "'functionName'", ",", "'identifierAssignedFunction'", ",", "'a'", ",", "'b'", ",", "'c'", ",", "'d'", ",", "'g'", ",", "'i'", ",", "'k'", ",", "'anotherValue'", ",", "'someValue'", "]", "]", ")", ";", "}", ")", ";", "}", ")", ";" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 2, null, null, null, 1519, null, null, null, null, null, null, null, null, null, null, null, null, 123, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5893, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1327
[ "license", "import", "*", "as", "babel", "from", "'@babel/types'", ";", "import", "{", "assert", "}", "from", "'chai'", ";", "import", "*", "as", "fs", "from", "'fs'", ";", "import", "*", "as", "path", "from", "'path'", ";", "import", "stripIndent", "=", "require", "(", "'strip-indent'", ")", ";", "import", "*", "as", "esutil", "from", "'../../javascript/esutil'", ";", "import", "{", "JavaScriptDocument", "}", "from", "'../../javascript/javascript-document'", ";", "import", "{", "JavaScriptParser", ",", "JavaScriptModuleParser", ",", "JavaScriptScriptParser", "}", "from", "'../../javascript/javascript-parser'", ";", "import", "{", "PackageUrlResolver", "}", "from", "'../../url-loader/package-url-resolver'", ";", "import", "{", "resolvedUrl", ",", "fixtureDir", "}", "from", "'../test-utils'", ";", "suite", "(", "'JavaScriptParser'", ",", "(", ")", "=>", "{", "let", "parser", ";", "setup", "(", "(", ")", "=>", "{", "parser", "=", "new", "JavaScriptParser", "(", ")", ";", "}", ")", ";", "suite", "(", "'parse()'", ",", "(", ")", "=>", "{", "test", "(", "'parses classes'", ",", "(", ")", "=>", "{", "const", "contents", "=", "`\n class Foo extends HTMLElement {\n constructor() {\n super();\n this.bar = () => {};\n const let_ = 'let const';\n }\n }\n `", ";", "const", "document", "=", "parser", ".", "parse", "(", "contents", ",", "resolvedUrl", "`/static/es6-support.js`", ",", "new", "PackageUrlResolver", "(", ")", ")", ";", "assert", ".", "instanceOf", "(", "document", ",", "JavaScriptDocument", ")", ";", "assert", ".", "equal", "(", "document", ".", "url", ",", "'/static/es6-support.js'", ")", ";", "assert", ".", "equal", "(", "document", ".", "ast", ".", "type", ",", "'File'", ")", ";", "assert", ".", "equal", "(", "document", ".", "parsedAsSourceType", ",", "'script'", ")", ";", "assert", ".", "equal", "(", "document", ".", "ast", ".", "program", ".", "body", "[", "0", "]", ".", "type", ",", "'ClassDeclaration'", ")", ";", "}", ")", ";", "test", "(", "'parses import.meta'", ",", "(", ")", "=>", "{", "const", "contents", "=", "`\n import.meta\n `", ";", "const", "document", "=", "parser", ".", "parse", "(", "contents", ",", "resolvedUrl", "`/static/es6-support.js`", ",", "new", "PackageUrlResolver", "(", ")", ")", ";", "assert", ".", "instanceOf", "(", "document", ",", "JavaScriptDocument", ")", ";", "assert", ".", "equal", "(", "document", ".", "url", ",", "'/static/es6-support.js'", ")", ";", "assert", ".", "equal", "(", "document", ".", "ast", ".", "type", ",", "'File'", ")", ";", "assert", ".", "equal", "(", "document", ".", "parsedAsSourceType", ",", "'module'", ")", ";", "const", "expr", "=", "document", ".", "ast", ".", "program", ".", "body", "[", "0", "]", "as", "babel", ".", "ExpressionStatement", ";", "assert", ".", "equal", "(", "expr", ".", "type", ",", "'ExpressionStatement'", ")", ";", "assert", ".", "equal", "(", "expr", ".", "expression", ".", "type", ",", "'MetaProperty'", ")", ";", "}", ")", ";", "test", "(", "'parses async await'", ",", "(", ")", "=>", "{", "const", "contents", "=", "`\n async function foo() {\n await Promise.resolve();\n }\n `", ";", "const", "document", "=", "parser", ".", "parse", "(", "contents", ",", "resolvedUrl", "`/static/es6-support.js`", ",", "new", "PackageUrlResolver", "(", ")", ")", ";", "assert", ".", "instanceOf", "(", "document", ",", "JavaScriptDocument", ")", ";", "assert", ".", "equal", "(", "document", ".", "url", ",", "'/static/es6-support.js'", ")", ";", "assert", ".", "equal", "(", "document", ".", "ast", ".", "type", ",", "'File'", ")", ";", "assert", ".", "equal", "(", "document", ".", "parsedAsSourceType", ",", "'script'", ")", ";", "const", "functionDecl", "=", "document", ".", "ast", ".", "program", ".", "body", "[", "0", "]", ";", "if", "(", "!", "babel", ".", "isFunctionDeclaration", "(", "functionDecl", ")", ")", "{", "throw", "new", "Error", "(", "'Expected a function declaration.'", ")", ";", "}", "assert", ".", "equal", "(", "functionDecl", ".", "async", ",", "true", ")", ";", "}", ")", ";", "test", "(", "'throws syntax errors'", ",", "(", ")", "=>", "{", "const", "file", "=", "fs", ".", "readFileSync", "(", "path", ".", "resolve", "(", "fixtureDir", ",", "'js-parse-error.js'", ")", ",", "'utf8'", ")", ";", "assert", ".", "throws", "(", "(", ")", "=>", "parser", ".", "parse", "(", "file", ",", "resolvedUrl", "`/static/js-parse-error.js`", ",", "new", "PackageUrlResolver", "(", ")", ")", ")", ";", "}", ")", ";", "test", "(", "'attaches comments'", ",", "(", ")", "=>", "{", "const", "file", "=", "fs", ".", "readFileSync", "(", "path", ".", "resolve", "(", "fixtureDir", ",", "'js-elements.js'", ")", ",", "'utf8'", ")", ";", "const", "document", "=", "parser", ".", "parse", "(", "file", ",", "resolvedUrl", "`/static/js-elements.js`", ",", "new", "PackageUrlResolver", "(", ")", ")", ";", "const", "ast", "=", "document", ".", "ast", ";", "const", "element1", "=", "ast", ".", "program", ".", "body", "[", "0", "]", ";", "const", "comment", "=", "esutil", ".", "getAttachedComment", "(", "element1", ")", "!", ";", "assert", ".", "isTrue", "(", "comment", ".", "indexOf", "(", "'test-element'", ")", "!==", "-", "1", ")", ";", "}", ")", ";", "test", "(", "'parses an ES module'", ",", "(", ")", "=>", "{", "const", "contents", "=", "`\n import foo from 'foo';\n `", ";", "const", "document", "=", "parser", ".", "parse", "(", "contents", ",", "resolvedUrl", "`/static/es6-support.js`", ",", "new", "PackageUrlResolver", "(", ")", ")", ";", "assert", ".", "instanceOf", "(", "document", ",", "JavaScriptDocument", ")", ";", "assert", ".", "equal", "(", "document", ".", "url", ",", "'/static/es6-support.js'", ")", ";", "assert", ".", "equal", "(", "document", ".", "ast", ".", "type", ",", "'File'", ")", ";", "assert", ".", "equal", "(", "document", ".", "parsedAsSourceType", ",", "'module'", ")", ";", "}", ")", ";", "}", ")", ";", "suite", "(", "`stringify()`", ",", "(", ")", "=>", "{", "test", "(", "'pretty prints output'", ",", "(", ")", "=>", "{", "const", "contents", "=", "stripIndent", "(", "`\n class Foo extends HTMLElement {\n constructor() {\n super();\n\n this.bar = () => {};\n\n const leet = 'let const';\n }\n\n }`", ")", ".", "trim", "(", ")", "+", "'\\n'", ";", "const", "document", "=", "parser", ".", "parse", "(", "contents", ",", "resolvedUrl", "`test-file.js`", ",", "new", "PackageUrlResolver", "(", ")", ")", ";", "assert", ".", "deepEqual", "(", "document", ".", "stringify", "(", "{", "}", ")", ",", "contents", ")", ";", "}", ")", ";", "}", ")", ";", "}", ")", ";", "suite", "(", "'JavaScriptModuleParser'", ",", "(", ")", "=>", "{", "let", "parser", ";", "setup", "(", "(", ")", "=>", "{", "parser", "=", "new", "JavaScriptModuleParser", "(", ")", ";", "}", ")", ";", "suite", "(", "'parse()'", ",", "(", ")", "=>", "{", "test", "(", "'parses an ES6 module'", ",", "(", ")", "=>", "{", "const", "contents", "=", "`\n import foo from 'foo';\n `", ";", "const", "document", "=", "parser", ".", "parse", "(", "contents", ",", "resolvedUrl", "`/static/es6-support.js`", ",", "new", "PackageUrlResolver", "(", ")", ")", ";", "assert", ".", "instanceOf", "(", "document", ",", "JavaScriptDocument", ")", ";", "assert", ".", "equal", "(", "document", ".", "url", ",", "'/static/es6-support.js'", ")", ";", "assert", ".", "equal", "(", "document", ".", "ast", ".", "type", ",", "'File'", ")", ";", "assert", ".", "equal", "(", "document", ".", "parsedAsSourceType", ",", "'module'", ")", ";", "}", ")", ";", "}", ")", ";", "}", ")", ";", "suite", "(", "'JavaScriptScriptParser'", ",", "(", ")", "=>", "{", "let", "parser", ";", "setup", "(", "(", ")", "=>", "{", "parser", "=", "new", "JavaScriptScriptParser", "(", ")", ";", "}", ")", ";", "test", "(", "'throws a syntax error when parsing es6 module'", ",", "(", ")", "=>", "{", "const", "contents", "=", "`\n import foo from 'foo';\n `", ";", "assert", ".", "throws", "(", "(", ")", "=>", "parser", ".", "parse", "(", "contents", ",", "resolvedUrl", "`/static/es6-support.js`", ",", "new", "PackageUrlResolver", "(", ")", ")", ")", ";", "}", ")", ";", "}", ")", ";" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, 6782, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, 6782, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1142, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, 6782, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6782, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 110, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, 6782, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, 6782, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, 6782, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1328
[ "license", "import", "{", "assert", "}", "from", "'chai'", ";", "import", "{", "ScannedBehavior", "}", "from", "'../../polymer/behavior'", ";", "import", "{", "BehaviorScanner", "}", "from", "'../../polymer/behavior-scanner'", ";", "import", "{", "createForDirectory", ",", "fixtureDir", ",", "runScanner", "}", "from", "'../test-utils'", ";", "suite", "(", "'BehaviorScanner'", ",", "(", ")", "=>", "{", "let", "behaviors", ";", "let", "behaviorsList", ";", "suiteSetup", "(", "async", "(", ")", "=>", "{", "const", "{", "analyzer", "}", "=", "await", "createForDirectory", "(", "fixtureDir", ")", ";", "const", "{", "features", "}", "=", "await", "runScanner", "(", "analyzer", ",", "new", "BehaviorScanner", "(", ")", ",", "'js-behaviors.js'", ")", ";", "behaviors", "=", "new", "Map", "(", ")", ";", "behaviorsList", "=", "<", "ScannedBehavior", "[", "]", ">", "features", ".", "filter", "(", "(", "e", ")", "=>", "e", "instanceof", "ScannedBehavior", ")", ";", "for", "(", "const", "behavior", "of", "behaviorsList", ")", "{", "if", "(", "behavior", ".", "className", "===", "undefined", ")", "{", "throw", "new", "Error", "(", "`Could not determine className of behavior.`", ")", ";", "}", "behaviors", ".", "set", "(", "behavior", ".", "className", ",", "behavior", ")", ";", "}", "}", ")", ";", "test", "(", "'Finds behavior object assignments'", ",", "(", ")", "=>", "{", "assert", ".", "deepEqual", "(", "behaviorsList", ".", "map", "(", "(", "b", ")", "=>", "b", ".", "className", ")", ".", "sort", "(", ")", ",", "[", "'SimpleBehavior'", ",", "'Polymer.SimpleNamespacedBehavior'", ",", "'AwesomeBehavior'", ",", "'Polymer.AwesomeNamespacedBehavior'", ",", "'Really.Really.Deep.Behavior'", ",", "'CustomBehaviorList'", ",", "'exportedBehavior'", ",", "'default'", ",", "]", ".", "sort", "(", ")", ")", ";", "}", ")", ";", "test", "(", "'Supports behaviors at local assignments'", ",", "(", ")", "=>", "{", "assert", "(", "behaviors", ".", "has", "(", "'SimpleBehavior'", ")", ")", ";", "assert", ".", "equal", "(", "behaviors", ".", "get", "(", "'SimpleBehavior'", ")", "!", ".", "properties", ".", "values", "(", ")", ".", "next", "(", ")", ".", "value", ".", "name", ",", "'simple'", ")", ";", "}", ")", ";", "test", "(", "'Supports behaviors with renamed paths'", ",", "(", ")", "=>", "{", "assert", "(", "behaviors", ".", "has", "(", "'AwesomeBehavior'", ")", ")", ";", "assert", "(", "behaviors", ".", "get", "(", "'AwesomeBehavior'", ")", "!", ".", "properties", ".", "has", "(", "'custom'", ")", ")", ";", "}", ")", ";", "test", "(", "'Supports behaviors On.Property.Paths'", ",", "(", ")", "=>", "{", "assert", "(", "behaviors", ".", "has", "(", "'Really.Really.Deep.Behavior'", ")", ")", ";", "assert", ".", "equal", "(", "behaviors", ".", "get", "(", "'Really.Really.Deep.Behavior'", ")", "!", ".", "properties", ".", "get", "(", "'deep'", ")", "!", ".", "name", ",", "'deep'", ")", ";", "}", ")", ";", "test", "(", "'Supports property array on behaviors'", ",", "(", ")", "=>", "{", "let", "defaultValue", ";", "behaviors", ".", "get", "(", "'AwesomeBehavior'", ")", "!", ".", "properties", ".", "forEach", "(", "(", "prop", ")", "=>", "{", "if", "(", "prop", ".", "name", "===", "'a'", ")", "{", "defaultValue", "=", "prop", ".", "default", ";", "}", "}", ")", ";", "assert", ".", "equal", "(", "defaultValue", ",", "1", ")", ";", "}", ")", ";", "test", "(", "'Supports chained behaviors'", ",", "function", "(", ")", "{", "assert", "(", "behaviors", ".", "has", "(", "'CustomBehaviorList'", ")", ")", ";", "const", "childBehaviors", "=", "behaviors", ".", "get", "(", "'CustomBehaviorList'", ")", "!", ".", "behaviorAssignments", ";", "const", "deepChainedBehaviors", "=", "behaviors", ".", "get", "(", "'Really.Really.Deep.Behavior'", ")", "!", ".", "behaviorAssignments", ";", "assert", ".", "deepEqual", "(", "childBehaviors", ".", "map", "(", "(", "b", ")", "=>", "b", ".", "identifier", ")", ",", "[", "'SimpleBehavior'", ",", "'AwesomeBehavior'", ",", "'Really.Really.Deep.Behavior'", "]", ")", ";", "assert", ".", "deepEqual", "(", "deepChainedBehaviors", ".", "map", "(", "(", "b", ")", "=>", "b", ".", "identifier", ")", ",", "[", "'Do.Re.Mi.Fa'", "]", ")", ";", "}", ")", ";", "test", "(", "'Does not count methods as properties'", ",", "function", "(", ")", "{", "const", "behavior", "=", "behaviors", ".", "get", "(", "'Polymer.SimpleNamespacedBehavior'", ")", ";", "if", "(", "!", "behavior", ")", "{", "throw", "new", "Error", "(", "'Could not find Polymer.SimpleNamespacedBehavior'", ")", ";", "}", "assert", ".", "deepEqual", "(", "[", "...", "behavior", ".", "methods", ".", "keys", "(", ")", "]", ",", "[", "'method'", ",", "'shorthandMethod'", "]", ")", ";", "assert", ".", "deepEqual", "(", "[", "...", "behavior", ".", "properties", ".", "keys", "(", ")", "]", ",", "[", "'simple'", ",", "'object'", ",", "'array'", ",", "'attached'", ",", "'templateLiteral'", ",", "'getter'", ",", "'getterSetter'", "]", ")", ";", "}", ")", ";", "test", "(", "'Correctly transforms property types'", ",", "function", "(", ")", "{", "const", "behavior", "=", "behaviors", ".", "get", "(", "'Polymer.SimpleNamespacedBehavior'", ")", ";", "if", "(", "!", "behavior", ")", "{", "throw", "new", "Error", "(", "'Could not find Polymer.SimpleNamespacedBehavior'", ")", ";", "}", "assert", ".", "deepEqual", "(", "[", "...", "behavior", ".", "properties", ".", "values", "(", ")", "]", ".", "map", "(", "(", "p", ")", "=>", "(", "{", "name", ":", "p", ".", "name", ",", "type", ":", "p", ".", "type", ",", "readOnly", ":", "p", ".", "readOnly", "}", ")", ")", ",", "[", "{", "name", ":", "'simple'", ",", "type", ":", "'boolean'", ",", "readOnly", ":", "false", "}", ",", "{", "name", ":", "'object'", ",", "type", ":", "'Object'", ",", "readOnly", ":", "false", "}", ",", "{", "name", ":", "'array'", ",", "type", ":", "'Array'", ",", "readOnly", ":", "false", "}", ",", "{", "name", ":", "'attached'", ",", "type", ":", "undefined", ",", "readOnly", ":", "false", "}", ",", "{", "name", ":", "'templateLiteral'", ",", "type", ":", "'string'", ",", "readOnly", ":", "false", "}", ",", "{", "name", ":", "'getter'", ",", "type", ":", "undefined", ",", "readOnly", ":", "true", "}", ",", "{", "name", ":", "'getterSetter'", ",", "type", ":", "undefined", ",", "readOnly", ":", "false", "}", "]", ")", ";", "}", ")", ";", "const", "testName", "=", "'Supports behaviors that are just arrays of other behaviors'", ";", "test", "(", "testName", ",", "async", "(", ")", "=>", "{", "const", "{", "analyzer", "}", "=", "await", "createForDirectory", "(", "fixtureDir", ")", ";", "const", "analysis", "=", "await", "analyzer", ".", "analyze", "(", "[", "'uses-behaviors.js'", "]", ")", ";", "const", "elements", "=", "[", "...", "analysis", ".", "getFeatures", "(", "{", "kind", ":", "'polymer-element'", "}", ")", "]", ";", "assert", ".", "deepEqual", "(", "elements", ".", "map", "(", "(", "e", ")", "=>", "e", ".", "tagName", ")", ",", "[", "'uses-basic-behavior'", ",", "'uses-array-behavior'", ",", "'uses-default-behavior'", "]", ")", ";", "assert", ".", "deepEqual", "(", "elements", ".", "map", "(", "(", "e", ")", "=>", "e", ".", "behaviorAssignments", ".", "map", "(", "(", "ba", ")", "=>", "ba", ".", "identifier", ")", ")", ",", "[", "[", "'BasicBehavior1'", "]", ",", "[", "'ArrayOfBehaviors'", "]", ",", "[", "'BasicBehavior1'", ",", "'DefaultBehavior'", "]", "]", ")", ";", "assert", ".", "deepEqual", "(", "elements", ".", "map", "(", "(", "e", ")", "=>", "[", "...", "e", ".", "methods", ".", "keys", "(", ")", "]", ")", ",", "[", "[", "'method1'", "]", ",", "[", "'method1'", ",", "'method2'", "]", ",", "[", "'method1'", ",", "'method3'", "]", "]", ")", ";", "}", ")", ";", "}", ")", ";" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 19, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 24293, null, null, null, null, null, null, null, null, null, null, 37614, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 37614, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 13364, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 17341, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 17341, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 37614, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 37614, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 13364, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1519, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 17343, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 17343, null, null, null, null, null, null, null, null, null, 17341, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 17343, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1329
[ "license", "import", "*", "as", "babel", "from", "'@babel/types'", ";", "import", "{", "assert", "}", "from", "'chai'", ";", "import", "{", "HtmlParser", "}", "from", "'../../html/html-parser'", ";", "import", "{", "JavaScriptParser", "}", "from", "'../../javascript/javascript-parser'", ";", "import", "{", "AttributeDatabindingExpression", ",", "parseExpressionInJsStringLiteral", ",", "scanDocumentForExpressions", ",", "TextNodeDatabindingExpression", "}", "from", "'../../polymer/expression-scanner'", ";", "import", "{", "PackageUrlResolver", "}", "from", "'../../url-loader/package-url-resolver'", ";", "import", "{", "CodeUnderliner", ",", "resolvedUrl", "}", "from", "'../test-utils'", ";", "suite", "(", "'ExpressionScanner'", ",", "(", ")", "=>", "{", "suite", "(", "'scanning html for expressions'", ",", "(", ")", "=>", "{", "test", "(", "'finds whole-attribute expressions'", ",", "async", "(", ")", "=>", "{", "const", "contents", "=", "`\n <dom-module id=\"foo-elem\">\n <template>\n <div id=\"{{foo}}\"></div>\n <input value=\"{{val::changed}}\">\n <template is=\"dom-if\">\n <div id=\"[[bar]]\"></div>\n </template>\n <div id=\"{{bada(wing, daba.boom, 10, -20)}}\"></div>\n </template>\n <script>\n Polymer({\n is: 'foo-elem',\n });\n </script>\n </dom-module>\n\n <div id=\"{{nope}}\"></div>\n <template>\n <div id=\"{{notHereEither}}\"></div>\n </template>\n\n <template is=\"dom-bind\">\n <div id=\"{{baz}}\"></div>\n <div id=\"{{camel.casePath}}\"></div>\n <div id=\"{{kebab.case-path}}\"></div>\n </template>\n `", ";", "const", "underliner", "=", "CodeUnderliner", ".", "withMapping", "(", "resolvedUrl", "`test.html`", ",", "contents", ")", ";", "const", "document", "=", "new", "HtmlParser", "(", ")", ".", "parse", "(", "contents", ",", "resolvedUrl", "`test.html`", ",", "new", "PackageUrlResolver", "(", ")", ")", ";", "const", "results", "=", "await", "scanDocumentForExpressions", "(", "document", ")", ";", "const", "generalExpressions", "=", "results", ".", "expressions", ";", "assert", ".", "deepEqual", "(", "results", ".", "warnings", ",", "[", "]", ")", ";", "assert", ".", "deepEqual", "(", "generalExpressions", ".", "map", "(", "(", "e", ")", "=>", "e", ".", "databindingInto", ")", ",", "[", "'attribute'", ",", "'attribute'", ",", "'attribute'", ",", "'attribute'", ",", "'attribute'", ",", "'attribute'", ",", "'attribute'", "]", ")", ";", "const", "expressions", "=", "generalExpressions", "as", "AttributeDatabindingExpression", "[", "]", ";", "assert", ".", "deepEqual", "(", "await", "underliner", ".", "underline", "(", "expressions", ".", "map", "(", "(", "e", ")", "=>", "e", ".", "sourceRange", ")", ")", ",", "[", "`\n <div id=\"{{foo}}\"></div>\n ~~~`", ",", "`\n <input value=\"{{val::changed}}\">\n ~~~~~~~~~~~~`", ",", "`\n <div id=\"{{bada(wing, daba.boom, 10, -20)}}\"></div>\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`", ",", "`\n <div id=\"[[bar]]\"></div>\n ~~~`", ",", "`\n <div id=\"{{baz}}\"></div>\n ~~~`", ",", "`\n <div id=\"{{camel.casePath}}\"></div>\n ~~~~~~~~~~~~~~`", ",", "`\n <div id=\"{{kebab.case-path}}\"></div>\n ~~~~~~~~~~~~~~~`", ",", "]", ")", ";", "assert", ".", "deepEqual", "(", "expressions", ".", "map", "(", "(", "e", ")", "=>", "e", ".", "direction", ")", ",", "[", "'{'", ",", "'{'", ",", "'{'", ",", "'['", ",", "'{'", ",", "'{'", ",", "'{'", "]", ")", ";", "assert", ".", "deepEqual", "(", "expressions", ".", "map", "(", "(", "e", ")", "=>", "e", ".", "expressionText", ")", ",", "[", "'foo'", ",", "'val'", ",", "'bada(wing, daba.boom, 10, -20)'", ",", "'bar'", ",", "'baz'", ",", "'camel.casePath'", ",", "'kebab.case-path'", "]", ")", ";", "assert", ".", "deepEqual", "(", "expressions", ".", "map", "(", "(", "e", ")", "=>", "e", ".", "eventName", ")", ",", "[", "undefined", ",", "'changed'", ",", "undefined", ",", "undefined", ",", "undefined", ",", "undefined", ",", "undefined", "]", ")", ";", "assert", ".", "deepEqual", "(", "expressions", ".", "map", "(", "(", "e", ")", "=>", "e", ".", "attribute", "&&", "e", ".", "attribute", ".", "name", ")", ",", "[", "'id'", ",", "'value'", ",", "'id'", ",", "'id'", ",", "'id'", ",", "'id'", ",", "'id'", "]", ")", ";", "assert", ".", "deepEqual", "(", "expressions", ".", "map", "(", "(", "e", ")", "=>", "e", ".", "properties", ".", "map", "(", "(", "p", ")", "=>", "p", ".", "name", ")", ")", ",", "[", "[", "'foo'", "]", ",", "[", "'val'", "]", ",", "[", "'bada'", ",", "'wing'", ",", "'daba'", "]", ",", "[", "'bar'", "]", ",", "[", "'baz'", "]", ",", "[", "'camel'", "]", ",", "[", "'kebab'", "]", "]", ")", ";", "assert", ".", "deepEqual", "(", "expressions", ".", "map", "(", "(", "e", ")", "=>", "e", ".", "warnings", ")", ",", "[", "[", "]", ",", "[", "]", ",", "[", "]", ",", "[", "]", ",", "[", "]", ",", "[", "]", ",", "[", "]", "]", ")", ";", "assert", ".", "deepEqual", "(", "expressions", ".", "map", "(", "(", "e", ")", "=>", "e", ".", "isCompleteBinding", ")", ",", "[", "true", ",", "true", ",", "true", ",", "true", ",", "true", ",", "true", ",", "true", "]", ")", ";", "}", ")", ";", "test", "(", "'finds interpolated attribute expressions'", ",", "async", "(", ")", "=>", "{", "const", "contents", "=", "`\n <template is=\"dom-bind\">\n <div id=\" {{foo}}\"></div>\n <div id=\"bar {{val}} baz\">\n <div id=\" [[x]]{{y}}\"></div>\n </template>\n\n <div id=\" {{nope}}\"></div>\n <template>\n <div id=\"{{notHereEither}}\"></div>\n </template>\n\n `", ";", "const", "underliner", "=", "CodeUnderliner", ".", "withMapping", "(", "resolvedUrl", "`test.html`", ",", "contents", ")", ";", "const", "document", "=", "new", "HtmlParser", "(", ")", ".", "parse", "(", "contents", ",", "resolvedUrl", "`test.html`", ",", "new", "PackageUrlResolver", "(", ")", ")", ";", "const", "results", "=", "await", "scanDocumentForExpressions", "(", "document", ")", ";", "const", "generalExpressions", "=", "results", ".", "expressions", ";", "assert", ".", "deepEqual", "(", "results", ".", "warnings", ",", "[", "]", ")", ";", "assert", ".", "deepEqual", "(", "await", "underliner", ".", "underline", "(", "generalExpressions", ".", "map", "(", "(", "e", ")", "=>", "e", ".", "sourceRange", ")", ")", ",", "[", "`\n <div id=\" {{foo}}\"></div>\n ~~~`", ",", "`\n <div id=\"bar {{val}} baz\">\n ~~~`", ",", "`\n <div id=\" [[x]]{{y}}\"></div>\n ~`", ",", "`\n <div id=\" [[x]]{{y}}\"></div>\n ~`", "]", ")", ";", "const", "expressions", "=", "generalExpressions", "as", "AttributeDatabindingExpression", "[", "]", ";", "assert", ".", "deepEqual", "(", "expressions", ".", "map", "(", "(", "e", ")", "=>", "e", ".", "isCompleteBinding", ")", ",", "[", "false", ",", "false", ",", "false", ",", "false", "]", ")", ";", "assert", ".", "deepEqual", "(", "expressions", ".", "map", "(", "(", "e", ")", "=>", "e", ".", "direction", ")", ",", "[", "'{'", ",", "'{'", ",", "'['", ",", "'{'", "]", ")", ";", "assert", ".", "deepEqual", "(", "expressions", ".", "map", "(", "(", "e", ")", "=>", "e", ".", "expressionText", ")", ",", "[", "'foo'", ",", "'val'", ",", "'x'", ",", "'y'", "]", ")", ";", "assert", ".", "deepEqual", "(", "expressions", ".", "map", "(", "(", "e", ")", "=>", "e", ".", "properties", ".", "map", "(", "(", "p", ")", "=>", "p", ".", "name", ")", ")", ",", "[", "[", "'foo'", "]", ",", "[", "'val'", "]", ",", "[", "'x'", "]", ",", "[", "'y'", "]", "]", ")", ";", "assert", ".", "deepEqual", "(", "expressions", ".", "map", "(", "(", "e", ")", "=>", "e", ".", "warnings", ")", ",", "[", "[", "]", ",", "[", "]", ",", "[", "]", ",", "[", "]", "]", ")", ";", "assert", ".", "deepEqual", "(", "expressions", ".", "map", "(", "(", "e", ")", "=>", "e", ".", "eventName", ")", ",", "[", "undefined", ",", "undefined", ",", "undefined", ",", "undefined", "]", ")", ";", "assert", ".", "deepEqual", "(", "expressions", ".", "map", "(", "(", "e", ")", "=>", "e", ".", "attribute", "&&", "e", ".", "attribute", ".", "name", ")", ",", "[", "'id'", ",", "'id'", ",", "'id'", ",", "'id'", "]", ")", ";", "assert", ".", "deepEqual", "(", "expressions", ".", "map", "(", "(", "e", ")", "=>", "e", ".", "databindingInto", ")", ",", "[", "'attribute'", ",", "'attribute'", ",", "'attribute'", ",", "'attribute'", "]", ")", ";", "}", ")", ";", "test", "(", "'finds expressions in text nodes'", ",", "async", "(", ")", "=>", "{", "const", "contents", "=", "`\n <template is=\"dom-bind\">\n <div>{{foo}}</div>\n <div>\n {{bar}} + {{baz}}[[zod]]\n {{\n multiline(\n expressions\n )\n }}\n </div>\n </template>\n\n {{nope}}\n <template>\n <div id=\"{{notHereEither}}\"></div>\n </template>\n `", ";", "const", "underliner", "=", "CodeUnderliner", ".", "withMapping", "(", "resolvedUrl", "`test.html`", ",", "contents", ")", ";", "const", "document", "=", "new", "HtmlParser", "(", ")", ".", "parse", "(", "contents", ",", "resolvedUrl", "`test.html`", ",", "new", "PackageUrlResolver", "(", ")", ")", ";", "const", "results", "=", "await", "scanDocumentForExpressions", "(", "document", ")", ";", "const", "generalExpressions", "=", "results", ".", "expressions", ";", "assert", ".", "deepEqual", "(", "results", ".", "warnings", ",", "[", "]", ")", ";", "assert", ".", "deepEqual", "(", "generalExpressions", ".", "map", "(", "(", "e", ")", "=>", "e", ".", "databindingInto", ")", ",", "[", "'text-node'", ",", "'text-node'", ",", "'text-node'", ",", "'text-node'", ",", "'text-node'", "]", ")", ";", "const", "expressions", "=", "generalExpressions", "as", "TextNodeDatabindingExpression", "[", "]", ";", "assert", ".", "deepEqual", "(", "await", "underliner", ".", "underline", "(", "expressions", ".", "map", "(", "(", "e", ")", "=>", "e", ".", "sourceRange", ")", ")", ",", "[", "`\n <div>{{foo}}</div>\n ~~~`", ",", "`\n {{bar}} + {{baz}}[[zod]]\n ~~~`", ",", "`\n {{bar}} + {{baz}}[[zod]]\n ~~~`", ",", "`\n {{bar}} + {{baz}}[[zod]]\n ~~~`", ",", "`\n {{\n ~\n multiline(\n~~~~~~~~~~~~~~~~~~~~~~~~\n expressions\n~~~~~~~~~~~~~~~~~~~~~~~~~~~\n )\n~~~~~~~~~~~~~~~\n }}\n~~~~~~~~~~~~`", "]", ")", ";", "assert", ".", "deepEqual", "(", "expressions", ".", "map", "(", "(", "e", ")", "=>", "e", ".", "direction", ")", ",", "[", "'{'", ",", "'{'", ",", "'{'", ",", "'['", ",", "'{'", "]", ")", ";", "assert", ".", "deepEqual", "(", "expressions", ".", "map", "(", "(", "e", ")", "=>", "e", ".", "expressionText", ")", ",", "[", "'foo'", ",", "'bar'", ",", "'baz'", ",", "'zod'", ",", "`\n multiline(\n expressions\n )\n `", "]", ")", ";", "assert", ".", "deepEqual", "(", "expressions", ".", "map", "(", "(", "e", ")", "=>", "e", ".", "properties", ".", "map", "(", "(", "p", ")", "=>", "p", ".", "name", ")", ")", ",", "[", "[", "'foo'", "]", ",", "[", "'bar'", "]", ",", "[", "'baz'", "]", ",", "[", "'zod'", "]", ",", "[", "'multiline'", ",", "'expressions'", "]", "]", ")", ";", "assert", ".", "deepEqual", "(", "expressions", ".", "map", "(", "(", "e", ")", "=>", "e", ".", "warnings", ")", ",", "[", "[", "]", ",", "[", "]", ",", "[", "]", ",", "[", "]", ",", "[", "]", "]", ")", ";", "}", ")", ";", "test", "(", "'gives accurate locations for parse errors'", ",", "async", "(", ")", "=>", "{", "const", "contents", "=", "`\n <template is=\"dom-bind\">\n <div id=\"{{foo(}}\"></div>\n <div id='[[\n foo bar\n ]]'></div>\n {{]}}\n\n <!-- ignores expressions that are invalid JS -->\n <div id=\"{{foo(bar.*)}}\"></div>\n <div id=\"{{foo(bar.0)}}\"></div>\n\n <!-- finds warnings in valid JS but invalid Polymer expressions -->\n <div id=\"{{-foo}}\"></div>\n {{foo(!bar, () => baz)}}\n </template>\n `", ";", "const", "underliner", "=", "CodeUnderliner", ".", "withMapping", "(", "resolvedUrl", "`test.html`", ",", "contents", ")", ";", "const", "document", "=", "new", "HtmlParser", "(", ")", ".", "parse", "(", "contents", ",", "resolvedUrl", "`test.html`", ",", "new", "PackageUrlResolver", "(", ")", ")", ";", "const", "results", "=", "await", "scanDocumentForExpressions", "(", "document", ")", ";", "assert", ".", "deepEqual", "(", "await", "underliner", ".", "underline", "(", "results", ".", "warnings", ".", "map", "(", "(", "w", ")", "=>", "w", ".", "sourceRange", ")", ")", ",", "[", "`\n <div id=\"{{foo(}}\"></div>\n ~`", ",", "`\n foo bar\n ~`", ",", "`\n {{]}}\n ~`", ",", "`\n <div id=\"{{-foo}}\"></div>\n ~~~~`", ",", "`\n {{foo(!bar, () => baz)}}\n ~~~~`", ",", "`\n {{foo(!bar, () => baz)}}\n ~~~~~~~~~`", "]", ")", ";", "}", ")", ";", "}", ")", ";", "suite", "(", "'parsing expressions from javascript string literals'", ",", "(", ")", "=>", "{", "test", "(", "'it succeeds and fails properly'", ",", "async", "(", ")", "=>", "{", "const", "contents", "=", "`\n const observers = [\n 'foo(bar, baz)',\n 'foo(bar baz)',\n 'foo(bar.*)',\n 10,\n observerAssignedElsewhere,\n ];\n `", ";", "const", "underliner", "=", "CodeUnderliner", ".", "withMapping", "(", "resolvedUrl", "`test.html`", ",", "contents", ")", ";", "const", "javascriptDocument", "=", "new", "JavaScriptParser", "(", ")", ".", "parse", "(", "contents", ",", "resolvedUrl", "`test.html`", ",", "new", "PackageUrlResolver", "(", ")", ")", ";", "const", "literals", "=", "(", "javascriptDocument", ".", "ast", ".", "program", "as", "any", ")", ".", "body", "[", "0", "]", "[", "'declarations'", "]", "[", "0", "]", "[", "'init'", "]", "[", "'elements'", "]", ";", "const", "parsedLiterals", "=", "literals", ".", "map", "(", "(", "l", ")", "=>", "parseExpressionInJsStringLiteral", "(", "javascriptDocument", ",", "l", ",", "'full'", ")", ")", ";", "const", "warnings", "=", "parsedLiterals", ".", "map", "(", "(", "pl", ")", "=>", "pl", ".", "warnings", ")", ".", "reduce", "(", "(", "p", ",", "n", ")", "=>", "p", ".", "concat", "(", "n", ")", ",", "[", "]", ")", ";", "const", "expressionRanges", "=", "parsedLiterals", ".", "map", "(", "(", "pl", ")", "=>", "pl", ".", "databinding", "&&", "pl", ".", "databinding", ".", "sourceRange", ")", ";", "assert", ".", "deepEqual", "(", "await", "underliner", ".", "underline", "(", "expressionRanges", ")", ",", "[", "`\n 'foo(bar, baz)',\n ~~~~~~~~~~~~~`", ",", "`No source range given.`", ",", "`\n 'foo(bar.*)',\n ~~~~~~~~~~`", ",", "`No source range given.`", ",", "`No source range given.`", ",", "]", ")", ";", "assert", ".", "deepEqual", "(", "await", "underliner", ".", "underline", "(", "warnings", ")", ",", "[", "`\n 'foo(bar baz)',\n ~`", ",", "`\n 10,\n ~~`", ",", "`\n observerAssignedElsewhere,\n ~~~~~~~~~~~~~~~~~~~~~~~~~`", ",", "]", ")", ";", "}", ")", ";", "}", ")", ";", "}", ")", ";" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, 27934, null, null, null, null, null, null, null, null, null, null, null, null, 5827, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 23115, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 23115, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 23115, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 23115, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 23115, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 23115, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 23115, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 23115, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, 27934, null, null, null, null, null, null, null, null, null, null, null, null, 5827, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 23115, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 23115, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 23115, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 23115, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 23115, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 23115, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 23115, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 23115, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, 27934, null, null, null, null, null, null, null, null, null, null, null, null, 5827, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, 27934, null, null, null, null, null, null, null, null, null, null, null, null, 5827, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5893, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, 27934, null, null, null, null, null, null, null, null, null, null, null, null, 6782, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, 1688, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, 5, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1330
[ "license", "import", "{", "assert", "}", "from", "'chai'", ";", "import", "{", "ScannedPolymerElement", "}", "from", "'../../polymer/polymer-element'", ";", "import", "{", "PolymerElementScanner", "}", "from", "'../../polymer/polymer-element-scanner'", ";", "import", "{", "CodeUnderliner", ",", "runScannerOnContents", "}", "from", "'../test-utils'", ";", "suite", "(", "'PolymerElementScanner'", ",", "(", ")", "=>", "{", "test", "(", "'finds polymer elements'", ",", "async", "(", ")", "=>", "{", "const", "contents", "=", "`Polymer({\n is: 'x-foo',\n properties: {\n a: {\n type: Boolean,\n value: 5\n },\n b: {\n type: String,\n value: function() {\n return 'test';\n }\n },\n c: {\n type: Number,\n readOnly: true\n },\n d: {\n type: Number,\n computed: '_computeD(c)'\n },\n e: {\n type: String,\n notify: true\n },\n f: {\n type: Object,\n observer: '_observeF'\n },\n g: {\n type: {},\n computed: '_computeG(a, b)',\n readOnly: false\n },\n h: String,\n [i]: Boolean, // should not be recognized,\n ['j']: Boolean,\n 'k': Boolean,\n all: {\n type: Object,\n notify: true,\n readOnly: false,\n reflectToAttribute: false,\n observer: '_observeAll'\n }\n },\n observers: [\n '_anObserver(foo, bar)',\n '_anotherObserver(foo)'\n ],\n listeners: {\n 'event-a': '_handleA',\n eventb: '_handleB',\n 'event-c': _handleC,\n [['event', 'd'].join('-')]: '_handleD'\n },\n customPublicMethod: (foo, bar) => { return foo + bar; },\n _customPrivateMethod: (foo, bar) => { return foo + bar; },\n /**\n * This is an instance method with JS Doc\n * @param {string} foo The first argument.\n * @param {number} bar The second argument.\n * @returns {boolean} The return.\n */\n customPublicMethodWithJsDoc: (foo, bar) => { return foo + bar; },\n customPublicMethodWithClassicFunction: function(foo, bar) { return foo + bar; },\n shorthandMethod(foo, bar) { return foo + bar; },\n\n /** @return {string} */\n get getterNoSetter() { },\n\n /** @return {string} */\n get getterSetter() { },\n\n /** @param {string} value */\n set getterSetter(value) { },\n });\n Polymer({\n is: 'x-bar',\n listeners: []\n });`", ";", "const", "{", "features", ":", "untypedFeatures", "}", "=", "await", "runScannerOnContents", "(", "new", "PolymerElementScanner", "(", ")", ",", "'test-file.js'", ",", "contents", ")", ";", "const", "features", "=", "untypedFeatures", "as", "ScannedPolymerElement", "[", "]", ";", "assert", ".", "deepEqual", "(", "features", "[", "0", "]", ".", "observers", ".", "map", "(", "(", "o", ")", "=>", "o", ".", "expression", ")", ",", "[", "'_anObserver(foo, bar)'", ",", "'_anotherObserver(foo)'", "]", ")", ";", "assert", ".", "deepEqual", "(", "features", "[", "0", "]", ".", "observers", ".", "map", "(", "(", "o", ")", "=>", "o", ".", "parsedExpression", "!", ".", "properties", ".", "map", "(", "(", "p", ")", "=>", "p", ".", "name", ")", ")", ",", "[", "[", "'_anObserver'", ",", "'foo'", ",", "'bar'", "]", ",", "[", "'_anotherObserver'", ",", "'foo'", "]", "]", ")", ";", "const", "properties", "=", "Array", ".", "from", "(", "features", "[", "0", "]", ".", "properties", ".", "values", "(", ")", ")", ";", "assert", ".", "deepEqual", "(", "properties", ".", "filter", "(", "(", "p", ")", "=>", "p", ".", "observerExpression", ")", ".", "map", "(", "(", "p", ")", "=>", "[", "p", ".", "name", ",", "p", ".", "observerExpression", "!", ".", "properties", ".", "map", "(", "(", "sp", ")", "=>", "sp", ".", "name", ")", "]", ")", ",", "[", "[", "'f'", ",", "[", "'_observeF'", "]", "]", ",", "[", "'all'", ",", "[", "'_observeAll'", "]", "]", "]", ")", ";", "assert", ".", "deepEqual", "(", "properties", ".", "filter", "(", "(", "p", ")", "=>", "p", ".", "computedExpression", ")", ".", "map", "(", "(", "p", ")", "=>", "[", "p", ".", "name", ",", "p", ".", "computedExpression", "!", ".", "properties", ".", "map", "(", "(", "sp", ")", "=>", "sp", ".", "name", ")", "]", ")", ",", "[", "[", "'d'", ",", "[", "'_computeD'", ",", "'c'", "]", "]", ",", "[", "'g'", ",", "[", "'_computeG'", ",", "'a'", ",", "'b'", "]", "]", "]", ")", ";", "assert", ".", "deepEqual", "(", "Array", ".", "from", "(", "features", "[", "0", "]", ".", "events", ".", "values", "(", ")", ")", ".", "map", "(", "(", "e", ")", "=>", "e", ".", "name", ")", ",", "[", "'e-changed'", ",", "'all-changed'", "]", ")", ";", "assert", ".", "deepEqual", "(", "properties", ".", "map", "(", "(", "p", ")", "=>", "p", ".", "name", ")", ",", "[", "'a'", ",", "'b'", ",", "'c'", ",", "'d'", ",", "'e'", ",", "'f'", ",", "'g'", ",", "'h'", ",", "'j'", ",", "'k'", ",", "'all'", ",", "'getterNoSetter'", ",", "'getterSetter'", ",", "]", ")", ";", "assert", ".", "deepEqual", "(", "properties", ".", "filter", "(", "(", "p", ")", "=>", "p", ".", "warnings", ".", "length", ">", "0", ")", ".", "map", "(", "(", "p", ")", "=>", "[", "p", ".", "name", ",", "p", ".", "warnings", ".", "map", "(", "(", "w", ")", "=>", "w", ".", "message", ")", "]", ")", ",", "[", "[", "'g'", ",", "[", "'Invalid type in property object.'", ",", "'Unable to determine type for property.'", "]", "]", "]", ")", ";", "const", "methods", "=", "Array", ".", "from", "(", "features", "[", "0", "]", ".", "methods", ".", "values", "(", ")", ")", ";", "assert", ".", "deepEqual", "(", "methods", ".", "map", "(", "(", "m", ")", "=>", "m", ".", "name", ")", ",", "[", "'customPublicMethod'", ",", "'_customPrivateMethod'", ",", "'customPublicMethodWithJsDoc'", ",", "'customPublicMethodWithClassicFunction'", ",", "'shorthandMethod'", ",", "]", ")", ";", "const", "jsDocMethod", "=", "features", "[", "0", "]", ".", "methods", ".", "get", "(", "'customPublicMethodWithJsDoc'", ")", "!", ";", "assert", ".", "deepEqual", "(", "jsDocMethod", ".", "return", "!", ",", "{", "type", ":", "'boolean'", ",", "desc", ":", "'The return.'", ",", "}", ")", ";", "assert", ".", "deepEqual", "(", "jsDocMethod", ".", "params", "!", ".", "map", "(", "(", "p", ")", "=>", "[", "p", ".", "name", ",", "p", ".", "type", ",", "p", ".", "description", "]", ")", ",", "[", "[", "'foo'", ",", "'string'", ",", "'The first argument.'", "]", ",", "[", "'bar'", ",", "'number'", ",", "'The second argument.'", "]", ",", "]", ")", ";", "assert", ".", "deepEqual", "(", "properties", ".", "map", "(", "(", "p", ")", "=>", "[", "p", ".", "name", ",", "p", ".", "type", "]", ")", ",", "[", "[", "'a'", ",", "'boolean | null | undefined'", "]", ",", "[", "'b'", ",", "'string | null | undefined'", "]", ",", "[", "'c'", ",", "'number | null | undefined'", "]", ",", "[", "'d'", ",", "'number | null | undefined'", "]", ",", "[", "'e'", ",", "'string | null | undefined'", "]", ",", "[", "'f'", ",", "'Object | null | undefined'", "]", ",", "[", "'g'", ",", "undefined", "]", ",", "[", "'h'", ",", "'string | null | undefined'", "]", ",", "[", "'j'", ",", "'boolean | null | undefined'", "]", ",", "[", "'k'", ",", "'boolean | null | undefined'", "]", ",", "[", "'all'", ",", "'Object | null | undefined'", "]", ",", "[", "'getterNoSetter'", ",", "'string'", "]", ",", "[", "'getterSetter'", ",", "'string'", "]", ",", "]", ")", ";", "assert", ".", "deepEqual", "(", "Array", ".", "from", "(", "features", "[", "0", "]", ".", "attributes", ".", "values", "(", ")", ")", ".", "map", "(", "(", "p", ")", "=>", "[", "p", ".", "name", ",", "p", ".", "changeEvent", "]", ")", ",", "[", "[", "'a'", ",", "undefined", "]", ",", "[", "'b'", ",", "undefined", "]", ",", "[", "'c'", ",", "undefined", "]", ",", "[", "'d'", ",", "undefined", "]", ",", "[", "'e'", ",", "'e-changed'", "]", ",", "[", "'f'", ",", "undefined", "]", ",", "[", "'g'", ",", "undefined", "]", ",", "[", "'h'", ",", "undefined", "]", ",", "[", "'j'", ",", "undefined", "]", ",", "[", "'k'", ",", "undefined", "]", ",", "[", "'all'", ",", "'all-changed'", "]", "]", ")", ";", "assert", ".", "deepEqual", "(", "properties", ".", "filter", "(", "(", "p", ")", "=>", "p", ".", "readOnly", ")", ".", "map", "(", "(", "p", ")", "=>", "p", ".", "name", ")", ",", "[", "'c'", ",", "'d'", ",", "'g'", ",", "'getterNoSetter'", "]", ")", ";", "assert", ".", "deepEqual", "(", "properties", ".", "filter", "(", "(", "p", ")", "=>", "p", ".", "default", ")", ".", "map", "(", "(", "p", ")", "=>", "[", "p", ".", "name", ",", "p", ".", "default", "]", ")", ",", "[", "[", "'a'", ",", "'5'", "]", ",", "[", "'b'", ",", "'\"test\"'", "]", "]", ")", ";", "assert", ".", "deepEqual", "(", "properties", ".", "filter", "(", "(", "p", ")", "=>", "p", ".", "notify", ")", ".", "map", "(", "(", "p", ")", "=>", "p", ".", "name", ")", ",", "[", "'e'", ",", "'all'", "]", ")", ";", "assert", ".", "deepEqual", "(", "features", "[", "0", "]", ".", "listeners", ",", "[", "{", "event", ":", "'event-a'", ",", "handler", ":", "'_handleA'", "}", ",", "{", "event", ":", "'eventb'", ",", "handler", ":", "'_handleB'", "}", "]", ")", ";", "assert", ".", "equal", "(", "features", "[", "0", "]", ".", "warnings", ".", "filter", "(", "(", "w", ")", "=>", "w", ".", "code", "===", "'invalid-listeners-declaration'", ")", ".", "length", ",", "0", ")", ";", "assert", ".", "equal", "(", "features", "[", "1", "]", ".", "warnings", ".", "filter", "(", "(", "w", ")", "=>", "w", ".", "code", "===", "'invalid-listeners-declaration'", ")", ".", "length", ",", "1", ")", ";", "}", ")", ";", "test", "(", "'finds declared and assigned call expressions'", ",", "async", "(", ")", "=>", "{", "const", "contents", "=", "`\n const MyOtherElement = Polymer({\n is: 'my-other-element'\n });\n\n window.MyElement = Polymer({is: 'my-element'});\n `", ";", "const", "{", "features", ":", "untypedFeatures", "}", "=", "await", "runScannerOnContents", "(", "new", "PolymerElementScanner", "(", ")", ",", "'test-file.js'", ",", "contents", ")", ";", "const", "features", "=", "untypedFeatures", "as", "ScannedPolymerElement", "[", "]", ";", "assert", ".", "deepEqual", "(", "features", ".", "map", "(", "(", "f", ")", "=>", "f", ".", "tagName", ")", ",", "[", "'my-other-element'", ",", "'my-element'", "]", ")", ";", "assert", ".", "deepEqual", "(", "features", ".", "map", "(", "(", "f", ")", "=>", "f", ".", "className", ")", ",", "[", "'MyOtherElement'", ",", "'window.MyElement'", "]", ")", ";", "}", ")", ";", "const", "testName", "=", "'Produces correct warnings for bad observers and computed properties'", ";", "test", "(", "testName", ",", "async", "(", ")", "=>", "{", "const", "contents", "=", "`\n Polymer({\n is: 'x-foo',\n properties: {\n parseError: {\n type: String,\n computed: 'let let let',\n observer: 'let let let',\n },\n badKindOfExpression: {\n type: String,\n computed: 'foo',\n observer: 'foo(bar, baz)'\n }\n },\n observers: [\n 'let let let parseError',\n 'foo'\n ],\n method() {\n const shouldIgnore = {\n ignore: 'please',\n meToo: true\n }\n }\n });`", ";", "const", "{", "features", ":", "untypedFeatures", ",", "analyzer", "}", "=", "await", "runScannerOnContents", "(", "new", "PolymerElementScanner", "(", ")", ",", "'test-file.js'", ",", "contents", ")", ";", "const", "features", "=", "untypedFeatures", "as", "ScannedPolymerElement", "[", "]", ";", "const", "underliner", "=", "new", "CodeUnderliner", "(", "analyzer", ")", ";", "assert", ".", "deepEqual", "(", "features", ".", "length", ",", "1", ")", ";", "const", "element", "=", "features", "[", "0", "]", "!", ";", "assert", ".", "deepEqual", "(", "Array", ".", "from", "(", "element", ".", "properties", ".", "keys", "(", ")", ")", ",", "[", "'parseError'", ",", "'badKindOfExpression'", "]", ")", ";", "assert", ".", "deepEqual", "(", "await", "Promise", ".", "all", "(", "Array", ".", "from", "(", "element", ".", "properties", ".", "values", "(", ")", ")", ".", "map", "(", "(", "p", ")", "=>", "underliner", ".", "underline", "(", "p", ".", "warnings", ")", ")", ")", ",", "[", "[", "`\n computed: 'let let let',\n ~`", ",", "`\n observer: 'let let let',\n ~`", "]", ",", "[", "`\n computed: 'foo',\n ~~~`", ",", "`\n observer: 'foo(bar, baz)'\n ~~~~~~~~~~~~~`", "]", "]", ")", ";", "assert", ".", "deepEqual", "(", "await", "underliner", ".", "underline", "(", "element", ".", "warnings", ")", ",", "[", "`\n 'let let let parseError',\n ~`", ",", "`\n 'foo'\n ~~~`", "]", ")", ";", "}", ")", ";", "test", "(", "'Polymer 2 class observers crash'", ",", "async", "(", ")", "=>", "{", "const", "contents", "=", "`class TestElement extends Polymer.Element {\n static get observers() {\n return foo.bar;\n }\n }`", ";", "await", "runScannerOnContents", "(", "new", "PolymerElementScanner", "(", ")", ",", "'test-file.js'", ",", "contents", ")", ";", "}", ")", ";", "}", ")", ";" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 708, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 708, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 13364, null, null, null, null, null, null, null, null, null, null, 13364, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 13364, null, null, null, null, null, null, null, null, null, null, 13364, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 13364, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 13364, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 13364, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5893, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 17965, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 17965, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 31919, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 13364, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 13364, null, null, null, null, null, null, null, null, null, null, 13364, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 13364, null, null, null, null, null, null, null, null, null, null, 13364, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 13364, null, null, null, null, null, null, null, null, null, null, 13364, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5893, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5893, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 19659, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 19659, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, 27934, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 19659, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 13364, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1331
[ "license", "import", "{", "assert", ",", "use", "as", "chaiUse", "}", "from", "'chai'", ";", "import", "*", "as", "path", "from", "'path'", ";", "import", "{", "ClassScanner", "}", "from", "'../../javascript/class-scanner'", ";", "import", "{", "ScannedPolymerElement", "}", "from", "'../../polymer/polymer-element'", ";", "import", "{", "createForDirectory", ",", "fixtureDir", ",", "runScanner", "}", "from", "'../test-utils'", ";", "chaiUse", "(", "require", "(", "'chai-subset'", ")", ")", ";", "suite", "(", "'Polymer2ElementScanner with old jsdoc annotations'", ",", "async", "(", ")", "=>", "{", "const", "testFilesDir", "=", "path", ".", "resolve", "(", "fixtureDir", ",", "'polymer2-old-jsdoc/'", ")", ";", "const", "{", "analyzer", ",", "underliner", "}", "=", "await", "createForDirectory", "(", "testFilesDir", ")", ";", "async", "function", "getElements", "(", "filename", ")", "{", "const", "{", "features", "}", "=", "await", "runScanner", "(", "analyzer", ",", "new", "ClassScanner", "(", ")", ",", "filename", ")", ";", "return", "features", ".", "filter", "(", "(", "e", ")", "=>", "e", "instanceof", "ScannedPolymerElement", ")", "as", "ScannedPolymerElement", "[", "]", ";", "}", ";", "async", "function", "getTestProps", "(", "element", ")", "{", "const", "props", "=", "{", "className", ":", "element", ".", "className", ",", "superClass", ":", "element", ".", "superClass", "&&", "element", ".", "superClass", ".", "identifier", ",", "tagName", ":", "element", ".", "tagName", ",", "description", ":", "element", ".", "description", ",", "summary", ":", "element", ".", "summary", ",", "properties", ":", "await", "Promise", ".", "all", "(", "Array", ".", "from", "(", "element", ".", "properties", ".", "values", "(", ")", ")", ".", "map", "(", "async", "(", "p", ")", "=>", "{", "const", "result", "=", "{", "name", ":", "p", ".", "name", ",", "description", ":", "p", ".", "description", "}", "as", "any", ";", "if", "(", "p", ".", "type", ")", "{", "result", ".", "type", "=", "p", ".", "type", ";", "}", "if", "(", "p", ".", "observerExpression", ")", "{", "result", ".", "propertiesInObserver", "=", "p", ".", "observerExpression", ".", "properties", ".", "map", "(", "(", "p", ")", "=>", "p", ".", "name", ")", ";", "}", "if", "(", "p", ".", "computedExpression", ")", "{", "result", ".", "propertiesInComputed", "=", "p", ".", "computedExpression", ".", "properties", ".", "map", "(", "(", "p", ")", "=>", "p", ".", "name", ")", ";", "}", "if", "(", "p", ".", "warnings", ".", "length", ">", "0", ")", "{", "result", ".", "warningUnderlines", "=", "await", "underliner", ".", "underline", "(", "p", ".", "warnings", ")", ";", "}", "return", "result", ";", "}", ")", ")", ",", "attributes", ":", "Array", ".", "from", "(", "element", ".", "attributes", ".", "values", "(", ")", ")", ".", "map", "(", "(", "a", ")", "=>", "(", "{", "name", ":", "a", ".", "name", ",", "}", ")", ")", ",", "methods", ":", "Array", ".", "from", "(", "element", ".", "methods", ".", "values", "(", ")", ")", ".", "map", "(", "(", "m", ")", "=>", "(", "{", "name", ":", "m", ".", "name", ",", "params", ":", "m", ".", "params", ",", "return", ":", "m", ".", "return", ",", "description", ":", "m", ".", "description", "}", ")", ")", ",", "warningUnderlines", ":", "await", "underliner", ".", "underline", "(", "element", ".", "warnings", ")", ",", "}", ";", "if", "(", "element", ".", "observers", ".", "length", ">", "0", ")", "{", "props", ".", "observers", "=", "element", ".", "observers", ".", "map", "(", "(", "o", ")", "=>", "o", ".", "expression", ")", ";", "props", ".", "observerProperties", "=", "element", ".", "observers", ".", "filter", "(", "(", "o", ")", "=>", "o", ".", "parsedExpression", ")", ".", "map", "(", "(", "o", ")", "=>", "o", ".", "parsedExpression", "!", ".", "properties", ".", "map", "(", "(", "p", ")", "=>", "p", ".", "name", ")", ")", ";", "}", "if", "(", "element", ".", "mixins", ".", "length", ">", "0", ")", "{", "props", ".", "mixins", "=", "element", ".", "mixins", ".", "map", "(", "(", "m", ")", "=>", "m", ".", "identifier", ")", ";", "}", "return", "props", ";", "}", "test", "(", "'Finds two basic elements'", ",", "async", "(", ")", "=>", "{", "const", "elements", "=", "await", "getElements", "(", "'test-element-1.js'", ")", ";", "const", "elementData", "=", "await", "Promise", ".", "all", "(", "elements", ".", "map", "(", "getTestProps", ")", ")", ";", "assert", ".", "deepEqual", "(", "elementData", ",", "[", "{", "tagName", ":", "'test-element'", ",", "className", ":", "'TestElement'", ",", "superClass", ":", "'Polymer.Element'", ",", "description", ":", "''", ",", "summary", ":", "''", ",", "properties", ":", "[", "{", "name", ":", "'foo'", ",", "description", ":", "'The foo prop.'", ",", "type", ":", "'(m-test | function)'", ",", "}", "]", ",", "attributes", ":", "[", "{", "name", ":", "'foo'", ",", "}", "]", ",", "methods", ":", "[", "]", ",", "warningUnderlines", ":", "[", "]", ",", "}", ",", "{", "tagName", ":", "undefined", ",", "className", ":", "'BaseElement'", ",", "superClass", ":", "'Polymer.Element'", ",", "description", ":", "'A very basic element'", ",", "summary", ":", "'A basic element'", ",", "properties", ":", "[", "{", "name", ":", "'foo'", ",", "description", ":", "'A base foo element.'", ",", "type", ":", "'string | null | undefined'", ",", "}", "]", ",", "attributes", ":", "[", "{", "name", ":", "'foo'", ",", "}", "]", ",", "methods", ":", "[", "]", ",", "warningUnderlines", ":", "[", "]", ",", "}", ",", "]", ")", ";", "const", "underlinedSource1", "=", "await", "underliner", ".", "underline", "(", "elements", "[", "0", "]", ".", "sourceRange", ")", ";", "assert", ".", "equal", "(", "underlinedSource1", ",", "`\nclass TestElement extends Polymer.Element {\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n static get properties() {\n~~~~~~~~~~~~~~~~~~~~~~~~~~~\n return {\n~~~~~~~~~~~~\n /**\n~~~~~~~~~\n * The foo prop.\n~~~~~~~~~~~~~~~~~~~~~~\n * @public\n~~~~~~~~~~~~~~~~\n * @type {m-test|function}\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n */\n~~~~~~~~~\n foo: {\n~~~~~~~~~~~~\n notify: true,\n~~~~~~~~~~~~~~~~~~~~~\n type: String,\n~~~~~~~~~~~~~~~~~~~~~\n }\n~~~~~~~\n }\n~~~~~\n }\n~~~\n}\n~`", ")", ";", "const", "underlinedSource2", "=", "await", "underliner", ".", "underline", "(", "elements", "[", "1", "]", ".", "sourceRange", ")", ";", "assert", ".", "equal", "(", "underlinedSource2", ",", "`\nclass BaseElement extends Polymer.Element {\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n static get properties() {\n~~~~~~~~~~~~~~~~~~~~~~~~~~~\n return {\n~~~~~~~~~~~~\n /** A base foo element. */\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n foo: {\n~~~~~~~~~~~~\n notify: true,\n~~~~~~~~~~~~~~~~~~~~~\n type: String,\n~~~~~~~~~~~~~~~~~~~~~\n },\n~~~~~~~~\n };\n~~~~~~\n }\n~~~\n}\n~`", ")", ";", "}", ")", ";", "test", "(", "'Uses static is getter for tagName'", ",", "async", "(", ")", "=>", "{", "const", "elements", "=", "await", "getElements", "(", "'test-element-2.js'", ")", ";", "const", "elementData", "=", "await", "Promise", ".", "all", "(", "elements", ".", "map", "(", "getTestProps", ")", ")", ";", "assert", ".", "deepEqual", "(", "elementData", ",", "[", "{", "tagName", ":", "'test-element'", ",", "className", ":", "'TestElement'", ",", "superClass", ":", "'HTMLElement'", ",", "description", ":", "''", ",", "summary", ":", "''", ",", "properties", ":", "[", "]", ",", "attributes", ":", "[", "]", ",", "methods", ":", "[", "]", ",", "warningUnderlines", ":", "[", "]", ",", "}", ",", "]", ")", ";", "}", ")", ";", "test", "(", "'Finds vanilla elements'", ",", "async", "(", ")", "=>", "{", "const", "elements", "=", "await", "getElements", "(", "'test-element-4.js'", ")", ";", "const", "elementData", "=", "await", "Promise", ".", "all", "(", "elements", ".", "map", "(", "getTestProps", ")", ")", ";", "assert", ".", "deepEqual", "(", "elementData", ",", "[", "{", "tagName", ":", "'test-element'", ",", "className", ":", "'TestElement'", ",", "superClass", ":", "'HTMLElement'", ",", "description", ":", "''", ",", "summary", ":", "''", ",", "properties", ":", "[", "]", ",", "attributes", ":", "[", "{", "name", ":", "'a'", ",", "}", ",", "{", "name", ":", "'b'", ",", "}", "]", ",", "methods", ":", "[", "]", ",", "warningUnderlines", ":", "[", "]", ",", "}", ",", "]", ")", ";", "}", ")", ";", "test", "(", "'Observed attributes override induced attributes'", ",", "async", "(", ")", "=>", "{", "const", "elements", "=", "await", "getElements", "(", "'test-element-5.js'", ")", ";", "const", "elementData", "=", "await", "Promise", ".", "all", "(", "elements", ".", "map", "(", "getTestProps", ")", ")", ";", "assert", ".", "deepEqual", "(", "elementData", ",", "[", "{", "tagName", ":", "'test-element'", ",", "className", ":", "'TestElement'", ",", "superClass", ":", "'Polymer.Element'", ",", "description", ":", "''", ",", "summary", ":", "''", ",", "properties", ":", "[", "{", "name", ":", "'foo'", ",", "description", ":", "''", ",", "type", ":", "'string | null | undefined'", ",", "}", "]", ",", "attributes", ":", "[", "{", "name", ":", "'a'", ",", "}", ",", "{", "name", ":", "'b'", ",", "}", "]", ",", "methods", ":", "[", "]", ",", "warningUnderlines", ":", "[", "]", ",", "}", ",", "]", ")", ";", "}", ")", ";", "test", "(", "'properly sets className for elements with the memberof tag'", ",", "async", "(", ")", "=>", "{", "const", "elements", "=", "await", "getElements", "(", "'test-element-8.js'", ")", ";", "const", "elementData", "=", "await", "Promise", ".", "all", "(", "elements", ".", "map", "(", "getTestProps", ")", ")", ";", "assert", ".", "deepEqual", "(", "elementData", ",", "[", "{", "tagName", ":", "'test-element-one'", ",", "className", ":", "'Polymer.TestElementOne'", ",", "superClass", ":", "'Polymer.Element'", ",", "description", ":", "`This element is a member of Polymer namespace and is registered with its\nnamespaced name.`", ",", "summary", ":", "''", ",", "properties", ":", "[", "{", "name", ":", "'foo'", ",", "description", ":", "''", ",", "type", ":", "'string | null | undefined'", ",", "}", "]", ",", "attributes", ":", "[", "{", "name", ":", "'foo'", ",", "}", "]", ",", "methods", ":", "[", "]", ",", "warningUnderlines", ":", "[", "]", ",", "}", ",", "{", "tagName", ":", "'test-element-two'", ",", "className", ":", "'Polymer.TestElementTwo'", ",", "superClass", ":", "'Polymer.Element'", ",", "description", ":", "`This element is a member of Polymer namespace and is registered without its\nnamespaced name.`", ",", "summary", ":", "''", ",", "properties", ":", "[", "{", "name", ":", "'foo'", ",", "description", ":", "''", ",", "type", ":", "'string | null | undefined'", ",", "}", "]", ",", "attributes", ":", "[", "{", "name", ":", "'foo'", ",", "}", "]", ",", "methods", ":", "[", "]", ",", "warningUnderlines", ":", "[", "]", ",", "}", "]", ")", ";", "}", ")", ";", "test", "(", "'Read @appliesMixin annotations'", ",", "async", "(", ")", "=>", "{", "const", "elements", "=", "await", "getElements", "(", "'test-element-6.js'", ")", ";", "const", "elementData", "=", "await", "Promise", ".", "all", "(", "elements", ".", "map", "(", "getTestProps", ")", ")", ";", "assert", ".", "deepEqual", "(", "elementData", ",", "[", "{", "tagName", ":", "'test-element'", ",", "className", ":", "'TestElement'", ",", "superClass", ":", "'Polymer.Element'", ",", "description", ":", "''", ",", "summary", ":", "''", ",", "properties", ":", "[", "]", ",", "attributes", ":", "[", "]", ",", "methods", ":", "[", "]", ",", "mixins", ":", "[", "'Mixin2'", ",", "'Mixin1'", "]", ",", "warningUnderlines", ":", "[", "]", ",", "}", ",", "]", ")", ";", "}", ")", ";", "test", "(", "'Reads just @appliesMixin annotation'", ",", "async", "(", ")", "=>", "{", "const", "elements", "=", "await", "getElements", "(", "'test-element-9.js'", ")", ";", "const", "elementData", "=", "await", "Promise", ".", "all", "(", "elements", ".", "map", "(", "getTestProps", ")", ")", ";", "assert", ".", "deepEqual", "(", "elementData", ",", "[", "{", "tagName", ":", "undefined", ",", "className", ":", "'BaseElement'", ",", "superClass", ":", "'Polymer.Element'", ",", "description", ":", "''", ",", "summary", ":", "''", ",", "properties", ":", "[", "]", ",", "attributes", ":", "[", "]", ",", "methods", ":", "[", "]", ",", "warningUnderlines", ":", "[", "]", ",", "}", ",", "{", "tagName", ":", "undefined", ",", "className", ":", "'SubElement'", ",", "superClass", ":", "'BaseElement'", ",", "description", ":", "''", ",", "summary", ":", "''", ",", "properties", ":", "[", "]", ",", "attributes", ":", "[", "]", ",", "methods", ":", "[", "]", ",", "mixins", ":", "[", "'Mixin'", "]", ",", "warningUnderlines", ":", "[", "]", ",", "}", ",", "{", "tagName", ":", "undefined", ",", "className", ":", "'SubElement2'", ",", "superClass", ":", "'BaseElement'", ",", "description", ":", "''", ",", "summary", ":", "''", ",", "properties", ":", "[", "]", ",", "attributes", ":", "[", "]", ",", "methods", ":", "[", "]", ",", "mixins", ":", "[", "'Mixin'", "]", ",", "warningUnderlines", ":", "[", "]", ",", "}", ",", "{", "tagName", ":", "undefined", ",", "className", ":", "'window.MyElement'", ",", "superClass", ":", "'MixedElement'", ",", "description", ":", "''", ",", "summary", ":", "''", ",", "properties", ":", "[", "]", ",", "attributes", ":", "[", "]", ",", "methods", ":", "[", "]", ",", "mixins", ":", "[", "'MyMixin'", "]", ",", "warningUnderlines", ":", "[", "]", ",", "}", "]", ")", ";", "}", ")", ";", "test", "(", "'properly reads properties and methods of elements and element classes'", ",", "async", "(", ")", "=>", "{", "const", "elements", "=", "await", "getElements", "(", "'test-element-10.js'", ")", ";", "const", "elementData", "=", "await", "Promise", ".", "all", "(", "elements", ".", "map", "(", "getTestProps", ")", ")", ";", "assert", ".", "deepEqual", "(", "elementData", ",", "[", "{", "tagName", ":", "'test-element'", ",", "className", ":", "'TestElement'", ",", "superClass", ":", "'Polymer.Element'", ",", "description", ":", "``", ",", "summary", ":", "''", ",", "properties", ":", "[", "{", "name", ":", "'customInstanceGetter'", ",", "description", ":", "undefined", "}", ",", "{", "name", ":", "'foo'", ",", "description", ":", "''", ",", "type", ":", "'string | null | undefined'", ",", "}", "]", ",", "attributes", ":", "[", "{", "name", ":", "'foo'", ",", "}", "]", ",", "methods", ":", "[", "{", "name", ":", "'customInstanceFunction'", ",", "description", ":", "''", ",", "params", ":", "[", "]", ",", "return", ":", "undefined", "}", ",", "{", "name", ":", "'customInstanceFunctionWithJSDoc'", ",", "description", ":", "'This is the description for '", "+", "'customInstanceFunctionWithJSDoc.'", ",", "params", ":", "[", "]", ",", "return", ":", "{", "desc", ":", "'The number 5, always.'", ",", "type", ":", "'Number'", ",", "}", ",", "}", ",", "{", "name", ":", "'customInstanceFunctionWithParams'", ",", "description", ":", "''", ",", "params", ":", "[", "{", "name", ":", "'a'", ",", "type", ":", "undefined", ",", "defaultValue", ":", "undefined", ",", "rest", ":", "undefined", ",", "description", ":", "undefined", "}", ",", "{", "name", ":", "'b'", ",", "type", ":", "undefined", ",", "defaultValue", ":", "undefined", ",", "rest", ":", "undefined", ",", "description", ":", "undefined", "}", ",", "{", "name", ":", "'c'", ",", "type", ":", "undefined", ",", "defaultValue", ":", "undefined", ",", "rest", ":", "undefined", ",", "description", ":", "undefined", "}", "]", ",", "return", ":", "undefined", ",", "}", ",", "{", "name", ":", "'customInstanceFunctionWithParamsAndJSDoc'", ",", "description", ":", "'This is the description for '", "+", "'customInstanceFunctionWithParamsAndJSDoc.'", ",", "params", ":", "[", "{", "name", ":", "'a'", ",", "type", ":", "'Number'", ",", "defaultValue", ":", "undefined", ",", "rest", ":", "undefined", ",", "description", ":", "'The first argument'", ",", "}", ",", "{", "name", ":", "'b'", ",", "type", ":", "'Number'", ",", "defaultValue", ":", "undefined", ",", "rest", ":", "undefined", ",", "description", ":", "undefined", "}", ",", "{", "name", ":", "'c'", ",", "type", ":", "'Number'", ",", "defaultValue", ":", "undefined", ",", "rest", ":", "undefined", ",", "description", ":", "'The third argument'", ",", "}", "]", ",", "return", ":", "{", "desc", ":", "'The number 7, always.'", ",", "type", ":", "'Number'", ",", "}", ",", "}", ",", "{", "name", ":", "'customInstanceFunctionWithParamsAndPrivateJSDoc'", ",", "description", ":", "'This is the description for\\n'", "+", "'customInstanceFunctionWithParamsAndPrivateJSDoc.'", ",", "params", ":", "[", "]", ",", "return", ":", "undefined", ",", "}", ",", "]", ",", "warningUnderlines", ":", "[", "]", ",", "}", ",", "]", ")", ";", "}", ")", ";", "test", "(", "'warns for bad observers and computed properties'", ",", "async", "(", ")", "=>", "{", "const", "elements", "=", "await", "getElements", "(", "'test-element-12.js'", ")", ";", "const", "elementData", "=", "await", "Promise", ".", "all", "(", "elements", ".", "map", "(", "getTestProps", ")", ")", ";", "assert", ".", "deepEqual", "(", "elementData", ",", "[", "{", "attributes", ":", "[", "{", "name", ":", "'parse-error'", "}", ",", "{", "name", ":", "'bad-kind-of-expression'", "}", "]", ",", "className", ":", "'TestElement'", ",", "description", ":", "''", ",", "methods", ":", "[", "]", ",", "properties", ":", "[", "{", "name", ":", "'parseError'", ",", "type", ":", "'string | null | undefined'", ",", "description", ":", "''", ",", "warningUnderlines", ":", "[", "`\n computed: 'let let let',\n ~`", ",", "`\n observer: 'let let let',\n ~`", ",", "]", "}", ",", "{", "name", ":", "'badKindOfExpression'", ",", "type", ":", "'string | null | undefined'", ",", "description", ":", "''", ",", "propertiesInComputed", ":", "[", "'foo'", "]", ",", "propertiesInObserver", ":", "[", "'foo'", ",", "'bar'", ",", "'baz'", "]", ",", "warningUnderlines", ":", "[", "`\n computed: 'foo',\n ~~~`", ",", "`\n observer: 'foo(bar, baz)'\n ~~~~~~~~~~~~~`", ",", "]", "}", "]", ",", "summary", ":", "''", ",", "superClass", ":", "'Polymer.Element'", ",", "tagName", ":", "'test-element'", ",", "warningUnderlines", ":", "[", "`\n 'let let let parseError',\n ~`", ",", "`\n 'foo',\n ~~~`", "]", ",", "observers", ":", "[", "'let let let parseError'", ",", "'foo'", ",", "'foo(bar)'", ",", "]", ",", "observerProperties", ":", "[", "[", "'foo'", "]", ",", "[", "'foo'", ",", "'bar'", "]", "]", ",", "}", "]", ")", ";", "}", ")", ";", "test", "(", "'can identify elements registered with ClassName.is'", ",", "async", "(", ")", "=>", "{", "const", "elements", "=", "await", "getElements", "(", "'test-element-11.js'", ")", ";", "const", "elementData", "=", "await", "Promise", ".", "all", "(", "elements", ".", "map", "(", "getTestProps", ")", ")", ";", "assert", ".", "deepEqual", "(", "elementData", ",", "[", "{", "attributes", ":", "[", "{", "name", ":", "'prop1'", "}", "]", ",", "className", ":", "'MyElement'", ",", "description", ":", "''", ",", "methods", ":", "[", "]", ",", "properties", ":", "[", "{", "name", ":", "'prop1'", ",", "description", ":", "''", ",", "type", ":", "'string | null | undefined'", "}", "]", ",", "summary", ":", "''", ",", "superClass", ":", "'Polymer.Element'", ",", "tagName", ":", "'my-app'", ",", "warningUnderlines", ":", "[", "]", ",", "}", "]", ")", ";", "}", ")", ";", "}", ")", ";" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 24293, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 19659, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 13364, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 17965, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 708, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 708, null, null, null, null, null, null, null, null, null, null, 708, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 17341, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1332
[ "license", "import", "{", "assert", "}", "from", "'chai'", ";", "import", "*", "as", "path", "from", "'path'", ";", "import", "{", "ClassScanner", "}", "from", "'../../javascript/class-scanner'", ";", "import", "{", "PolymerElementMixin", ",", "ScannedPolymerElementMixin", "}", "from", "'../../polymer/polymer-element-mixin'", ";", "import", "{", "createForDirectory", ",", "fixtureDir", ",", "runScanner", "}", "from", "'../test-utils'", ";", "suite", "(", "'Polymer2MixinScanner with old jsdoc annotations'", ",", "async", "(", ")", "=>", "{", "const", "testFilesDir", "=", "path", ".", "resolve", "(", "fixtureDir", ",", "'polymer2-old-jsdoc/'", ")", ";", "const", "{", "analyzer", ",", "underliner", "}", "=", "await", "createForDirectory", "(", "testFilesDir", ")", ";", "async", "function", "getScannedMixins", "(", "filename", ")", "{", "const", "{", "features", "}", "=", "await", "runScanner", "(", "analyzer", ",", "new", "ClassScanner", "(", ")", ",", "filename", ")", ";", "return", "<", "ScannedPolymerElementMixin", "[", "]", ">", "features", ".", "filter", "(", "(", "e", ")", "=>", "e", "instanceof", "ScannedPolymerElementMixin", ")", ";", "}", ";", "async", "function", "getMixins", "(", "filename", ")", "{", "const", "analysis", "=", "await", "analyzer", ".", "analyze", "(", "[", "filename", "]", ")", ";", "return", "Array", ".", "from", "(", "analysis", ".", "getFeatures", "(", "{", "kind", ":", "'polymer-element-mixin'", "}", ")", ")", ";", "}", ";", "async", "function", "getTestProps", "(", "mixin", ")", "{", "const", "properties", "=", "[", "]", ";", "for", "(", "const", "name", "of", "mixin", ".", "properties", ".", "keys", "(", ")", ")", "{", "properties", ".", "push", "(", "{", "name", "}", ")", ";", "}", "const", "attributes", "=", "[", "]", ";", "for", "(", "const", "name", "of", "mixin", ".", "attributes", ".", "keys", "(", ")", ")", "{", "attributes", ".", "push", "(", "{", "name", "}", ")", ";", "}", "const", "methods", "=", "[", "]", ";", "for", "(", "const", "{", "name", ",", "params", ",", "return", ":", "r", "}", "of", "mixin", ".", "methods", ".", "values", "(", ")", ")", "{", "let", "processedParams", "=", "undefined", ";", "if", "(", "params", ")", "{", "processedParams", "=", "params", ".", "map", "(", "(", "{", "name", ",", "type", ",", "description", "}", ")", "=>", "{", "const", "result", "=", "{", "name", "}", ";", "if", "(", "type", "!=", "null", ")", "{", "result", ".", "type", "=", "type", ";", "}", "if", "(", "description", "!=", "null", ")", "{", "result", ".", "description", "=", "description", ";", "}", "return", "result", ";", "}", ")", ";", "}", "methods", ".", "push", "(", "{", "name", ",", "return", ":", "r", ",", "params", ":", "processedParams", "}", ")", ";", "}", "const", "{", "name", ",", "description", ",", "summary", "}", "=", "mixin", ";", "return", "{", "name", ",", "description", ",", "summary", ",", "properties", ",", "attributes", ",", "methods", ",", "underlinedWarnings", ":", "await", "underliner", ".", "underline", "(", "mixin", ".", "warnings", ")", "}", ";", "}", "test", "(", "'finds mixin function declarations'", ",", "async", "(", ")", "=>", "{", "const", "mixins", "=", "await", "getScannedMixins", "(", "'test-mixin-1.js'", ")", ";", "const", "mixinData", "=", "await", "Promise", ".", "all", "(", "mixins", ".", "map", "(", "getTestProps", ")", ")", ";", "assert", ".", "deepEqual", "(", "mixinData", ",", "[", "{", "name", ":", "'TestMixin'", ",", "description", ":", "'A mixin description'", ",", "summary", ":", "'A mixin summary'", ",", "properties", ":", "[", "{", "name", ":", "'foo'", ",", "}", "]", ",", "attributes", ":", "[", "{", "name", ":", "'foo'", ",", "}", "]", ",", "methods", ":", "[", "]", ",", "underlinedWarnings", ":", "[", "]", "}", "]", ")", ";", "const", "underlinedSource", "=", "await", "underliner", ".", "underline", "(", "mixins", "[", "0", "]", ".", "sourceRange", ")", ";", "assert", ".", "deepEqual", "(", "underlinedSource", ",", "`\nfunction TestMixin(superclass) {\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n return class extends superclass {\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n static get properties() {\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n return {\n~~~~~~~~~~~~~~\n foo: {\n~~~~~~~~~~~~~~\n notify: true,\n~~~~~~~~~~~~~~~~~~~~~~~\n type: String,\n~~~~~~~~~~~~~~~~~~~~~~~\n },\n~~~~~~~~~~\n };\n~~~~~~~~\n }\n~~~~~\n }\n~~~\n}\n~`", ")", ";", "}", ")", ";", "test", "(", "'finds mixin arrow function expressions'", ",", "async", "(", ")", "=>", "{", "const", "mixins", "=", "await", "getScannedMixins", "(", "'test-mixin-2.js'", ")", ";", "const", "mixinData", "=", "await", "Promise", ".", "all", "(", "mixins", ".", "map", "(", "getTestProps", ")", ")", ";", "assert", ".", "deepEqual", "(", "mixinData", ",", "[", "{", "name", ":", "'Polymer.TestMixin'", ",", "description", ":", "'A mixin description'", ",", "summary", ":", "'A mixin summary'", ",", "properties", ":", "[", "{", "name", ":", "'foo'", ",", "}", "]", ",", "attributes", ":", "[", "{", "name", ":", "'foo'", ",", "}", "]", ",", "methods", ":", "[", "]", ",", "underlinedWarnings", ":", "[", "]", "}", "]", ")", ";", "const", "underlinedSource", "=", "await", "underliner", ".", "underline", "(", "mixins", "[", "0", "]", ".", "sourceRange", ")", ";", "assert", ".", "deepEqual", "(", "underlinedSource", ",", "`\nconst TestMixin = (superclass) => class extends superclass {\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n static get properties() {\n~~~~~~~~~~~~~~~~~~~~~~~~~~~\n return {\n~~~~~~~~~~~~\n foo: {\n~~~~~~~~~~~~\n notify: true,\n~~~~~~~~~~~~~~~~~~~~~\n type: String,\n~~~~~~~~~~~~~~~~~~~~~\n },\n~~~~~~~~\n };\n~~~~~~\n }\n~~~\n}\n~`", ")", ";", "}", ")", ";", "test", "(", "'finds mixin function expressions'", ",", "async", "(", ")", "=>", "{", "const", "mixins", "=", "await", "getScannedMixins", "(", "'test-mixin-3.js'", ")", ";", "const", "mixinData", "=", "await", "Promise", ".", "all", "(", "mixins", ".", "map", "(", "getTestProps", ")", ")", ";", "assert", ".", "deepEqual", "(", "mixinData", ",", "[", "{", "name", ":", "'Polymer.TestMixin'", ",", "description", ":", "''", ",", "summary", ":", "''", ",", "properties", ":", "[", "{", "name", ":", "'foo'", ",", "}", "]", ",", "attributes", ":", "[", "{", "name", ":", "'foo'", ",", "}", "]", ",", "methods", ":", "[", "]", ",", "underlinedWarnings", ":", "[", "]", ",", "}", "]", ")", ";", "const", "underlinedSource", "=", "await", "underliner", ".", "underline", "(", "mixins", "[", "0", "]", ".", "sourceRange", ")", ";", "assert", ".", "deepEqual", "(", "underlinedSource", ",", "`\nconst TestMixin = function(superclass) {\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n return class extends superclass {\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n static get properties() {\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n return {\n~~~~~~~~~~~~~~\n foo: {\n~~~~~~~~~~~~~~\n notify: true,\n~~~~~~~~~~~~~~~~~~~~~~~\n type: String,\n~~~~~~~~~~~~~~~~~~~~~~~\n },\n~~~~~~~~~~\n };\n~~~~~~~~\n }\n~~~~~\n }\n~~~\n}\n~`", ")", ";", "}", ")", ";", "test", "(", "'finds mixin variable declaration with only name, does not use trailing function'", ",", "async", "(", ")", "=>", "{", "const", "mixins", "=", "await", "getScannedMixins", "(", "'test-mixin-4.js'", ")", ";", "const", "mixinData", "=", "await", "Promise", ".", "all", "(", "mixins", ".", "map", "(", "getTestProps", ")", ")", ";", "assert", ".", "deepEqual", "(", "mixinData", ",", "[", "{", "name", ":", "'Polymer.TestMixin'", ",", "description", ":", "''", ",", "summary", ":", "''", ",", "properties", ":", "[", "]", ",", "attributes", ":", "[", "]", ",", "methods", ":", "[", "]", ",", "underlinedWarnings", ":", "[", "]", ",", "}", "]", ")", ";", "const", "underlinedSource", "=", "await", "underliner", ".", "underline", "(", "mixins", "[", "0", "]", ".", "sourceRange", ")", ";", "assert", ".", "deepEqual", "(", "underlinedSource", ",", "`\nlet TestMixin;\n~~~~~~~~~~~~~~`", ")", ";", "}", ")", ";", "test", "(", "'what to do on a class marked @mixinFunction?'", ",", "async", "(", ")", "=>", "{", "const", "mixins", "=", "await", "getScannedMixins", "(", "'test-mixin-5.js'", ")", ";", "const", "mixinData", "=", "mixins", ".", "map", "(", "getTestProps", ")", ";", "assert", ".", "deepEqual", "(", "mixinData", ",", "[", "]", ")", ";", "}", ")", ";", "test", "(", "'finds mixin function declaration with only name'", ",", "async", "(", ")", "=>", "{", "const", "mixins", "=", "await", "getScannedMixins", "(", "'test-mixin-6.js'", ")", ";", "const", "mixinData", "=", "await", "Promise", ".", "all", "(", "mixins", ".", "map", "(", "getTestProps", ")", ")", ";", "assert", ".", "deepEqual", "(", "mixinData", ",", "[", "{", "name", ":", "'Polymer.TestMixin'", ",", "description", ":", "''", ",", "summary", ":", "''", ",", "properties", ":", "[", "]", ",", "attributes", ":", "[", "]", ",", "methods", ":", "[", "]", ",", "underlinedWarnings", ":", "[", "]", "}", "]", ")", ";", "const", "underlinedSource", "=", "await", "underliner", ".", "underline", "(", "mixins", "[", "0", "]", ".", "sourceRange", ")", ";", "assert", ".", "deepEqual", "(", "underlinedSource", ",", "`\nfunction TestMixin() {\n~~~~~~~~~~~~~~~~~~~~~~\n}\n~`", ")", ";", "}", ")", ";", "test", "(", "'finds mixin assigned to a namespace'", ",", "async", "(", ")", "=>", "{", "const", "mixins", "=", "await", "getScannedMixins", "(", "'test-mixin-7.js'", ")", ";", "const", "mixinData", "=", "await", "Promise", ".", "all", "(", "mixins", ".", "map", "(", "getTestProps", ")", ")", ";", "assert", ".", "deepEqual", "(", "mixinData", ",", "[", "{", "name", ":", "'Polymer.TestMixin'", ",", "description", ":", "''", ",", "summary", ":", "''", ",", "properties", ":", "[", "{", "name", ":", "'foo'", ",", "}", "]", ",", "attributes", ":", "[", "{", "name", ":", "'foo'", ",", "}", "]", ",", "methods", ":", "[", "]", ",", "underlinedWarnings", ":", "[", "]", ",", "}", "]", ")", ";", "const", "underlinedSource", "=", "await", "underliner", ".", "underline", "(", "mixins", "[", "0", "]", ".", "sourceRange", ")", ";", "assert", ".", "deepEqual", "(", "underlinedSource", ",", "`\nPolymer.TestMixin = Polymer.woohoo(function TestMixin(base) {\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n /**\n~~~~~\n * @polymerMixinClass\n~~~~~~~~~~~~~~~~~~~~~~~\n */\n~~~~~\n class TestMixin extends base {\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n static get properties() {\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n return {\n~~~~~~~~~~~~~~\n foo: {\n~~~~~~~~~~~~~~\n notify: true,\n~~~~~~~~~~~~~~~~~~~~~~~\n type: String,\n~~~~~~~~~~~~~~~~~~~~~~~\n },\n~~~~~~~~~~\n };\n~~~~~~~~\n };\n~~~~~~\n };\n~~~~\n return TestMixin;\n~~~~~~~~~~~~~~~~~~~\n});\n~~`", ")", ";", "}", ")", ";", "test", "(", "'properly analyzes nested mixin assignments with memberof tags'", ",", "async", "(", ")", "=>", "{", "const", "mixins", "=", "await", "getScannedMixins", "(", "'test-mixin-8.js'", ")", ";", "const", "mixinData", "=", "await", "Promise", ".", "all", "(", "mixins", ".", "map", "(", "getTestProps", ")", ")", ";", "assert", ".", "deepEqual", "(", "mixinData", ",", "[", "{", "name", ":", "'Polymer.TestMixin'", ",", "description", ":", "''", ",", "summary", ":", "''", ",", "properties", ":", "[", "{", "name", ":", "'foo'", ",", "}", "]", ",", "attributes", ":", "[", "{", "name", ":", "'foo'", ",", "}", "]", ",", "methods", ":", "[", "]", ",", "underlinedWarnings", ":", "[", "]", ",", "}", "]", ")", ";", "}", ")", ";", "test", "(", "'properly analyzes mixin instance and class methods'", ",", "async", "(", ")", "=>", "{", "const", "mixins", "=", "await", "getScannedMixins", "(", "'test-mixin-9.js'", ")", ";", "const", "mixinData", "=", "await", "Promise", ".", "all", "(", "mixins", ".", "map", "(", "getTestProps", ")", ")", ";", "assert", ".", "deepEqual", "(", "mixinData", ",", "[", "{", "name", ":", "'TestMixin'", ",", "description", ":", "'A mixin description'", ",", "summary", ":", "'A mixin summary'", ",", "properties", ":", "[", "{", "name", ":", "'customInstanceGetter'", "}", ",", "{", "name", ":", "'foo'", "}", "]", ",", "attributes", ":", "[", "{", "name", ":", "'foo'", ",", "}", "]", ",", "methods", ":", "[", "{", "name", ":", "'customInstanceFunction'", ",", "params", ":", "[", "]", ",", "return", ":", "undefined", "}", ",", "{", "name", ":", "'customInstanceFunctionWithJSDoc'", ",", "params", ":", "[", "]", ",", "return", ":", "{", "desc", ":", "'The number 5, always.'", ",", "type", ":", "'Number'", ",", "}", ",", "}", ",", "{", "name", ":", "'customInstanceFunctionWithParams'", ",", "params", ":", "[", "{", "name", ":", "'a'", "}", ",", "{", "name", ":", "'b'", "}", ",", "{", "name", ":", "'c'", "}", "]", ",", "return", ":", "undefined", ",", "}", ",", "{", "name", ":", "'customInstanceFunctionWithParamsAndJSDoc'", ",", "params", ":", "[", "{", "name", ":", "'a'", ",", "type", ":", "'Number'", ",", "description", ":", "'The first argument'", ",", "}", ",", "{", "name", ":", "'b'", ",", "type", ":", "'Number'", ",", "}", ",", "{", "name", ":", "'c'", ",", "type", ":", "'Number'", ",", "description", ":", "'The third argument'", ",", "}", "]", ",", "return", ":", "{", "desc", ":", "'The number 7, always.'", ",", "type", ":", "'Number'", ",", "}", ",", "}", ",", "{", "name", ":", "'customInstanceFunctionWithParamsAndPrivateJSDoc'", ",", "params", ":", "[", "]", ",", "return", ":", "undefined", ",", "}", ",", "]", ",", "underlinedWarnings", ":", "[", "]", ",", "}", "]", ")", ";", "}", ")", ";", "test", "(", "'applies mixins to mixins'", ",", "async", "(", ")", "=>", "{", "const", "mixins", "=", "await", "getMixins", "(", "'test-mixin-10.js'", ")", ";", "const", "mixinData", "=", "await", "Promise", ".", "all", "(", "mixins", ".", "map", "(", "getTestProps", ")", ")", ";", "assert", ".", "deepEqual", "(", "mixinData", ",", "[", "{", "name", ":", "'Base'", ",", "description", ":", "''", ",", "summary", ":", "''", ",", "attributes", ":", "[", "{", "name", ":", "'foo'", "}", "]", ",", "methods", ":", "[", "{", "name", ":", "'baseMethod'", ",", "params", ":", "[", "]", ",", "return", ":", "{", "type", ":", "'void'", "}", "}", ",", "{", "name", ":", "'privateMethod'", ",", "params", ":", "[", "]", ",", "return", ":", "{", "type", ":", "'void'", "}", "}", ",", "{", "name", ":", "'privateOverriddenMethod'", ",", "params", ":", "[", "]", ",", "return", ":", "{", "type", ":", "'void'", "}", "}", ",", "{", "name", ":", "'overrideMethod'", ",", "params", ":", "[", "]", ",", "return", ":", "{", "type", ":", "'void'", "}", "}", ",", "]", ",", "properties", ":", "[", "{", "name", ":", "'foo'", "}", "]", ",", "underlinedWarnings", ":", "[", "]", ",", "}", ",", "{", "name", ":", "'Middle'", ",", "attributes", ":", "[", "{", "name", ":", "'foo'", "}", "]", ",", "description", ":", "''", ",", "methods", ":", "[", "{", "name", ":", "'baseMethod'", ",", "params", ":", "[", "]", ",", "return", ":", "{", "type", ":", "'void'", "}", "}", ",", "{", "name", ":", "'privateMethod'", ",", "params", ":", "[", "]", ",", "return", ":", "{", "type", ":", "'void'", "}", "}", ",", "{", "name", ":", "'privateOverriddenMethod'", ",", "params", ":", "[", "]", ",", "return", ":", "{", "type", ":", "'void'", "}", "}", ",", "{", "name", ":", "'overrideMethod'", ",", "params", ":", "[", "]", ",", "return", ":", "{", "type", ":", "'void'", "}", "}", ",", "{", "name", ":", "'middleMethod'", ",", "params", ":", "[", "]", ",", "return", ":", "{", "type", ":", "'void'", "}", "}", ",", "]", ",", "properties", ":", "[", "{", "name", ":", "'foo'", "}", "]", ",", "summary", ":", "''", ",", "underlinedWarnings", ":", "[", "`\n privateOverriddenMethod() { }\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`", "]", ",", "}", "]", ")", ";", "}", ")", ";", "}", ")", ";" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 24293, null, null, null, null, null, null, null, null, null, null, null, 7, null, 2, null, null, null, 1519, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, null, 5, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1333
[ "license", "import", "*", "as", "fs", "from", "'fs'", ";", "import", "*", "as", "path", "from", "'path'", ";", "import", "*", "as", "ts", "from", "'typescript'", ";", "import", "{", "AnalysisContext", "}", "from", "'../core/analysis-context'", ";", "import", "{", "LanguageAnalyzer", "}", "from", "'../core/language-analyzer'", ";", "import", "{", "PackageRelativeUrl", ",", "ResolvedUrl", "}", "from", "'../model/url'", ";", "import", "{", "ParsedTypeScriptDocument", "}", "from", "'./typescript-document'", ";", "const", "_compilerOptions", "=", "{", "allowJs", ":", "true", ",", "emit", ":", "false", ",", "lib", ":", "[", "'ES2017'", ",", "'DOM'", "]", ",", "}", ";", "export", "class", "TypeScriptAnalyzer", "implements", "LanguageAnalyzer", "<", "ts", ".", "Program", ">", "{", "private", "_context", ":", "AnalysisContext", ";", "constructor", "(", "analysisContext", ")", "{", "this", ".", "_context", "=", "analysisContext", ";", "}", "analyze", "(", "url", ")", "{", "const", "host", "=", "new", "AnalyzerCompilerHost", "(", "this", ".", "_context", ")", ";", "return", "ts", ".", "createProgram", "(", "[", "url", "]", ",", "_compilerOptions", ",", "host", ")", ";", "}", "}", "const", "defaultLib", "=", "'/$lib/lib.es2017.d.ts'", ";", "const", "tsLibPath", "=", "path", ".", "dirname", "(", "require", ".", "resolve", "(", "'typescript'", ")", ")", ";", "function", "isLibraryPath", "(", "filename", ")", "{", "return", "filename", ".", "startsWith", "(", "'/$lib/'", ")", ";", "}", "const", "libraryCache", "=", "new", "Map", "<", "string", ",", "string", "|", "undefined", ">", "(", ")", ";", "function", "getLibrarySource", "(", "filePath", ")", "{", "if", "(", "libraryCache", ".", "has", "(", "filePath", ")", ")", "{", "return", "libraryCache", ".", "get", "(", "filePath", ")", ";", "}", "let", "libFileName", "=", "filePath", ".", "substring", "(", "'/$lib/'", ".", "length", ")", ".", "toLowerCase", "(", ")", ";", "if", "(", "!", "libFileName", ".", "startsWith", "(", "'lib.'", ")", ")", "{", "libFileName", "=", "`lib.${", "libFileName", "}`", ";", "}", "const", "libPath", "=", "path", ".", "resolve", "(", "tsLibPath", ",", "libFileName", ")", ";", "let", "source", ";", "try", "{", "source", "=", "fs", ".", "readFileSync", "(", "libPath", ",", "{", "encoding", ":", "'utf-8'", "}", ")", ";", "}", "catch", "(", "e", ")", "{", "}", "libraryCache", ".", "set", "(", "filePath", ",", "source", ")", ";", "return", "source", ";", "}", "/**\n * A TypeScript CompilerHost that reads files from an AnalysisContext.\n */", "class", "AnalyzerCompilerHost", "implements", "ts", ".", "CompilerHost", "{", "context", ":", "AnalysisContext", ";", "constructor", "(", "context", ")", "{", "this", ".", "context", "=", "context", ";", "}", "getSourceFile", "(", "fileName", ",", "languageVersion", ",", "onError", "?", ")", "{", "if", "(", "isLibraryPath", "(", "fileName", ")", ")", "{", "const", "libSource", "=", "getLibrarySource", "(", "fileName", ")", ";", "if", "(", "libSource", "!=", "null", ")", "{", "return", "ts", ".", "createSourceFile", "(", "fileName", ",", "libSource", ",", "languageVersion", ")", ";", "}", "}", "else", "{", "const", "scannedDocument", "=", "this", ".", "context", ".", "_getScannedDocument", "(", "this", ".", "_failSafeResolveUrl", "(", "fileName", ")", ")", ";", "if", "(", "scannedDocument", "!=", "null", ")", "{", "const", "typescriptDocument", "=", "scannedDocument", ".", "document", "as", "ParsedTypeScriptDocument", ";", "return", "typescriptDocument", ".", "ast", "as", "ts", ".", "SourceFile", ";", "}", "if", "(", "onError", ")", "{", "onError", "(", "'not found'", ")", ";", "}", "}", "return", "null", "as", "any", "as", "ts", ".", "SourceFile", ";", "}", "getDefaultLibFileName", "(", ")", "{", "return", "defaultLib", ";", "}", "get", "writeFile", "(", ")", ":", "ts", ".", "WriteFileCallback", "{", "return", "(", "_fileName", ",", "_data", ",", "_writeByteOrderMark", ",", "_onError", "?", ",", "_sourceFiles", "?", ")", ":", "void", "=>", "{", "throw", "new", "Error", "(", "'unsupported operation'", ")", ";", "}", ";", "}", "getCurrentDirectory", "(", ")", "{", "return", "''", ";", "}", "getDirectories", "(", "_path", ")", "{", "return", "[", "''", "]", ";", "}", "getCanonicalFileName", "(", "fileName", ")", "{", "return", "this", ".", "_failSafeResolveUrl", "(", "fileName", ")", ";", "}", "getNewLine", "(", ")", "{", "return", "ts", ".", "sys", ".", "newLine", ";", "}", "useCaseSensitiveFileNames", "(", ")", "{", "return", "true", ";", "}", "fileExists", "(", "fileName", ")", "{", "const", "resolvedUrl", "=", "this", ".", "_failSafeResolveUrl", "(", "fileName", ")", ";", "return", "isLibraryPath", "(", "resolvedUrl", ")", "&&", "getLibrarySource", "(", "resolvedUrl", ")", "!=", "null", "||", "this", ".", "context", ".", "_getScannedDocument", "(", "resolvedUrl", ")", "!=", "null", ";", "}", "readFile", "(", "fileName", ")", "{", "const", "resolvedUrl", "=", "this", ".", "_failSafeResolveUrl", "(", "fileName", ")", ";", "if", "(", "isLibraryPath", "(", "resolvedUrl", ")", ")", "{", "const", "libPath", "=", "require", ".", "resolve", "(", "`typescript/lib/${", "fileName", "}`", ")", ";", "return", "fs", ".", "readFileSync", "(", "libPath", ",", "{", "encoding", ":", "'utf-8'", "}", ")", ";", "}", "const", "document", "=", "this", ".", "context", ".", "_getScannedDocument", "(", "resolvedUrl", ")", ";", "return", "(", "document", ")", "?", "document", ".", "document", ".", "contents", ":", "null", "as", "any", "as", "string", ";", "}", "resolveModuleNames", "(", "moduleNames", ",", "containingFile", ")", "{", "return", "moduleNames", ".", "map", "(", "(", "moduleName", ")", "=>", "{", "if", "(", "!", "(", "moduleName", ".", "startsWith", "(", "'./'", ")", "||", "moduleName", ".", "startsWith", "(", "'../'", ")", "||", "moduleName", ".", "startsWith", "(", "'/'", ")", ")", ")", "{", "return", "{", "resolvedFileName", ":", "null", "as", "any", "as", "string", "}", ";", "}", "const", "fileName", "=", "path", ".", "resolve", "(", "path", ".", "dirname", "(", "containingFile", ")", ",", "moduleName", ")", "as", "PackageRelativeUrl", ";", "const", "resolvedFileName", "=", "this", ".", "_failSafeResolveUrl", "(", "fileName", ")", ";", "return", "{", "resolvedFileName", "}", ";", "}", ")", ";", "}", "/**\n * Resolves the given url.\n *\n * If the url is unresolvable, the given unresolved URL is returned as a\n * resolved URL.\n */", "private", "_failSafeResolveUrl", "(", "url", ")", "{", "const", "resolved", "=", "this", ".", "context", ".", "resolver", ".", "resolve", "(", "url", "as", "PackageRelativeUrl", ")", ";", "return", "resolved", "===", "undefined", "?", "url", "as", "any", "as", "ResolvedUrl", ":", "resolved", ";", "}", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 975, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 10984, null, null, null, null, null, null, null, null, null, 1352, null, 2, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, 19, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 10984, null, null, null, null, null, null, null, null, null, 306, null, 17964, null, 9385, null, 4, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 24294, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, 2, null, 8, null, 4, null, null, 130, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, 5, null, 2, null, null, null, null, null, null, null, null, 1462, null, 17964, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, 8, null, 17964, null, null, null, 1462, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, 17964, null, null, null, 1462, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 24294, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, 5, null, 2, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 17964, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1462, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1462, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1334
[ "license", "import", "*", "as", "ts", "from", "'typescript'", ";", "import", "{", "correctSourceRange", ",", "InlineDocInfo", ",", "Severity", ",", "Warning", ",", "WarningCarryingException", "}", "from", "'../model/model'", ";", "import", "{", "ResolvedUrl", "}", "from", "'../model/url'", ";", "import", "{", "Parser", "}", "from", "'../parser/parser'", ";", "import", "{", "UrlResolver", "}", "from", "'../url-loader/url-resolver'", ";", "import", "{", "ParsedTypeScriptDocument", "}", "from", "'./typescript-document'", ";", "/**\n * A TypeScript parser that only parses a single file, not imported files.\n * This parser is suitable for parsing ES6 as well.\n *\n * This parser uses a TypeScript CompilerHost that resolves all imported\n * modules to null, and resolve the standard library to an empty file.\n * Type checking against the result will be riddled with errors, but the\n * parsed AST can be used to find imports.\n *\n * This parser may eventually be replaced with a lightweight parser that\n * can find import statements, but due to the addition of the import()\n * function, it could be that a full parse is needed anyway.\n */", "export", "class", "TypeScriptPreparser", "implements", "Parser", "<", "ParsedTypeScriptDocument", ">", "{", "parse", "(", "contents", ",", "url", ",", "_urlResolver", ",", "inlineInfo", "?", ")", "{", "const", "isInline", "=", "!", "!", "inlineInfo", ";", "inlineInfo", "=", "inlineInfo", "||", "{", "}", ";", "const", "sourceFile", "=", "ts", ".", "createSourceFile", "(", "url", ",", "contents", ",", "ts", ".", "ScriptTarget", ".", "ES2016", ",", "true", ")", ";", "const", "sourceFileMaybeWithDiagnostics", "=", "sourceFile", "as", "{", "parseDiagnostics", "?", ":", "ts", ".", "Diagnostic", "[", "]", ";", "}", ";", "const", "diagnostics", "=", "sourceFileMaybeWithDiagnostics", ".", "parseDiagnostics", "||", "[", "]", ";", "const", "parseError", "=", "diagnostics", ".", "find", "(", "(", "d", ")", "=>", "d", ".", "category", "===", "ts", ".", "DiagnosticCategory", ".", "Error", ")", ";", "const", "result", "=", "new", "ParsedTypeScriptDocument", "(", "{", "url", ",", "contents", ",", "baseUrl", ":", "inlineInfo", ".", "baseUrl", ",", "ast", ":", "sourceFile", ",", "locationOffset", ":", "inlineInfo", ".", "locationOffset", ",", "astNode", ":", "inlineInfo", ".", "astNode", ",", "isInline", ",", "}", ")", ";", "if", "(", "parseError", ")", "{", "if", "(", "parseError", ".", "start", "&&", "parseError", ".", "length", ")", "{", "const", "start", "=", "sourceFile", ".", "getLineAndCharacterOfPosition", "(", "parseError", ".", "start", ")", ";", "const", "end", "=", "sourceFile", ".", "getLineAndCharacterOfPosition", "(", "parseError", ".", "start", "+", "parseError", ".", "length", ")", ";", "throw", "new", "WarningCarryingException", "(", "new", "Warning", "(", "{", "code", ":", "'parse-error'", ",", "severity", ":", "Severity", ".", "ERROR", ",", "message", ":", "ts", ".", "flattenDiagnosticMessageText", "(", "parseError", ".", "messageText", ",", "'\\n'", ")", ",", "sourceRange", ":", "correctSourceRange", "(", "{", "file", ":", "url", ",", "start", ":", "{", "column", ":", "start", ".", "character", ",", "line", ":", "start", ".", "line", "}", ",", "end", ":", "{", "column", ":", "end", ".", "character", ",", "line", ":", "end", ".", "line", "}", "}", ",", "inlineInfo", ".", "locationOffset", ")", "!", ",", "parsedDocument", ":", "result", ",", "}", ")", ")", ";", "}", "throw", "new", "Error", "(", "ts", ".", "flattenDiagnosticMessageText", "(", "parseError", ".", "messageText", ",", "'\\n'", ")", ")", ";", "}", "return", "result", ";", "}", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, 2, null, 1462, null, 13912, null, 0, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, 77, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, 155, null, null, null, null, null, null, 155, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1695, null, null, null, null, null, null, null, null, null, null, null, 1695, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1335
[ "license", "import", "{", "assert", "}", "from", "'chai'", ";", "import", "*", "as", "ts", "from", "'typescript'", ";", "import", "{", "AnalysisContext", "}", "from", "'../../core/analysis-context'", ";", "import", "{", "neverCancels", "}", "from", "'../../core/cancel-token'", ";", "import", "{", "PackageRelativeUrl", "}", "from", "'../../index'", ";", "import", "{", "ResolvedUrl", "}", "from", "'../../model/url'", ";", "import", "{", "TypeScriptAnalyzer", "}", "from", "'../../typescript/typescript-analyzer'", ";", "import", "{", "TypeScriptPreparser", "}", "from", "'../../typescript/typescript-preparser'", ";", "import", "{", "InMemoryOverlayUrlLoader", "}", "from", "'../../url-loader/overlay-loader'", ";", "import", "{", "PackageUrlResolver", "}", "from", "'../../url-loader/package-url-resolver'", ";", "async", "function", "getTypeScriptAnalyzer", "(", "files", ")", "{", "const", "urlLoader", "=", "new", "InMemoryOverlayUrlLoader", "(", ")", ";", "const", "urlResolver", "=", "new", "PackageUrlResolver", "(", ")", ";", "for", "(", "const", "[", "url", ",", "contents", "]", "of", "files", ")", "{", "urlLoader", ".", "urlContentsMap", ".", "set", "(", "urlResolver", ".", "resolve", "(", "''", "as", "any", ",", "url", "as", "any", ")", "!", ",", "contents", ")", ";", "}", "const", "analysisContext", "=", "new", "AnalysisContext", "(", "{", "parsers", ":", "new", "Map", "(", "[", "[", "'ts'", ",", "new", "TypeScriptPreparser", "(", ")", "]", "]", ")", ",", "urlLoader", ",", "urlResolver", "}", ")", ";", "await", "Promise", ".", "all", "(", "Object", ".", "keys", "(", "files", ")", ".", "map", "(", "(", "url", ")", "=>", "analysisContext", ".", "scan", "(", "url", "as", "ResolvedUrl", ",", "neverCancels", ")", ")", ")", ";", "return", "new", "TypeScriptAnalyzer", "(", "analysisContext", ")", ";", "}", "suite", "(", "'TypeScriptParser'", ",", "(", ")", "=>", "{", "suite", "(", "'parse()'", ",", "(", ")", "=>", "{", "test", "(", "'parses classes'", ",", "async", "(", ")", "=>", "{", "const", "fileName", "=", "'typescript/test.ts'", "as", "PackageRelativeUrl", ";", "const", "typescriptAnalyzer", "=", "await", "getTypeScriptAnalyzer", "(", "new", "Map", "(", "[", "[", "fileName", ",", "`\n class A extends HTMLElement {\n foo() { return 'bar'; }\n }`", "]", "]", ")", ")", ";", "const", "program", "=", "typescriptAnalyzer", ".", "analyze", "(", "fileName", ")", ";", "const", "checker", "=", "program", ".", "getTypeChecker", "(", ")", ";", "assert", ".", "deepEqual", "(", "program", ".", "getRootFileNames", "(", ")", ",", "[", "fileName", "]", ")", ";", "let", "htmlElement", ";", "const", "domSource", "=", "program", ".", "getSourceFile", "(", "'/$lib/DOM.d.ts'", ")", "!", ";", "ts", ".", "forEachChild", "(", "domSource", ",", "(", "node", ")", "=>", "{", "if", "(", "node", ".", "kind", "===", "ts", ".", "SyntaxKind", ".", "InterfaceDeclaration", ")", "{", "const", "innerface", "=", "node", "as", "ts", ".", "InterfaceDeclaration", ";", "if", "(", "innerface", ".", "name", ".", "getText", "(", ")", "===", "'HTMLElement'", ")", "{", "htmlElement", "=", "checker", ".", "getTypeAtLocation", "(", "innerface", ")", ";", "}", "}", "}", ")", ";", "const", "sourceFile", "=", "program", ".", "getSourceFile", "(", "fileName", ")", "!", ";", "ts", ".", "forEachChild", "(", "sourceFile", ",", "(", "node", ")", "=>", "{", "if", "(", "node", ".", "kind", "===", "ts", ".", "SyntaxKind", ".", "ClassDeclaration", ")", "{", "const", "class_", "=", "node", "as", "ts", ".", "ClassDeclaration", ";", "if", "(", "class_", ".", "name", "&&", "class_", ".", "name", ".", "getText", "(", ")", "===", "'A'", ")", "{", "const", "type", "=", "checker", ".", "getTypeAtLocation", "(", "class_", ")", "as", "ts", ".", "InterfaceType", ";", "const", "baseTypes", "=", "checker", ".", "getBaseTypes", "(", "type", ")", ";", "assert", ".", "include", "(", "baseTypes", ",", "htmlElement", ")", ";", "const", "properties", "=", "checker", ".", "getPropertiesOfType", "(", "type", ")", ";", "const", "ownProperties", "=", "properties", ".", "filter", "(", "(", "p", ")", "=>", "p", ".", "getDeclarations", "(", ")", "!", ".", "some", "(", "(", "d", ")", "=>", "d", ".", "parent", "===", "class_", ")", ")", ";", "assert", ".", "equal", "(", "ownProperties", ".", "length", ",", "1", ")", ";", "assert", ".", "equal", "(", "ownProperties", "[", "0", "]", ".", "name", ",", "'foo'", ")", ";", "}", "}", "}", ")", ";", "}", ")", ";", "}", ")", ";", "}", ")", ";" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 19, null, null, null, 21744, null, null, null, null, null, null, null, 20795, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 10984, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 17964, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 361, null, null, null, null, null, null, null, null, null, 577, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 627, null, null, 77, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 24, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1869, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 77, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 24, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 816, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2421, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, 72, null, null, null, null, null, null, null, null, null, null, null, null, 164, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1336
[ "license", "import", "{", "assert", "}", "from", "'chai'", ";", "import", "{", "Analyzer", "}", "from", "'../../core/analyzer'", ";", "import", "{", "FsUrlResolver", "}", "from", "'../../url-loader/fs-url-resolver'", ";", "import", "{", "IndirectUrlResolver", "}", "from", "'../../url-loader/indirect-url-resolver'", ";", "import", "{", "InMemoryOverlayUrlLoader", "}", "from", "'../../url-loader/overlay-loader'", ";", "import", "{", "fileRelativeUrl", ",", "packageRelativeUrl", ",", "resolvedUrl", ",", "rootedFileUrl", "}", "from", "'../test-utils'", ";", "suite", "(", "'IndirectUrlResolver'", ",", "function", "(", ")", "{", "const", "mapping", "=", "new", "Map", "<", "string", ",", "string", ">", "(", "[", "[", "'/foo/foo.html'", ",", "'sub/package/foo/foo.html'", "]", ",", "[", "'/foo/foo.css'", ",", "'sub/package/foo/foo.css'", "]", ",", "[", "'/bar/bar.html'", ",", "'different/x/y/bar.html'", "]", ",", "[", "'/bar/bar.css'", ",", "'different/x/y/bar.css'", "]", ",", "]", ")", ";", "const", "indirectResolver", "=", "new", "IndirectUrlResolver", "(", "'/root'", ",", "'/root/sub/package'", ",", "mapping", ")", ";", "test", "(", "'resolve'", ",", "async", "(", ")", "=>", "{", "assert", ".", "deepEqual", "(", "indirectResolver", ".", "resolve", "(", "packageRelativeUrl", "`foo.html`", ")", ",", "rootedFileUrl", "`root/sub/package/foo.html`", ")", ";", "assert", ".", "deepEqual", "(", "indirectResolver", ".", "resolve", "(", "rootedFileUrl", "`root/sub/package/bar.html`", ")", ",", "rootedFileUrl", "`root/sub/package/bar.html`", ")", ";", "assert", ".", "deepEqual", "(", "indirectResolver", ".", "resolve", "(", "rootedFileUrl", "`root/sub/package/foo/foo.html`", ",", "fileRelativeUrl", "`../bar/bar.html`", ")", ",", "rootedFileUrl", "`root/different/x/y/bar.html`", ")", ";", "assert", ".", "deepEqual", "(", "indirectResolver", ".", "resolve", "(", "packageRelativeUrl", "`//foo.com/bar.html`", ")", ",", "resolvedUrl", "`https://foo.com/bar.html`", ")", ";", "assert", ".", "deepEqual", "(", "(", "new", "IndirectUrlResolver", "(", "'/root'", ",", "'/root/sub/package'", ",", "mapping", ",", "'potato'", ")", ")", ".", "resolve", "(", "packageRelativeUrl", "`//foo.com/bar.html`", ")", ",", "resolvedUrl", "`potato://foo.com/bar.html`", ")", ";", "}", ")", ";", "test", "(", "'relative'", ",", "async", "(", ")", "=>", "{", "assert", ".", "deepEqual", "(", "indirectResolver", ".", "relative", "(", "rootedFileUrl", "`root/different/x/y/bar.html`", ",", "rootedFileUrl", "`root/sub/package/foo/foo.css`", ")", ",", "`../foo/foo.css`", ")", ";", "assert", ".", "deepEqual", "(", "indirectResolver", ".", "relative", "(", "rootedFileUrl", "`root/different/x/y/bar.html`", ",", "rootedFileUrl", "`root/different/x/y/bar.js`", ")", ",", "`bar.js`", ")", ";", "assert", ".", "deepEqual", "(", "indirectResolver", ".", "relative", "(", "rootedFileUrl", "`root/another/baz.html`", ",", "rootedFileUrl", "`root/more/bonk.html`", ")", ",", "`../more/bonk.html`", ")", ";", "}", ")", ";", "suite", "(", "'integration'", ",", "(", ")", "=>", "{", "const", "testName", "=", "`handles resolving urls with a full mapping from deep `", "+", "`subdirs into a flatter runtime url space`", ";", "test", "(", "testName", ",", "async", "(", ")", "=>", "{", "const", "fsUrlResolver", "=", "new", "FsUrlResolver", "(", "'/root'", ")", ";", "const", "overlayLoader", "=", "new", "InMemoryOverlayUrlLoader", "(", ")", ";", "overlayLoader", ".", "urlContentsMap", ".", "set", "(", "fsUrlResolver", ".", "resolve", "(", "packageRelativeUrl", "`sub/package/foo/foo.html`", ")", "!", ",", "`\n <link rel=\"import\" href=\"../bar/bar.html\">\n <link rel=\"stylesheet\" href=\"foo.css\">\n `", ")", ";", "overlayLoader", ".", "urlContentsMap", ".", "set", "(", "fsUrlResolver", ".", "resolve", "(", "packageRelativeUrl", "`sub/package/foo/foo.css`", ")", "!", ",", "``", ")", ";", "overlayLoader", ".", "urlContentsMap", ".", "set", "(", "fsUrlResolver", ".", "resolve", "(", "packageRelativeUrl", "`different/x/y/bar.html`", ")", "!", ",", "`\n <link rel=\"stylesheet\" href=\"./bar.css\">\n `", ")", ";", "overlayLoader", ".", "urlContentsMap", ".", "set", "(", "fsUrlResolver", ".", "resolve", "(", "packageRelativeUrl", "`different/x/y/bar.css`", ")", "!", ",", "``", ")", ";", "const", "analyzer", "=", "new", "Analyzer", "(", "{", "urlLoader", ":", "overlayLoader", ",", "urlResolver", ":", "indirectResolver", "}", ")", ";", "const", "analysis", "=", "await", "analyzer", ".", "analyze", "(", "[", "'foo/foo.html'", "]", ")", ";", "assert", ".", "deepEqual", "(", "analysis", ".", "getWarnings", "(", ")", ".", "map", "(", "(", "w", ")", "=>", "w", ".", "toString", "(", "{", "verbosity", ":", "'code-only'", "}", ")", ")", ",", "[", "]", ")", ";", "const", "documents", "=", "analysis", ".", "getFeatures", "(", "{", "kind", ":", "'document'", "}", ")", ";", "assert", ".", "deepEqual", "(", "[", "...", "documents", "]", ".", "map", "(", "(", "d", ")", "=>", "d", ".", "url", ")", ",", "[", "rootedFileUrl", "`root/sub/package/foo/foo.html`", ",", "rootedFileUrl", "`root/different/x/y/bar.html`", ",", "rootedFileUrl", "`root/different/x/y/bar.css`", ",", "rootedFileUrl", "`root/sub/package/foo/foo.css`", "]", ")", ";", "const", "imports", "=", "analysis", ".", "getFeatures", "(", "{", "kind", ":", "'import'", "}", ")", ";", "assert", ".", "deepEqual", "(", "[", "...", "imports", "]", ".", "map", "(", "(", "i", ")", "=>", "i", ".", "originalUrl", ")", ",", "[", "'../bar/bar.html'", ",", "'./bar.css'", ",", "'foo.css'", "]", ")", ";", "assert", ".", "deepEqual", "(", "[", "...", "imports", "]", ".", "map", "(", "(", "i", ")", "=>", "i", ".", "url", ")", ",", "[", "rootedFileUrl", "`root/different/x/y/bar.html`", ",", "rootedFileUrl", "`root/different/x/y/bar.css`", ",", "rootedFileUrl", "`root/sub/package/foo/foo.css`", "]", ")", ";", "}", ")", ";", "}", ")", ";", "}", ")", ";" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 19, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, 21744, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1344, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1519, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5893, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 30, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 91, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 30, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1670, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1670, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1337
[ "license", "import", "{", "assert", "}", "from", "'chai'", ";", "import", "{", "FileRelativeUrl", ",", "PackageRelativeUrl", ",", "ResolvedUrl", "}", "from", "'../../model/url'", ";", "import", "{", "MultiUrlResolver", "}", "from", "'../../url-loader/multi-url-resolver'", ";", "import", "{", "UrlResolver", "}", "from", "'../../url-loader/url-resolver'", ";", "import", "{", "fileRelativeUrl", ",", "packageRelativeUrl", ",", "resolvedUrl", "}", "from", "'../test-utils'", ";", "class", "MockResolver", "extends", "UrlResolver", "{", "packageUrl", "=", "resolvedUrl", "``", ";", "resolveCount", ":", "number", "=", "0", ";", "relativeCount", ":", "number", "=", "0", ";", "constructor", "(", "private", "_resolution", ")", "{", "super", "(", ")", ";", "}", "resolve", "(", "firstUrl", ",", "secondUrl", "?", ")", "{", "const", "url", "=", "secondUrl", "||", "firstUrl", ";", "++", "this", ".", "resolveCount", ";", "if", "(", "this", ".", "_resolution", "&&", "url", "===", "this", ".", "_resolution", ")", "{", "return", "this", ".", "brandAsResolved", "(", "this", ".", "_resolution", ")", ";", "}", "return", "undefined", ";", "}", "relative", "(", "to", ")", ";", "relative", "(", "from", ",", "to", ",", "kind", "?", ")", ";", "relative", "(", "fromOrTo", ",", "maybeTo", "?", ",", "_kind", "?", ")", "{", "const", "[", "from", ",", "to", "]", "=", "(", "maybeTo", "!==", "undefined", ")", "?", "[", "fromOrTo", ",", "maybeTo", "]", ":", "[", "this", ".", "packageUrl", ",", "fromOrTo", "]", ";", "++", "this", ".", "relativeCount", ";", "const", "result", "=", "this", ".", "simpleUrlRelative", "(", "from", ",", "to", ")", ";", "if", "(", "maybeTo", "===", "undefined", ")", "{", "return", "this", ".", "brandAsPackageRelative", "(", "result", ")", ";", "}", "return", "result", ";", "}", "}", "const", "mockResolverArray", "=", "(", "resolutions", ")", "=>", "{", "return", "resolutions", ".", "map", "(", "(", "resolution", ")", ":", "MockResolver", "=>", "{", "return", "new", "MockResolver", "(", "resolution", ")", ";", "}", ")", ";", "}", ";", "suite", "(", "'MultiUrlResolver'", ",", "function", "(", ")", "{", "suite", "(", "'resolve'", ",", "(", ")", "=>", "{", "test", "(", "'only the first resolution is returned'", ",", "(", ")", "=>", "{", "const", "resolvers", "=", "mockResolverArray", "(", "[", "'file1.html'", ",", "'file2.html'", ",", "'file3.html'", "]", ")", ";", "const", "resolver", "=", "new", "MultiUrlResolver", "(", "resolvers", ")", ";", "assert", ".", "equal", "(", "resolver", ".", "resolve", "(", "packageRelativeUrl", "`file2.html`", ")", ",", "resolvedUrl", "`file2.html`", ")", ";", "assert", ".", "equal", "(", "resolvers", "[", "0", "]", ".", "resolveCount", ",", "1", ")", ";", "assert", ".", "equal", "(", "resolvers", "[", "1", "]", ".", "resolveCount", ",", "1", ")", ";", "assert", ".", "equal", "(", "resolvers", "[", "2", "]", ".", "resolveCount", ",", "0", ")", ";", "}", ")", ";", "test", "(", "'keeps trying until it finds a good resolver'", ",", "(", ")", "=>", "{", "const", "resolvers", "=", "mockResolverArray", "(", "[", "null", ",", "null", ",", "'test.html'", "]", ")", ";", "const", "resolver", "=", "new", "MultiUrlResolver", "(", "resolvers", ")", ";", "assert", ".", "equal", "(", "resolver", ".", "resolve", "(", "resolvedUrl", "``", ",", "fileRelativeUrl", "`test.html`", ")", ",", "resolvedUrl", "`test.html`", ")", ";", "assert", ".", "equal", "(", "resolvers", "[", "0", "]", ".", "resolveCount", ",", "1", ")", ";", "assert", ".", "equal", "(", "resolvers", "[", "1", "]", ".", "resolveCount", ",", "1", ")", ";", "assert", ".", "equal", "(", "resolvers", "[", "2", "]", ".", "resolveCount", ",", "1", ")", ";", "}", ")", ";", "test", "(", "`returns undefined if no resolver works`", ",", "(", ")", "=>", "{", "const", "resolvers", "=", "mockResolverArray", "(", "[", "null", ",", "null", ",", "null", "]", ")", ";", "const", "resolver", "=", "new", "MultiUrlResolver", "(", "resolvers", ")", ";", "assert", ".", "equal", "(", "resolver", ".", "resolve", "(", "resolvedUrl", "``", ",", "fileRelativeUrl", "`test.html`", ")", ",", "undefined", ")", ";", "assert", ".", "equal", "(", "resolvers", "[", "0", "]", ".", "resolveCount", ",", "1", ")", ";", "assert", ".", "equal", "(", "resolvers", "[", "1", "]", ".", "resolveCount", ",", "1", ")", ";", "assert", ".", "equal", "(", "resolvers", "[", "2", "]", ".", "resolveCount", ",", "1", ")", ";", "}", ")", ";", "}", ")", ";", "suite", "(", "'relative'", ",", "(", ")", "=>", "{", "test", "(", "'delegate the relative function based on resolve'", ",", "(", ")", "=>", "{", "const", "resolvers", "=", "mockResolverArray", "(", "[", "'file1.html'", ",", "'file2.html'", ",", "'file3.html'", "]", ")", ";", "const", "resolver", "=", "new", "MultiUrlResolver", "(", "resolvers", ")", ";", "assert", ".", "equal", "(", "resolver", ".", "relative", "(", "resolvedUrl", "`file2.html`", ")", ",", "packageRelativeUrl", "`file2.html`", ")", ";", "assert", ".", "equal", "(", "resolvers", "[", "0", "]", ".", "resolveCount", ",", "1", ")", ";", "assert", ".", "equal", "(", "resolvers", "[", "1", "]", ".", "resolveCount", ",", "1", ")", ";", "assert", ".", "equal", "(", "resolvers", "[", "2", "]", ".", "resolveCount", ",", "0", ")", ";", "assert", ".", "equal", "(", "resolvers", "[", "0", "]", ".", "relativeCount", ",", "0", ")", ";", "assert", ".", "equal", "(", "resolvers", "[", "1", "]", ".", "relativeCount", ",", "1", ")", ";", "assert", ".", "equal", "(", "resolvers", "[", "2", "]", ".", "relativeCount", ",", "0", ")", ";", "}", ")", ";", "}", ")", ";", "}", ")", ";" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, 1462, null, null, null, 7135, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 17964, null, 1462, null, null, 7135, null, 1462, null, 1462, null, 2, null, null, null, null, null, 1462, null, 1462, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7135, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, 13, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1338
[ "license", "import", "{", "assert", "}", "from", "'chai'", ";", "import", "{", "PackageRelativeUrl", "}", "from", "'../../index'", ";", "import", "{", "PackageUrlResolver", "}", "from", "'../../url-loader/package-url-resolver'", ";", "import", "{", "fileRelativeUrl", ",", "packageRelativeUrl", ",", "resolvedUrl", ",", "rootedFileUrl", "}", "from", "'../test-utils'", ";", "suite", "(", "'PackageUrlResolver'", ",", "function", "(", ")", "{", "suite", "(", "'resolve'", ",", "(", ")", "=>", "{", "let", "resolver", ";", "setup", "(", "(", ")", "=>", "{", "resolver", "=", "new", "PackageUrlResolver", "(", "{", "packageDir", ":", "`/1/2`", "}", ")", ";", "}", ")", ";", "test", "(", "`resolves file:// urls to themselves`", ",", "(", ")", "=>", "{", "const", "r", "=", "new", "PackageUrlResolver", "(", ")", ";", "assert", ".", "equal", "(", "r", ".", "resolve", "(", "resolvedUrl", "`https://example.com/bar`", ",", "fileRelativeUrl", "`file:///foo/bar/baz`", ")", ",", "resolvedUrl", "`file:///foo/bar/baz`", ")", ";", "}", ")", ";", "test", "(", "'resolves an in-package URL'", ",", "(", ")", "=>", "{", "assert", ".", "equal", "(", "resolver", ".", "resolve", "(", "packageRelativeUrl", "`foo.html`", ")", ",", "rootedFileUrl", "`1/2/foo.html`", ")", ";", "assert", ".", "equal", "(", "resolver", ".", "resolve", "(", "packageRelativeUrl", "`/foo.html`", ")", ",", "rootedFileUrl", "`1/2/foo.html`", ")", ";", "assert", ".", "equal", "(", "resolver", ".", "resolve", "(", "packageRelativeUrl", "`./foo.html`", ")", ",", "rootedFileUrl", "`1/2/foo.html`", ")", ";", "}", ")", ";", "test", "(", "`resolves sibling URLs to the component dir`", ",", "(", ")", "=>", "{", "assert", ".", "equal", "(", "resolver", ".", "resolve", "(", "packageRelativeUrl", "`../foo/foo.html`", ")", ",", "rootedFileUrl", "`1/2/bower_components/foo/foo.html`", ")", ";", "const", "configured", "=", "new", "PackageUrlResolver", "(", "{", "componentDir", ":", "'components'", ",", "packageDir", ":", "'/1/2/'", "}", ")", ";", "assert", ".", "equal", "(", "configured", ".", "resolve", "(", "(", "rootedFileUrl", "`1/bar/bar.html`", ")", "as", "any", "as", "PackageRelativeUrl", ")", ",", "rootedFileUrl", "`1/2/components/bar/bar.html`", ")", ";", "}", ")", ";", "test", "(", "'resolves sibling with matching name prefix to component dir'", ",", "(", ")", "=>", "{", "const", "configured", "=", "new", "PackageUrlResolver", "(", "{", "packageDir", ":", "'/repos/iron-icons'", "}", ")", ";", "assert", ".", "equal", "(", "configured", ".", "resolve", "(", "rootedFileUrl", "`repos/iron-iconset-svg/foo.html`", "as", "any", "as", "PackageRelativeUrl", ")", ",", "rootedFileUrl", "`repos/iron-icons/bower_components/iron-iconset-svg/foo.html`", ")", ";", "}", ")", ";", "test", "(", "'resolves cousin URLs as normal'", ",", "(", ")", "=>", "{", "assert", ".", "equal", "(", "resolver", ".", "resolve", "(", "packageRelativeUrl", "`../../foo/foo.html`", ")", ",", "rootedFileUrl", "`foo/foo.html`", ")", ";", "}", ")", ";", "test", "(", "'passes URLs with unknown hostnames through untouched'", ",", "(", ")", "=>", "{", "const", "r", "=", "new", "PackageUrlResolver", "(", ")", ";", "assert", ".", "equal", "(", "r", ".", "resolve", "(", "packageRelativeUrl", "`http://abc.xyz/foo.html`", ")", ",", "resolvedUrl", "`http://abc.xyz/foo.html`", ")", ";", "assert", ".", "equal", "(", "r", ".", "resolve", "(", "resolvedUrl", "`https://baz.com/qux.js`", ",", "fileRelativeUrl", "`https://foo.com/bar.html`", ")", ",", "resolvedUrl", "`https://foo.com/bar.html`", ")", ";", "}", ")", ";", "test", "(", "'resolves protocol-relative URLs using default protocol'", ",", "(", ")", "=>", "{", "const", "r", "=", "new", "PackageUrlResolver", "(", "{", "packageDir", ":", "`/1/2`", ",", "host", ":", "'foo.com'", "}", ")", ";", "assert", ".", "equal", "(", "r", ".", "resolve", "(", "packageRelativeUrl", "`//abc.xyz/foo.html`", ")", ",", "resolvedUrl", "`https://abc.xyz/foo.html`", ")", ";", "assert", ".", "equal", "(", "r", ".", "resolve", "(", "rootedFileUrl", "`1/2/bar.html`", ",", "fileRelativeUrl", "`//abc.xyz/foo.html`", ")", ",", "resolvedUrl", "`https://abc.xyz/foo.html`", ")", ";", "assert", ".", "equal", "(", "r", ".", "resolve", "(", "rootedFileUrl", "`1/2/bar.html`", ",", "fileRelativeUrl", "`//foo.com/baz.html`", ")", ",", "rootedFileUrl", "`1/2/baz.html`", ")", ";", "}", ")", ";", "test", "(", "'resolves protocol-relative URLs using provided protocol'", ",", "(", ")", "=>", "{", "const", "r", "=", "new", "PackageUrlResolver", "(", "{", "protocol", ":", "'potato'", ",", "packageDir", ":", "`/1/2`", ",", "host", ":", "'foo.com'", "}", ")", ";", "assert", ".", "equal", "(", "r", ".", "resolve", "(", "packageRelativeUrl", "`//foo.com/bar.html`", ")", ",", "rootedFileUrl", "`1/2/bar.html`", ",", "'host matches resolver, resolve to file URL'", ")", ";", "assert", ".", "equal", "(", "r", ".", "resolve", "(", "packageRelativeUrl", "`//abc.xyz/foo.html`", ")", ",", "resolvedUrl", "`potato://abc.xyz/foo.html`", ",", "'host does not match resolver, resolve with protocol option'", ")", ";", "assert", ".", "equal", "(", "r", ".", "resolve", "(", "resolvedUrl", "`spaghetti://abc.xyz/foo.html`", ",", "fileRelativeUrl", "`//foo.com/bar.html`", ")", ",", "rootedFileUrl", "`1/2/bar.html`", ",", "'host matches resolver, resolve as file URL'", ")", ";", "assert", ".", "equal", "(", "r", ".", "resolve", "(", "resolvedUrl", "`spaghetti://abc.xyz/foo.html`", ",", "fileRelativeUrl", "`//abc.xyz/foo.html`", ")", ",", "resolvedUrl", "`spaghetti://abc.xyz/foo.html`", ",", "'host does not match resolver, inherit non-file protocol from base URL'", ")", ";", "assert", ".", "equal", "(", "r", ".", "resolve", "(", "rootedFileUrl", "`1/2/bar.html`", ",", "fileRelativeUrl", "`//abc.xyz/foo.html`", ")", ",", "resolvedUrl", "`potato://abc.xyz/foo.html`", ",", "'host does not match resolver, do not inherit file protocol from base URL'", ")", ";", "assert", ".", "equal", "(", "r", ".", "resolve", "(", "resolvedUrl", "`spaghetti://example.com/`", ",", "fileRelativeUrl", "`//abc.xyz/foo.html`", ")", ",", "resolvedUrl", "`spaghetti://abc.xyz/foo.html`", ",", "'host does not match resolver, inherit non-file protocol from base URL'", ")", ";", "}", ")", ";", "test", "(", "`resolves a URL with the right hostname`", ",", "(", ")", "=>", "{", "const", "resolver", "=", "new", "PackageUrlResolver", "(", "{", "componentDir", ":", "`components`", ",", "host", ":", "`abc.xyz`", ",", "packageDir", ":", "`/1/2`", "}", ")", ";", "assert", ".", "equal", "(", "resolver", ".", "resolve", "(", "packageRelativeUrl", "`http://abc.xyz/foo.html`", ")", ",", "rootedFileUrl", "`1/2/foo.html`", ")", ";", "assert", ".", "equal", "(", "resolver", ".", "resolve", "(", "packageRelativeUrl", "`http://abc.xyz/./foo.html`", ")", ",", "rootedFileUrl", "`1/2/foo.html`", ")", ";", "assert", ".", "equal", "(", "resolver", ".", "resolve", "(", "packageRelativeUrl", "`http://abc.xyz/../foo.html`", ")", ",", "rootedFileUrl", "`1/2/foo.html`", ")", ";", "assert", ".", "equal", "(", "resolver", ".", "resolve", "(", "packageRelativeUrl", "`http://abc.xyz/foo/../foo.html`", ")", ",", "rootedFileUrl", "`1/2/foo.html`", ")", ";", "assert", ".", "equal", "(", "resolver", ".", "resolve", "(", "packageRelativeUrl", "`foo.html`", ")", ",", "rootedFileUrl", "`1/2/foo.html`", ")", ";", "assert", ".", "equal", "(", "resolver", ".", "resolve", "(", "packageRelativeUrl", "`./foo.html`", ")", ",", "rootedFileUrl", "`1/2/foo.html`", ")", ";", "assert", ".", "equal", "(", "resolver", ".", "resolve", "(", "packageRelativeUrl", "`foo/../foo.html`", ")", ",", "rootedFileUrl", "`1/2/foo.html`", ")", ";", "assert", ".", "equal", "(", "resolver", ".", "resolve", "(", "packageRelativeUrl", "`/foo.html`", ")", ",", "rootedFileUrl", "`1/2/foo.html`", ")", ";", "assert", ".", "equal", "(", "resolver", ".", "resolve", "(", "packageRelativeUrl", "`/./foo.html`", ")", ",", "rootedFileUrl", "`1/2/foo.html`", ")", ";", "assert", ".", "equal", "(", "resolver", ".", "resolve", "(", "packageRelativeUrl", "`/../foo/foo.html`", ")", ",", "rootedFileUrl", "`1/2/foo/foo.html`", ")", ";", "assert", ".", "equal", "(", "resolver", ".", "resolve", "(", "packageRelativeUrl", "`/foo/../foo.html`", ")", ",", "rootedFileUrl", "`1/2/foo.html`", ")", ";", "}", ")", ";", "test", "(", "`resolves a URL with spaces`", ",", "(", ")", "=>", "{", "assert", ".", "equal", "(", "resolver", ".", "resolve", "(", "packageRelativeUrl", "`spaced name.html`", ")", ",", "rootedFileUrl", "`1/2/spaced%20name.html`", ")", ";", "}", ")", ";", "test", "(", "'resolves an undecodable URL to undefined'", ",", "(", ")", "=>", "{", "assert", ".", "equal", "(", "resolver", ".", "resolve", "(", "packageRelativeUrl", "`%><><%=`", ")", ",", "undefined", ")", ";", "}", ")", ";", "test", "(", "'resolves a relative URL containing querystring and fragment'", ",", "(", ")", "=>", "{", "assert", ".", "equal", "(", "resolver", ".", "resolve", "(", "rootedFileUrl", "`1/2/foo.html?bar`", ",", "fileRelativeUrl", "`foo.html#bat`", ")", ",", "rootedFileUrl", "`1/2/foo.html#bat`", ")", ";", "assert", ".", "equal", "(", "resolver", ".", "resolve", "(", "packageRelativeUrl", "`foo.html?baz#bat`", ")", ",", "rootedFileUrl", "`1/2/foo.html?baz#bat`", ")", ";", "assert", ".", "equal", "(", "resolver", ".", "resolve", "(", "rootedFileUrl", "`1/2/bar/baz/`", ",", "fileRelativeUrl", "`foo.html?baz#bat`", ")", ",", "rootedFileUrl", "`1/2/bar/baz/foo.html?baz#bat`", ")", ";", "}", ")", ";", "test", "(", "'resolves a URL with no pathname'", ",", "(", ")", "=>", "{", "assert", ".", "equal", "(", "resolver", ".", "resolve", "(", "rootedFileUrl", "`1/2/foo.html`", ",", "fileRelativeUrl", "``", ")", ",", "rootedFileUrl", "`1/2/foo.html`", ")", ";", "assert", ".", "equal", "(", "resolver", ".", "resolve", "(", "rootedFileUrl", "`1/2/foo.html?baz#bat`", ",", "fileRelativeUrl", "``", ")", ",", "rootedFileUrl", "`1/2/foo.html?baz`", ")", ";", "assert", ".", "equal", "(", "resolver", ".", "resolve", "(", "rootedFileUrl", "`1/2/foo.html`", ",", "fileRelativeUrl", "`#buz`", ")", ",", "rootedFileUrl", "`1/2/foo.html#buz`", ")", ";", "assert", ".", "equal", "(", "resolver", ".", "resolve", "(", "rootedFileUrl", "`1/2/foo.html?baz#bat`", ",", "fileRelativeUrl", "`#buz`", ")", ",", "rootedFileUrl", "`1/2/foo.html?baz#buz`", ")", ";", "assert", ".", "equal", "(", "resolver", ".", "resolve", "(", "rootedFileUrl", "`1/2/foo.html?bar#buz`", ",", "fileRelativeUrl", "`?fiz`", ")", ",", "rootedFileUrl", "`1/2/foo.html?fiz`", ")", ";", "assert", ".", "equal", "(", "resolver", ".", "resolve", "(", "rootedFileUrl", "`1/2/foo.html`", ",", "fileRelativeUrl", "`?fiz#buz`", ")", ",", "rootedFileUrl", "`1/2/foo.html?fiz#buz`", ")", ";", "assert", ".", "equal", "(", "resolver", ".", "resolve", "(", "rootedFileUrl", "`1/2/foo.html?bar`", ",", "fileRelativeUrl", "`?fiz#buz`", ")", ",", "rootedFileUrl", "`1/2/foo.html?fiz#buz`", ")", ";", "}", ")", ";", "}", ")", ";", "suite", "(", "'relative'", ",", "(", ")", "=>", "{", "const", "resolver", "=", "new", "PackageUrlResolver", "(", "{", "packageDir", ":", "process", ".", "cwd", "(", ")", "}", ")", ";", "function", "relative", "(", "from", ",", "to", ")", "{", "const", "fromResolved", "=", "resolver", ".", "resolve", "(", "from", "as", "PackageRelativeUrl", ")", "!", ";", "const", "toResolved", "=", "resolver", ".", "resolve", "(", "to", "as", "PackageRelativeUrl", ")", "!", ";", "const", "result", "=", "resolver", ".", "relative", "(", "fromResolved", ",", "toResolved", ")", ";", "return", "result", ";", "}", "test", "(", "'can get relative urls between urls'", ",", "(", ")", "=>", "{", "assert", ".", "equal", "(", "relative", "(", "'/'", ",", "'/'", ")", ",", "''", ")", ";", "assert", ".", "equal", "(", "relative", "(", "'/'", ",", "'/bar/'", ")", ",", "'bar/'", ")", ";", "assert", ".", "equal", "(", "relative", "(", "'/foo/'", ",", "'/foo/'", ")", ",", "''", ")", ";", "assert", ".", "equal", "(", "relative", "(", "'/foo/'", ",", "'/bar/'", ")", ",", "'../bar/'", ")", ";", "assert", ".", "equal", "(", "relative", "(", "'foo/'", ",", "'/'", ")", ",", "'../'", ")", ";", "assert", ".", "equal", "(", "relative", "(", "'foo.html'", ",", "'foo.html'", ")", ",", "''", ")", ";", "assert", ".", "equal", "(", "relative", "(", "'foo/'", ",", "'bar/'", ")", ",", "'../bar/'", ")", ";", "assert", ".", "equal", "(", "relative", "(", "'foo.html'", ",", "'bar.html'", ")", ",", "'bar.html'", ")", ";", "assert", ".", "equal", "(", "relative", "(", "'sub/foo.html'", ",", "'bar.html'", ")", ",", "'../bar.html'", ")", ";", "assert", ".", "equal", "(", "relative", "(", "'sub1/foo.html'", ",", "'sub2/bar.html'", ")", ",", "'../sub2/bar.html'", ")", ";", "assert", ".", "equal", "(", "relative", "(", "'foo.html'", ",", "'sub/bar.html'", ")", ",", "'sub/bar.html'", ")", ";", "assert", ".", "equal", "(", "relative", "(", "'./foo.html'", ",", "'./sub/bar.html'", ")", ",", "'sub/bar.html'", ")", ";", "assert", ".", "equal", "(", "relative", "(", "'./foo.html'", ",", "'./bar.html'", ")", ",", "'bar.html'", ")", ";", "assert", ".", "equal", "(", "relative", "(", "'./foo/'", ",", "'sub/bar.html'", ")", ",", "'../sub/bar.html'", ")", ";", "assert", ".", "equal", "(", "relative", "(", "'./foo/bonk.html'", ",", "'sub/bar/'", ")", ",", "'../sub/bar/'", ")", ";", "}", ")", ";", "test", "(", "'will keep absolute urls absolute'", ",", "(", ")", "=>", "{", "assert", ".", "equal", "(", "relative", "(", "'foo/'", ",", "'http://example.com'", ")", ",", "'http://example.com/'", ")", ";", "assert", ".", "equal", "(", "relative", "(", "'foo/'", ",", "'https://example.com'", ")", ",", "'https://example.com/'", ")", ";", "assert", ".", "equal", "(", "relative", "(", "'foo/'", ",", "'file://host/path/to/file'", ")", ",", "'file://host/path/to/file'", ")", ";", "}", ")", ";", "test", "(", "'sibling urls work properly'", ",", "(", ")", "=>", "{", "assert", ".", "equal", "(", "relative", "(", "'foo.html'", ",", "'../bar/bar.html'", ")", ",", "'../bar/bar.html'", ")", ";", "assert", ".", "equal", "(", "relative", "(", "'foo/foo.html'", ",", "'../bar/bar.html'", ")", ",", "'../../bar/bar.html'", ")", ";", "assert", ".", "equal", "(", "relative", "(", "'../foo/foo.html'", ",", "'../bar/bar.html'", ")", ",", "'../bar/bar.html'", ")", ";", "}", ")", ";", "}", ")", ";", "}", ")", ";" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 20795, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 20795, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 20795, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 20795, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 20795, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 20795, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 20795, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 20795, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 20795, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, 2, null, null, null, 1462, null, null, null, null, null, null, null, null, null, null, null, null, 1462, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1339
[ "license", "import", "{", "assert", "}", "from", "'chai'", ";", "import", "{", "FileRelativeUrl", ",", "PackageRelativeUrl", ",", "ResolvedUrl", "}", "from", "'../../index'", ";", "import", "{", "UrlResolver", "}", "from", "'../../url-loader/url-resolver'", ";", "class", "SimplestUrlResolver", "extends", "UrlResolver", "{", "resolve", "(", "firstUrl", ",", "secondUrl", "?", ")", "{", "const", "[", "baseUrl", "=", "'/test/'", "as", "ResolvedUrl", ",", "url", "]", "=", "this", ".", "getBaseAndUnresolved", "(", "firstUrl", ",", "secondUrl", ")", ";", "return", "this", ".", "simpleUrlResolve", "(", "baseUrl", ",", "url", ",", "'https'", ")", ";", "}", "relative", "(", "to", ")", ";", "relative", "(", "from", ",", "to", ",", "kind", "?", ")", ";", "relative", "(", "fromOrTo", ",", "maybeTo", "?", ",", "_kind", "?", ")", "{", "let", "from", ",", "to", ";", "if", "(", "maybeTo", "!==", "undefined", ")", "{", "from", "=", "fromOrTo", ";", "to", "=", "maybeTo", ";", "}", "else", "{", "throw", "new", "Error", "(", "'simplest url resolver.relative must be called with two arguments'", ")", ";", "}", "const", "result", "=", "this", ".", "simpleUrlRelative", "(", "from", ",", "to", ")", ";", "if", "(", "maybeTo", "===", "undefined", ")", "{", "return", "this", ".", "brandAsPackageRelative", "(", "result", ")", ";", "}", "return", "result", ";", "}", "}", "suite", "(", "'UrlResolver'", ",", "(", ")", "=>", "{", "suite", "(", "'resolve'", ",", "(", ")", "=>", "{", "const", "resolver", "=", "new", "SimplestUrlResolver", "(", ")", ";", "function", "resolve", "(", "baseUrl", ",", "unresolvedUrl", ")", "{", "return", "resolver", ".", "resolve", "(", "baseUrl", "as", "ResolvedUrl", ",", "unresolvedUrl", "as", "FileRelativeUrl", ")", ";", "}", "test", "(", "'can resolve a url when relative url contains no pathname'", ",", "(", ")", "=>", "{", "assert", ".", "equal", "(", "resolve", "(", "'/foo.html?fiz#buz'", ",", "''", ")", ",", "'/foo.html?fiz'", ")", ";", "assert", ".", "equal", "(", "resolve", "(", "'/foo.html'", ",", "'#fiz'", ")", ",", "'/foo.html#fiz'", ")", ";", "assert", ".", "equal", "(", "resolve", "(", "'/foo.html#buz'", ",", "'#fiz'", ")", ",", "'/foo.html#fiz'", ")", ";", "assert", ".", "equal", "(", "resolve", "(", "'/foo.html'", ",", "'?fiz'", ")", ",", "'/foo.html?fiz'", ")", ";", "assert", ".", "equal", "(", "resolve", "(", "'/foo.html?buz'", ",", "'?fiz'", ")", ",", "'/foo.html?fiz'", ")", ";", "assert", ".", "equal", "(", "resolve", "(", "'/foo.html?bar#buz'", ",", "'?fiz'", ")", ",", "`/foo.html?fiz`", ")", ";", "}", ")", ";", "}", ")", ";", "suite", "(", "'relative'", ",", "(", ")", "=>", "{", "const", "resolver", "=", "new", "SimplestUrlResolver", "(", ")", ";", "function", "relative", "(", "from", ",", "to", ")", "{", "const", "fromResolved", "=", "resolver", ".", "resolve", "(", "from", "as", "PackageRelativeUrl", ")", ";", "const", "toResolved", "=", "resolver", ".", "resolve", "(", "to", "as", "PackageRelativeUrl", ")", ";", "return", "resolver", ".", "relative", "(", "fromResolved", ",", "toResolved", ")", ";", "}", "test", "(", "'can get relative urls between urls'", ",", "(", ")", "=>", "{", "assert", ".", "equal", "(", "relative", "(", "'/'", ",", "'/'", ")", ",", "''", ")", ";", "assert", ".", "equal", "(", "relative", "(", "'/'", ",", "'/bar/'", ")", ",", "'bar/'", ")", ";", "assert", ".", "equal", "(", "relative", "(", "'/foo/'", ",", "'/foo/'", ")", ",", "''", ")", ";", "assert", ".", "equal", "(", "relative", "(", "'/foo/'", ",", "'/bar/'", ")", ",", "'../bar/'", ")", ";", "assert", ".", "equal", "(", "relative", "(", "'foo/'", ",", "'/'", ")", ",", "'../../'", ")", ";", "assert", ".", "equal", "(", "relative", "(", "'foo.html'", ",", "'foo.html'", ")", ",", "''", ")", ";", "assert", ".", "equal", "(", "relative", "(", "'foo/'", ",", "'bar/'", ")", ",", "'../bar/'", ")", ";", "assert", ".", "equal", "(", "relative", "(", "'foo.html'", ",", "'bar.html'", ")", ",", "'bar.html'", ")", ";", "assert", ".", "equal", "(", "relative", "(", "'sub/foo.html'", ",", "'bar.html'", ")", ",", "'../bar.html'", ")", ";", "assert", ".", "equal", "(", "relative", "(", "'sub1/foo.html'", ",", "'sub2/bar.html'", ")", ",", "'../sub2/bar.html'", ")", ";", "assert", ".", "equal", "(", "relative", "(", "'foo.html'", ",", "'sub/bar.html'", ")", ",", "'sub/bar.html'", ")", ";", "assert", ".", "equal", "(", "relative", "(", "'./foo.html'", ",", "'./sub/bar.html'", ")", ",", "'sub/bar.html'", ")", ";", "assert", ".", "equal", "(", "relative", "(", "'./foo.html'", ",", "'./bar.html'", ")", ",", "'bar.html'", ")", ";", "assert", ".", "equal", "(", "relative", "(", "'./foo/'", ",", "'sub/bar.html'", ")", ",", "'../sub/bar.html'", ")", ";", "assert", ".", "equal", "(", "relative", "(", "'./foo/bonk.html'", ",", "'sub/bar/'", ")", ",", "'../sub/bar/'", ")", ";", "}", ")", ";", "test", "(", "'preserves target url querystrings and fragments'", ",", "(", ")", "=>", "{", "assert", ".", "equal", "(", "relative", "(", "'foo.html'", ",", "'foo.html?fiz=buz'", ")", ",", "'?fiz=buz'", ")", ";", "assert", ".", "equal", "(", "relative", "(", "'foo.html'", ",", "'bar.html?fiz=buz'", ")", ",", "'bar.html?fiz=buz'", ")", ";", "assert", ".", "equal", "(", "relative", "(", "'foo.html?fiz=buz'", ",", "'foo.html'", ")", ",", "''", ")", ";", "assert", ".", "equal", "(", "relative", "(", "'foo.html'", ",", "'foo.html#fiz'", ")", ",", "'#fiz'", ")", ";", "}", ")", ";", "test", "(", "'will keep absolute urls absolute'", ",", "(", ")", "=>", "{", "assert", ".", "equal", "(", "relative", "(", "'foo/'", ",", "'http://example.com'", ")", ",", "'http://example.com/'", ")", ";", "assert", ".", "equal", "(", "relative", "(", "'foo/'", ",", "'https://example.com'", ")", ",", "'https://example.com/'", ")", ";", "assert", ".", "equal", "(", "relative", "(", "'foo/'", ",", "'file://host/path/to/file'", ")", ",", "'file://host/path/to/file'", ")", ";", "}", ")", ";", "test", "(", "'sibling urls work properly'", ",", "(", ")", "=>", "{", "assert", ".", "equal", "(", "relative", "(", "'foo.html'", ",", "'../bar/bar.html'", ")", ",", "'../bar/bar.html'", ")", ";", "assert", ".", "equal", "(", "relative", "(", "'foo/foo.html'", ",", "'../bar/bar.html'", ")", ",", "'../../bar/bar.html'", ")", ";", "assert", ".", "equal", "(", "relative", "(", "'../foo/foo.html'", ",", "'../bar/bar.html'", ")", ",", "'../bar/bar.html'", ")", ";", "}", ")", ";", "}", ")", ";", "}", ")", ";" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1462, null, null, null, 7135, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 17964, null, 1462, null, null, 7135, null, 1462, null, 1462, null, 2, null, null, null, null, null, 1462, null, 1462, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7135, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, 1462, null, 2, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, 7135, null, 2, null, 2, null, null, null, 1462, null, null, null, null, null, null, null, null, null, null, null, 1462, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1340
[ "export", "type", "language", "=", "{", "name", ":", "string", ";", "fileName", "?", ":", "string", ";", "extension", ":", "string", ";", "extensionAliases", "?", ":", "Array", "<", "string", ">", ";", "assetName", ":", "string", ";", "}", ";", "let", "langs", "=", "[", "]", ";", "langs", ".", "push", "(", "{", "name", ":", "\"LICENSE\"", ",", "fileName", ":", "\"license\"", ",", "extension", ":", "\"\"", ",", "extensionAliases", ":", "[", "\"txt\"", ",", "\"md\"", ",", "\"html\"", ",", "\"asciidoc\"", "]", ",", "assetName", ":", "\"license\"", "}", ")", ";", "langs", ".", "push", "(", "{", "name", ":", "\"LICENSE\"", ",", "fileName", ":", "\"LICENSE\"", ",", "extension", ":", "\"\"", ",", "extensionAliases", ":", "[", "\"txt\"", ",", "\"md\"", ",", "\"html\"", ",", "\"asciidoc\"", "]", ",", "assetName", ":", "\"license\"", "}", ")", ";", "langs", ".", "push", "(", "{", "name", ":", "\"Prettier\"", ",", "fileName", ":", "\".prettierrc\"", ",", "extension", ":", "\"json\"", ",", "extensionAliases", ":", "[", "\"yml\"", ",", "\"yaml\"", ",", "\"toml\"", ",", "\"js\"", ",", "\"config.js\"", "]", ",", "assetName", ":", "\"prettier\"", "}", ")", ";", "langs", ".", "push", "(", "{", "name", ":", "\"ESLint\"", ",", "fileName", ":", "\".eslintrc\"", ",", "extension", ":", "\"json\"", ",", "extensionAliases", ":", "[", "\"js\"", ",", "\"yaml\"", "]", ",", "assetName", ":", "\"eslint\"", "}", ")", ";", "langs", ".", "push", "(", "{", "name", ":", "\"Composer\"", ",", "fileName", ":", "\"composer\"", ",", "extension", ":", "\"json\"", ",", "assetName", ":", "\"php\"", "}", ")", ";", "langs", ".", "push", "(", "{", "name", ":", "\"TypeScript config\"", ",", "fileName", ":", "\"tsconfig\"", ",", "extension", ":", "\"json\"", ",", "assetName", ":", "\"tsconfig\"", "}", ")", ";", "langs", ".", "push", "(", "{", "name", ":", "\"Babel\"", ",", "fileName", ":", "\"babel.config\"", ",", "extension", ":", "\"json\"", ",", "assetName", ":", "\"babel\"", "}", ")", ";", "langs", ".", "push", "(", "{", "name", ":", "\"Babel\"", ",", "fileName", ":", "\".babelrc\"", ",", "extension", ":", "\"json\"", ",", "assetName", ":", "\"babel\"", "}", ")", ";", "langs", ".", "push", "(", "{", "name", ":", "\"C language\"", ",", "extension", ":", "\"c\"", ",", "assetName", ":", "\"c\"", "}", ")", ";", "langs", ".", "push", "(", "{", "name", ":", "\"CMake\"", ",", "fileName", ":", "\"CMake\"", ",", "extension", ":", "\"txt\"", ",", "assetName", ":", "\"cmake\"", "}", ")", ";", "langs", ".", "push", "(", "{", "name", ":", "\"Config\"", ",", "extension", ":", "\"conf\"", ",", "assetName", ":", "\"config\"", "}", ")", ";", "langs", ".", "push", "(", "{", "name", ":", "\"C++\"", ",", "extension", ":", "\"cpp\"", ",", "extensionAliases", ":", "[", "\"cc\"", ",", "\"cxx\"", "]", ",", "assetName", ":", "\"cpp\"", "}", ")", ";", "langs", ".", "push", "(", "{", "name", ":", "\"Crystal\"", ",", "extension", ":", "\"cr\"", ",", "assetName", ":", "\"crystal\"", "}", ")", ";", "langs", ".", "push", "(", "{", "name", ":", "\"C#\"", ",", "extension", ":", "\"cs\"", ",", "assetName", ":", "\"csharp\"", "}", ")", ";", "langs", ".", "push", "(", "{", "name", ":", "\"CSProj\"", ",", "extension", ":", "\"csproj\"", ",", "assetName", ":", "\"csproj\"", "}", ")", ";", "langs", ".", "push", "(", "{", "name", ":", "\"CSS\"", ",", "extension", ":", "\"css\"", ",", "assetName", ":", "\"css\"", "}", ")", ";", "langs", ".", "push", "(", "{", "name", ":", "\"Docker\"", ",", "fileName", ":", "\"Dockerfile\"", ",", "extension", ":", "\"\"", ",", "assetName", ":", "\"docker\"", "}", ")", ";", "langs", ".", "push", "(", "{", "name", ":", "\"Docker\"", ",", "fileName", ":", "\"docker-compose\"", ",", "extension", ":", "\"yml\"", ",", "assetName", ":", "\"docker\"", "}", ")", ";", "langs", ".", "push", "(", "{", "name", ":", "\"Docker\"", ",", "fileName", ":", "\".dockerignore\"", ",", "extension", ":", "\"\"", ",", "assetName", ":", "\"docker\"", "}", ")", ";", "langs", ".", "push", "(", "{", "name", ":", "\"EditorConfig\"", ",", "fileName", ":", "\".editorconfig\"", ",", "extension", ":", "\"\"", ",", "assetName", ":", "\"editorconfig\"", "}", ")", ";", "langs", ".", "push", "(", "{", "name", ":", "\"favicon\"", ",", "fileName", ":", "\"favicon\"", ",", "extension", ":", "\"ico\"", ",", "assetName", ":", "\"favicon\"", "}", ")", ";", "langs", ".", "push", "(", "{", "name", ":", "\"Git\"", ",", "fileName", ":", "\".gitignore\"", ",", "extension", ":", "\"\"", ",", "assetName", ":", "\"git\"", "}", ")", ";", "langs", ".", "push", "(", "{", "name", ":", "\"Golang\"", ",", "fileName", ":", "\"go\"", ",", "extension", ":", "\"mod\"", ",", "assetName", ":", "\"golang\"", "}", ")", ";", "langs", ".", "push", "(", "{", "name", ":", "\"Golang\"", ",", "fileName", ":", "\"go\"", ",", "extension", ":", "\"sum\"", ",", "assetName", ":", "\"golang\"", "}", ")", ";", "langs", ".", "push", "(", "{", "name", ":", "\"Golang\"", ",", "extension", ":", "\"go\"", ",", "assetName", ":", "\"golang\"", "}", ")", ";", "langs", ".", "push", "(", "{", "name", ":", "\"Golang\"", ",", "fileName", ":", "\"go\"", ",", "extension", ":", "\"mod\"", ",", "assetName", ":", "\"golang\"", "}", ")", ";", "langs", ".", "push", "(", "{", "name", ":", "\"GraphQL\"", ",", "extension", ":", "\"graphql\"", ",", "assetName", ":", "\"graphql\"", "}", ")", ";", "langs", ".", "push", "(", "{", "name", ":", "\"C language\"", ",", "extension", ":", "\"h\"", ",", "assetName", ":", "\"h\"", "}", ")", ";", "langs", ".", "push", "(", "{", "name", ":", "\"Haskell\"", ",", "extension", ":", "\"hs\"", ",", "extensionAliases", ":", "[", "\"lhs\"", "]", ",", "assetName", ":", "\"haskell\"", "}", ")", ";", "langs", ".", "push", "(", "{", "name", ":", "\"C++\"", ",", "extension", ":", "\"hpp\"", ",", "extensionAliases", ":", "[", "\"hh\"", ",", "\"hxx\"", "]", ",", "assetName", ":", "\"hpp\"", "}", ")", ";", "langs", ".", "push", "(", "{", "name", ":", "\"INI\"", ",", "extension", ":", "\"ini\"", ",", "assetName", ":", "\"config\"", "}", ")", ";", "langs", ".", "push", "(", "{", "name", ":", "\"HTML\"", ",", "extension", ":", "\"html\"", ",", "assetName", ":", "\"html\"", "}", ")", ";", "langs", ".", "push", "(", "{", "name", ":", "\"Java\"", ",", "extension", ":", "\"java\"", ",", "extensionAliases", ":", "[", "\"jar\"", "]", ",", "assetName", ":", "\"java\"", "}", ")", ";", "langs", ".", "push", "(", "{", "name", ":", "\"JavaScript\"", ",", "extension", ":", "\"js\"", ",", "assetName", ":", "\"javascript\"", "}", ")", ";", "langs", ".", "push", "(", "{", "name", ":", "\"JavaScript React\"", ",", "extension", ":", "\"jsx\"", ",", "assetName", ":", "\"javascriptx\"", "}", ")", ";", "langs", ".", "push", "(", "{", "name", ":", "\"JSON\"", ",", "extension", ":", "\"json\"", ",", "assetName", ":", "\"json\"", "}", ")", ";", "langs", ".", "push", "(", "{", "name", ":", "\"Kotlin\"", ",", "extension", ":", "\"kt\"", ",", "extensionAliases", ":", "[", "\"kts\"", ",", "\"ktm\"", "]", ",", "assetName", ":", "\"kotlin\"", "}", ")", ";", "langs", ".", "push", "(", "{", "name", ":", "\"Lua\"", ",", "extension", ":", "\"lua\"", ",", "assetName", ":", "\"lua\"", "}", ")", ";", "langs", ".", "push", "(", "{", "name", ":", "\"Julia\"", ",", "extension", ":", "\"jl\"", ",", "assetName", ":", "\"julia\"", "}", ")", ";", "langs", ".", "push", "(", "{", "name", ":", "\"GNU Make\"", ",", "fileName", ":", "\"makefile\"", ",", "extension", ":", "\"\"", ",", "assetName", ":", "\"makefile\"", "}", ")", ";", "langs", ".", "push", "(", "{", "name", ":", "\"GNU Make\"", ",", "fileName", ":", "\"Makefile\"", ",", "extension", ":", "\"\"", ",", "assetName", ":", "\"makefile\"", "}", ")", ";", "langs", ".", "push", "(", "{", "name", ":", "\"Markdown\"", ",", "extension", ":", "\"md\"", ",", "extensionAliases", ":", "[", "\"MD\"", "]", ",", "assetName", ":", "\"markdown\"", "}", ")", ";", "langs", ".", "push", "(", "{", "name", ":", "\"Nim\"", ",", "extension", ":", "\"nim\"", ",", "assetName", ":", "\"nim\"", "}", ")", ";", "langs", ".", "push", "(", "{", "name", ":", "\"Perl\"", ",", "extension", ":", "\"pl\"", ",", "extensionAliases", ":", "[", "\"plx\"", ",", "\"pl\"", ",", "\"pm\"", ",", "\"xs\"", ",", "\"t\"", ",", "\"pod\"", "]", ",", "assetName", ":", "\"perl\"", "}", ")", ";", "langs", ".", "push", "(", "{", "name", ":", "\"PHP\"", ",", "extension", ":", "\"php\"", ",", "assetName", ":", "\"php\"", "}", ")", ";", "langs", ".", "push", "(", "{", "name", ":", "\"PowerShell\"", ",", "extension", ":", "\"ps1\"", ",", "assetName", ":", "\"powershell\"", "}", ")", ";", "langs", ".", "push", "(", "{", "name", ":", "\"Prettier\"", ",", "fileName", ":", "\".prettierrc\"", ",", "extension", ":", "\"\"", ",", "assetName", ":", "\"prettier\"", "}", ")", ";", "langs", ".", "push", "(", "{", "name", ":", "\"Python\"", ",", "extension", ":", "\"py\"", ",", "assetName", ":", "\"python\"", "}", ")", ";", "langs", ".", "push", "(", "{", "name", ":", "\"Razor page\"", ",", "extension", ":", "\"cshtml\"", ",", "assetName", ":", "\"razor\"", "}", ")", ";", "langs", ".", "push", "(", "{", "name", ":", "\"Ruby\"", ",", "extension", ":", "\"rb\"", ",", "assetName", ":", "\"ruby\"", "}", ")", ";", "langs", ".", "push", "(", "{", "name", ":", "\"Rust\"", ",", "extension", ":", "\"rs\"", ",", "assetName", ":", "\"rust\"", "}", ")", ";", "langs", ".", "push", "(", "{", "name", ":", "\"SASS\"", ",", "extension", ":", "\"sass\"", ",", "assetName", ":", "\"sass\"", "}", ")", ";", "langs", ".", "push", "(", "{", "name", ":", "\"SCSS\"", ",", "extension", ":", "\"scss\"", ",", "assetName", ":", "\"scss\"", "}", ")", ";", "langs", ".", "push", "(", "{", "name", ":", "\"Shell\"", ",", "extension", ":", "\"sh\"", ",", "extensionAliases", ":", "[", "\"bash\"", ",", "\"zsh\"", ",", "\"fish\"", ",", "\"ksh\"", "]", ",", "assetName", ":", "\"shell\"", "}", ")", ";", "langs", ".", "push", "(", "{", "name", ":", "\"VS Solution\"", ",", "extension", ":", "\"sln\"", ",", "assetName", ":", "\"sln\"", "}", ")", ";", "langs", ".", "push", "(", "{", "name", ":", "\"SQL\"", ",", "extension", ":", "\"sql\"", ",", "assetName", ":", "\"sql\"", "}", ")", ";", "langs", ".", "push", "(", "{", "name", ":", "\"SVG\"", ",", "extension", ":", "\"svg\"", ",", "assetName", ":", "\"svg\"", "}", ")", ";", "langs", ".", "push", "(", "{", "name", ":", "\"Swift\"", ",", "extension", ":", "\"swift\"", ",", "assetName", ":", "\"swift\"", "}", ")", ";", "langs", ".", "push", "(", "{", "name", ":", "\"TOML\"", ",", "extension", ":", "\"toml\"", ",", "assetName", ":", "\"toml\"", "}", ")", ";", "langs", ".", "push", "(", "{", "name", ":", "\"TypeScript\"", ",", "extension", ":", "\"ts\"", ",", "assetName", ":", "\"typescript\"", "}", ")", ";", "langs", ".", "push", "(", "{", "name", ":", "\"TypeScript Declaration\"", ",", "extension", ":", "\"d.ts\"", ",", "assetName", ":", "\"typescript_d\"", "}", ")", ";", "langs", ".", "push", "(", "{", "name", ":", "\"TypeScript React\"", ",", "extension", ":", "\"tsx\"", ",", "assetName", ":", "\"typescriptx\"", "}", ")", ";", "langs", ".", "push", "(", "{", "name", ":", "\"Vim\"", ",", "extension", ":", "\"vim\"", ",", "assetName", ":", "\"vim\"", "}", ")", ";", "langs", ".", "push", "(", "{", "name", ":", "\"Vue\"", ",", "extension", ":", "\"vue\"", ",", "assetName", ":", "\"vue\"", "}", ")", ";", "langs", ".", "push", "(", "{", "name", ":", "\"XML\"", ",", "extension", ":", "\"xml\"", ",", "assetName", ":", "\"xml\"", "}", ")", ";", "langs", ".", "push", "(", "{", "name", ":", "\"YAML\"", ",", "extension", ":", "\"yaml\"", ",", "extensionAliases", ":", "[", "\"yml\"", "]", ",", "assetName", ":", "\"yaml\"", "}", ")", ";", "export", "const", "languages", "=", "langs", ";" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 13, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null ]
1341
[ "import", "{", "Presence", "}", "from", "\"discord-rpc\"", ";", "import", "{", "language", ",", "languages", "}", "from", "\"../language/language\"", ";", "export", "const", "getPresence", "=", "(", "startTimeStamp", ",", "workspace", "?", ",", "fileName", "?", ")", ":", "Presence", "=>", "{", "let", "presence", "=", "{", "startTimestamp", ":", "startTimeStamp", ",", "smallImageKey", ":", "\"nvim\"", ",", "smallImageText", ":", "\"NeoVim text editor\"", "}", ";", "let", "idlingPresence", "=", "{", "largeImageKey", ":", "presence", ".", "smallImageKey", ",", "largeImageText", ":", "presence", ".", "smallImageText", ",", "state", ":", "undefined", ",", "details", ":", "\"idling\"", "}", ";", "presence", "=", "{", "...", "presence", ",", "...", "idlingPresence", "}", ";", "if", "(", "!", "workspace", "||", "!", "fileName", ")", "{", "return", "presence", ";", "}", "presence", ".", "state", "=", "`Workspace: ${", "workspace", "}`", ";", "presence", ".", "details", "=", "`Editing ${", "fileName", "}`", ";", "let", "ext", "=", "fileName", ".", "split", "(", "\".\"", ")", ";", "if", "(", "ext", ".", "length", ">", "1", ")", "{", "ext", "=", "ext", ".", "slice", "(", "1", ",", "ext", ".", "length", ")", ";", "if", "(", "fileName", "[", "0", "]", "===", "\".\"", ")", "{", "ext", "[", "0", "]", "=", "\".\"", "+", "ext", "[", "0", "]", ";", "}", "}", "const", "lang", "=", "languages", ".", "find", "(", "(", "lang", ")", "=>", "{", "if", "(", "lang", ".", "fileName", "&&", "fileName", "===", "fileNameForLanguage", "(", "lang", ")", ")", "{", "return", "lang", ";", "}", "if", "(", "lang", ".", "fileName", "&&", "isAliasedExtensionForFile", "(", "lang", ",", "fileName", ")", ")", "{", "return", "lang", ";", "}", "if", "(", "!", "lang", ".", "fileName", "&&", "lang", ".", "extension", "===", "ext", "[", "ext", ".", "length", "-", "1", "]", ")", "{", "return", "lang", ";", "}", "if", "(", "!", "lang", ".", "fileName", "&&", "lang", ".", "extension", "===", "ext", ".", "join", "(", "\".\"", ")", ")", "{", "return", "lang", ";", "}", "if", "(", "!", "lang", "?.", "fileName", "&&", "isAliasedExtension", "(", "lang", ",", "ext", "[", "0", "]", ")", ")", "{", "return", "lang", ";", "}", "}", ")", ";", "if", "(", "!", "lang", ")", "{", "return", "presence", ";", "}", "presence", ".", "largeImageKey", "=", "lang", ".", "assetName", ";", "presence", ".", "largeImageText", "=", "lang", ".", "name", ";", "presence", ".", "details", "=", "`Editing ${", "fileName", "}`", ";", "return", "presence", ";", "}", ";", "const", "fileNameForLanguage", "=", "(", "lang", ")", "=>", "(", "lang", ".", "extension", "===", "\"\"", "?", "lang", ".", "fileName", "!", ":", "lang", ".", "fileName", "+", "\".\"", "+", "lang", ".", "extension", ")", ";", "const", "isAliasedExtensionForFile", "=", "(", "lang", ",", "fileName", ")", "=>", "lang", ".", "extensionAliases", "?.", "find", "(", "(", "ext", ")", "=>", "lang", ".", "fileName", "+", "\".\"", "+", "ext", "===", "fileName", ")", ";", "const", "isAliasedExtension", "=", "(", "lang", ",", "extension", ")", "=>", "lang", ".", "extensionAliases", "?.", "find", "(", "(", "ext", ")", "=>", "ext", "==", "extension", ")", ";" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4312, null, null, null, null, 2, null, null, 2, null, null, null, null, null, null, null, 4312, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4312, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 42384, null, null, null, null, null, null, 42384, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, 42384, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, 42384, null, 2, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, 42384, null, 2, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null ]
1342
[ "import", "{", "workspace", "}", "from", "\"coc.nvim\"", ";", "export", "enum", "LogLevel", "{", "Info", "=", "0", ",", "Warn", ",", "Err", "}", "export", "const", "LOG", "=", "(", "level", ",", "message", ")", "=>", "{", "switch", "(", "level", ")", "{", "case", "LogLevel", ".", "Info", ":", "{", "workspace", ".", "showMessage", "(", "`coc-cord: ${", "message", "}`", ",", "\"more\"", ")", ";", "}", "case", "LogLevel", ".", "Warn", ":", "{", "workspace", ".", "showMessage", "(", "`coc-cord: ${", "message", "}`", ",", "\"warning\"", ")", ";", "}", "case", "LogLevel", ".", "Err", ":", "{", "workspace", ".", "showMessage", "(", "`coc-cord: ${", "message", "}`", ",", "\"error\"", ")", ";", "}", "default", ":", "{", "workspace", ".", "showMessage", "(", "`coc-cord: ${", "message", "}`", ",", "undefined", ")", ";", "}", "}", "}", ";" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, null, 489, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1343
[ "export", "const", "VERSION", "=", "\"0.5.1\"", ";" ]
[ null, null, 2, null, null, null ]
1344
[ "import", "{", "Client", "as", "RPCClient", "}", "from", "\"discord-rpc\"", ";", "import", "{", "workspace", ",", "commands", ",", "ExtensionContext", "}", "from", "\"coc.nvim\"", ";", "import", "{", "getPresence", "}", "from", "\"../presence/presence\"", ";", "import", "{", "LOG", ",", "LogLevel", "}", "from", "\"../logger/logger\"", ";", "import", "{", "VERSION", "}", "from", "\"../version/version\"", ";", "export", "class", "Client", "{", "private", "readonly", "_clientID", ":", "string", ";", "private", "_client", "?", ":", "RPCClient", ";", "private", "interval", "=", "setInterval", "(", "(", ")", "=>", "{", "}", ",", "1", ")", ";", "constructor", "(", "clientID", ")", "{", "this", ".", "_clientID", "=", "clientID", ";", "this", ".", "_client", "=", "new", "RPCClient", "(", "{", "transport", ":", "\"ipc\"", "}", ")", ";", "clearInterval", "(", "this", ".", "interval", ")", ";", "}", "public", "connect", "=", "async", "(", "ctx", "?", ")", "=>", "{", "if", "(", "!", "this", ".", "_client", ")", "{", "this", ".", "_client", "=", "new", "RPCClient", "(", "{", "transport", ":", "\"ipc\"", "}", ")", ";", "}", "this", ".", "_client", ".", "connect", "(", "this", ".", "_clientID", ")", ";", "this", ".", "_client", ".", "login", "(", "{", "clientId", ":", "this", ".", "_clientID", "}", ")", ";", "this", ".", "_client", ".", "on", "(", "\"ready\"", ",", "(", ")", "=>", "this", ".", "ready", "(", "ctx", ")", ")", ";", "}", ";", "public", "disconnect", "=", "async", "(", ")", "=>", "{", "clearInterval", "(", "this", ".", "interval", ")", ";", "await", "this", ".", "_client", "!", ".", "destroy", "(", ")", ";", "this", ".", "_client", "=", "undefined", ";", "LOG", "(", "LogLevel", ".", "Info", ",", "\"disconnected from Discord gateway\"", ")", ";", "}", ";", "private", "ready", "=", "async", "(", "ctx", "?", ")", "=>", "{", "LOG", "(", "LogLevel", ".", "Info", ",", "\"connected to Discord gateway\"", ")", ";", "if", "(", "ctx", ")", "{", "this", ".", "registerCommands", "(", "ctx", ")", ";", "}", "this", ".", "trackActivity", "(", ")", ";", "}", ";", "private", "registerCommands", "=", "async", "(", "ctx", ")", "=>", "{", "ctx", ".", "subscriptions", ".", "push", "(", "commands", ".", "registerCommand", "(", "\"cord.disconnect\"", ",", "(", ")", "=>", "{", "LOG", "(", "LogLevel", ".", "Info", ",", "\"trying to disconnect from Discord gateway\"", ")", ";", "this", ".", "disconnect", "(", ")", ";", "}", ")", ")", ";", "ctx", ".", "subscriptions", ".", "push", "(", "commands", ".", "registerCommand", "(", "\"cord.reconnect\"", ",", "(", ")", "=>", "{", "LOG", "(", "LogLevel", ".", "Info", ",", "\"trying to reconnect to Discord gateway\"", ")", ";", "this", ".", "connect", "(", "ctx", ")", ";", "}", ")", ")", ";", "ctx", ".", "subscriptions", ".", "push", "(", "commands", ".", "registerCommand", "(", "\"cord.version\"", ",", "(", ")", "=>", "{", "LOG", "(", "LogLevel", ".", "Info", ",", "`version ${", "VERSION", "}`", ")", ";", "}", ")", ")", ";", "}", ";", "private", "trackActivity", "=", "async", "(", ")", "=>", "{", "const", "startTimeStamp", "=", "new", "Date", "(", ")", ";", "this", ".", "interval", "=", "setInterval", "(", "(", ")", "=>", "{", "this", ".", "_client", "!", ".", "setActivity", "(", "getPresence", "(", "startTimeStamp", ",", "workspace", ".", "root", ".", "split", "(", "\"/\"", ")", ".", "pop", "(", ")", ",", "workspace", ".", "getDocument", "(", "workspace", ".", "uri", ")", "?.", "uri", ".", "split", "(", "\"/\"", ")", ".", "pop", "(", ")", ")", ")", ";", "}", ",", "1000", ")", ";", "}", ";", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 606, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 606, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 606, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 26, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1345
[ "import", "{", "Client", "}", "from", "\"./client/client\"", ";", "import", "{", "LOG", ",", "LogLevel", "}", "from", "\"./logger/logger\"", ";", "import", "{", "ExtensionContext", "}", "from", "\"coc.nvim\"", ";", "const", "clientID", "=", "\"731545228539985940\"", ";", "const", "client", "=", "new", "Client", "(", "clientID", ")", ";", "export", "const", "activate", "=", "async", "(", "ctx", ")", "=>", "{", "LOG", "(", "LogLevel", ".", "Info", ",", "\"extension activated, trying to connect to Discord gateway\"", ")", ";", "await", "client", ".", "connect", "(", "ctx", ")", ";", "}", ";", "export", "const", "deactivate", "=", "async", "(", ")", "=>", "{", "LOG", "(", "LogLevel", ".", "Info", ",", "\"extension deactivated, trying to disconnect from Discord gateway\"", ")", ";", "return", "await", "client", ".", "disconnect", "(", ")", ";", "}", ";", "process", ".", "on", "(", "\"unhandledRejection\"", ",", "(", "err", ")", "=>", "LOG", "(", "LogLevel", ".", "Err", ",", "err", "as", "string", ")", ")", ";" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, 82, null, null, null, null, null, null, null, null, null, 7, null, null, null, 606, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1346
[ "import", "*", "as", "path", "from", "'path'", ";", "export", "{", "sep", ",", "basename", ",", "isAbsolute", ",", "}", "from", "'path'", ";", "param", "p", "returns", "export", "function", "normalize", "(", "p", ")", "{", "if", "(", "p", "===", "''", "||", "p", "===", "'.'", ")", "{", "return", "''", ";", "}", "p", "=", "path", ".", "normalize", "(", "p", ")", ".", "replace", "(", "/\\\\/g", ",", "'/'", ")", ";", "if", "(", "p", "!==", "'/'", "&&", "p", ".", "endsWith", "(", "'/'", ")", ")", "{", "p", "=", "p", ".", "substr", "(", "0", ",", "p", ".", "length", "-", "1", ")", ";", "}", "return", "p", ";", "}", "export", "function", "normalizeExt", "(", "p", ")", "{", "if", "(", "p", "===", "''", "||", "p", "===", "'.'", ")", "{", "return", "''", ";", "}", "p", "=", "path", ".", "normalize", "(", "p", ")", ";", "if", "(", "p", ".", "endsWith", "(", "'/'", ")", ")", "{", "p", "=", "p", ".", "substr", "(", "0", ",", "p", ".", "length", "-", "1", ")", ";", "}", "return", "p", ".", "replace", "(", "'/'", ",", "path", ".", "sep", ")", ";", "}", "export", "function", "join", "(", "...", "paths", ")", "{", "return", "normalize", "(", "path", ".", "join", "(", "...", "paths", ")", ")", ";", "}", "export", "function", "dirname", "(", "p", ")", "{", "return", "normalize", "(", "path", ".", "dirname", "(", "p", ")", ")", ";", "}", "export", "function", "resolve", "(", "...", "pathSegments", ")", "{", "return", "normalize", "(", "path", ".", "resolve", "(", "...", "pathSegments", ")", ")", ";", "}", "export", "function", "relative", "(", "from", ",", "to", ")", "{", "return", "normalize", "(", "path", ".", "relative", "(", "from", ",", "to", ")", ")", ";", "}", "export", "function", "extname", "(", "p", ")", "{", "return", "path", ".", "extname", "(", "p", ")", ";", "}", "export", "function", "parse", "(", "p", ")", "{", "return", "path", ".", "parse", "(", "p", ")", ";", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, 2, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, 13913, null, 2, null, null, null, null, null, null, null, null, null, null, null ]
1347
[ "import", "*", "as", "cp", "from", "'child_process'", ";", "import", "*", "as", "fse", "from", "'fs-extra'", ";", "import", "{", "PathLike", ",", "Stats", "}", "from", "'fs-extra'", ";", "import", "{", "normalize", ",", "parse", "}", "from", "'./path'", ";", "export", "{", "PathLike", ",", "Stats", "}", "from", "'fs-extra'", ";", "let", "useOriginalFs", "=", "false", ";", "let", "fs", ";", "if", "(", "Object", ".", "prototype", ".", "hasOwnProperty", ".", "call", "(", "process", ".", "versions", ",", "'electron'", ")", ")", "{", "fs", "=", "require", "(", "'original-fs'", ")", ";", "useOriginalFs", "=", "true", ";", "}", "else", "{", "fs", "=", "require", "(", "'fs'", ")", ";", "}", "let", "winattr", ";", "if", "(", "process", ".", "platform", "===", "'win32'", ")", "{", "winattr", "=", "require", "(", "'winattr'", ")", ";", "}", "/**\n * Return true if 'original-fs' is used as the underlying filesystem module.\n */", "export", "function", "usesOriginalFs", "(", ")", "{", "return", "useOriginalFs", ";", "}", "export", "class", "DirItem", "{", "/** Absolute path of dir item */", "absPath", ":", "string", ";", "/** Relative path of dir item */", "relPath", ":", "string", ";", "stats", ":", "fse", ".", "Stats", ";", "/** If [[DirItem.isdir]] is `true`, this value indicates if the directory is empty or not. */", "isempty", ":", "boolean", ";", "}", "/** Used in [[osWalk]]. */", "export", "enum", "OSWALK", "{", "/** Return all directories. [[DirItem.isdir]] will be `true` */", "DIRS", "=", "1", ",", "/** Return all files. [[DirItem.isdir]] will be `false` */", "FILES", "=", "2", ",", "/** Return all hidden items. */", "HIDDEN", "=", "4", ",", "/** Browse Git and/or SnowFS repositories. */", "BROWSE_REPOS", "=", "8", ",", "/** Only run over the first level of the directory */", "NO_RECURSIVE", "=", "16", "}", "function", "darwinZip", "(", "src", ",", "dst", ")", "{", "const", "p0", "=", "cp", ".", "spawn", "(", "'ditto'", ",", "[", "'-c'", ",", "'-k'", ",", "'--sequesterRsrc'", ",", "src", ",", "dst", "]", ")", ";", "return", "new", "Promise", "(", "(", "resolve", ",", "reject", ")", "=>", "{", "p0", ".", "on", "(", "'exit'", ",", "(", "code", ")", "=>", "{", "if", "(", "code", "===", "0", ")", "{", "resolve", "(", ")", ";", "}", "else", "{", "reject", "(", "code", ")", ";", "}", "}", ")", ";", "}", ")", ";", "}", "export", "function", "zipFile", "(", "src", ",", "dst", ",", "opts", ")", "{", "if", "(", "!", "dst", ".", "endsWith", "(", "'.zip'", ")", ")", "{", "throw", "new", "Error", "(", "'destination must be a zip'", ")", ";", "}", "let", "promise", ";", "switch", "(", "process", ".", "platform", ")", "{", "case", "'darwin'", ":", "promise", "=", "darwinZip", "(", "src", ",", "dst", ")", ";", "break", ";", "case", "'win32'", ":", "default", ":", "throw", "new", "Error", "(", "'zip not yet implemented'", ")", ";", "}", "return", "promise", ".", "then", "(", "(", ")", "=>", "{", "if", "(", "opts", ".", "deleteSrc", ")", "{", "return", "fse", ".", "remove", "(", "src", ")", ";", "}", "}", ")", ";", "}", "param", "path", "returns", "export", "function", "hideItem", "(", "path", ")", "{", "if", "(", "winattr", ")", "{", "return", "new", "Promise", "<", "void", ">", "(", "(", "resolve", ")", "=>", "{", "winattr", ".", "set", "(", "path", ",", "{", "hidden", ":", "true", "}", ",", "(", ")", "=>", "{", "resolve", "(", ")", ";", "}", ")", ";", "}", ")", ";", "}", "return", "Promise", ".", "resolve", "(", ")", ";", "}", "function", "checkPath", "(", "pth", ")", "{", "if", "(", "process", ".", "platform", "===", "'win32'", ")", "{", "const", "pathHasInvalidWinCharacters", "=", "/[<>:\"|?*]/u", ".", "test", "(", "pth", ".", "replace", "(", "parse", "(", "pth", ")", ".", "root", ",", "''", ")", ")", ";", "if", "(", "pathHasInvalidWinCharacters", ")", "{", "const", "error", "=", "new", "Error", "(", "`Path contains invalid characters: ${", "pth", "}`", ")", ";", "(", "error", "as", "any", ")", ".", "code", "=", "'EINVAL'", ";", "throw", "error", ";", "}", "}", "}", "const", "getMode", "=", "(", "options", ")", "=>", "{", "const", "defaults", "=", "{", "mode", ":", "0o777", "}", ";", "if", "(", "typeof", "options", "===", "'number'", ")", "return", "options", ";", "return", "(", "{", "...", "defaults", ",", "...", "options", "}", ")", ".", "mode", ";", "}", ";", "/**\n * Ensures that the directory exists. If the directory structure does not exist, it is created.\n * Preferred usage over 'fs' or 'fs-extra' because it ensures always the\n * fastest filesystem module is used inside Electron or inside node.\n * For more information check the module import comments above.\n * For more information about the API of [pathExists] visit https://nodejs.org/api/fs.html#fs_fs_exists_path_callback\n */", "export", "function", "ensureDir", "(", "dir", ",", "options", "?", ")", "{", "checkPath", "(", "dir", ")", ";", "return", "new", "Promise", "<", "void", ">", "(", "(", "resolve", ",", "reject", ")", "=>", "{", "try", "{", "fs", ".", "mkdir", "(", "dir", ",", "{", "mode", ":", "getMode", "(", "options", ")", ",", "recursive", ":", "true", ",", "}", ",", "(", "error", ")", "=>", "{", "if", "(", "error", ")", "{", "reject", "(", "error", ")", ";", "}", "else", "{", "resolve", "(", ")", ";", "}", "}", ")", ";", "}", "catch", "(", "error", ")", "{", "reject", "(", "error", ")", ";", "}", "}", ")", ";", "}", "/**\n * Tests a user's permissions for the file or directory specified by path.\n * Preferred usage over 'fs' or 'fs-extra' because it ensures always the\n * fastest filesystem module is used inside Electron or inside node.\n * For more information check the module import comments above.\n * For more information about the API of [pathExists] visit https://nodejs.org/api/fs.html#fs_fs_exists_path_callback\n */", "export", "function", "access", "(", "path", ",", "mode", ")", "{", "return", "new", "Promise", "(", "(", "resolve", ",", "reject", ")", "=>", "{", "try", "{", "fs", ".", "access", "(", "path", ",", "mode", ",", "(", "error", ")", "=>", "{", "if", "(", "error", ")", "{", "reject", "(", "error", ")", ";", "}", "else", "{", "resolve", "(", ")", ";", "}", "}", ")", ";", "}", "catch", "(", "error", ")", "{", "reject", "(", "error", ")", ";", "}", "}", ")", ";", "}", "/**\n * Test whether or not the given path exists by checking with the file system.\n * Preferred usage over 'fs' or 'fs-extra' because it ensures always the\n * fastest filesystem module is used inside Electron or inside node.\n * For more information check the module import comments above.\n * For more information about the API of [pathExists] visit https://nodejs.org/api/fs.html#fs_fs_exists_path_callback\n */", "export", "function", "pathExists", "(", "path", ")", "{", "return", "new", "Promise", "(", "(", "resolve", ",", "reject", ")", "=>", "{", "try", "{", "fs", ".", "exists", "(", "path", ",", "(", "exists", ")", "=>", "{", "resolve", "(", "exists", ")", ";", "}", ")", ";", "}", "catch", "(", "error", ")", "{", "reject", "(", "error", ")", ";", "}", "}", ")", ";", "}", "/**\n * Change the file system timestamps of the object referenced by the <FileHandle> then resolves the promise with no arguments upon success.\n * fastest filesystem module is used inside Electron or inside node.\n * For more information check the module import comments above.\n * For more information about the API of [createReadStream] visit https://nodejs.org/api/fs.html#fs_fs_createreadstream_path_options\n */", "export", "function", "utimes", "(", "path", ",", "atime", ",", "mtime", ")", "{", "return", "new", "Promise", "(", "(", "resolve", ",", "reject", ")", "=>", "{", "try", "{", "fs", ".", "utimes", "(", "path", ",", "atime", ",", "mtime", ",", "(", "error", ")", "=>", "{", "if", "(", "error", ")", "{", "reject", "(", "error", ")", ";", "}", "else", "{", "resolve", "(", ")", ";", "}", "}", ")", ";", "}", "catch", "(", "error", ")", "{", "reject", "(", "error", ")", ";", "}", "}", ")", ";", "}", "export", "async", "function", "rmdir", "(", "dir", ")", "{", "return", "new", "Promise", "(", "(", "resolve", ",", "reject", ")", "=>", "{", "try", "{", "(", "fs", ".", "rmdir", "||", "fs", ".", "rm", ")", "(", "dir", ",", "{", "recursive", ":", "true", "}", ",", "(", "error", ")", "=>", "{", "if", "(", "error", ")", "{", "reject", "(", "error", ")", ";", "}", "else", "{", "resolve", "(", ")", ";", "}", "}", ")", ";", "}", "catch", "(", "error", ")", "{", "resolve", "(", "error", ")", ";", "}", "}", ")", ";", "}", "/**\n * Retrieve the statistics about a directory item. Preferred usage over 'fs' or 'fs-extra' because it ensures always the\n * fastest filesystem module is used inside Electron or inside node.\n * For more information check the module import comments above.\n * For more information about the API of [stat] visit https://nodejs.org/api/fs.html#fs_fs_fstat_fd_options_callback\n */", "export", "function", "stat", "(", "path", ")", "{", "return", "new", "Promise", "(", "(", "resolve", ",", "reject", ")", "=>", "{", "try", "{", "fs", ".", "stat", "(", "path", ",", "(", "error", ",", "stats", ")", "=>", "{", "if", "(", "error", ")", "{", "reject", "(", "error", ")", ";", "}", "else", "{", "resolve", "(", "stats", ")", ";", "}", "}", ")", ";", "}", "catch", "(", "error", ")", "{", "reject", "(", "error", ")", ";", "}", "}", ")", ";", "}", "/**\n * Asynchronously copies `src` to `dest`. Preferred usage over 'fs' or 'fs-extra' because it ensures always the\n * fastest filesystem module is used inside Electron or inside node.\n * For more information check the module import comments above.\n * For more information about the API of [copyFile] visit https://nodejs.org/api/fs.html#fs_fs_copyfilesync_src_dest_mode\n */", "export", "function", "copyFile", "(", "src", ",", "dest", ",", "flags", ")", "{", "return", "new", "Promise", "(", "(", "resolve", ",", "reject", ")", "=>", "{", "try", "{", "fs", ".", "copyFile", "(", "src", ",", "dest", ",", "flags", ",", "(", "error", ")", "=>", "{", "if", "(", "error", ")", "{", "reject", "(", "error", ")", ";", "}", "else", "{", "resolve", "(", ")", ";", "}", "}", ")", ";", "}", "catch", "(", "error", ")", "{", "reject", "(", "error", ")", ";", "}", "}", ")", ";", "}", "/**\n * Read the contents of a directory. Preferred usage over 'fs' or 'fs-extra' because it ensures always the\n * fastest filesystem module is used inside Electron or inside node.\n * For more information check the module import comments above.\n * For more information about the API of [readdir] visit https://nodejs.org/api/fs.html#fs_fs_readdir_path_options_callback\n */", "export", "function", "readdir", "(", "path", ",", "callback", ")", "{", "return", "fs", ".", "readdir", "(", "path", ",", "callback", ")", ";", "}", "/**\n * Open a read stream. Preferred usage over 'fs' or 'fs-extra' because it ensures always the\n * fastest filesystem module is used inside Electron or inside node.\n * For more information check the module import comments above.\n * For more information about the API of [createReadStream] visit https://nodejs.org/api/fs.html#fs_fs_createreadstream_path_options\n */", "export", "function", "createReadStream", "(", "path", ",", "options", "?", ")", "{", "return", "fs", ".", "createReadStream", "(", "path", ",", "options", ")", ";", "}", "param", "dirPath", "param", "request", "param", "dirItemRef", "export", "function", "osWalk", "(", "dirPath", ",", "request", ")", "{", "const", "returnDirs", "=", "request", "&", "OSWALK", ".", "DIRS", ";", "const", "returnFiles", "=", "request", "&", "OSWALK", ".", "FILES", ";", "const", "returnHidden", "=", "request", "&", "OSWALK", ".", "HIDDEN", ";", "const", "browseRepo", "=", "request", "&", "OSWALK", ".", "BROWSE_REPOS", ";", "function", "internalOsWalk", "(", "dirPath", ",", "request", ",", "relPath", ",", "dirItemRef", "?", ")", "{", "if", "(", "dirPath", ".", "endsWith", "(", "'/'", ")", ")", "{", "dirPath", "=", "dirPath", ".", "substr", "(", "0", ",", "dirPath", ".", "length", "-", "1", ")", ";", "}", "const", "dirItems", "=", "[", "]", ";", "return", "new", "Promise", "<", "string", "[", "]", ">", "(", "(", "resolve", ",", "reject", ")", "=>", "{", "readdir", "(", "dirPath", ",", "(", "error", ",", "entries", ")", "=>", "{", "if", "(", "error", ")", "{", "if", "(", "dirItemRef", ")", "{", "resolve", "(", "[", "]", ")", ";", "}", "else", "{", "reject", "(", "error", ")", ";", "}", "return", ";", "}", "resolve", "(", "entries", ".", "map", "(", "normalize", ")", ")", ";", "}", ")", ";", "}", ")", ".", "then", "(", "(", "items", ")", "=>", "{", "const", "promises", "=", "[", "]", ";", "for", "(", "const", "item", "of", "items", ")", "{", "if", "(", "item", "===", "'.DS_Store'", "||", "item", "===", "'thumbs.db'", ")", "{", "continue", ";", "}", "else", "if", "(", "!", "browseRepo", "&&", "(", "item", "===", "'.snow'", "||", "item", "===", "'.git'", ")", ")", "{", "continue", ";", "}", "else", "if", "(", "!", "returnHidden", "&&", "item", ".", "startsWith", "(", "'.'", ")", ")", "{", "continue", ";", "}", "const", "absPath", "=", "`${", "dirPath", "}/${", "item", "}`", ";", "promises", ".", "push", "(", "stat", "(", "absPath", ")", ".", "then", "(", "(", "stats", ")", "=>", "{", "return", "{", "absPath", ",", "isempty", ":", "false", ",", "relPath", ":", "relPath", ".", "length", "===", "0", "?", "item", ":", "`${", "relPath", "}/${", "item", "}`", ",", "stats", ",", "}", ";", "}", ")", ".", "catch", "(", "(", ")", "=>", "null", ")", ")", ";", "}", "return", "Promise", ".", "all", "(", "promises", ")", ";", "}", ")", ".", "then", "(", "(", "itemStatArray", ")", "=>", "{", "const", "promises", "=", "[", "]", ";", "for", "(", "const", "dirItem", "of", "itemStatArray", ".", "filter", "(", "(", "x", ")", "=>", "x", ")", ")", "{", "if", "(", "(", "dirItem", ".", "stats", ".", "isDirectory", "(", ")", "&&", "returnDirs", ")", "||", "(", "!", "dirItem", ".", "stats", ".", "isDirectory", "(", ")", "&&", "returnFiles", ")", ")", "{", "dirItems", ".", "push", "(", "dirItem", ")", ";", "}", "if", "(", "dirItem", ".", "stats", ".", "isDirectory", "(", ")", "&&", "!", "(", "request", "&", "OSWALK", ".", "NO_RECURSIVE", ")", ")", "{", "promises", ".", "push", "(", "internalOsWalk", "(", "dirItem", ".", "absPath", ",", "request", ",", "dirItem", ".", "relPath", ",", "dirItem", ")", ")", ";", "}", "}", "if", "(", "dirItemRef", ")", "{", "dirItemRef", ".", "isempty", "=", "itemStatArray", ".", "length", "===", "0", ";", "}", "return", "Promise", ".", "all", "(", "promises", ")", ";", "}", ")", ".", "then", "(", "(", "dirItemResults", ")", "=>", "dirItems", ".", "concat", "(", "...", "dirItemResults", ")", ")", ";", "}", "return", "internalOsWalk", "(", "dirPath", ",", "request", ",", "''", ")", ";", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 2, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 4, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 2, null, 2, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 25, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 2, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 4, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 3544, null, 3, null, null, null, null, null, null, null, 4, null, 4, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 3544, null, null, null, null, null, null, null, 4, null, 4, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 3544, null, 26, null, 26, null, null, null, null, null, null, null, 4, null, 4, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 2, null, null, null, null, null, null, null, 4, null, 4, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 3544, null, null, null, null, null, null, null, 4, null, 4, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 235, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 3544, null, 3544, null, 3, null, null, null, null, null, null, null, 4, null, 4, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 3544, null, 4, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, 3544, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 2, null, 0, null, null, null, 3, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, 7, null, 2, null, 0, null, 2, null, 19661, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 4, null, null, null, null, null, null, null, null, 25, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, 5, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 235, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, 5, null, null, null, null, null, null, null, 19661, null, null, null, null, null, null, 19661, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1348
[ "import", "*", "as", "fse", "from", "'fs-extra'", ";", "import", "*", "as", "crypto", "from", "'crypto'", ";", "param", "path", "param", "data", "param", "options", "returns", "export", "function", "writeSafeFile", "(", "path", ",", "data", ",", "options", "?", ")", "{", "const", "tmp", "=", "crypto", ".", "createHash", "(", "'sha256'", ")", ".", "update", "(", "process", ".", "hrtime", "(", ")", ".", "toString", "(", ")", ")", ".", "digest", "(", "'hex'", ")", ".", "substring", "(", "0", ",", "6", ")", ";", "const", "tmpPath", "=", "`${", "path", "}.${", "tmp", "}.tmp`", ";", "return", "fse", ".", "writeFile", "(", "tmpPath", ",", "data", ",", "options", ")", ".", "then", "(", "(", ")", "=>", "fse", ".", "rename", "(", "tmpPath", ",", "path", ")", ")", ".", "catch", "(", "(", "err", ")", "=>", "{", "try", "{", "fse", ".", "unlinkSync", "(", "tmpPath", ")", ";", "}", "catch", "(", "err2", ")", "{", "console", ".", "log", "(", "err2", ")", ";", "}", "throw", "err", ";", "}", ")", ";", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1349
[ "import", "*", "as", "fse", "from", "'fs-extra'", ";", "import", "{", "join", "}", "from", "'./path'", ";", "import", "{", "Repository", "}", "from", "'./repository'", ";", "param", "date", "returns", "function", "getZOffset", "(", "date", ")", "{", "function", "fill", "(", "value", ")", "{", "return", "value", "<", "10", "?", "`0${", "value", "}`", ":", "value", ";", "}", "const", "offset", "=", "Math", ".", "abs", "(", "date", ".", "getTimezoneOffset", "(", ")", ")", ";", "const", "hours", "=", "fill", "(", "Math", ".", "floor", "(", "offset", "/", "60", ")", ")", ";", "const", "minutes", "=", "fill", "(", "offset", "%", "60", ")", ";", "const", "sign", "=", "(", "date", ".", "getTimezoneOffset", "(", ")", ">", "0", ")", "?", "'-'", ":", "'+'", ";", "return", "`${", "sign", "+", "hours", "}${", "minutes", "}`", ";", "}", "/**\n * The log helper class of a Repository\n */", "export", "class", "Log", "{", "constructor", "(", "private", "repo", ")", "{", "}", "getAbsLogDirPath", "(", ")", "{", "return", "join", "(", "this", ".", "repo", ".", "commondir", "(", ")", ",", "'logs'", ")", ";", "}", "init", "(", ")", "{", "return", "fse", ".", "ensureDir", "(", "this", ".", "getAbsLogDirPath", "(", ")", ")", ";", "}", "param", "message", "writeLog", "(", "message", ")", "{", "const", "now", "=", "new", "Date", "(", ")", ";", "const", "logMessage", "=", "`${", "now", ".", "getTime", "(", ")", "} ${", "getZOffset", "(", "now", ")", "} $> ${", "message", "}\\n`", ";", "return", "fse", ".", "appendFile", "(", "join", "(", "this", ".", "getAbsLogDirPath", "(", ")", ",", "'mainlog'", ")", ",", "logMessage", ")", ".", "catch", "(", "(", ")", "=>", "{", "}", ")", ";", "}", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, 26, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 112, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 2, null, null, null, 26, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1350
[ "import", "*", "as", "fse", "from", "'fs-extra'", ";", "import", "*", "as", "crypto", "from", "'crypto'", ";", "import", "*", "as", "io", "from", "'./io'", ";", "import", "{", "join", ",", "relative", ",", "normalize", ",", "extname", ",", "}", "from", "'./path'", ";", "import", "{", "Repository", "}", "from", "'./repository'", ";", "import", "{", "getPartHash", ",", "HashBlock", ",", "MB20", ",", "StatsSubset", ",", "}", "from", "'./common'", ";", "const", "sortPaths", "=", "require", "(", "'sort-paths'", ")", ";", "export", "const", "enum", "FILEMODE", "{", "UNREADABLE", "=", "0", ",", "TREE", "=", "16384", ",", "BLOB", "=", "33188", ",", "EXECUTABLE", "=", "33261", ",", "LINK", "=", "40960", ",", "COMMIT", "=", "57344", "}", "const", "textFileExtensions", "=", "new", "Set", "(", "[", "'.txt'", ",", "'.html'", ",", "'.plist'", ",", "'.htm'", ",", "'.css'", ",", "'.js'", ",", "'.jsx'", ",", "'.less'", ",", "'.scss'", ",", "'.wasm'", ",", "'.php'", ",", "'.c'", ",", "'.cc'", ",", "'.class'", ",", "'.clj'", ",", "'.cpp'", ",", "'.cs'", ",", "'.cxx'", ",", "'.el'", ",", "'.go'", ",", "'.h'", ",", "'.java'", ",", "'.lua'", ",", "'.m'", ",", "'.m4'", ",", "'.php'", ",", "'.pl'", ",", "'.po'", ",", "'.py'", ",", "'.rb'", ",", "'.rs'", ",", "'.info'", ",", "'.sh'", ",", "'.swift'", ",", "'.vb'", ",", "'.vcxproj'", ",", "'.xcodeproj'", ",", "'.xml'", ",", "'.diff'", ",", "'.patch'", ",", "'.html'", ",", "'.js'", ",", "'.ts'", ",", "]", ")", ";", "export", "const", "enum", "DETECTIONMODE", "{", "/**\n * Uses SIZE_AND_HASH_FOR_SMALL_FILES for all known text files and ONLY_SIZE_AND_MKTIME for everything else.\n */", "DEFAULT", "=", "1", ",", "/**\n * Only perform a size and mktime check. If the modified time differs between the commited file\n * and the one in the working directory, the file is identified as modified.\n * If the modified time is the same, the file is not identified as modified.\n */", "ONLY_SIZE_AND_MKTIME", "=", "2", ",", "/**\n * Perform a size and hash check for all files smaller than 20 MB.\n */", "SIZE_AND_HASH_FOR_SMALL_FILES", "=", "3", ",", "/**\n * Perform a size and hash check for all files. Please note,\n * that this is the slowest of all detection modes.\n */", "SIZE_AND_HASH_FOR_ALL_FILES", "=", "4", "}", "export", "function", "calculateSizeAndHash", "(", "items", ")", "{", "const", "hash", "=", "crypto", ".", "createHash", "(", "'sha256'", ")", ";", "let", "size", "=", "0", ";", "items", "=", "sortPaths", "(", "items", ",", "(", "item", ")", "=>", "item", ".", "path", ",", "'/'", ")", ";", "for", "(", "const", "r", "of", "items", ")", "{", "size", "+=", "r", ".", "stats", ".", "size", ";", "hash", ".", "update", "(", "r", ".", "hash", ".", "toString", "(", ")", ")", ";", "}", "return", "[", "size", ",", "hash", ".", "digest", "(", "'hex'", ")", "]", ";", "}", "export", "abstract", "class", "TreeEntry", "{", "constructor", "(", "public", "hash", ",", "public", "path", ",", "public", "stats", ")", "{", "}", "isDirectory", "(", ")", "{", "return", "this", "instanceof", "TreeDir", ";", "}", "isFile", "(", ")", "{", "return", "this", "instanceof", "TreeFile", ";", "}", "abstract", "clone", "(", "parent", "?", ")", ";", "}", "function", "generateSizeAndCaches", "(", "item", ")", "{", "if", "(", "item", "instanceof", "TreeDir", ")", "{", "for", "(", "const", "subitem", "of", "item", ".", "children", ")", "{", "if", "(", "subitem", "instanceof", "TreeDir", ")", "{", "generateSizeAndCaches", "(", "subitem", ")", ";", "}", "}", "const", "calcs", "=", "calculateSizeAndHash", "(", "item", ".", "children", ")", ";", "item", ".", "stats", ".", "size", "=", "calcs", "[", "0", "]", ";", "item", ".", "hash", "=", "calcs", "[", "1", "]", ";", "return", "[", "calcs", "[", "0", "]", ",", "calcs", "[", "1", "]", "]", ";", "}", "return", "[", "item", ".", "stats", ".", "size", ",", "item", ".", "hash", "]", ";", "}", "export", "class", "TreeFile", "extends", "TreeEntry", "{", "constructor", "(", "hash", ",", "path", ",", "stats", ",", "public", "ext", ",", "public", "parent", ")", "{", "super", "(", "hash", ",", "path", ",", "stats", ")", ";", "}", "clone", "(", "parent", "?", ")", "{", "return", "new", "TreeFile", "(", "this", ".", "hash", ",", "this", ".", "path", ",", "StatsSubset", ".", "clone", "(", "this", ".", "stats", ")", ",", "this", ".", "ext", ",", "parent", ")", ";", "}", "toJsonObject", "(", ")", "{", "if", "(", "!", "this", ".", "parent", "&&", "this", ".", "path", ")", "{", "throw", "new", "Error", "(", "'parent has no path'", ")", ";", "}", "else", "if", "(", "this", ".", "parent", "&&", "!", "this", ".", "path", ")", "{", "throw", "new", "Error", "(", "'item must have path'", ")", ";", "}", "const", "output", "=", "{", "hash", ":", "this", ".", "hash", ",", "path", ":", "this", ".", "path", ",", "ext", ":", "this", ".", "ext", ",", "stats", ":", "{", "size", ":", "this", ".", "stats", ".", "size", ",", "ctime", ":", "this", ".", "stats", ".", "ctime", ".", "getTime", "(", ")", ",", "mtime", ":", "this", ".", "stats", ".", "mtime", ".", "getTime", "(", ")", ",", "birthtime", ":", "this", ".", "stats", ".", "birthtime", ".", "getTime", "(", ")", ",", "}", ",", "}", ";", "return", "output", ";", "}", "isFileModified", "(", "repo", ",", "detectionMode", ")", "{", "const", "filepath", "=", "join", "(", "repo", ".", "workdir", "(", ")", ",", "this", ".", "path", ")", ";", "return", "io", ".", "stat", "(", "filepath", ")", ".", "then", "(", "(", "newStats", ")", "=>", "{", "if", "(", "this", ".", "stats", ".", "size", "!==", "newStats", ".", "size", ")", "{", "return", "{", "file", ":", "this", ",", "modified", ":", "true", ",", "newStats", "}", ";", "}", "if", "(", "Math", ".", "abs", "(", "+", "this", ".", "stats", ".", "mtime", "-", "(", "+", "newStats", ".", "mtime", ")", ")", ">=", "1.0", ")", "{", "switch", "(", "detectionMode", ")", "{", "case", "DETECTIONMODE", ".", "DEFAULT", ":", "{", "const", "ext", "=", "extname", "(", "filepath", ")", ";", "if", "(", "!", "textFileExtensions", ".", "has", "(", "ext", ")", ")", "{", "return", "{", "file", ":", "this", ",", "modified", ":", "true", ",", "newStats", "}", ";", "}", "}", "case", "DETECTIONMODE", ".", "SIZE_AND_HASH_FOR_SMALL_FILES", ":", "if", "(", "this", ".", "stats", ".", "size", ">=", "MB20", ")", "{", "return", "{", "file", ":", "this", ",", "modified", ":", "true", ",", "newStats", "}", ";", "}", "break", ";", "case", "DETECTIONMODE", ".", "ONLY_SIZE_AND_MKTIME", ":", "return", "{", "file", ":", "this", ",", "modified", ":", "true", ",", "newStats", "}", ";", "case", "DETECTIONMODE", ".", "SIZE_AND_HASH_FOR_ALL_FILES", ":", "default", ":", "break", ";", "}", "return", "getPartHash", "(", "filepath", ")", ".", "then", "(", "(", "hashBlock", ")", "=>", "{", "return", "{", "file", ":", "this", ",", "modified", ":", "this", ".", "hash", "!==", "hashBlock", ".", "hash", ",", "newStats", "}", ";", "}", ")", ";", "}", "return", "{", "file", ":", "this", ",", "modified", ":", "false", ",", "newStats", "}", ";", "}", ")", ";", "}", "}", "export", "class", "TreeDir", "extends", "TreeEntry", "{", "static", "ROOT", "=", "undefined", ";", "hash", ":", "string", ";", "children", ":", "(", "TreeEntry", ")", "[", "]", "=", "[", "]", ";", "constructor", "(", "public", "path", ",", "public", "stats", ",", "public", "parent", "=", "null", ")", "{", "super", "(", "''", ",", "path", ",", "stats", ")", ";", "}", "static", "createRootTree", "(", ")", "{", "return", "new", "TreeDir", "(", "''", ",", "{", "size", ":", "0", ",", "ctime", ":", "new", "Date", "(", "0", ")", ",", "mtime", ":", "new", "Date", "(", "0", ")", ",", "birthtime", ":", "new", "Date", "(", "0", ")", ",", "}", ")", ";", "}", "clone", "(", "parent", "?", ")", "{", "const", "newTree", "=", "new", "TreeDir", "(", "this", ".", "path", ",", "StatsSubset", ".", "clone", "(", "this", ".", "stats", ")", ",", "parent", ")", ";", "newTree", ".", "children", "=", "this", ".", "children", ".", "map", "(", "(", "c", ")", "=>", "c", ".", "clone", "(", "newTree", ")", ")", ";", "return", "newTree", ";", "}", "/**\n * Merge two trees, with target having the precedence in case\n * the element is already located in 'source.\n */", "static", "merge", "(", "source", ",", "target", ")", "{", "function", "privateMerge", "(", "source", ",", "target", ")", "{", "if", "(", "source", "instanceof", "TreeDir", "&&", "target", "instanceof", "TreeDir", ")", "{", "const", "newItems", "=", "new", "Map", "<", "string", ",", "TreeEntry", ">", "(", ")", ";", "for", "(", "const", "child", "of", "source", ".", "children", ")", "{", "newItems", ".", "set", "(", "child", ".", "path", ",", "child", ")", ";", "}", "for", "(", "const", "child", "of", "target", ".", "children", ")", "{", "newItems", ".", "set", "(", "child", ".", "path", ",", "child", ")", ";", "}", "for", "(", "const", "sourceItem", "of", "source", ".", "children", ")", "{", "for", "(", "const", "targetItem", "of", "target", ".", "children", ")", "{", "if", "(", "targetItem", ".", "path", "===", "sourceItem", ".", "path", ")", "{", "const", "res", "=", "privateMerge", "(", "sourceItem", ",", "targetItem", ")", ";", "newItems", ".", "set", "(", "res", ".", "path", ",", "res", ")", ";", "}", "}", "}", "target", ".", "children", "=", "Array", ".", "from", "(", "newItems", ".", "values", "(", ")", ")", ";", "const", "calcs", "=", "generateSizeAndCaches", "(", "target", ")", ";", "target", ".", "stats", ".", "size", "=", "calcs", "[", "0", "]", ";", "target", ".", "hash", "=", "calcs", "[", "1", "]", ";", "}", "return", "target", ";", "}", "return", "privateMerge", "(", "source", ",", "target", ".", "clone", "(", ")", ")", "as", "TreeDir", ";", "}", "toJsonObject", "(", "includeChildren", "?", ")", "{", "if", "(", "!", "this", ".", "parent", "&&", "this", ".", "path", ")", "{", "throw", "new", "Error", "(", "'parent has no path'", ")", ";", "}", "else", "if", "(", "this", ".", "parent", "&&", "(", "!", "this", ".", "path", "||", "this", ".", "path", ".", "length", "===", "0", ")", ")", "{", "throw", "new", "Error", "(", "'item must have path'", ")", ";", "}", "const", "children", "=", "this", ".", "children", ".", "map", "(", "(", "value", ")", "=>", "value", ".", "toJsonObject", "(", "includeChildren", ")", ")", ";", "const", "stats", "=", "{", "size", ":", "this", ".", "stats", ".", "size", ",", "ctime", ":", "this", ".", "stats", ".", "ctime", ".", "getTime", "(", ")", ",", "mtime", ":", "this", ".", "stats", ".", "mtime", ".", "getTime", "(", ")", ",", "birthtime", ":", "this", ".", "stats", ".", "birthtime", ".", "getTime", "(", ")", ",", "}", ";", "return", "{", "hash", ":", "this", ".", "hash", ",", "path", ":", "this", ".", "path", "??", "''", ",", "stats", ",", "children", ",", "}", ";", "}", "getAllTreeFiles", "(", "opt", ")", "{", "const", "visit", "=", "(", "obj", ",", "map", ")", "=>", "{", "if", "(", "Array", ".", "isArray", "(", "obj", ")", ")", "{", "return", "obj", ".", "forEach", "(", "(", "c", ")", "=>", "visit", "(", "c", ",", "map", ")", ")", ";", "}", "if", "(", "obj", "instanceof", "TreeDir", ")", "{", "if", "(", "opt", ".", "includeDirs", ")", "{", "map", ".", "set", "(", "obj", ".", "path", ",", "obj", ")", ";", "}", "return", "obj", ".", "children", ".", "forEach", "(", "(", "c", ")", "=>", "visit", "(", "c", ",", "map", ")", ")", ";", "}", "map", ".", "set", "(", "obj", ".", "path", ",", "obj", ")", ";", "}", ";", "const", "map", "=", "new", "Map", "(", ")", ";", "if", "(", "opt", ".", "entireHierarchy", ")", "{", "visit", "(", "this", ".", "children", ",", "map", ")", ";", "}", "else", "{", "this", ".", "children", ".", "forEach", "(", "(", "o", ")", "=>", "{", "if", "(", "o", "instanceof", "TreeFile", "||", "opt", ".", "entireHierarchy", ")", "{", "map", ".", "set", "(", "o", ".", "path", ",", "o", ")", ";", "}", "}", ")", ";", "}", "return", "map", ";", "}", "find", "(", "relativePath", ")", "{", "if", "(", "relativePath", "===", "this", ".", "path", ")", "{", "return", "this", ";", "}", "let", "tree", "=", "null", ";", "TreeDir", ".", "walk", "(", "this", ",", "(", "entry", ")", "=>", "{", "if", "(", "entry", ".", "path", "===", "relativePath", ")", "{", "tree", "=", "entry", ";", "}", "}", ")", ";", "return", "tree", ";", "}", "/**\n * Browse through the entire hierarchy of the tree and remove the given item.\n */", "static", "remove", "(", "tree", ",", "cb", ")", "{", "for", "(", "const", "child", "of", "tree", ".", "children", ")", "{", "if", "(", "child", "instanceof", "TreeDir", ")", "{", "TreeDir", ".", "remove", "(", "child", ",", "cb", ")", ";", "}", "}", "tree", ".", "children", "=", "tree", ".", "children", ".", "filter", "(", "(", "value", ",", "index", ",", "array", ")", "=>", "!", "cb", "(", "value", ",", "index", ",", "array", ")", ")", ";", "}", "static", "walk", "(", "tree", ",", "cb", ")", "{", "let", "i", "=", "0", ";", "for", "(", "const", "entry", "of", "tree", ".", "children", ")", "{", "cb", "(", "<", "TreeFile", ">", "entry", ",", "i", ",", "tree", ".", "children", ".", "length", ")", ";", "if", "(", "entry", "instanceof", "TreeDir", ")", "{", "TreeDir", ".", "walk", "(", "entry", ",", "cb", ")", ";", "}", "i", "++", ";", "}", "}", "}", "export", "function", "constructTree", "(", "dirPath", ",", "tree", "?", ",", "root", "?", ")", "{", "if", "(", "dirPath", ".", "endsWith", "(", "'/'", ")", ")", "{", "dirPath", "=", "dirPath", ".", "substr", "(", "0", ",", "dirPath", ".", "length", "-", "1", ")", ";", "}", "if", "(", "!", "root", ")", "{", "root", "=", "dirPath", ";", "}", "if", "(", "!", "tree", ")", "{", "tree", "=", "TreeDir", ".", "createRootTree", "(", ")", ";", "}", "return", "new", "Promise", "<", "string", "[", "]", ">", "(", "(", "resolve", ",", "reject", ")", "=>", "{", "io", ".", "readdir", "(", "dirPath", ",", "(", "error", ",", "entries", ")", "=>", "{", "if", "(", "error", ")", "{", "reject", "(", "error", ")", ";", "return", ";", "}", "resolve", "(", "entries", ".", "map", "(", "normalize", ")", ")", ";", "}", ")", ";", "}", ")", ".", "then", "(", "(", "entries", ")", "=>", "{", "const", "promises", "=", "[", "]", ";", "for", "(", "const", "entry", "of", "entries", ")", "{", "if", "(", "entry", "===", "'.snow'", "||", "entry", "===", "'.git'", "||", "entry", "===", "'.DS_Store'", "||", "entry", "===", "'thumbs.db'", ")", "{", "continue", ";", "}", "const", "absPath", "=", "`${", "dirPath", "}/${", "entry", "}`", ";", "const", "relPath", "=", "relative", "(", "root", ",", "absPath", ")", ";", "promises", ".", "push", "(", "io", ".", "stat", "(", "absPath", ")", ".", "then", "(", "(", "stat", ")", "=>", "{", "if", "(", "stat", ".", "isDirectory", "(", ")", ")", "{", "const", "subtree", "=", "new", "TreeDir", "(", "relative", "(", "root", ",", "absPath", ")", ",", "StatsSubset", ".", "clone", "(", "stat", ")", ",", "tree", ")", ";", "tree", ".", "children", ".", "push", "(", "subtree", ")", ";", "return", "constructTree", "(", "absPath", ",", "subtree", ",", "root", ")", ";", "}", "const", "entry", "=", "new", "TreeFile", "(", "''", ",", "relPath", ",", "StatsSubset", ".", "clone", "(", "stat", ")", ",", "extname", "(", "relPath", ")", ",", "tree", ")", ";", "tree", ".", "children", ".", "push", "(", "entry", ")", ";", "}", ")", ")", ";", "}", "return", "Promise", ".", "all", "(", "promises", ")", ";", "}", ")", ".", "then", "(", "(", ")", "=>", "{", "let", "size", "=", "0", ";", "for", "(", "const", "r", "of", "tree", ".", "children", ")", "{", "size", "+=", "r", ".", "stats", ".", "size", ";", "}", "tree", ".", "stats", ".", "size", "=", "size", ";", "return", "tree", ";", "}", ")", ";", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 30, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7827, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, 2, null, null, 0, null, null, null, 8, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, 7827, null, 18801, null, null, null, null, null, 5, null, 7827, null, null, null, null, null, null, null, null, null, null, null, null, 7827, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, 2, null, 0, null, null, 2, null, null, 18801, null, null, null, null, null, null, null, null, null, null, null, null, 29925, null, 18801, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 112, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 21745, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, 0, null, null, 18801, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 18801, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 18801, null, 18801, null, null, null, null, 18801, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7827, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 18801, null, 7827, null, 7827, null, null, null, 7827, null, 7827, null, 7827, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 19, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7827, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7827, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7827, null, null, null, null, null, null, null, null, null, 7827, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7827, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 19, null, 6, null, null, null, null, null, null, null, null, 19, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 19, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7827, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7827, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 18801, null, 8, null, null, null, null, null, 7827, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7827, null, 3, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 18801, null, 4, null, null, null, 3, null, null, null, null, null, null, 7827, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 2, null, 18801, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 4, null, null, null, null, null, null, null, null, null, null, 25, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, 5, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 21745, null, null, null, null, null, null, null, null, null, null, null, null, null, 18801, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 29925, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, 7827, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1351
[ "import", "*", "as", "crypto", "from", "'crypto'", ";", "import", "{", "Repository", "}", "from", "'./repository'", ";", "import", "{", "TreeDir", "}", "from", "'./treedir'", ";", "import", "{", "jsonCompliant", "}", "from", "'./common'", ";", "/**\n * A class that represents the commits of a repository.\n * It contains a variety of information like the creation date,\n * a human readable message string, that describes the changes, etc.\n *\n * Each commit is distinguishable by its commit hash that can be obtained\n * by [[Commit.hash]]\n */", "export", "class", "Commit", "{", "/** Unique commit hash */", "hash", ":", "string", ";", "tags", ":", "string", "[", "]", ";", "/** Custom commit user data, that was added to [[Repository.createCommit]]. */", "userData", ":", "any", ";", "/** The repository this commit belongs to. */", "repo", ":", "Repository", ";", "/** Human readable message string. */", "message", ":", "string", ";", "/** Creation date of the commit. */", "date", ":", "Date", ";", "/** The root represents the directory of the worktree when the commit was created. */", "root", ":", "TreeDir", ";", "/** Parent commit before this commit. */", "parent", ":", "string", "[", "]", "|", "null", ";", "constructor", "(", "repo", ",", "message", ",", "creationDate", ",", "root", ",", "parent", ")", "{", "this", ".", "hash", "=", "crypto", ".", "createHash", "(", "'sha256'", ")", ".", "update", "(", "process", ".", "hrtime", "(", ")", ".", "toString", "(", ")", ")", ".", "digest", "(", "'hex'", ")", ";", "this", ".", "tags", "=", "[", "]", ";", "this", ".", "userData", "=", "{", "}", ";", "this", ".", "repo", "=", "repo", ";", "this", ".", "message", "=", "jsonCompliant", "(", "message", ")", ";", "this", ".", "date", "=", "creationDate", ";", "this", ".", "root", "=", "root", ";", "this", ".", "parent", "=", "parent", ";", "}", "/**\n * Return a cloned commit object.\n */", "clone", "(", ")", "{", "const", "commit", "=", "new", "Commit", "(", "this", ".", "repo", ",", "this", ".", "message", ",", "this", ".", "date", ",", "this", ".", "root", ",", "this", ".", "parent", "?", "[", "...", "this", ".", "parent", "]", ":", "[", "]", ")", ";", "commit", ".", "hash", "=", "this", ".", "hash", ";", "commit", ".", "tags", "=", "[", "]", ";", "if", "(", "this", ".", "tags", "!=", "null", ")", "{", "commit", ".", "tags", "=", "[", "...", "this", ".", "tags", "]", ";", "}", "commit", ".", "userData", "=", "{", "}", ";", "if", "(", "this", ".", "userData", "!=", "null", ")", "{", "commit", ".", "userData", "=", "{", "...", "this", ".", "userData", "}", ";", "}", "return", "commit", ";", "}", "/**\n * Add custom data to the commit object.\n */", "addData", "(", "key", ",", "value", ")", "{", "this", ".", "userData", "[", "key", "]", "=", "value", ";", "}", "/**\n * Add custom tag to the commit object.\n */", "addTag", "(", "tag", ")", "{", "if", "(", "tag", ".", "length", "===", "0", ")", "{", "return", ";", "}", "if", "(", "this", ".", "tags", "==", "null", ")", "{", "this", ".", "tags", "=", "[", "]", ";", "}", "if", "(", "this", ".", "tags", ".", "includes", "(", "tag", ")", ")", "{", "return", ";", "}", "tag", "=", "jsonCompliant", "(", "tag", ")", ";", "this", ".", "tags", ".", "push", "(", "tag", ")", ";", "}", "/**\n * The owner repository of the commit.\n */", "owner", "(", ")", "{", "return", "this", ".", "repo", ";", "}", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 112, null, 2, null, 26, null, 18801, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1112, null, null, null, null, 1112, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 112, null, null, null, null, null, null, null, null, null, null ]
1352
[ "import", "*", "as", "fse", "from", "'fs-extra'", ";", "import", "nm", "=", "require", "(", "'micromatch'", ")", ";", "export", "class", "IgnoreManager", "{", "patterns", ":", "string", "[", "]", ";", "constructor", "(", ")", "{", "this", ".", "patterns", "=", "[", "'**/.DS_Store'", ",", "'**/thumbs.db'", ",", "'**/._.*'", ",", "'**/.git'", ",", "'**/.git/**'", ",", "'**/.snowignore'", ",", "'**/*.bkp'", ",", "'**/**/bkp/**'", ",", "'**/*_bak[0-9]*.[A-Za-z0-9]+'", ",", "'**/*.tmp'", ",", "'**/tmp/**'", ",", "'**/temp/**'", ",", "'**/cache/**'", ",", "'**/*.lnk'", ",", "'**/desktop.ini'", ",", "'**/.idea/**'", ",", "'**/.Spotlight-V100'", ",", "'**/Backup_of*'", ",", "'**/Adobe Premiere Pro Auto-Save/**'", ",", "'**/Adobe After Effects Auto-Save/**'", ",", "'**/RECOVER_*'", ",", "'**/temp.noindex/**'", ",", "'**/~*'", ",", "'**/*.blend+([0-9])'", ",", "'**/*.bak*([0-9])'", ",", "'**/backup/**'", ",", "'**/*.3dm.rhl'", ",", "'**/*.3dmbak'", ",", "]", ";", "}", "loadFile", "(", "filepath", ")", "{", "return", "fse", ".", "readFile", "(", "filepath", ")", ".", "then", "(", "(", "value", ")", "=>", "{", "const", "lines", "=", "value", ".", "toString", "(", ")", ".", "split", "(", "'\\n'", ")", ";", "for", "(", "let", "line", "of", "lines", ")", "{", "line", "=", "line", ".", "trim", "(", ")", ".", "replace", "(", "/\\/\\*[\\s\\S]*?\\*\\/|\\/\\/.*/g", ",", "''", ")", ";", "if", "(", "line", ".", "length", ">", "0", ")", "{", "this", ".", "patterns", ".", "push", "(", "line", ")", ";", "if", "(", "!", "line", ".", "endsWith", "(", "'/'", ")", ")", "{", "this", ".", "patterns", ".", "push", "(", "`${", "line", "}/**`", ")", ";", "}", "}", "}", "}", ")", ";", "}", "ignoredList", "(", "filepaths", ")", "{", "const", "ignored", "=", "nm", "(", "filepaths", ",", "this", ".", "patterns", ",", "{", "dot", ":", "true", ",", "nocase", ":", "true", ",", "}", ")", ";", "return", "new", "Set", "(", "ignored", "as", "string", "[", "]", ")", ";", "}", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, 12, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 30, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1353
[ "import", "{", "REFERENCE_TYPE", ",", "Repository", "}", "from", "'./repository'", ";", "/**\n * A class currently representing a branch. A reference points to an existing commit through the hash (aka `target`).\n * In the future, a reference might also be used as a **tag** or other commit references.\n */", "export", "class", "Reference", "{", "hash", ":", "string", ";", "/** Custom commit user data, that was added to [[Repository.createCommit]]. */", "userData", ":", "any", ";", "refName", ":", "string", ";", "repo", ":", "Repository", ";", "startHash", ":", "string", ";", "type", ":", "REFERENCE_TYPE", ";", "constructor", "(", "type", ",", "refName", ",", "repo", ",", "c", ")", "{", "this", ".", "hash", "=", "c", ".", "hash", ";", "this", ".", "userData", "=", "c", ".", "userData", "??", "{", "}", ";", "this", ".", "startHash", "=", "c", ".", "start", ";", "this", ".", "refName", "=", "refName", ";", "this", ".", "repo", "=", "repo", ";", "this", ".", "type", "=", "type", ";", "}", "getName", "(", ")", "{", "return", "this", ".", "refName", ";", "}", "setName", "(", "name", ")", "{", "this", ".", "refName", "=", "name", ";", "}", "getType", "(", ")", "{", "return", "this", ".", "type", ";", "}", "owner", "(", ")", "{", "return", "this", ".", "repo", ";", "}", "isDetached", "(", ")", "{", "return", "this", ".", "refName", "===", "'HEAD'", ";", "}", "target", "(", ")", "{", "return", "this", ".", "hash", ";", "}", "start", "(", ")", "{", "return", "this", ".", "startHash", ";", "}", "clone", "(", ")", "{", "const", "ref", "=", "new", "Reference", "(", "this", ".", "type", ",", "this", ".", "refName", ",", "this", ".", "repo", ",", "{", "hash", ":", "this", ".", "hash", ",", "start", ":", "this", ".", "startHash", ",", "}", ")", ";", "ref", ".", "userData", "=", "{", "}", ";", "if", "(", "this", ".", "userData", "!=", "null", ")", "{", "ref", ".", "userData", "=", "{", "...", "this", ".", "userData", "}", ";", "}", "return", "ref", ";", "}", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, 2, null, 112, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, 4, null, 2, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, 112, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, 491, null, null, null, null, 491, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1354
[ "import", "*", "as", "crypto", "from", "'crypto'", ";", "import", "*", "as", "fse", "from", "'fs-extra'", ";", "import", "{", "basename", ",", "join", ",", "dirname", ",", "relative", ",", "extname", ",", "}", "from", "'./path'", ";", "import", "{", "DirItem", ",", "OSWALK", ",", "osWalk", ",", "zipFile", ",", "}", "from", "'./io'", ";", "import", "*", "as", "io", "from", "'./io'", ";", "import", "*", "as", "fss", "from", "'./fs-safe'", ";", "import", "{", "Repository", ",", "RepositoryInitOptions", "}", "from", "'./repository'", ";", "import", "{", "Commit", "}", "from", "'./commit'", ";", "import", "{", "Reference", "}", "from", "'./reference'", ";", "import", "{", "calculateFileHash", ",", "FileInfo", ",", "HashBlock", ",", "StatsSubset", ",", "}", "from", "'./common'", ";", "import", "{", "TreeDir", ",", "TreeFile", "}", "from", "'./treedir'", ";", "import", "{", "IoContext", "}", "from", "'./io_context'", ";", "const", "defaultConfig", "=", "{", "version", ":", "2", ",", "filemode", ":", "false", ",", "symlinks", ":", "true", ",", "}", ";", "/**\n * A class representing the internal database of a `SnowFS` repository.\n * The class offers accessibility functions to read or write from the database.\n * Some functions are useful in a variety of contexts, where others are mostly\n * used when a repository is opened or initialized.\n */", "export", "class", "Odb", "{", "config", ":", "any", ";", "repo", ":", "Repository", ";", "constructor", "(", "repo", ")", "{", "this", ".", "repo", "=", "repo", ";", "}", "static", "open", "(", "repo", ")", "{", "const", "odb", "=", "new", "Odb", "(", "repo", ")", ";", "return", "fse", ".", "readFile", "(", "join", "(", "repo", ".", "commondir", "(", ")", ",", "'config'", ")", ")", ".", "then", "(", "(", "buf", ")", "=>", "{", "odb", ".", "config", "=", "JSON", ".", "parse", "(", "buf", ".", "toString", "(", ")", ")", ";", "if", "(", "odb", ".", "config", ".", "version", "===", "1", ")", "{", "throw", "new", "Error", "(", "`repository version ${", "odb", ".", "config", ".", "version", "} is not supported`", ")", ";", "}", "return", "odb", ";", "}", ")", ";", "}", "static", "create", "(", "repo", ",", "options", ")", "{", "const", "odb", "=", "new", "Odb", "(", "repo", ")", ";", "return", "io", ".", "pathExists", "(", "options", ".", "commondir", ")", ".", "then", "(", "(", "exists", ")", "=>", "{", "if", "(", "exists", ")", "{", "throw", "new", "Error", "(", "'directory already exists'", ")", ";", "}", "return", "io", ".", "ensureDir", "(", "options", ".", "commondir", ")", ";", "}", ")", ".", "then", "(", "(", ")", "=>", "io", ".", "ensureDir", "(", "join", "(", "options", ".", "commondir", ",", "'objects'", ")", ")", ")", ".", "then", "(", "(", ")", "=>", "io", ".", "ensureDir", "(", "join", "(", "options", ".", "commondir", ",", "'versions'", ")", ")", ")", ".", "then", "(", "(", ")", "=>", "io", ".", "ensureDir", "(", "join", "(", "options", ".", "commondir", ",", "'hooks'", ")", ")", ")", ".", "then", "(", "(", ")", "=>", "io", ".", "ensureDir", "(", "join", "(", "options", ".", "commondir", ",", "'refs'", ")", ")", ")", ".", "then", "(", "(", ")", "=>", "{", "odb", ".", "config", "=", "{", "...", "defaultConfig", "}", ";", "let", "config", "=", "{", "...", "defaultConfig", "}", ";", "if", "(", "options", ".", "additionalConfig", ")", "{", "config", "=", "Object", ".", "assign", "(", "config", ",", "{", "additionalConfig", ":", "options", ".", "additionalConfig", "}", ")", ";", "}", "return", "fse", ".", "writeFile", "(", "join", "(", "options", ".", "commondir", ",", "'config'", ")", ",", "JSON", ".", "stringify", "(", "config", ")", ")", ";", "}", ")", ".", "then", "(", "(", ")", "=>", "odb", ")", ";", "}", "readCommits", "(", ")", "{", "const", "objectsDir", "=", "join", "(", "this", ".", "repo", ".", "options", ".", "commondir", ",", "'versions'", ")", ";", "return", "osWalk", "(", "objectsDir", ",", "OSWALK", ".", "FILES", ")", ".", "then", "(", "(", "value", ")", "=>", "{", "const", "promises", "=", "[", "]", ";", "for", "(", "const", "ref", "of", "value", ")", "{", "if", "(", "ref", ".", "relPath", ".", "endsWith", "(", "'.tmp'", ")", ")", "{", "continue", ";", "}", "promises", ".", "push", "(", "fse", ".", "readFile", "(", "ref", ".", "absPath", ")", ".", "then", "(", "(", "buf", ")", "=>", "JSON", ".", "parse", "(", "buf", ".", "toString", "(", ")", ")", ")", ")", ";", "}", "return", "Promise", ".", "all", "(", "promises", ")", ";", "}", ")", ".", "then", "(", "(", "commits", ")", "=>", "{", "const", "visit", "=", "(", "obj", ",", "parent", ")", "=>", "{", "if", "(", "Array", ".", "isArray", "(", "obj", ")", ")", "{", "return", "obj", ".", "map", "(", "(", "c", ")", "=>", "visit", "(", "c", ",", "parent", ")", ")", ";", "}", "if", "(", "obj", ".", "stats", ")", "{", "if", "(", "obj", ".", "stats", ".", "ctimeMs", ")", "{", "obj", ".", "stats", ".", "ctime", "=", "obj", ".", "stats", ".", "cTimeMs", ";", "}", "if", "(", "obj", ".", "stats", ".", "mtimeMs", ")", "{", "obj", ".", "stats", ".", "mtime", "=", "obj", ".", "stats", ".", "mtimeMs", ";", "}", "if", "(", "!", "obj", ".", "stats", ".", "birthtime", ")", "{", "obj", ".", "stats", ".", "birthtime", "=", "new", "Date", "(", "0", ")", ";", "}", "obj", ".", "stats", ".", "mtime", "=", "new", "Date", "(", "obj", ".", "stats", ".", "mtime", ")", ";", "obj", ".", "stats", ".", "ctime", "=", "new", "Date", "(", "obj", ".", "stats", ".", "ctime", ")", ";", "obj", ".", "stats", ".", "birthtime", "=", "new", "Date", "(", "obj", ".", "stats", ".", "birthtime", ")", ";", "}", "if", "(", "obj", ".", "children", ")", "{", "const", "o", "=", "Object", ".", "setPrototypeOf", "(", "obj", ",", "TreeDir", ".", "prototype", ")", ";", "o", ".", "children", "=", "obj", ".", "children", ".", "map", "(", "(", "t", ")", "=>", "visit", "(", "t", ",", "o", ")", ")", ";", "o", ".", "parent", "=", "parent", ";", "return", "o", ";", "}", "const", "o", "=", "Object", ".", "setPrototypeOf", "(", "obj", ",", "TreeFile", ".", "prototype", ")", ";", "o", ".", "parent", "=", "parent", ";", "if", "(", "obj", ".", "hash", ")", "{", "o", ".", "hash", "=", "obj", ".", "hash", ";", "}", "return", "o", ";", "}", ";", "return", "commits", ".", "map", "(", "(", "commit", ")", "=>", "{", "const", "tmpCommit", "=", "commit", ";", "tmpCommit", ".", "date", "=", "new", "Date", "(", "tmpCommit", ".", "date", ")", ";", "const", "c", "=", "Object", ".", "setPrototypeOf", "(", "tmpCommit", ",", "Commit", ".", "prototype", ")", ";", "c", ".", "repo", "=", "this", ".", "repo", ";", "c", ".", "root", "=", "visit", "(", "c", ".", "root", ",", "null", ")", ";", "return", "c", ";", "}", ")", ";", "}", ")", ";", "}", "readReference", "(", "ref", ")", "{", "const", "refPath", "=", "ref", ".", "absPath", ";", "return", "fse", ".", "readFile", "(", "refPath", ")", ".", "then", "(", "(", "buf", ")", "=>", "{", "try", "{", "return", "{", "ref", ",", "content", ":", "JSON", ".", "parse", "(", "buf", ".", "toString", "(", ")", ")", "}", ";", "}", "catch", "(", "error", ")", "{", "console", ".", "log", "(", "'Error'", ")", ";", "return", "null", ";", "}", "}", ")", ";", "}", "readReferences", "(", ")", "{", "type", "DirItemAndReference", "=", "{", "ref", ":", "DirItem", ";", "content", ":", "any", ";", "}", ";", "const", "refsDir", "=", "join", "(", "this", ".", "repo", ".", "options", ".", "commondir", ",", "'refs'", ")", ";", "return", "osWalk", "(", "refsDir", ",", "OSWALK", ".", "FILES", ")", ".", "then", "(", "(", "value", ")", "=>", "{", "const", "promises", "=", "[", "]", ";", "for", "(", "const", "ref", "of", "value", ")", "{", "if", "(", "ref", ".", "relPath", ".", "endsWith", "(", "'.tmp'", ")", ")", "{", "continue", ";", "}", "promises", ".", "push", "(", "this", ".", "readReference", "(", "ref", ")", ")", ";", "}", "return", "Promise", ".", "all", "(", "promises", ")", ";", "}", ")", ".", "then", "(", "(", "ret", ")", ":", "Reference", "[", "]", "=>", "ret", ".", "filter", "(", "(", "x", ")", "=>", "!", "!", "x", ")", ".", "map", "(", "(", "ret", ")", "=>", "{", "const", "opts", "=", "{", "hash", ":", "ret", ".", "content", ".", "hash", ",", "start", ":", "ret", ".", "content", ".", "start", ",", "userData", ":", "ret", ".", "content", ".", "userData", ",", "}", ";", "return", "new", "Reference", "(", "ret", ".", "content", ".", "type", ",", "basename", "(", "ret", ".", "ref", ".", "absPath", ")", ",", "this", ".", "repo", ",", "opts", ")", ";", "}", ")", ")", ".", "then", "(", "(", "refsResult", ")", "=>", "refsResult", ")", ";", "}", "deleteReference", "(", "ref", ")", "{", "const", "refsDir", "=", "join", "(", "this", ".", "repo", ".", "options", ".", "commondir", ",", "'refs'", ")", ";", "return", "fse", ".", "unlink", "(", "join", "(", "refsDir", ",", "ref", ".", "getName", "(", ")", ")", ")", ".", "then", "(", "(", ")", "=>", "this", ".", "repo", ".", "modified", "(", ")", ")", ";", "}", "writeHeadReference", "(", "head", ")", "{", "const", "refsDir", "=", "this", ".", "repo", ".", "options", ".", "commondir", ";", "return", "fss", ".", "writeSafeFile", "(", "join", "(", "refsDir", ",", "'HEAD'", ")", ",", "head", ".", "getName", "(", ")", "===", "'HEAD'", "?", "head", ".", "hash", ":", "head", ".", "getName", "(", ")", ")", ".", "then", "(", "(", ")", "=>", "this", ".", "repo", ".", "modified", "(", ")", ")", ";", "}", "readHeadReference", "(", ")", "{", "const", "refsDir", "=", "this", ".", "repo", ".", "options", ".", "commondir", ";", "return", "fse", ".", "readFile", "(", "join", "(", "refsDir", ",", "'HEAD'", ")", ")", ".", "then", "(", "(", "buf", ")", "=>", "buf", ".", "toString", "(", ")", ")", ".", "catch", "(", "(", ")", "=>", "{", "console", ".", "log", "(", "'No HEAD found'", ")", ";", "return", "null", ";", "}", ")", ";", "}", "getAbsObjectPath", "(", "file", ")", "{", "const", "objects", "=", "join", "(", "this", ".", "repo", ".", "options", ".", "commondir", ",", "'objects'", ")", ";", "return", "join", "(", "objects", ",", "file", ".", "hash", ".", "substr", "(", "0", ",", "2", ")", ",", "file", ".", "hash", ".", "substr", "(", "2", ",", "2", ")", ",", "file", ".", "hash", ".", "toString", "(", ")", "+", "extname", "(", "file", ".", "path", ")", ")", ";", "}", "getObjectByHash", "(", "hash", ",", "extname", ")", "{", "const", "objects", "=", "join", "(", "this", ".", "repo", ".", "options", ".", "commondir", ",", "'objects'", ")", ";", "const", "object", "=", "join", "(", "objects", ",", "hash", ".", "substr", "(", "0", ",", "2", ")", ",", "hash", ".", "substr", "(", "2", ",", "2", ")", ",", "hash", ".", "toString", "(", ")", "+", "extname", ")", ";", "return", "io", ".", "stat", "(", "object", ")", ".", "catch", "(", "(", ")", "=>", "null", ")", ";", "}", "writeReference", "(", "ref", ")", "{", "const", "refsDir", "=", "join", "(", "this", ".", "repo", ".", "options", ".", "commondir", ",", "'refs'", ")", ";", "if", "(", "ref", ".", "isDetached", "(", ")", ")", "{", "console", ".", "warn", "(", "'Was about to write HEAD ref to disk'", ")", ";", "return", ";", "}", "if", "(", "!", "ref", ".", "hash", ")", "{", "throw", "new", "Error", "(", "`hash value of ref is ${", "ref", ".", "hash", "}`", ")", ";", "}", "const", "refPath", "=", "join", "(", "refsDir", ",", "ref", ".", "getName", "(", ")", ")", ";", "return", "fss", ".", "writeSafeFile", "(", "refPath", ",", "JSON", ".", "stringify", "(", "{", "hash", ":", "ref", ".", "hash", ",", "type", ":", "ref", ".", "type", ",", "start", ":", "ref", ".", "startHash", "?", "ref", ".", "startHash", ":", "undefined", ",", "userData", ":", "ref", ".", "userData", "??", "{", "}", ",", "}", ")", ")", ".", "then", "(", "(", ")", "=>", "this", ".", "repo", ".", "modified", "(", ")", ")", ";", "}", "writeCommit", "(", "commit", ")", "{", "const", "objectsDir", "=", "join", "(", "this", ".", "repo", ".", "options", ".", "commondir", ",", "'versions'", ")", ";", "const", "commitSha256", "=", "commit", ".", "hash", ";", "const", "dstFile", "=", "join", "(", "objectsDir", ",", "commitSha256", ")", ";", "const", "parent", "=", "commit", ".", "parent", "?", "commit", ".", "parent", ":", "null", ";", "const", "root", "=", "commit", ".", "root", ".", "toJsonObject", "(", "true", ")", ";", "const", "tags", "=", "commit", ".", "tags", "?.", "length", ">", "0", "?", "commit", ".", "tags", ":", "undefined", ";", "const", "userData", "=", "commit", ".", "userData", "&&", "Object", ".", "keys", "(", "commit", ".", "userData", ")", ".", "length", ">", "0", "?", "commit", ".", "userData", ":", "undefined", ";", "const", "stream", "=", "fse", ".", "createWriteStream", "(", "dstFile", ",", "{", "flags", ":", "'w'", "}", ")", ";", "const", "content", "=", "JSON", ".", "stringify", "(", "{", "hash", ":", "commit", ".", "hash", ",", "message", ":", "commit", ".", "message", ",", "date", ":", "commit", ".", "date", ".", "getTime", "(", ")", ",", "parent", ",", "root", ",", "tags", ",", "userData", ",", "}", ",", "null", ",", "'\\t'", ")", ";", "stream", ".", "write", "(", "content", ")", ";", "return", "new", "Promise", "(", "(", "resolve", ",", "reject", ")", "=>", "{", "stream", ".", "on", "(", "'finish'", ",", "resolve", ")", ";", "stream", ".", "on", "(", "'error'", ",", "reject", ")", ";", "stream", ".", "end", "(", ")", ";", "}", ")", ".", "then", "(", "(", ")", "=>", "this", ".", "repo", ".", "modified", "(", ")", ")", ";", "}", "writeObject", "(", "filepath", ",", "ioContext", ")", "{", "const", "tmpFilename", "=", "crypto", ".", "createHash", "(", "'sha256'", ")", ".", "update", "(", "process", ".", "hrtime", "(", ")", ".", "toString", "(", ")", ")", ".", "digest", "(", "'hex'", ")", ";", "const", "objects", "=", "join", "(", "this", ".", "repo", ".", "options", ".", "commondir", ",", "'objects'", ")", ";", "const", "tmpDir", "=", "join", "(", "this", ".", "repo", ".", "options", ".", "commondir", ",", "'tmp'", ")", ";", "const", "tmpPath", "=", "join", "(", "tmpDir", ",", "tmpFilename", ")", ";", "let", "dstFile", ";", "let", "filehash", ";", "let", "hashBlocks", ";", "return", "fse", ".", "ensureDir", "(", "tmpDir", ",", "{", "}", ")", ".", "then", "(", "(", ")", "=>", "ioContext", ".", "copyFile", "(", "filepath", ",", "tmpPath", ")", ")", ".", "then", "(", "(", ")", "=>", "calculateFileHash", "(", "filepath", ")", ")", ".", "then", "(", "(", "res", ")", "=>", "{", "filehash", "=", "res", ".", "filehash", ";", "hashBlocks", "=", "res", ".", "hashBlocks", ";", "dstFile", "=", "join", "(", "objects", ",", "filehash", ".", "substr", "(", "0", ",", "2", ")", ",", "filehash", ".", "substr", "(", "2", ",", "2", ")", ",", "filehash", ".", "toString", "(", ")", "+", "extname", "(", "filepath", ")", ")", ";", "return", "io", ".", "pathExists", "(", "dstFile", ")", ";", "}", ")", ".", "then", "(", "(", "exists", ")", "=>", "{", "if", "(", "exists", ")", "{", "return", "fse", ".", "remove", "(", "tmpPath", ")", ";", "}", "if", "(", "this", ".", "repo", ".", "options", ".", "compress", ")", "{", "return", "zipFile", "(", "tmpPath", ",", "dstFile", ",", "{", "deleteSrc", ":", "true", "}", ")", ";", "}", "return", "fse", ".", "move", "(", "tmpPath", ",", "dstFile", ",", "{", "overwrite", ":", "false", "}", ")", ".", "catch", "(", "(", "error", ")", "=>", "{", "if", "(", "!", "error", ".", "message", ".", "startsWith", "(", "'dest already exists'", ")", "&&", "!", "error", ".", "message", ".", "startsWith", "(", "'EPERM: operation not permitted, rename'", ")", ")", "{", "throw", "error", ";", "}", "}", ")", ";", "}", ")", ".", "then", "(", "(", ")", "=>", "{", "if", "(", "hashBlocks", ")", "{", "const", "content", "=", "hashBlocks", ".", "map", "(", "(", "block", ")", "=>", "`${", "block", ".", "start", "};${", "block", ".", "end", "};${", "block", ".", "hash", "};`", ")", ".", "join", "(", "'\\n'", ")", ";", "return", "fss", ".", "writeSafeFile", "(", "`${", "dstFile", "}.hblock`", ",", "content", ")", ";", "}", "return", "Promise", ".", "resolve", "(", ")", ";", "}", ")", ".", "then", "(", "(", ")", "=>", "io", ".", "stat", "(", "filepath", ")", ".", "then", "(", "(", "stat", ")", "=>", "(", "{", "file", ":", "relative", "(", "this", ".", "repo", ".", "repoWorkDir", ",", "filepath", ")", ",", "fileinfo", ":", "{", "ext", ":", "extname", "(", "filepath", ")", ",", "hash", ":", "filehash", ",", "stat", ":", "StatsSubset", ".", "clone", "(", "stat", ")", ",", "}", ",", "}", ")", ")", ")", ".", "then", "(", "(", "res", ")", "=>", "this", ".", "repo", ".", "modified", "(", "res", ")", ")", ";", "}", "readObject", "(", "file", ",", "dstAbsPath", ",", "ioContext", ")", "{", "const", "hash", "=", "file", ".", "hash", ";", "const", "objectFile", "=", "this", ".", "getAbsObjectPath", "(", "file", ")", ";", "return", "io", ".", "pathExists", "(", "objectFile", ")", ".", "then", "(", "(", "exists", ")", "=>", "{", "if", "(", "!", "exists", ")", "{", "throw", "new", "Error", "(", "`object ${", "hash", "} not found`", ")", ";", "}", "return", "io", ".", "ensureDir", "(", "dirname", "(", "dstAbsPath", ")", ")", ";", "}", ")", ".", "then", "(", "(", ")", "=>", "{", "return", "ioContext", ".", "copyFile", "(", "objectFile", ",", "dstAbsPath", ")", ";", "}", ")", ".", "then", "(", "(", ")", "=>", "{", "return", "io", ".", "utimes", "(", "dstAbsPath", ",", "file", ".", "stats", ".", "mtime", ",", "file", ".", "stats", ".", "mtime", ")", ";", "}", ")", ";", "}", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 112, null, null, null, null, null, null, null, null, null, null, 7, null, 112, null, null, null, 46500, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 12, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 112, null, 0, null, null, null, 46500, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, 5, null, null, null, null, null, null, null, 19661, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 12, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, 18801, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 18801, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 29925, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1112, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 19661, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 12, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, 5, null, null, null, null, null, null, null, 19661, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, 7, null, 491, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 491, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 12, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, 29925, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 2, null, 2, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 491, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 1112, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 4, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 2, null, 0, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, 2, null, null, 2, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 21745, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 29925, null, 2, null, 0, null, null, null, 2, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1355
[ "import", "*", "as", "fse", "from", "'fs-extra'", ";", "import", "*", "as", "crypto", "from", "'crypto'", ";", "import", "*", "as", "io", "from", "'./io'", ";", "import", "{", "resolve", ",", "join", ",", "dirname", ",", "extname", ",", "}", "from", "'./path'", ";", "import", "{", "Log", "}", "from", "'./log'", ";", "import", "{", "Commit", "}", "from", "'./commit'", ";", "import", "{", "calculateFileHash", ",", "FileInfo", ",", "HashBlock", ",", "StatsSubset", ",", "}", "from", "'./common'", ";", "import", "{", "IgnoreManager", "}", "from", "'./ignore'", ";", "import", "{", "Index", "}", "from", "'./index'", ";", "import", "{", "DirItem", ",", "hideItem", ",", "OSWALK", ",", "osWalk", ",", "}", "from", "'./io'", ";", "import", "{", "IoContext", ",", "TEST_IF", "}", "from", "'./io_context'", ";", "import", "{", "Odb", "}", "from", "'./odb'", ";", "import", "{", "Reference", "}", "from", "'./reference'", ";", "import", "{", "constructTree", ",", "DETECTIONMODE", ",", "TreeDir", ",", "TreeEntry", ",", "TreeFile", ",", "}", "from", "'./treedir'", ";", "const", "PromisePool", "=", "require", "(", "'@supercharge/promise-pool'", ")", ";", "export", "enum", "COMMIT_ORDER", "{", "UNDEFINED", "=", "1", ",", "NEWEST_FIRST", "=", "2", ",", "OLDEST_FIRST", "=", "3", "}", "/**\n * Reference type, introduced to support TAGS in the future.\n */", "export", "enum", "REFERENCE_TYPE", "{", "BRANCH", "=", "0", "}", "/**\n * Initialize a new [[Repository]].\n */", "export", "class", "RepositoryInitOptions", "{", "defaultBranchName", "?", ":", "string", ";", "defaultCommitMessage", "?", ":", "string", ";", "commondir", "?", ":", "string", ";", "compress", "?", ":", "boolean", ";", "additionalConfig", "?", ":", "any", ";", "param", "commondir", "param", "compress", "constructor", "(", "commondir", "?", ",", "compress", "?", ")", "{", "this", ".", "commondir", "=", "commondir", ";", "this", ".", "compress", "=", "compress", ";", "}", "}", "/**\n * Used in [[StatusFileOptionsCustom]] to specify the state of a [[StatusEntry]]\n */", "export", "const", "enum", "STATUS", "{", "/** Set if [[FILTER.INCLUDE_UNMODIFIED]] is passed to [[Repository.getStatus]] and item is not modified */", "UNMODIFIED", "=", "0", ",", "/** Set if [[FILTER.INCLUDE_UNTRACKED]] is passed to [[Repository.getStatus]] and item is new. */", "WT_NEW", "=", "1", ",", "/** File existed before, and is modified. */", "WT_MODIFIED", "=", "2", ",", "/** File got deleted */", "WT_DELETED", "=", "4", ",", "WT_IGNORED", "=", "8", "}", "/**\n * Flags passed to [[Repository.restoreVersion]].\n */", "export", "const", "enum", "RESET", "{", "NONE", "=", "0", ",", "/** Restore modified items. */", "RESTORE_MODIFIED_ITEMS", "=", "1", ",", "/** Delete items from the worktree, if they are untracked/new. The affected items will be deleted. */", "DELETE_NEW_ITEMS", "=", "2", ",", "/** Restore deleted items from the worktree, if they were deleted. */", "RESTORE_DELETED_ITEMS", "=", "4", ",", "/**\n * Restore function will detach HEAD after the commit got restored.\n * This can be helpful if the restore target is a reference, but you\n * need a detached HEAD state nonetheless.\n */", "DETACH", "=", "8", ",", "/**\n * If a checkout is performed on HEAD to restore the working directory some files might get deleted\n * if they are new or were modified.\n *\n * By using this flag, each items hash will be checked if it exists in the object database.\n * If no match was found the item will be moved to the trash instead. This flag might increase\n * the runtime significantly due to the potential hash calculation.\n */", "MOVE_FILES_TO_TRASH_IF_NEEDED", "=", "16", ",", "/**\n * Overwrites the default detection mode, which only to trust the mktime (or content if text-files).\n * Please check [[DETECTIONMODE.ONLY_SIZE_AND_MKTIME]] for more information.\n */", "DETECTIONMODE_ONLY_SIZE_AND_MKTIME", "=", "2048", ",", "/**\n * Overwrites the default detection mode, which only to trust the mktime (or content if text-files).\n * Please check [[DETECTIONMODE.SIZE_AND_HASH_FOR_SMALL_FILES]] for more information.\n */", "DETECTIONMODE_SIZE_AND_HASH_FOR_SMALL_FILES", "=", "4096", ",", "/**\n * Overwrites the default detection mode, which only to trust the mktime (or content if text-files).\n * Please check [[DETECTIONMODE.SIZE_AND_HASH_FOR_ALL_FILES]] for more information.\n */", "DETECTIONMODE_SIZE_AND_HASH_FOR_ALL_FILES", "=", "8192", ",", "/** Default flag passed to [[Repository.restoreVersion]] */", "DEFAULT", "=", "RESTORE_MODIFIED_ITEMS", "|", "DELETE_NEW_ITEMS", "|", "RESTORE_DELETED_ITEMS", "}", "/**\n * Flags passed to [[Repository.getStatus]].\n */", "export", "const", "enum", "FILTER", "{", "/** Return all untracked/new items. */", "INCLUDE_UNTRACKED", "=", "1", ",", "/** Return all items ignored through [[IgnoreManager]]. */", "INCLUDE_IGNORED", "=", "2", ",", "/** Return all unmodified items. */", "INCLUDE_UNMODIFIED", "=", "4", ",", "/** Return all directories - in such case [[StatusEntry.isDirectory]] returns true */", "INCLUDE_DIRECTORIES", "=", "8", ",", "/** Return all deleted items */", "INCLUDE_DELETED", "=", "16", ",", "/** Return all modified items */", "INCLUDE_MODIFIED", "=", "32", ",", "/** Default flag passed to [[Repository.getStatus]] */", "DEFAULT", "=", "INCLUDE_UNTRACKED", "|", "INCLUDE_MODIFIED", "|", "INCLUDE_DELETED", "|", "INCLUDE_UNMODIFIED", "|", "INCLUDE_DIRECTORIES", ",", "/** Same as DEFAULT, but includes ignored entries */", "ALL", "=", "DEFAULT", "|", "INCLUDE_IGNORED", ",", "/** Sort return value case sensitively. Cannot be mixed with SORT_CASE_INSENSITIVELY. */", "SORT_CASE_SENSITIVELY", "=", "512", ",", "/** Sort return value case sensitively. Cannot be mixed with SORT_CASE_SENSITIVELY. */", "SORT_CASE_INSENSITIVELY", "=", "1024", ",", "/**\n * Overwrites the default detection mode, which only to trust the mktime (or content if text-files).\n * Please check [[DETECTIONMODE.ONLY_SIZE_AND_MKTIME]] for more information.\n */", "DETECTIONMODE_ONLY_SIZE_AND_MKTIME", "=", "2048", ",", "/**\n * Overwrites the default detection mode, which only to trust the mktime (or content if text-files).\n * Please check [[DETECTIONMODE.SIZE_AND_HASH_FOR_SMALL_FILES]] for more information.\n */", "DETECTIONMODE_SIZE_AND_HASH_FOR_SMALL_FILES", "=", "4096", ",", "/**\n * Overwrites the default detection mode, which only to trust the mktime (or content if text-files).\n * Please check [[DETECTIONMODE.SIZE_AND_HASH_FOR_ALL_FILES]] for more information.\n */", "DETECTIONMODE_SIZE_AND_HASH_FOR_ALL_FILES", "=", "8192", "}", "/** Initialize a new [[StatusEntry]] */", "export", "interface", "StatusItemOptionsCustom", "{", "/** Relative path of the item to the workdir root. */", "path", "?", ":", "string", ";", "/** Flags, which define the attributes of the item. */", "status", "?", ":", "STATUS", ";", "/**\n * Stats that represent the status items file/directory statistics.\n * Null if [[StatusEntry.isDeleted]] is true.\n */", "stats", ":", "fse", ".", "Stats", "|", "null", ";", "}", "/**\n * Used toinitialize a new repository.\n */", "export", "class", "StatusEntry", "{", "/** Relative path of the item to the workdir root. */", "path", "?", ":", "string", ";", "/** Flags, which define the attributes of the item. */", "status", "?", ":", "STATUS", ";", "/** True if the item is a directory. */", "isdir", ":", "boolean", ";", "stats", ":", "StatsSubset", "|", "null", ";", "constructor", "(", "data", ",", "isdir", ")", "{", "this", ".", "path", "=", "data", ".", "path", ";", "this", ".", "status", "=", "data", ".", "status", ";", "this", ".", "isdir", "=", "isdir", ";", "if", "(", "data", ".", "stats", ")", "{", "this", ".", "stats", "=", "{", "ctime", ":", "data", ".", "stats", ".", "ctime", ",", "mtime", ":", "data", ".", "stats", ".", "mtime", ",", "birthtime", ":", "data", ".", "stats", ".", "birthtime", ",", "size", ":", "data", ".", "stats", ".", "size", ",", "}", ";", "}", "}", "/** Return true if the object is new. */", "isNew", "(", ")", "{", "return", "Boolean", "(", "this", ".", "status", "&", "STATUS", ".", "WT_NEW", ")", ";", "}", "/** Return true if the object is modified. */", "isModified", "(", ")", "{", "return", "Boolean", "(", "this", ".", "status", "&", "STATUS", ".", "WT_MODIFIED", ")", ";", "}", "/** Return true if the object got deleted. */", "isDeleted", "(", ")", "{", "return", "Boolean", "(", "this", ".", "status", "&", "STATUS", ".", "WT_DELETED", ")", ";", "}", "/** Return true if the object is ignored by [[IgnoreManager]]. */", "isIgnored", "(", ")", "{", "return", "Boolean", "(", "this", ".", "status", "&", "STATUS", ".", "WT_IGNORED", ")", ";", "}", "/** Sets the internal status bits of the object. Normally used only inside [[Repository.getStatus]]. */", "setStatusBit", "(", "status", ")", "{", "this", ".", "status", "=", "status", ";", "}", "/** Return all status bits of the object. */", "statusBit", "(", ")", "{", "return", "this", ".", "status", ";", "}", "/** Return true if the object represents a directory. */", "isDirectory", "(", ")", "{", "return", "this", ".", "isdir", ";", "}", "/** Return true if the object represents a file. */", "isFile", "(", ")", "{", "return", "!", "this", ".", "isdir", ";", "}", "}", "export", "function", "getSnowFSRepo", "(", "dirpath", ")", "{", "const", "snowInit", "=", "join", "(", "dirpath", ",", "'.snow'", ")", ";", "return", "io", ".", "pathExists", "(", "snowInit", ")", ".", "then", "(", "(", "exists", ")", "=>", "{", "if", "(", "exists", ")", "{", "return", "dirpath", ";", "}", "if", "(", "dirname", "(", "dirpath", ")", "===", "dirpath", ")", "{", "throw", "new", "Error", "(", "'commondir not found'", ")", ";", "}", "return", "getSnowFSRepo", "(", "dirname", "(", "dirpath", ")", ")", ";", "}", ")", ";", "}", "param", "workdir", "returns", "export", "function", "getCommondir", "(", "workdir", ")", "{", "const", "commondir", "=", "join", "(", "workdir", ",", "'.snow'", ")", ";", "return", "io", ".", "stat", "(", "commondir", ")", ".", "then", "(", "(", "stat", ")", "=>", "{", "if", "(", "stat", ".", "isFile", "(", ")", ")", "{", "return", "fse", ".", "readFile", "(", "commondir", ")", ".", "then", "(", "(", "buf", ")", "=>", "buf", ".", "toString", "(", ")", ")", ";", "}", "return", "commondir", ";", "}", ")", ".", "catch", "(", "(", ")", "=>", "null", ")", ";", "}", "/**\n * Delete an item or move it to the trash/recycle-bin if the file has a shadow copy in the object database.\n */", "function", "deleteOrTrash", "(", "repo", ",", "absPath", ",", "alwaysDelete", ",", "putToTrash", ")", "{", "let", "isDirectory", ";", "return", "io", ".", "stat", "(", "absPath", ")", ".", "then", "(", "(", "stat", ")", "=>", "{", "isDirectory", "=", "stat", ".", "isDirectory", "(", ")", ";", "if", "(", "alwaysDelete", ")", "{", "if", "(", "isDirectory", ")", "{", "return", "io", ".", "rmdir", "(", "absPath", ")", ";", "}", "return", "fse", ".", "remove", "(", "absPath", ")", ";", "}", "let", "res", ";", "const", "calculateHash", "=", "[", "]", ";", "if", "(", "stat", ".", "isDirectory", "(", ")", ")", "{", "res", "=", "io", ".", "osWalk", "(", "absPath", ",", "io", ".", "OSWALK", ".", "FILES", ")", ".", "then", "(", "(", "items", ")", "=>", "{", "for", "(", "const", "item", "of", "items", ")", "{", "calculateHash", ".", "push", "(", "item", ".", "absPath", ")", ";", "}", "return", "Promise", ".", "resolve", "(", "calculateHash", ")", ";", "}", ")", ";", "}", "res", "=", "Promise", ".", "resolve", "(", "[", "absPath", "]", ")", ";", "return", "res", ".", "then", "(", "(", "calculateHashFrom", ")", "=>", "{", "return", "PromisePool", ".", "withConcurrency", "(", "8", ")", ".", "for", "(", "calculateHashFrom", ")", ".", "handleError", "(", "(", "error", ")", "=>", "{", "throw", "error", ";", "}", ")", ".", "process", "(", "(", "path", ")", "=>", "{", "return", "calculateFileHash", "(", "path", ")", ".", "then", "(", "(", "res", ")", "=>", "{", "return", "{", "absPath", ":", "path", ",", "filehash", ":", "res", ".", "filehash", "}", ";", "}", ")", ";", "}", ")", ";", "}", ")", ".", "then", "(", "(", "res", ")", "=>", "{", "const", "promises", "=", "[", "]", ";", "for", "(", "const", "r", "of", "res", ".", "results", ")", "{", "promises", ".", "push", "(", "repo", ".", "repoOdb", ".", "getObjectByHash", "(", "r", ".", "filehash", ",", "extname", "(", "r", ".", "absPath", ")", ")", ")", ";", "}", "return", "Promise", ".", "all", "(", "promises", ")", ";", "}", ")", ".", "then", "(", "(", "stats", ")", "=>", "{", "if", "(", "stats", ".", "includes", "(", "null", ")", ")", "{", "putToTrash", ".", "push", "(", "absPath", ")", ";", "return", "Promise", ".", "resolve", "(", ")", ";", "}", "if", "(", "isDirectory", ")", "{", "return", "io", ".", "rmdir", "(", "absPath", ")", ";", "}", "return", "fse", ".", "remove", "(", "absPath", ")", ";", "}", ")", ";", "}", ")", ";", "}", "/**\n * A class representing a `SnowFS` repository.\n */", "export", "class", "Repository", "{", "/** Object database of the repository */", "repoOdb", ":", "Odb", ";", "/** Repository log helper */", "repoLog", ":", "Log", ";", "/** Repository index of the repository */", "repoIndexes", ":", "Index", "[", "]", ";", "/** Options object, with which the repository got initialized */", "options", ":", "RepositoryInitOptions", ";", "/** HEAD reference to the currently checked out commit */", "readonly", "head", ":", "Reference", "=", "new", "Reference", "(", "REFERENCE_TYPE", ".", "BRANCH", ",", "'HEAD'", ",", "this", ",", "{", "hash", ":", "undefined", ",", "start", ":", "null", "}", ")", ";", "/** Array of all commits of the repository. The order is undefined. */", "commits", ":", "Commit", "[", "]", "=", "[", "]", ";", "/** Hash Map of all commits of the repository. The commit hash is the key, and the Commit object is the value. */", "commitMap", "=", "new", "Map", "<", "string", ",", "Commit", ">", "(", ")", ";", "/** Array of all references in the repository. The order is undefined.\n * The array does not contain the HEAD reference\n */", "references", ":", "Reference", "[", "]", "=", "[", "]", ";", "/** See [[Repository.workdir]] */", "repoWorkDir", ":", "string", ";", "/** See [[Repository.commondir]] */", "repoCommonDir", ":", "string", ";", "/**\n * Path to the repositories commondir, also known as the `.snow` directory.\n * The commondir might be located outside [[Repository.repoWorkDir]].\n */", "commondir", "(", ")", "{", "return", "this", ".", "repoCommonDir", ";", "}", "/**\n * Path to the repositories workdir.\n */", "workdir", "(", ")", "{", "return", "this", ".", "repoWorkDir", ";", "}", "param", "res", "returns", "modified", "<", "T", ">", "(", "res", "?", ")", "{", "const", "state", "=", "crypto", ".", "createHash", "(", "'sha256'", ")", ".", "update", "(", "process", ".", "hrtime", "(", ")", ".", "toString", "(", ")", ")", ".", "digest", "(", "'hex'", ")", ";", "return", "fse", ".", "writeFile", "(", "join", "(", "this", ".", "commondir", "(", ")", ",", "'state'", ")", ",", "state", ")", ".", "then", "(", "(", ")", "=>", "res", ")", ".", "catch", "(", "(", ")", "=>", "res", ")", ";", "}", "returns", "ensureMainIndex", "(", ")", "{", "let", "mainIndex", "=", "this", ".", "repoIndexes", ".", "find", "(", "(", "index", ")", "=>", "index", ".", "id", "===", "''", ")", ";", "if", "(", "!", "mainIndex", ")", "{", "mainIndex", "=", "new", "Index", "(", "this", ",", "this", ".", "repoOdb", ")", ";", "this", ".", "repoIndexes", ".", "push", "(", "mainIndex", ")", ";", "}", "return", "mainIndex", ";", "}", "returns", "createIndex", "(", ")", "{", "const", "indexId", "=", "crypto", ".", "createHash", "(", "'sha256'", ")", ".", "update", "(", "process", ".", "hrtime", "(", ")", ".", "toString", "(", ")", ")", ".", "digest", "(", "'hex'", ")", ".", "substring", "(", "0", ",", "6", ")", ";", "const", "index", "=", "new", "Index", "(", "this", ",", "this", ".", "repoOdb", ",", "indexId", ")", ";", "this", ".", "repoIndexes", ".", "push", "(", "index", ")", ";", "return", "index", ";", "}", "/**\n * Return the first index of the repository.\n */", "getFirstIndex", "(", ")", "{", "return", "this", ".", "repoIndexes", ".", "length", ">", "0", "?", "this", ".", "repoIndexes", "[", "0", "]", ":", "null", ";", "}", "/**\n * Return the index by id.\n */", "getIndex", "(", "id", ")", "{", "return", "this", ".", "repoIndexes", ".", "find", "(", "(", "index", ")", "=>", "index", ".", "id", "===", "id", ")", ";", "}", "param", "index", "removeIndex", "(", "index", ")", "{", "index", ".", "throwIfNotValid", "(", ")", ";", "const", "foundIndex", "=", "this", ".", "repoIndexes", ".", "findIndex", "(", "(", "i", ")", "=>", "i", ".", "id", "===", "index", ".", "id", ")", ";", "if", "(", "foundIndex", ">", "-", "1", ")", "{", "this", ".", "repoIndexes", ".", "splice", "(", "foundIndex", ",", "1", ")", ";", "}", "}", "/**\n * Return all indexes. No copied are returned\n */", "getIndexes", "(", ")", "{", "return", "this", ".", "repoIndexes", ";", "}", "/**\n * Return a clone instance of the HEAD ref.\n */", "getHead", "(", ")", "{", "return", "this", ".", "head", ".", "clone", "(", ")", ";", "}", "/**\n * Return the internal object database.\n */", "getOdb", "(", ")", "{", "return", "this", ".", "repoOdb", ";", "}", "/**\n * Return an array of all commit clones of the repository. The order is undefined.\n */", "getAllCommits", "(", "order", ")", "{", "const", "commits", "=", "this", ".", "commits", ".", "map", "(", "(", "c", ")", "=>", "c", ".", "clone", "(", ")", ")", ";", "switch", "(", "order", ")", "{", "case", "COMMIT_ORDER", ".", "OLDEST_FIRST", ":", "commits", ".", "sort", "(", "(", "a", ",", "b", ")", "=>", "{", "const", "aDate", "=", "a", ".", "date", ".", "getTime", "(", ")", ";", "const", "bDate", "=", "b", ".", "date", ".", "getTime", "(", ")", ";", "if", "(", "aDate", "<", "bDate", ")", "{", "return", "-", "1", ";", "}", "if", "(", "aDate", ">", "bDate", ")", "{", "return", "1", ";", "}", "return", "0", ";", "}", ")", ";", "break", ";", "case", "COMMIT_ORDER", ".", "NEWEST_FIRST", ":", "commits", ".", "sort", "(", "(", "a", ",", "b", ")", "=>", "{", "const", "aDate", "=", "a", ".", "date", ".", "getTime", "(", ")", ";", "const", "bDate", "=", "b", ".", "date", ".", "getTime", "(", ")", ";", "if", "(", "aDate", ">", "bDate", ")", "{", "return", "-", "1", ";", "}", "if", "(", "aDate", "<", "bDate", ")", "{", "return", "1", ";", "}", "return", "0", ";", "}", ")", ";", "break", ";", "case", "COMMIT_ORDER", ".", "UNDEFINED", ":", "default", ":", "break", ";", "}", "return", "commits", ";", "}", "/**\n * Find and return the commit object by a given reference name.\n * The reference names can be acquired by [[Repository.getAllReferences]].\n * `name` can also be `HEAD`.\n */", "findCommitByReferenceName", "(", "type", ",", "refName", ")", "{", "let", "ref", "=", "this", ".", "references", ".", "find", "(", "(", "r", ")", "=>", "r", ".", "getName", "(", ")", "===", "refName", "&&", "r", ".", "getType", "(", ")", "===", "type", ")", ";", "if", "(", "!", "ref", ")", "{", "ref", "=", "(", "refName", "===", "'HEAD'", ")", "?", "this", ".", "head", ":", "null", ";", "}", "if", "(", "!", "ref", ")", "{", "return", "null", ";", "}", "return", "this", ".", "commitMap", ".", "get", "(", "ref", ".", "hash", ".", "toString", "(", ")", ")", ";", "}", "/**\n * Find and return the commit object by a given reference.\n * The references can be acquired by [[Repository.getAllReferences]].\n */", "findCommitByReference", "(", "ref", ")", "{", "return", "this", ".", "commitMap", ".", "get", "(", "ref", ".", "hash", ".", "toString", "(", ")", ")", ";", "}", "/**\n * Find and return the reference by a given name.\n * The reference names can be acquired by [[Repository.getAllReferences]].\n */", "findReferenceByName", "(", "type", ",", "refName", ")", "{", "const", "ref", "=", "this", ".", "references", ".", "find", "(", "(", "r", ")", "=>", "r", ".", "getName", "(", ")", "===", "refName", "&&", "r", ".", "getType", "(", ")", "===", "type", ")", ";", "return", "ref", "?.", "clone", "(", ")", ";", "}", "/**\n * Walk the commits back in the history by it's parents. Useful to acquire\n * all commits only related to the current branch.\n */", "walkCommit", "(", "commit", ",", "cb", ")", "{", "if", "(", "!", "commit", ")", "{", "throw", "new", "Error", "(", "'commit must be set'", ")", ";", "}", "while", "(", "commit", ".", "parent", ")", "{", "for", "(", "const", "parentHash", "of", "commit", ".", "parent", ")", "{", "this", ".", "walkCommit", "(", "this", ".", "commitMap", ".", "get", "(", "parentHash", ".", "toString", "(", ")", ")", ",", "cb", ")", ";", "}", "}", "}", "/**\n * Returns all references of the repository. The HEAD reference is not part\n * returned array and must be acquired seperately by [[Repository.getHead]].\n */", "getAllReferences", "(", ")", "{", "return", "Object", ".", "assign", "(", "[", "]", ",", "this", ".", "references", ")", ";", "}", "/**\n * Returns all reference names of the repository. The HEAD reference name is not part\n * returned array and must be acquired seperately by [[Repository.getHead]].\n */", "getAllReferenceNames", "(", ")", "{", "return", "this", ".", "references", ".", "map", "(", "(", "ref", ")", "=>", "ref", ".", "getName", "(", ")", ")", ";", "}", "/**\n * Return the commit the HEAD reference is pointing to.\n */", "getCommitByHead", "(", ")", "{", "return", "this", ".", "commitMap", ".", "get", "(", "this", ".", "head", ".", "hash", ".", "toString", "(", ")", ")", ";", "}", "param", "hash", "throws", "returns", "findCommitByHash", "(", "hash", ")", "{", "let", "commit", "=", "null", ";", "const", "hashSplit", "=", "hash", ".", "split", "(", "'~'", ")", ";", "if", "(", "hashSplit", ".", "length", ">", "1", ")", "{", "for", "(", "const", "idx", "of", "hash", ".", "split", "(", "'~'", ")", ")", "{", "if", "(", "idx", "===", "'HEAD'", ")", "{", "commit", "=", "this", ".", "commitMap", ".", "get", "(", "this", ".", "getHead", "(", ")", ".", "hash", ")", ";", "}", "else", "if", "(", "this", ".", "references", ".", "map", "(", "(", "r", ")", "=>", "r", ".", "getName", "(", ")", ")", ".", "includes", "(", "idx", ")", ")", "{", "const", "ref", "=", "this", ".", "references", ".", "find", "(", "(", "r", ")", "=>", "r", ".", "getName", "(", ")", "===", "idx", ")", ";", "commit", "=", "this", ".", "commitMap", ".", "get", "(", "ref", ".", "target", "(", ")", ")", ";", "}", "else", "if", "(", "commit", ")", "{", "const", "iteration", "=", "parseInt", "(", "idx", ",", "10", ")", ";", "if", "(", "Number", ".", "isNaN", "(", "iteration", ")", ")", "{", "throw", "Error", "(", "`invalid commit-hash '${", "hash", "}'`", ")", ";", "}", "for", "(", "let", "i", "=", "0", ";", "i", "<", "iteration", ";", "++", "i", ")", "{", "if", "(", "!", "commit", ".", "parent", "||", "commit", ".", "parent", ".", "length", "===", "0", ")", "{", "throw", "new", "Error", "(", "`commit hash '${", "hash", "}' out of history`", ")", ";", "}", "commit", "=", "this", ".", "commitMap", ".", "get", "(", "commit", ".", "parent", "[", "0", "]", ")", ";", "if", "(", "!", "commit", ")", "{", "throw", "new", "Error", "(", "`could not find commit with hash '${", "hash", "}'`", ")", ";", "}", "}", "}", "}", "}", "else", "{", "commit", "=", "this", ".", "commitMap", ".", "get", "(", "hash", ")", ";", "}", "return", "(", "commit", "===", "undefined", ")", "?", "null", ":", "commit", ";", "}", "/**\n * Return all references, which point to a given commit hash. The HEAD reference\n * is not part of the returned array and must be acquired seperately by [[Repository.getHead]].\n */", "filterReferenceByHash", "(", "hash", ")", "{", "return", "this", ".", "references", ".", "filter", "(", "(", "ref", ")", "=>", "ref", ".", "hash", "===", "hash", ")", ";", "}", "filterReferencesByHead", "(", ")", "{", "return", "this", ".", "references", ".", "filter", "(", "(", "ref", ")", "=>", "this", ".", "head", ".", "hash", "===", "ref", ".", "hash", ")", ";", "}", "/**\n * Deletes the passed reference. If the passed Reference is the HEAD reference, it is ignored.\n */", "deleteReference", "(", "type", ",", "branchName", ")", "{", "if", "(", "this", ".", "getHead", "(", ")", ".", "getName", "(", ")", "===", "branchName", ")", "{", "throw", "new", "Error", "(", "`Cannot delete branch '${", "branchName", "}' checked out at '${", "this", ".", "workdir", "(", ")", "}'`", ")", ";", "}", "let", "ref", "=", "null", ";", "const", "index", "=", "this", ".", "references", ".", "findIndex", "(", "(", "r", ")", "=>", "r", ".", "getName", "(", ")", "===", "branchName", "&&", "r", ".", "getType", "(", ")", "===", "type", ")", ";", "if", "(", "index", ">", "-", "1", ")", "{", "ref", "=", "this", ".", "references", "[", "index", "]", ";", "this", ".", "references", ".", "splice", "(", "index", ",", "1", ")", ";", "}", "return", "this", ".", "repoOdb", ".", "deleteReference", "(", "ref", ")", ".", "then", "(", "(", ")", "=>", "(", "ref", "?", "ref", ".", "target", "(", ")", ":", "null", ")", ")", ".", "catch", "(", "(", ")", "=>", "(", "ref", "?", "ref", ".", "target", "(", ")", ":", "null", ")", ")", ";", "}", "/**\n * Stores the HEAD reference to disk, inside the commondir.\n */", "writeHeadRefToDisk", "(", ")", "{", "return", "this", ".", "repoOdb", ".", "writeHeadReference", "(", "this", ".", "head", ")", ";", "}", "param", "name", "param", "startPoint", "createNewReference", "(", "type", ",", "name", ",", "startPoint", ",", "userData", "?", ")", "{", "const", "existingRef", "=", "this", ".", "references", ".", "find", "(", "(", "ref", ")", "=>", "ref", ".", "getName", "(", ")", "===", "name", ")", ";", "if", "(", "existingRef", ")", "{", "if", "(", "type", "===", "REFERENCE_TYPE", ".", "BRANCH", ")", "{", "throw", "new", "Error", "(", "`A branch named '${", "name", "}' already exists.`", ")", ";", "}", "else", "{", "throw", "new", "Error", "(", "`A reference named '${", "name", "}' already exists.`", ")", ";", "}", "}", "startPoint", "=", "startPoint", "??", "this", ".", "getHead", "(", ")", ".", "hash", ";", "if", "(", "!", "this", ".", "commitMap", ".", "has", "(", "startPoint", ")", ")", "{", "throw", "new", "Error", "(", "`Not a valid start point: '${", "startPoint", "}'`", ")", ";", "}", "const", "newRef", "=", "new", "Reference", "(", "type", ",", "name", ",", "this", ",", "{", "hash", ":", "startPoint", ",", "start", ":", "startPoint", ",", "userData", "}", ")", ";", "this", ".", "references", ".", "push", "(", "newRef", ")", ";", "return", "this", ".", "repoOdb", ".", "writeReference", "(", "newRef", ")", ".", "then", "(", "(", ")", "=>", "this", ".", "repoLog", ".", "writeLog", "(", "`reference: creating ${", "name", "} at ${", "startPoint", "}`", ")", ")", ".", "then", "(", "(", ")", "=>", "newRef", ")", ";", "}", "param", "name", "setHead", "(", "name", ")", "{", "if", "(", "!", "this", ".", "references", ".", "find", "(", "(", "v", ")", "=>", "v", ".", "getName", "(", ")", "===", "name", ")", ")", "{", "throw", "new", "Error", "(", "`unknown reference name ${", "name", "}`", ")", ";", "}", "this", ".", "head", ".", "setName", "(", "name", ")", ";", "}", "param", "hash", "setHeadDetached", "(", "hash", ")", "{", "if", "(", "!", "this", ".", "commitMap", ".", "get", "(", "hash", ")", ")", "{", "throw", "new", "Error", "(", "'unknown commit hash'", ")", ";", "}", "this", ".", "head", ".", "hash", "=", "hash", ";", "this", ".", "head", ".", "setName", "(", "'HEAD'", ")", ";", "}", "param", "target", "param", "reset", "checkout", "(", "target", ",", "reset", ")", "{", "let", "targetRef", "=", "null", ";", "let", "targetCommit", "=", "null", ";", "if", "(", "typeof", "target", "===", "'string'", ")", "{", "const", "ref", "=", "this", ".", "findReferenceByName", "(", "REFERENCE_TYPE", ".", "BRANCH", ",", "target", ")", ";", "if", "(", "ref", ")", "{", "targetRef", "=", "ref", ";", "targetCommit", "=", "this", ".", "findCommitByHash", "(", "ref", ".", "target", "(", ")", ")", ";", "}", "else", "{", "const", "refs", "=", "this", ".", "filterReferenceByHash", "(", "target", ")", ";", "if", "(", "refs", ".", "length", "===", "0", ")", "{", "targetCommit", "=", "this", ".", "findCommitByHash", "(", "target", ")", ";", "}", "else", "if", "(", "refs", ".", "length", ">", "1", ")", "{", "throw", "new", "Error", "(", "`more than one ref found for ${", "target", "}`", ")", ";", "}", "else", "{", "targetRef", "=", "refs", "[", "0", "]", ";", "targetCommit", "=", "this", ".", "findCommitByHash", "(", "refs", "[", "0", "]", ".", "target", "(", ")", ")", ";", "}", "}", "}", "else", "if", "(", "target", "instanceof", "Reference", ")", "{", "targetRef", "=", "target", ";", "targetCommit", "=", "this", ".", "findCommitByHash", "(", "target", ".", "hash", ")", ";", "}", "else", "if", "(", "target", "instanceof", "Commit", ")", "{", "const", "refs", "=", "this", ".", "filterReferenceByHash", "(", "target", ".", "hash", ")", ";", "if", "(", "refs", ".", "length", "===", "1", ")", "{", "targetRef", "=", "refs", "[", "0", "]", ";", "}", "targetCommit", "=", "target", ";", "}", "if", "(", "!", "targetCommit", ")", "{", "throw", "new", "Error", "(", "'unknown target version'", ")", ";", "}", "let", "detectionMode", "=", "DETECTIONMODE", ".", "DEFAULT", ";", "if", "(", "reset", "&", "RESET", ".", "DETECTIONMODE_ONLY_SIZE_AND_MKTIME", ")", "{", "detectionMode", "=", "DETECTIONMODE", ".", "ONLY_SIZE_AND_MKTIME", ";", "}", "else", "if", "(", "reset", "&", "RESET", ".", "DETECTIONMODE_SIZE_AND_HASH_FOR_ALL_FILES", ")", "{", "detectionMode", "=", "DETECTIONMODE", ".", "SIZE_AND_HASH_FOR_ALL_FILES", ";", "}", "else", "if", "(", "reset", "&", "RESET", ".", "DETECTIONMODE_SIZE_AND_HASH_FOR_SMALL_FILES", ")", "{", "detectionMode", "=", "DETECTIONMODE", ".", "SIZE_AND_HASH_FOR_SMALL_FILES", ";", "}", "const", "oldFilesMap", "=", "targetCommit", ".", "root", ".", "getAllTreeFiles", "(", "{", "entireHierarchy", ":", "true", ",", "includeDirs", ":", "true", "}", ")", ";", "let", "statuses", "=", "[", "]", ";", "const", "deleteDirCandidates", "=", "new", "Map", "<", "string", ",", "StatusEntry", ">", "(", ")", ";", "const", "deleteRevokeDirs", "=", "new", "Set", "<", "string", ">", "(", ")", ";", "type", "IoTask", "=", "(", ")", "=>", "Promise", "<", "unknown", ">", ";", "const", "tasks", "=", "[", "]", ";", "const", "performAccessCheck", "=", "[", "]", ";", "const", "putToTrash", "=", "[", "]", ";", "const", "oldHeadHash", "=", "this", ".", "head", ".", "hash", ";", "const", "commitChange", "=", "targetCommit", ".", "hash", "!==", "this", ".", "head", ".", "hash", ";", "const", "alwaysDelete", "=", "commitChange", "||", "!", "(", "reset", "&", "RESET", ".", "MOVE_FILES_TO_TRASH_IF_NEEDED", ")", ";", "const", "ioContext", "=", "new", "IoContext", "(", ")", ";", "return", "ioContext", ".", "init", "(", ")", ".", "then", "(", "(", ")", "=>", "this", ".", "getStatus", "(", "FILTER", ".", "INCLUDE_UNTRACKED", "|", "FILTER", ".", "INCLUDE_MODIFIED", "|", "FILTER", ".", "INCLUDE_DELETED", "|", "FILTER", ".", "INCLUDE_DIRECTORIES", "|", "FILTER", ".", "INCLUDE_IGNORED", "|", "FILTER", ".", "SORT_CASE_SENSITIVELY", ",", "targetCommit", ")", ")", ".", "then", "(", "(", "statusResult", ")", "=>", "{", "if", "(", "!", "this", ".", "head", ".", "hash", ")", "{", "return", "[", "]", "as", "any", ";", "}", "statuses", "=", "statusResult", ";", "statuses", ".", "forEach", "(", "(", "status", ")", "=>", "{", "if", "(", "reset", "&", "RESET", ".", "RESTORE_DELETED_ITEMS", "&&", "status", ".", "isDeleted", "(", ")", ")", "{", "const", "dst", "=", "join", "(", "this", ".", "repoWorkDir", ",", "status", ".", "path", ")", ";", "if", "(", "status", ".", "isFile", "(", ")", ")", "{", "const", "tfile", "=", "oldFilesMap", ".", "get", "(", "status", ".", "path", ")", ";", "if", "(", "tfile", ")", "{", "tasks", ".", "push", "(", "(", ")", "=>", "this", ".", "repoOdb", ".", "readObject", "(", "<", "TreeFile", ">", "tfile", ",", "dst", ",", "ioContext", ")", ")", ";", "}", "else", "{", "throw", "new", "Error", "(", "\"item was detected as deleted but couldn't be found in reference commit\"", ")", ";", "}", "let", "parent", "=", "status", ".", "path", ";", "while", "(", "parent", ".", "length", ">", "0", ")", "{", "if", "(", "deleteRevokeDirs", ".", "has", "(", "parent", ")", ")", "{", "break", ";", "}", "else", "{", "deleteRevokeDirs", ".", "add", "(", "parent", ")", ";", "}", "parent", "=", "dirname", "(", "parent", ")", ";", "}", "}", "else", "{", "tasks", ".", "push", "(", "(", ")", "=>", "io", ".", "ensureDir", "(", "dst", ")", ")", ";", "}", "}", "else", "if", "(", "reset", "&", "RESET", ".", "DELETE_NEW_ITEMS", "&&", "status", ".", "isNew", "(", ")", ")", "{", "deleteDirCandidates", ".", "set", "(", "status", ".", "path", ",", "status", ")", ";", "}", "else", "if", "(", "reset", "&", "RESET", ".", "RESTORE_MODIFIED_ITEMS", "&&", "status", ".", "isModified", "(", ")", ")", "{", "const", "tfile", "=", "oldFilesMap", ".", "get", "(", "status", ".", "path", ")", ";", "if", "(", "tfile", ")", "{", "if", "(", "tfile", "instanceof", "TreeFile", ")", "{", "performAccessCheck", ".", "push", "(", "tfile", ".", "path", ")", ";", "const", "dst", "=", "join", "(", "this", ".", "repoWorkDir", ",", "tfile", ".", "path", ")", ";", "const", "putToTrashImmediately", "=", "[", "]", ";", "tasks", ".", "push", "(", "(", ")", "=>", "deleteOrTrash", "(", "this", ",", "dst", ",", "alwaysDelete", ",", "putToTrashImmediately", ")", ".", "then", "(", "(", ")", "=>", "{", "if", "(", "putToTrashImmediately", ".", "length", ">", "0", ")", "{", "return", "IoContext", ".", "putToTrash", "(", "putToTrashImmediately", ")", ";", "}", "}", ")", ".", "then", "(", "(", ")", "=>", "{", "return", "this", ".", "repoOdb", ".", "readObject", "(", "tfile", ",", "dst", ",", "ioContext", ")", ";", "}", ")", ")", ";", "}", "}", "else", "{", "throw", "new", "Error", "(", "`File '${", "tfile", ".", "path", "}' not found during last-modified-check`", ")", ";", "}", "}", "else", "if", "(", "status", ".", "isIgnored", "(", ")", ")", "{", "let", "parent", "=", "dirname", "(", "status", ".", "path", ")", ";", "while", "(", "parent", ".", "length", ">", "0", ")", "{", "if", "(", "deleteRevokeDirs", ".", "has", "(", "parent", ")", ")", "{", "break", ";", "}", "else", "{", "deleteRevokeDirs", ".", "add", "(", "parent", ")", ";", "}", "parent", "=", "dirname", "(", "parent", ")", ";", "}", "}", "}", ")", ";", "deleteDirCandidates", ".", "forEach", "(", "(", "candidate", ",", "relPath", ")", "=>", "{", "if", "(", "candidate", ".", "isDirectory", "(", ")", ")", "{", "if", "(", "!", "deleteRevokeDirs", ".", "has", "(", "relPath", ")", ")", "{", "deleteDirCandidates", ".", "forEach", "(", "(", "_c", ",", "relPath2", ")", "=>", "{", "if", "(", "relPath2", ".", "startsWith", "(", "`${", "relPath", "}/`", ")", ")", "{", "deleteDirCandidates", ".", "delete", "(", "relPath2", ")", ";", "}", "}", ")", ";", "tasks", ".", "push", "(", "(", ")", "=>", "deleteOrTrash", "(", "this", ",", "join", "(", "this", ".", "workdir", "(", ")", ",", "candidate", ".", "path", ")", ",", "alwaysDelete", ",", "putToTrash", ")", ")", ";", "}", "}", "else", "{", "performAccessCheck", ".", "push", "(", "candidate", ".", "path", ")", ";", "tasks", ".", "push", "(", "(", ")", "=>", "deleteOrTrash", "(", "this", ",", "join", "(", "this", ".", "workdir", "(", ")", ",", "candidate", ".", "path", ")", ",", "alwaysDelete", ",", "putToTrash", ")", ")", ";", "}", "}", ")", ";", "return", "ioContext", ".", "performFileAccessCheck", "(", "this", ".", "workdir", "(", ")", ",", "performAccessCheck", ",", "TEST_IF", ".", "FILE_CAN_BE_WRITTEN_TO", ")", ";", "}", ")", ".", "then", "(", "(", ")", "=>", "{", "this", ".", "head", ".", "hash", "=", "targetCommit", ".", "hash", ";", "if", "(", "!", "targetRef", "||", "reset", "&", "RESET", ".", "DETACH", ")", "{", "this", ".", "head", ".", "setName", "(", "'HEAD'", ")", ";", "}", "else", "{", "this", ".", "head", ".", "setName", "(", "targetRef", ".", "getName", "(", ")", ")", ";", "}", "return", "this", ".", "writeHeadRefToDisk", "(", ")", ";", "}", ")", ".", "then", "(", "(", ")", "=>", "{", "return", "PromisePool", ".", "withConcurrency", "(", "32", ")", ".", "for", "(", "tasks", ")", ".", "handleError", "(", "(", "error", ")", "=>", "{", "throw", "error", ";", "}", ")", ".", "process", "(", "(", "task", ")", "=>", "task", "(", ")", ")", ";", "}", ")", ".", "then", "(", "(", ")", "=>", "{", "if", "(", "putToTrash", ".", "length", ">", "0", ")", "{", "return", "IoContext", ".", "putToTrash", "(", "putToTrash", ")", ";", "}", "}", ")", ".", "then", "(", "(", ")", "=>", "{", "let", "moveTo", "=", "''", ";", "if", "(", "target", "instanceof", "Reference", ")", "{", "moveTo", "=", "target", ".", "getName", "(", ")", ";", "}", "else", "if", "(", "target", "instanceof", "Commit", ")", "{", "moveTo", "=", "target", ".", "hash", ";", "}", "else", "{", "moveTo", "=", "target", ";", "}", "return", "this", ".", "repoLog", ".", "writeLog", "(", "`checkout: move from '${", "oldHeadHash", "}' to ${", "targetCommit", ".", "hash", "} with ${", "reset", "}`", ")", ";", "}", ")", ";", "}", "param", "filter", "getStatus", "(", "filter", "?", ",", "commit", "?", ")", "{", "const", "statusResult", "=", "new", "Map", "<", "string", ",", "StatusEntry", ">", "(", ")", ";", "const", "currentDirs", "=", "new", "Map", "<", "string", ",", "StatusEntry", ">", "(", ")", ";", "const", "ignore", "=", "new", "IgnoreManager", "(", ")", ";", "let", "detectionMode", "=", "DETECTIONMODE", ".", "DEFAULT", ";", "if", "(", "filter", "&", "FILTER", ".", "DETECTIONMODE_ONLY_SIZE_AND_MKTIME", ")", "{", "detectionMode", "=", "DETECTIONMODE", ".", "ONLY_SIZE_AND_MKTIME", ";", "}", "else", "if", "(", "filter", "&", "FILTER", ".", "DETECTIONMODE_SIZE_AND_HASH_FOR_ALL_FILES", ")", "{", "detectionMode", "=", "DETECTIONMODE", ".", "SIZE_AND_HASH_FOR_ALL_FILES", ";", "}", "else", "if", "(", "filter", "&", "FILTER", ".", "DETECTIONMODE_SIZE_AND_HASH_FOR_SMALL_FILES", ")", "{", "detectionMode", "=", "DETECTIONMODE", ".", "SIZE_AND_HASH_FOR_SMALL_FILES", ";", "}", "function", "markParentsAsModified", "(", "itemPath", ")", "{", "const", "parents", "=", "[", "]", ";", "dirname", "(", "itemPath", ")", ".", "split", "(", "'/'", ")", ".", "reduce", "(", "(", "a", ",", "b", ")", "=>", "{", "const", "constructedPath", "=", "a", "?", "`${", "a", "}/${", "b", "}`", ":", "b", ";", "parents", ".", "push", "(", "constructedPath", ")", ";", "return", "constructedPath", ";", "}", ",", "null", ")", ";", "for", "(", "const", "parent", "of", "parents", ")", "{", "const", "dirItem", "=", "currentDirs", ".", "get", "(", "parent", ")", ";", "dirItem", "?.", "setStatusBit", "(", "STATUS", ".", "WT_MODIFIED", ")", ";", "}", "}", "const", "snowtrackIgnoreDefault", "=", "join", "(", "this", ".", "repoWorkDir", ",", "'.snowignore'", ")", ";", "return", "io", ".", "pathExists", "(", "snowtrackIgnoreDefault", ")", ".", "then", "(", "(", "exists", ")", "=>", "{", "if", "(", "exists", ")", "{", "return", "ignore", ".", "loadFile", "(", "snowtrackIgnoreDefault", ")", ";", "}", "}", ")", ".", "then", "(", "(", ")", "=>", "{", "let", "walk", "=", "OSWALK", ".", "FILES", ";", "walk", "|=", "filter", "&", "FILTER", ".", "INCLUDE_DIRECTORIES", "?", "OSWALK", ".", "DIRS", ":", "0", ";", "return", "osWalk", "(", "this", ".", "repoWorkDir", ",", "walk", ")", ";", "}", ")", ".", "then", "(", "(", "currentItemsInProj", ")", "=>", "{", "const", "targetCommit", "=", "commit", "??", "this", ".", "getCommitByHead", "(", ")", ";", "const", "promises", "=", "[", "]", ";", "if", "(", "!", "this", ".", "head", ".", "hash", "||", "!", "targetCommit", ")", "{", "return", "[", "]", "as", "any", ";", "}", "const", "oldItemsMap", "=", "targetCommit", ".", "root", ".", "getAllTreeFiles", "(", "{", "entireHierarchy", ":", "true", ",", "includeDirs", ":", "true", "}", ")", ";", "const", "curItemsMap", "=", "new", "Map", "(", "currentItemsInProj", ".", "map", "(", "(", "x", ")", "=>", "[", "x", ".", "relPath", ",", "x", "]", ")", ")", ";", "const", "oldItems", "=", "Array", ".", "from", "(", "oldItemsMap", ".", "values", "(", ")", ")", ";", "if", "(", "filter", "&", "FILTER", ".", "INCLUDE_IGNORED", ")", "{", "const", "areIgnored", "=", "ignore", ".", "ignoredList", "(", "currentItemsInProj", ".", "map", "(", "(", "item", ")", "=>", "item", ".", "relPath", ")", ")", ";", "const", "ignored", "=", "currentItemsInProj", ".", "filter", "(", "(", "item", ")", "=>", "areIgnored", ".", "has", "(", "item", ".", "relPath", ")", ")", ";", "for", "(", "const", "entry", "of", "ignored", ")", "{", "if", "(", "!", "entry", ".", "stats", ".", "isDirectory", "(", ")", "||", "filter", "&", "FILTER", ".", "INCLUDE_DIRECTORIES", ")", "{", "statusResult", ".", "set", "(", "entry", ".", "relPath", ",", "new", "StatusEntry", "(", "{", "path", ":", "entry", ".", "relPath", ",", "status", ":", "STATUS", ".", "WT_IGNORED", ",", "stats", ":", "entry", ".", "stats", ",", "}", ",", "entry", ".", "stats", ".", "isDirectory", "(", ")", ")", ")", ";", "}", "}", "}", "if", "(", "filter", "&", "FILTER", ".", "INCLUDE_DIRECTORIES", ")", "{", "const", "itemsStep1", "=", "currentItemsInProj", ".", "filter", "(", "(", "item", ")", "=>", "item", ".", "stats", ".", "isDirectory", "(", ")", "&&", "!", "statusResult", ".", "has", "(", "item", ".", "relPath", ")", ")", ";", "const", "areIgnored", "=", "ignore", ".", "ignoredList", "(", "itemsStep1", ".", "map", "(", "(", "item", ")", "=>", "item", ".", "relPath", ")", ")", ";", "const", "itemsStep2", "=", "itemsStep1", ".", "filter", "(", "(", "item", ")", "=>", "!", "areIgnored", ".", "has", "(", "item", ".", "relPath", ")", ")", ";", "for", "(", "const", "item", "of", "itemsStep2", ")", "{", "const", "dir", "=", "new", "StatusEntry", "(", "{", "path", ":", "item", ".", "relPath", ",", "status", ":", "0", ",", "stats", ":", "item", ".", "stats", ",", "}", ",", "true", ")", ";", "statusResult", ".", "set", "(", "item", ".", "relPath", ",", "dir", ")", ";", "currentDirs", ".", "set", "(", "item", ".", "relPath", ",", "dir", ")", ";", "}", "}", "if", "(", "filter", "&", "FILTER", ".", "INCLUDE_UNTRACKED", ")", "{", "const", "itemsStep1", "=", "currentItemsInProj", ".", "filter", "(", "(", "item", ")", "=>", "!", "oldItemsMap", ".", "has", "(", "item", ".", "relPath", ")", ")", ";", "const", "areIgnored", "=", "ignore", ".", "ignoredList", "(", "itemsStep1", ".", "map", "(", "(", "item", ")", "=>", "item", ".", "relPath", ")", ")", ";", "const", "itemsStep2", "=", "itemsStep1", ".", "filter", "(", "(", "item", ")", "=>", "!", "areIgnored", ".", "has", "(", "item", ".", "relPath", ")", ")", ";", "for", "(", "const", "entry", "of", "itemsStep2", ")", "{", "if", "(", "!", "entry", ".", "stats", ".", "isDirectory", "(", ")", "||", "(", "filter", "&", "FILTER", ".", "INCLUDE_DIRECTORIES", "&&", "!", "entry", ".", "isempty", ")", ")", "{", "statusResult", ".", "set", "(", "entry", ".", "relPath", ",", "new", "StatusEntry", "(", "{", "path", ":", "entry", ".", "relPath", ",", "status", ":", "STATUS", ".", "WT_NEW", ",", "stats", ":", "entry", ".", "stats", ",", "}", ",", "entry", ".", "stats", ".", "isDirectory", "(", ")", ")", ")", ";", "markParentsAsModified", "(", "entry", ".", "relPath", ")", ";", "}", "}", "}", "if", "(", "filter", "&", "FILTER", ".", "INCLUDE_DELETED", ")", "{", "const", "itemsStep1", "=", "oldItems", ".", "filter", "(", "(", "item", ")", "=>", "!", "curItemsMap", ".", "has", "(", "item", ".", "path", ")", ")", ";", "const", "areIgnored", "=", "ignore", ".", "ignoredList", "(", "itemsStep1", ".", "map", "(", "(", "item", ")", "=>", "item", ".", "path", ")", ")", ";", "const", "itemsStep2", "=", "itemsStep1", ".", "filter", "(", "(", "item", ")", "=>", "!", "areIgnored", ".", "has", "(", "item", ".", "path", ")", ")", ";", "for", "(", "const", "entry", "of", "itemsStep2", ")", "{", "if", "(", "!", "entry", ".", "isDirectory", "(", ")", "||", "filter", "&", "FILTER", ".", "INCLUDE_DIRECTORIES", ")", "{", "statusResult", ".", "set", "(", "entry", ".", "path", ",", "new", "StatusEntry", "(", "{", "path", ":", "entry", ".", "path", ",", "status", ":", "STATUS", ".", "WT_DELETED", ",", "stats", ":", "null", "}", ",", "entry", ".", "isDirectory", "(", ")", ")", ")", ";", "markParentsAsModified", "(", "entry", ".", "path", ")", ";", "}", "}", "}", "if", "(", "filter", "&", "FILTER", ".", "INCLUDE_MODIFIED", ")", "{", "const", "itemsStep1", "=", "oldItems", ".", "filter", "(", "(", "item", ")", "=>", "curItemsMap", ".", "has", "(", "item", ".", "path", ")", ")", ";", "const", "areIgnored", "=", "ignore", ".", "ignoredList", "(", "itemsStep1", ".", "map", "(", "(", "item", ")", "=>", "item", ".", "path", ")", ")", ";", "const", "itemsStep2", "=", "itemsStep1", ".", "filter", "(", "(", "item", ")", "=>", "!", "areIgnored", ".", "has", "(", "item", ".", "path", ")", ")", ";", "for", "(", "const", "existingItem", "of", "itemsStep2", ")", "{", "if", "(", "existingItem", "instanceof", "TreeFile", ")", "{", "promises", ".", "push", "(", "existingItem", ".", "isFileModified", "(", "this", ",", "detectionMode", ")", ")", ";", "}", "}", "}", "return", "Promise", ".", "all", "(", "promises", ")", ";", "}", ")", ".", "then", "(", "(", "existingItems", ")", "=>", "{", "for", "(", "const", "existingItem", "of", "existingItems", ")", "{", "if", "(", "existingItem", ".", "modified", ")", "{", "statusResult", ".", "set", "(", "existingItem", ".", "file", ".", "path", ",", "new", "StatusEntry", "(", "{", "path", ":", "existingItem", ".", "file", ".", "path", ",", "status", ":", "STATUS", ".", "WT_MODIFIED", ",", "stats", ":", "existingItem", ".", "newStats", ",", "}", ",", "false", ")", ")", ";", "markParentsAsModified", "(", "existingItem", ".", "file", ".", "path", ")", ";", "}", "else", "if", "(", "filter", "&", "FILTER", ".", "INCLUDE_UNMODIFIED", ")", "{", "statusResult", ".", "set", "(", "existingItem", ".", "file", ".", "path", ",", "new", "StatusEntry", "(", "{", "path", ":", "existingItem", ".", "file", ".", "path", ",", "status", ":", "STATUS", ".", "UNMODIFIED", ",", "stats", ":", "existingItem", ".", "newStats", ",", "}", ",", "false", ")", ")", ";", "}", "}", "const", "result", "=", "Array", ".", "from", "(", "statusResult", ".", "values", "(", ")", ")", ";", "if", "(", "filter", "&", "FILTER", ".", "SORT_CASE_INSENSITIVELY", ")", "{", "result", ".", "sort", "(", "(", "a", ",", "b", ")", "=>", "{", "if", "(", "a", ".", "isDirectory", "(", ")", "!==", "b", ".", "isDirectory", "(", ")", ")", "{", "return", "a", ".", "isDirectory", "(", ")", "?", "-", "1", ":", "1", ";", "}", "return", "a", ".", "path", ".", "toLocaleLowerCase", "(", ")", ".", "localeCompare", "(", "b", ".", "path", ".", "toLocaleLowerCase", "(", ")", ")", ";", "}", ")", ";", "}", "else", "if", "(", "filter", "&", "FILTER", ".", "SORT_CASE_SENSITIVELY", ")", "{", "result", ".", "sort", "(", "(", "a", ",", "b", ")", "=>", "{", "if", "(", "a", ".", "isDirectory", "(", ")", "!==", "b", ".", "isDirectory", "(", ")", ")", "{", "return", "a", ".", "isDirectory", "(", ")", "?", "-", "1", ":", "1", ";", "}", "return", "a", ".", "path", ".", "localeCompare", "(", "b", ".", "path", ")", ";", "}", ")", ";", "}", "return", "result", ";", "}", ")", ";", "}", "param", "index", "param", "message", "param", "userData", "returns", "async", "createCommit", "(", "index", ",", "message", ",", "opts", "?", ",", "tags", "?", ",", "userData", "?", ")", "{", "let", "tree", "=", "null", ";", "let", "commit", "=", "null", ";", "if", "(", "opts", "?.", "allowEmpty", ")", "{", "if", "(", "!", "index", ")", "{", "index", "=", "new", "Index", "(", "this", ",", "this", ".", "repoOdb", ")", ";", "await", "index", ".", "writeFiles", "(", ")", ";", "}", "}", "else", "if", "(", "index", ".", "addRelPaths", ".", "size", "===", "0", "&&", "index", ".", "deleteRelPaths", ".", "size", "===", "0", ")", "{", "throw", "new", "Error", "(", "'nothing to commit (create/copy files and use \"snow add\" to track)'", ")", ";", "}", "let", "promise", "=", "Promise", ".", "resolve", "(", "TreeDir", ".", "createRootTree", "(", ")", ")", ";", "if", "(", "this", ".", "head", "?.", "hash", ")", "{", "promise", "=", "constructTree", "(", "this", ".", "repoWorkDir", ")", ".", "then", "(", "(", "workdirTree", ")", "=>", "{", "const", "headCommit", "=", "this", ".", "getCommitByHead", "(", ")", ";", "const", "added", "=", "new", "Set", "<", "string", ">", "(", ")", ";", "for", "(", "const", "relPath", "of", "Array", ".", "from", "(", "index", ".", "addRelPaths", ".", "keys", "(", ")", ")", ")", "{", "if", "(", "!", "index", ".", "processedAdded", ".", "has", "(", "relPath", ")", ")", "{", "continue", ";", "}", "let", "dname", "=", "relPath", ";", "do", "{", "added", ".", "add", "(", "dname", ")", ";", "dname", "=", "dirname", "(", "dname", ")", ";", "}", "while", "(", "dname", "!==", "''", ")", ";", "}", "TreeDir", ".", "remove", "(", "workdirTree", ",", "(", "entry", ")", ":", "boolean", "=>", "{", "const", "removeItem", "=", "!", "added", ".", "has", "(", "entry", ".", "path", ")", ";", "if", "(", "removeItem", ")", "{", "return", "true", ";", "}", "const", "finfo", "=", "index", ".", "processedAdded", ".", "get", "(", "entry", ".", "path", ")", ";", "if", "(", "finfo", ")", "{", "entry", ".", "hash", "=", "finfo", ".", "hash", ";", "entry", ".", "stats", "=", "finfo", ".", "stat", ";", "}", "return", "false", ";", "}", ")", ";", "const", "commitTree", "=", "headCommit", ".", "root", ".", "clone", "(", ")", ";", "TreeDir", ".", "remove", "(", "commitTree", ",", "(", "entry", ")", ":", "boolean", "=>", "{", "return", "index", ".", "deleteRelPaths", ".", "has", "(", "entry", ".", "path", ")", ";", "}", ")", ";", "const", "newTree", "=", "TreeDir", ".", "merge", "(", "commitTree", ",", "workdirTree", ")", ";", "TreeDir", ".", "remove", "(", "newTree", ",", "(", "entry", ")", ":", "boolean", "=>", "{", "return", "entry", "instanceof", "TreeDir", "&&", "entry", ".", "children", ".", "length", "===", "0", ";", "}", ")", ";", "return", "newTree", ";", "}", ")", ";", "}", "return", "promise", ".", "then", "(", "(", "treeResult", ")", "=>", "{", "tree", "=", "treeResult", ";", "TreeDir", ".", "walk", "(", "treeResult", ",", "(", "item", ")", "=>", "{", "if", "(", "!", "Number", ".", "isInteger", "(", "item", ".", "stats", ".", "size", ")", ")", "{", "throw", "new", "Error", "(", "`Item '${", "item", ".", "path", "}' has no valid size: ${", "item", ".", "stats", ".", "size", "}`", ")", ";", "}", "if", "(", "!", "(", "item", ".", "stats", ".", "ctime", "instanceof", "Date", ")", ")", "{", "throw", "new", "Error", "(", "`Item '${", "item", ".", "path", "}' has no valid ctime: ${", "item", ".", "stats", ".", "ctime", "}`", ")", ";", "}", "if", "(", "!", "(", "item", ".", "stats", ".", "mtime", "instanceof", "Date", ")", ")", "{", "throw", "new", "Error", "(", "`Item '${", "item", ".", "path", "}' has no valid mtime: ${", "item", ".", "stats", ".", "mtime", "}`", ")", ";", "}", "if", "(", "!", "(", "item", ".", "stats", ".", "birthtime", "instanceof", "Date", ")", ")", "{", "throw", "new", "Error", "(", "`Item '${", "item", ".", "path", "}' has no valid birthtime: ${", "item", ".", "stats", ".", "birthtime", "}`", ")", ";", "}", "if", "(", "!", "(", "/[0-9a-f]{64}/i", ".", "exec", "(", "item", ".", "hash", ")", ")", ")", "{", "throw", "new", "Error", "(", "`Item '${", "item", ".", "path", "}' has no valid hash: ${", "item", ".", "hash", "}`", ")", ";", "}", "}", ")", ";", "return", "index", ".", "invalidate", "(", ")", ";", "}", ")", ".", "then", "(", "(", ")", "=>", "{", "commit", "=", "new", "Commit", "(", "this", ",", "message", ",", "new", "Date", "(", ")", ",", "tree", ",", "this", ".", "head", "?.", "hash", "?", "[", "this", ".", "head", ".", "hash", "]", ":", "null", ")", ";", "if", "(", "tags", "&&", "tags", ".", "length", ">", "0", ")", "{", "tags", ".", "forEach", "(", "(", "tag", ")", "=>", "{", "commit", ".", "addTag", "(", "tag", ")", ";", "}", ")", ";", "}", "if", "(", "userData", ")", "{", "for", "(", "const", "[", "key", ",", "value", "]", "of", "Object", ".", "entries", "(", "userData", ")", ")", "{", "commit", ".", "addData", "(", "key", ",", "value", ")", ";", "}", "}", "this", ".", "commits", ".", "push", "(", "commit", ")", ";", "this", ".", "commitMap", ".", "set", "(", "commit", ".", "hash", ".", "toString", "(", ")", ",", "commit", ")", ";", "if", "(", "this", ".", "head", ".", "hash", ")", "{", "this", ".", "head", ".", "hash", "=", "commit", ".", "hash", ";", "const", "curRef", "=", "this", ".", "references", ".", "find", "(", "(", "r", ")", "=>", "r", ".", "getName", "(", ")", "===", "this", ".", "head", ".", "getName", "(", ")", ")", ";", "if", "(", "curRef", ")", "{", "curRef", ".", "hash", "=", "commit", ".", "hash", ";", "}", "}", "else", "{", "this", ".", "head", ".", "setName", "(", "this", ".", "options", ".", "defaultBranchName", "??", "'Main'", ")", ";", "this", ".", "head", ".", "hash", "=", "commit", ".", "hash", ";", "this", ".", "references", ".", "push", "(", "new", "Reference", "(", "REFERENCE_TYPE", ".", "BRANCH", ",", "this", ".", "head", ".", "getName", "(", ")", ",", "this", ",", "{", "hash", ":", "commit", ".", "hash", ",", "start", ":", "commit", ".", "hash", "}", ")", ")", ";", "}", "return", "this", ".", "repoOdb", ".", "writeCommit", "(", "commit", ")", ";", "}", ")", ".", "then", "(", "(", ")", "=>", "{", "this", ".", "head", ".", "hash", "=", "commit", ".", "hash", ";", "return", "this", ".", "repoOdb", ".", "writeHeadReference", "(", "this", ".", "head", ")", ";", "}", ")", ".", "then", "(", "(", ")", "=>", "this", ".", "repoOdb", ".", "writeReference", "(", "this", ".", "head", ")", ")", ".", "then", "(", "(", ")", "=>", "this", ".", "repoLog", ".", "writeLog", "(", "`commit: ${", "message", "}`", ")", ")", ".", "then", "(", "(", ")", "=>", "commit", ")", ";", "}", "param", "workdir", "returns", "static", "open", "(", "workdir", ")", "{", "const", "repo", "=", "new", "Repository", "(", ")", ";", "let", "odb", "=", "null", ";", "let", "commondirInside", "=", "null", ";", "let", "commondir", "=", "null", ";", "return", "io", ".", "pathExists", "(", "workdir", ")", ".", "then", "(", "(", "exists", ")", "=>", "{", "if", "(", "!", "exists", ")", "{", "throw", "new", "Error", "(", "'workdir doesn\\'t exist'", ")", ";", "}", "return", "getSnowFSRepo", "(", "workdir", ")", ";", "}", ")", ".", "then", "(", "(", "snowFSRepoPath", ")", "=>", "{", "if", "(", "!", "snowFSRepoPath", ")", "{", "throw", "new", "Error", "(", "'directory contains no .snow'", ")", ";", "}", "workdir", "=", "snowFSRepoPath", ";", "commondirInside", "=", "join", "(", "workdir", ",", "'.snow'", ")", ";", "return", "io", ".", "stat", "(", "commondirInside", ")", ";", "}", ")", ".", "then", "(", "(", "stat", ")", "=>", "{", "if", "(", "stat", ".", "isFile", "(", ")", ")", "{", "return", "fse", ".", "readFile", "(", "commondirInside", ")", ".", "then", "(", "(", "buf", ")", "=>", "buf", ".", "toString", "(", ")", ")", ";", "}", "return", "commondirInside", ";", "}", ")", ".", "then", "(", "(", "commondirResult", ")", "=>", "{", "commondir", "=", "commondirResult", ";", "return", "io", ".", "pathExists", "(", "commondir", ")", ";", "}", ")", ".", "then", "(", "(", "exists", ")", "=>", "{", "if", "(", "!", "exists", ")", "throw", "new", "Error", "(", "'commondir not found'", ")", ";", "return", "io", ".", "stat", "(", "commondir", ")", ";", "}", ")", ".", "then", "(", "(", "stat", ")", "=>", "{", "if", "(", "!", "stat", ".", "isDirectory", "(", ")", ")", "throw", "new", "Error", "(", "'commondir must be a directory'", ")", ";", "repo", ".", "options", "=", "new", "RepositoryInitOptions", "(", "commondir", ")", ";", "repo", ".", "repoWorkDir", "=", "workdir", ";", "repo", ".", "repoCommonDir", "=", "commondir", ";", "return", "Odb", ".", "open", "(", "repo", ")", ";", "}", ")", ".", "then", "(", "(", "odbResult", ")", "=>", "{", "odb", "=", "odbResult", ";", "repo", ".", "repoOdb", "=", "odbResult", ";", "repo", ".", "repoLog", "=", "new", "Log", "(", "repo", ")", ";", "return", "odb", ".", "readCommits", "(", ")", ";", "}", ")", ".", "then", "(", "(", "commits", ")", "=>", "{", "repo", ".", "commits", "=", "commits", ";", "for", "(", "const", "commit", "of", "commits", ")", "{", "repo", ".", "commitMap", ".", "set", "(", "commit", ".", "hash", ".", "toString", "(", ")", ",", "commit", ")", ";", "}", "return", "odb", ".", "readReferences", "(", ")", ";", "}", ")", ".", "then", "(", "(", "references", ")", "=>", "{", "repo", ".", "references", "=", "references", ";", "return", "odb", ".", "readHeadReference", "(", ")", ";", "}", ")", ".", "then", "(", "(", "hashOrRefNameResult", ")", "=>", "{", "let", "hashOrRefName", "=", "hashOrRefNameResult", ";", "if", "(", "!", "hashOrRefName", ")", "{", "if", "(", "repo", ".", "references", ".", "length", ">", "0", ")", "{", "hashOrRefName", "=", "repo", ".", "references", "[", "0", "]", ".", "getName", "(", ")", ";", "}", "else", "{", "throw", "new", "Error", "(", "'no reference nor HEAD found'", ")", ";", "}", "}", "let", "headRef", "=", "null", ";", "if", "(", "hashOrRefName", ")", "{", "headRef", "=", "repo", ".", "references", ".", "find", "(", "(", "ref", ")", "=>", "ref", ".", "getName", "(", ")", "===", "hashOrRefName", ")", ";", "}", "if", "(", "!", "headRef", ")", "{", "headRef", "=", "new", "Reference", "(", "REFERENCE_TYPE", ".", "BRANCH", ",", "'HEAD'", ",", "repo", ",", "{", "hash", ":", "hashOrRefName", ",", "start", ":", "hashOrRefName", "}", ")", ";", "}", "repo", ".", "head", ".", "setName", "(", "headRef", ".", "getName", "(", ")", ")", ";", "repo", ".", "head", ".", "hash", "=", "headRef", ".", "hash", ";", "return", "Index", ".", "loadAll", "(", "repo", ",", "odb", ")", ";", "}", ")", ".", "then", "(", "(", "indexes", ")", "=>", "{", "repo", ".", "repoIndexes", "=", "indexes", ";", "return", "repo", ";", "}", ")", ";", "}", "param", "workdir", "param", "opts", "returns", "static", "initExt", "(", "workdir", ",", "opts", "?", ")", "{", "const", "repo", "=", "new", "Repository", "(", ")", ";", "if", "(", "!", "opts", ")", "{", "opts", "=", "new", "RepositoryInitOptions", "(", ")", ";", "}", "let", "commondirOutside", ";", "if", "(", "opts", ".", "commondir", ")", "{", "if", "(", "opts", ".", "commondir", ".", "startsWith", "(", "workdir", ")", ")", "{", "throw", "new", "Error", "(", "'commondir must be outside repository'", ")", ";", "}", "commondirOutside", "=", "true", ";", "}", "else", "{", "commondirOutside", "=", "false", ";", "opts", ".", "commondir", "=", "join", "(", "workdir", ",", "'.snow'", ")", ";", "}", "return", "fse", ".", "pathExists", "(", "join", "(", "workdir", ",", "'.snow'", ")", ")", ".", "then", "(", "(", "workdirExists", ")", "=>", "{", "if", "(", "workdirExists", ")", "{", "throw", "new", "Error", "(", "'workdir already exists'", ")", ";", "}", "return", "fse", ".", "pathExists", "(", "opts", ".", "commondir", ")", ";", "}", ")", ".", "then", "(", "(", "commondirExists", ")", "=>", "{", "if", "(", "commondirExists", ")", "{", "throw", "new", "Error", "(", "'commondir already exists'", ")", ";", "}", "return", "io", ".", "ensureDir", "(", "workdir", ")", ";", "}", ")", ".", "then", "(", "(", ")", "=>", "Odb", ".", "create", "(", "repo", ",", "opts", ")", ")", ".", "then", "(", "(", "odb", ")", "=>", "{", "repo", ".", "repoOdb", "=", "odb", ";", "repo", ".", "options", "=", "opts", ";", "repo", ".", "repoWorkDir", "=", "workdir", ";", "repo", ".", "repoCommonDir", "=", "opts", ".", "commondir", ";", "repo", ".", "repoIndexes", "=", "[", "]", ";", "if", "(", "commondirOutside", ")", "{", "const", "snowtrackFile", "=", "join", "(", "workdir", ",", "'.snow'", ")", ";", "return", "fse", ".", "writeFile", "(", "snowtrackFile", ",", "opts", ".", "commondir", ")", ".", "then", "(", "(", ")", "=>", "hideItem", "(", "snowtrackFile", ")", ")", ";", "}", "return", "hideItem", "(", "opts", ".", "commondir", ")", ";", "}", ")", ".", "then", "(", "(", ")", "=>", "{", "repo", ".", "repoLog", "=", "new", "Log", "(", "repo", ")", ";", "return", "repo", ".", "repoLog", ".", "init", "(", ")", ";", "}", ")", ".", "then", "(", "(", ")", "=>", "repo", ".", "repoLog", ".", "writeLog", "(", "`init: initialized at ${", "resolve", "(", "workdir", ")", "}`", ")", ")", ".", "then", "(", "(", ")", "=>", "repo", ".", "createCommit", "(", "repo", ".", "getFirstIndex", "(", ")", ",", "repo", ".", "options", ".", "defaultCommitMessage", "??", "'Created Project'", ",", "{", "allowEmpty", ":", "true", "}", ")", ")", ".", "then", "(", "(", ")", "=>", "repo", ")", ";", "}", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 27935, null, null, null, null, null, null, null, null, null, null, 27935, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 2, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 21745, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 12, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 112, null, 2, null, 8, null, 5, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, 21745, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, 19661, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, 5, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, 11, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 488, null, null, null, null, 488, null, null, null, null, null, null, null, null, 488, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 488, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 488, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 488, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 488, null, 2, null, null, null, null, null, null, null, null, null, null, 488, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 488, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, 488, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, 491, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 46500, null, null, null, null, null, null, null, null, null, null, 5, null, 0, null, null, null, 5, null, null, null, null, null, null, null, null, 1112, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1112, null, 1112, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1112, null, 1112, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1112, null, 0, null, 2, null, null, null, 491, null, null, null, null, null, null, null, null, 491, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1112, null, 491, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 491, null, 0, null, 2, null, null, null, 491, null, null, null, null, null, null, null, null, 491, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 1112, null, 4, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, 491, null, null, null, null, null, null, null, null, null, null, null, 1112, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1112, null, 2, null, null, null, 1112, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 491, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 491, null, null, null, null, null, null, null, null, 491, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, 2, null, null, null, null, null, null, null, null, null, null, 491, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, 491, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 0, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 491, null, null, null, null, 3, null, null, null, null, null, null, null, null, 491, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 0, null, 2, null, 2, null, null, null, null, null, null, 491, null, null, null, null, null, null, null, null, 491, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 491, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, 491, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, 0, null, null, null, 491, null, null, null, null, 1112, null, null, null, null, null, null, null, null, null, null, null, null, 491, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 19, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, 19, null, null, null, null, null, null, null, null, null, null, null, null, 30, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, 5, null, null, null, null, null, 5, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 23116, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7827, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7827, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 23116, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 23116, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 0, null, null, 1112, null, null, null, null, 19, null, null, null, null, null, null, null, null, null, null, null, null, 19, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 2, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 23116, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, 1112, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 19, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 19, null, null, null, null, null, null, null, null, null, 19661, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 30, null, null, null, null, null, null, null, null, null, null, 19661, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, 19661, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 19661, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, 19661, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 30, null, null, null, null, null, null, null, null, null, null, 19661, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, 19661, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 19661, null, null, null, null, null, 23116, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, 19661, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 30, null, null, null, null, null, null, null, null, null, null, 19661, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, 19661, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 19661, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, 7827, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 30, null, null, null, null, null, null, null, null, null, null, 7827, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, 7827, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7827, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, 7827, null, null, null, null, null, null, null, null, null, null, null, null, null, 30, null, null, null, null, null, null, null, null, null, null, 7827, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, 7827, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7827, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 23116, null, 23116, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 23116, null, 23116, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 488, null, 2, null, 6, null, null, 5, null, null, 6, null, null, null, null, 18801, null, null, null, null, 1112, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 18801, null, null, null, null, 1112, null, null, null, null, null, null, null, null, 30, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7827, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 854, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 18801, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7827, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 18801, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7827, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 18801, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7827, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 491, null, null, null, null, null, null, null, null, 491, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 2, null, null, null, 112, null, null, null, null, null, null, null, 46500, null, null, null, null, 2, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 21745, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 12, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 21745, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 46500, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, 1112, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 491, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 491, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 2, null, 0, null, null, null, null, 112, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 46500, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1356
[ "import", "*", "as", "hasha", "from", "'hasha'", ";", "import", "*", "as", "crypto", "from", "'crypto'", ";", "import", "*", "as", "fse", "from", "'fs-extra'", ";", "import", "*", "as", "io", "from", "'./io'", ";", "import", "{", "join", ",", "dirname", ",", "}", "from", "'./path'", ";", "import", "{", "Repository", "}", "from", "'./repository'", ";", "export", "const", "MB100", "=", "100000000", ";", "export", "const", "MB20", "=", "20000000", ";", "export", "const", "MB10", "=", "10000000", ";", "export", "const", "MB2", "=", "2000000", ";", "export", "const", "MB1", "=", "1000000", ";", "export", "class", "StatsSubset", "{", "size", ":", "number", ";", "ctime", ":", "Date", ";", "mtime", ":", "Date", ";", "birthtime", ":", "Date", ";", "static", "clone", "(", "stats", ")", "{", "return", "{", "size", ":", "stats", ".", "size", ",", "ctime", ":", "new", "Date", "(", "stats", ".", "ctime", ")", ",", "mtime", ":", "new", "Date", "(", "stats", ".", "mtime", ")", ",", "birthtime", ":", "new", "Date", "(", "stats", ".", "birthtime", ")", ",", "}", ";", "}", "}", "/**\n * A commonly used class which contains a hash and\n * file stats of a given file\n */", "export", "class", "FileInfo", "{", "hash", ":", "string", ";", "ext", ":", "string", ";", "stat", ":", "StatsSubset", ";", "}", "/**\n * Indicating the type of a directory.\n */", "export", "enum", "LOADING_STATE", "{", "/** The directory is neither a SnowFS repo, nor a Git repo */", "NONE", ",", "/** The directory is a Git repo. */", "GIT", "=", "2", ",", "/** The directory is a SnowFS repo. */", "SNOW", "=", "4", "}", "export", "interface", "HashBlock", "{", "hash", ":", "string", ";", "start", ":", "number", ";", "end", ":", "number", ";", "}", "param", "filepath", "param", "options", "export", "function", "getPartHash", "(", "filepath", ",", "options", "?", ")", "{", "const", "fh", "=", "io", ".", "createReadStream", "(", "filepath", ",", "{", "start", ":", "options", "?.", "start", ",", "end", ":", "options", "?.", "end", ",", "highWaterMark", ":", "options", "?.", "highWaterMark", "??", "MB2", ",", "autoClose", ":", "true", ",", "}", ")", ";", "return", "hasha", ".", "fromStream", "(", "fh", ",", "{", "algorithm", ":", "'sha256'", "}", ")", ".", "then", "(", "(", "hash", ")", "=>", "{", "return", "{", "hash", ",", "start", ":", "options", "?.", "start", "??", "-", "1", ",", "end", ":", "options", "?.", "end", "??", "-", "1", "}", ";", "}", ")", ";", "}", "param", "filepath", "param", "filehash", "param", "hashBlocks", "export", "function", "compareFileHash", "(", "filepath", ",", "filehash", ",", "hashBlocks", "?", ")", "{", "return", "io", ".", "stat", "(", "filepath", ")", ".", "then", "(", "(", "stat", ")", "=>", "{", "if", "(", "stat", ".", "size", "<", "MB20", ")", "{", "if", "(", "hashBlocks", ")", "{", "console", ".", "warn", "(", "`File ${", "filepath", "} should have no hash blocks because it's too small`", ")", ";", "}", "return", "getPartHash", "(", "filepath", ")", ".", "then", "(", "(", "hashBlock", ")", "=>", "hashBlock", ".", "hash", "===", "filehash", ")", ";", "}", "if", "(", "!", "hashBlocks", ")", "{", "console", ".", "warn", "(", "`File ${", "filepath", "} should have hash blocks because it's too big`", ")", ";", "}", "const", "divider", "=", "Math", ".", "ceil", "(", "stat", ".", "size", "/", "MB100", ")", ";", "const", "blocks", "=", "new", "Array", "<", "{", "start", ":", "number", ";", "end", ":", "number", ";", "}", ">", "(", "divider", ")", ";", "for", "(", "let", "i", "=", "0", ";", "i", "<", "divider", ";", "++", "i", ")", "{", "blocks", "[", "i", "]", "=", "{", "start", ":", "i", "*", "MB100", ",", "end", ":", "(", "i", "+", "1", ")", "*", "MB100", "-", "1", "}", ";", "}", "blocks", "[", "blocks", ".", "length", "-", "1", "]", ".", "end", "=", "Math", ".", "min", "(", "MB100", "*", "divider", ",", "stat", ".", "size", ")", "-", "1", ";", "const", "promiseHash", "=", "[", "]", ";", "for", "(", "let", "i", "=", "0", ";", "i", "<", "divider", ";", "++", "i", ")", "{", "promiseHash", ".", "push", "(", "getPartHash", "(", "filepath", ",", "{", "start", ":", "blocks", "[", "i", "]", ".", "start", ",", "end", ":", "blocks", "[", "i", "]", ".", "end", ",", "highWaterMark", ":", "MB2", ",", "}", ")", ".", "then", "(", "(", "hashBlock", ")", "=>", "{", "if", "(", "hashBlocks", "&&", "hashBlock", ".", "hash", "!==", "hashBlocks", "[", "i", "]", ")", "{", "throw", "new", "Error", "(", "'hashblock different'", ")", ";", "}", "return", "hashBlock", ";", "}", ")", ")", ";", "}", "return", "Promise", ".", "all", "(", "promiseHash", ")", ".", "then", "(", "(", "hashes", ")", "=>", "{", "const", "hash", "=", "crypto", ".", "createHash", "(", "'sha256'", ")", ";", "for", "(", "const", "h", "of", "hashes", ")", "{", "hash", ".", "update", "(", "h", ".", "toString", "(", ")", ")", ";", "}", "return", "filehash", "===", "hash", ".", "digest", "(", "'hex'", ")", ";", "}", ")", ";", "}", ")", ".", "catch", "(", "(", "error", ")", "=>", "{", "if", "(", "error", ".", "message", "===", "'hashblock different'", ")", "{", "return", "false", ";", "}", "throw", "error", ";", "}", ")", ";", "}", "param", "filepath", "export", "function", "calculateFileHash", "(", "filepath", ")", "{", "return", "io", ".", "stat", "(", "filepath", ")", ".", "then", "(", "(", "stat", ")", "=>", "{", "if", "(", "stat", ".", "size", "<", "MB20", ")", "{", "return", "getPartHash", "(", "filepath", ")", ".", "then", "(", "(", "oid", ")", "=>", "(", "{", "filehash", ":", "oid", ".", "hash", "}", ")", ")", ";", "}", "const", "divider", "=", "Math", ".", "ceil", "(", "stat", ".", "size", "/", "MB100", ")", ";", "const", "blocks", "=", "new", "Array", "<", "{", "start", ":", "number", ";", "end", ":", "number", ";", "}", ">", "(", "divider", ")", ";", "for", "(", "let", "i", "=", "0", ";", "i", "<", "divider", ";", "++", "i", ")", "{", "blocks", "[", "i", "]", "=", "{", "start", ":", "i", "*", "MB100", ",", "end", ":", "(", "i", "+", "1", ")", "*", "MB100", "-", "1", "}", ";", "}", "blocks", "[", "blocks", ".", "length", "-", "1", "]", ".", "end", "=", "Math", ".", "min", "(", "MB100", "*", "divider", ",", "stat", ".", "size", ")", "-", "1", ";", "const", "promiseHash", "=", "[", "]", ";", "for", "(", "let", "i", "=", "0", ";", "i", "<", "divider", ";", "++", "i", ")", "{", "promiseHash", ".", "push", "(", "getPartHash", "(", "filepath", ",", "{", "start", ":", "blocks", "[", "i", "]", ".", "start", ",", "end", ":", "blocks", "[", "i", "]", ".", "end", ",", "highWaterMark", ":", "MB2", ",", "}", ")", ")", ";", "}", "return", "Promise", ".", "all", "(", "promiseHash", ")", ".", "then", "(", "(", "hashes", ")", "=>", "{", "const", "hash", "=", "crypto", ".", "createHash", "(", "'sha256'", ")", ";", "for", "(", "const", "h", "of", "hashes", ")", "{", "hash", ".", "update", "(", "h", ".", "hash", ")", ";", "}", "return", "{", "filehash", ":", "hash", ".", "digest", "(", "'hex'", ")", ",", "hashBlocks", ":", "hashes", "}", ";", "}", ")", ";", "}", ")", ";", "}", "param", "repoPath", "returns", "export", "function", "getRepoDetails", "(", "repoPath", ")", "{", "return", "io", ".", "stat", "(", "repoPath", ")", ".", "then", "(", "(", "stat", ")", "=>", "{", "if", "(", "stat", ".", "isFile", "(", ")", ")", "{", "repoPath", "=", "dirname", "(", "repoPath", ")", ";", "}", "return", "io", ".", "pathExists", "(", "join", "(", "repoPath", ",", "'.git'", ")", ")", ";", "}", ")", ".", "then", "(", "(", "exists", ")", "=>", "{", "if", "(", "exists", ")", "{", "return", "{", "state", ":", "LOADING_STATE", ".", "GIT", ",", "workdir", ":", "null", ",", "commondir", ":", "null", ",", "}", ";", "}", "return", "io", ".", "pathExists", "(", "join", "(", "repoPath", ",", "'.snow'", ")", ")", ".", "then", "(", "(", "exists", ")", "=>", "{", "if", "(", "exists", ")", "{", "return", "Repository", ".", "open", "(", "repoPath", ")", ".", "then", "(", "(", "repo", ")", "=>", "{", "const", "workdir", "=", "repo", ".", "workdir", "(", ")", ";", "const", "commondir", "=", "repo", ".", "commondir", "(", ")", ";", "if", "(", "repo", ")", "{", "return", "{", "state", ":", "LOADING_STATE", ".", "SNOW", ",", "workdir", ",", "commondir", ",", "}", ";", "}", "return", "{", "state", ":", "LOADING_STATE", ".", "NONE", ",", "workdir", ":", "null", ",", "commondir", ":", "null", "}", ";", "}", ")", ";", "}", "return", "{", "state", ":", "LOADING_STATE", ".", "NONE", ",", "workdir", ":", "null", ",", "commondir", ":", "null", "}", ";", "}", ")", ";", "}", ")", ";", "}", "param", "s", "returns", "export", "function", "jsonCompliant", "(", "s", ")", "{", "return", "s", ".", "replace", "(", "/\\\\n/g", ",", "'\\\\n'", ")", ".", "replace", "(", "/\\\\'/g", ",", "\"\\\\'\"", ")", ".", "replace", "(", "/\\\\\"/g", ",", "'\\\\\"'", ")", ".", "replace", "(", "/\\\\&/g", ",", "'\\\\&'", ")", ".", "replace", "(", "/\\\\r/g", ",", "'\\\\r'", ")", ".", "replace", "(", "/\\\\t/g", ",", "'\\\\t'", ")", ".", "replace", "(", "/\\\\b/g", ",", "'\\\\b'", ")", ".", "replace", "(", "/\\\\f/g", ",", "'\\\\f'", ")", ";", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, 3, null, null, null, null, null, 3, null, null, null, null, null, 3, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 2, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 2, null, 2, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 21745, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 25, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, 21745, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, 21745, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1357
[ "import", "*", "as", "cp", "from", "'child_process'", ";", "import", "*", "as", "fse", "from", "'fs-extra'", ";", "import", "*", "as", "os", "from", "'os'", ";", "import", "{", "exec", ",", "spawn", "}", "from", "'child_process'", ";", "import", "{", "join", ",", "dirname", ",", "normalize", ",", "relative", ",", "}", "from", "'./path'", ";", "import", "{", "MB1", "}", "from", "'./common'", ";", "import", "*", "as", "io", "from", "'./io'", ";", "const", "trash", "=", "require", "(", "'trash'", ")", ";", "const", "AggregateError", "=", "require", "(", "'es-aggregate-error'", ")", ";", "const", "drivelist", "=", "require", "(", "'drivelist'", ")", ";", "const", "PromisePool", "=", "require", "(", "'@supercharge/promise-pool'", ")", ";", "class", "StacklessError", "extends", "Error", "{", "constructor", "(", "...", "args", ")", "{", "super", "(", "...", "args", ")", ";", "this", ".", "name", "=", "this", ".", "constructor", ".", "name", ";", "delete", "this", ".", "stack", ";", "}", "}", "export", "enum", "FILESYSTEM", "{", "APFS", "=", "1", ",", "HFS_PLUS", "=", "2", ",", "REFS", "=", "3", ",", "NTFS", "=", "4", ",", "FAT32", "=", "5", ",", "FAT16", "=", "6", ",", "OTHER", "=", "7", "}", "export", "class", "Drive", "{", "displayName", ":", "string", ";", "filesystem", ":", "FILESYSTEM", ";", "constructor", "(", "displayName", ",", "filesystem", ")", "{", "this", ".", "displayName", "=", "displayName", ";", "this", ".", "filesystem", "=", "filesystem", ";", "}", "}", "export", "enum", "TEST_IF", "{", "FILE_CAN_BE_READ_FROM", "=", "1", ",", "FILE_CAN_BE_WRITTEN_TO", "=", "2", "}", "/**\n * Convert a passed string to an utf-16 le string.\n */", "function", "strEncodeUTF16", "(", "str", ")", "{", "const", "buf", "=", "new", "ArrayBuffer", "(", "str", ".", "length", "*", "2", ")", ";", "const", "bufView", "=", "new", "Uint16Array", "(", "buf", ")", ";", "for", "(", "let", "i", "=", "0", ",", "strLen", "=", "str", ".", "length", ";", "i", "<", "strLen", ";", "i", "++", ")", "{", "bufView", "[", "i", "]", "=", "str", ".", "charCodeAt", "(", "i", ")", ";", "}", "return", "new", "Uint8Array", "(", "buf", ")", ";", "}", "param", "absPaths", "param", "relPaths", "throws", "export", "function", "checkReadAccess", "(", "absPaths", ",", "relPaths", ")", "{", "const", "promises", "=", "[", "]", ";", "for", "(", "const", "absPath", "of", "absPaths", ")", "{", "promises", ".", "push", "(", "io", ".", "stat", "(", "absPath", ")", ")", ";", "}", "const", "stats1", "=", "new", "Map", "<", "string", ",", "fse", ".", "Stats", ">", "(", ")", ";", "return", "Promise", ".", "all", "(", "promises", ")", ".", "then", "(", "(", "stats", ")", "=>", "{", "for", "(", "let", "i", "=", "0", ";", "i", "<", "relPaths", ".", "length", ";", "++", "i", ")", "{", "stats1", ".", "set", "(", "relPaths", "[", "i", "]", ",", "stats", "[", "i", "]", ")", ";", "}", "return", "new", "Promise", "<", "void", ">", "(", "(", "resolve", ")", "=>", "{", "setTimeout", "(", "(", ")", "=>", "{", "resolve", "(", ")", ";", "}", ",", "500", ")", ";", "}", ")", ";", "}", ")", ".", "then", "(", "(", ")", "=>", "{", "const", "promises", "=", "[", "]", ";", "for", "(", "const", "absPath", "of", "absPaths", ")", "{", "promises", ".", "push", "(", "io", ".", "stat", "(", "absPath", ")", ")", ";", "}", "return", "Promise", ".", "all", "(", "promises", ")", ";", "}", ")", ".", "then", "(", "(", "stats", ")", "=>", "{", "const", "errors", "=", "[", "]", ";", "for", "(", "let", "i", "=", "0", ";", "i", "<", "relPaths", ".", "length", ";", "++", "i", ")", "{", "const", "prevStats", "=", "stats1", ".", "get", "(", "relPaths", "[", "i", "]", ")", ";", "if", "(", "prevStats", "&&", "(", "prevStats", ".", "size", "!==", "stats", "[", "i", "]", ".", "size", "||", "prevStats", ".", "mtime", ".", "getTime", "(", ")", "!==", "stats", "[", "i", "]", ".", "mtime", ".", "getTime", "(", ")", ")", ")", "{", "const", "msg", "=", "`File '${", "relPaths", "[", "i", "]", "}' is being written by another process`", ";", "errors", ".", "push", "(", "new", "StacklessError", "(", "msg", ")", ")", ";", "}", "}", "if", "(", "errors", ".", "length", ">", "0", ")", "{", "throw", "new", "AggregateError", "(", "errors", ")", ";", "}", "}", ")", ";", "}", "export", "namespace", "win32", "{", "param", "absPaths", "param", "relPaths", "throws", "export", "function", "checkWriteAccess", "(", "ioContextClass", ",", "absPaths", ")", "{", "const", "winAccess", "=", "ioContextClass", ".", "calculateAndGetWinAccessPath", "(", ")", ";", "return", "new", "Promise", "<", "void", ">", "(", "(", "resolve", ",", "reject", ")", "=>", "{", "let", "std", "=", "''", ";", "let", "paths", "=", "''", ";", "for", "(", "const", "absPath", "of", "absPaths", ")", "{", "paths", "+=", "`${", "absPath", "}\\n`", ";", "}", "const", "pathsArray", "=", "strEncodeUTF16", "(", "paths", ")", ";", "const", "p0", "=", "spawn", "(", "winAccess", ")", ";", "p0", ".", "stdin", ".", "write", "(", "pathsArray", ")", ";", "p0", ".", "stdin", ".", "end", "(", ")", ";", "p0", ".", "stdout", ".", "on", "(", "'data'", ",", "(", "data", ")", "=>", "{", "std", "+=", "data", ".", "toString", "(", ")", ";", "}", ")", ";", "p0", ".", "on", "(", "'exit'", ",", "(", "code", ")", "=>", "{", "if", "(", "code", "===", "0", ")", "{", "resolve", "(", ")", ";", "}", "else", "{", "try", "{", "for", "(", "const", "d", "of", "JSON", ".", "parse", "(", "std", ")", ")", "{", "let", "msg", "=", "`Your files are accessed by ${", "d", ".", "strAppName", "}.`", ";", "if", "(", "d", ".", "strAppName", "!==", "'Windows Explorer'", ")", "{", "msg", "+=", "' Please close the application and retry.'", ";", "}", "return", "reject", "(", "new", "Error", "(", "msg", ")", ")", ";", "}", "}", "catch", "(", "error", ")", "{", "reject", "(", "new", "Error", "(", "error", ")", ")", ";", "}", "}", "}", ")", ";", "}", ")", ";", "}", "}", "export", "namespace", "unix", "{", "/**\n * Possible file lock types on a given file. This are the extracted\n * information from a `man lsof` converted into an enum.\n */", "export", "enum", "LOCKTYPE", "{", "NFS_LOCK", "=", "'N'", ",", "READ_LOCK_FILE_PART", "=", "'r'", ",", "READ_LOCK_FILE", "=", "'R'", ",", "WRITE_LOCK_FILE_PART", "=", "'w'", ",", "WRITE_LOCK_FILE", "=", "'W'", ",", "READ_WRITE_LOCK_FILE", "=", "'u'", ",", "UNKNOWN", "=", "'X'", "}", "export", "class", "FileHandle", "{", "/** PID of process which acquired the file handle */", "pid", ":", "string", ";", "processname", ":", "string", ";", "/** File access information with file lock info */", "lockType", ":", "LOCKTYPE", ";", "/** Documents filepath */", "filepath", ":", "string", ";", "}", "export", "function", "whichFilesInDirAreOpen", "(", "dirpath", ")", "{", "try", "{", "return", "new", "Promise", "<", "Map", "<", "string", ",", "FileHandle", "[", "]", ">", ">", "(", "(", "resolve", ",", "reject", ")", "=>", "{", "const", "p0", "=", "cp", ".", "spawn", "(", "'lsof'", ",", "[", "'-X'", ",", "'-F'", ",", "'pcan'", ",", "'+D'", ",", "dirpath", "]", ")", ";", "const", "p", "=", "new", "Map", "<", "string", ",", "FileHandle", "[", "]", ">", "(", ")", ";", "let", "stdout", "=", "''", ";", "p0", ".", "stdout", ".", "on", "(", "'data'", ",", "(", "data", ")", "=>", "{", "stdout", "+=", "data", ".", "toString", "(", ")", ";", "}", ")", ";", "function", "parseStdout", "(", "stdout", ")", "{", "let", "lsofEntry", "=", "new", "FileHandle", "(", ")", ";", "for", "(", "const", "pline", "of", "stdout", ".", "split", "(", "/\\n/", ")", ")", "{", "if", "(", "pline", ".", "startsWith", "(", "'p'", ")", ")", "{", "lsofEntry", "=", "new", "FileHandle", "(", ")", ";", "lsofEntry", ".", "pid", "=", "pline", ".", "substr", "(", "1", ",", "pline", ".", "length", "-", "1", ")", ";", "}", "else", "if", "(", "pline", ".", "startsWith", "(", "'c'", ")", ")", "{", "lsofEntry", ".", "processname", "=", "pline", ".", "substr", "(", "1", ",", "pline", ".", "length", "-", "1", ")", ";", "}", "else", "if", "(", "pline", ".", "startsWith", "(", "'a'", ")", ")", "{", "if", "(", "pline", ".", "includes", "(", "'N'", ")", ")", "{", "lsofEntry", ".", "lockType", "=", "LOCKTYPE", ".", "NFS_LOCK", ";", "}", "else", "if", "(", "pline", ".", "includes", "(", "'r'", ")", ")", "{", "lsofEntry", ".", "lockType", "=", "LOCKTYPE", ".", "READ_LOCK_FILE_PART", ";", "}", "else", "if", "(", "pline", ".", "includes", "(", "'R'", ")", ")", "{", "lsofEntry", ".", "lockType", "=", "LOCKTYPE", ".", "READ_LOCK_FILE", ";", "}", "else", "if", "(", "pline", ".", "includes", "(", "'w'", ")", ")", "{", "lsofEntry", ".", "lockType", "=", "LOCKTYPE", ".", "WRITE_LOCK_FILE_PART", ";", "}", "else", "if", "(", "pline", ".", "includes", "(", "'W'", ")", ")", "{", "lsofEntry", ".", "lockType", "=", "LOCKTYPE", ".", "WRITE_LOCK_FILE", ";", "}", "else", "if", "(", "pline", ".", "includes", "(", "'u'", ")", ")", "{", "lsofEntry", ".", "lockType", "=", "LOCKTYPE", ".", "READ_WRITE_LOCK_FILE", ";", "}", "else", "{", "lsofEntry", ".", "lockType", "=", "LOCKTYPE", ".", "UNKNOWN", ";", "}", "}", "else", "if", "(", "pline", ".", "startsWith", "(", "'n'", ")", ")", "{", "const", "absPath", "=", "pline", ".", "substr", "(", "1", ",", "pline", ".", "length", "-", "1", ")", ";", "if", "(", "absPath", ".", "startsWith", "(", "dirpath", ")", ")", "{", "const", "relPath", "=", "relative", "(", "dirpath", ",", "pline", ".", "substr", "(", "1", ",", "pline", ".", "length", "-", "1", ")", ")", ";", "const", "q", "=", "p", ".", "get", "(", "relPath", ")", ";", "if", "(", "q", ")", "{", "q", ".", "push", "(", "lsofEntry", ")", ";", "}", "else", "{", "p", ".", "set", "(", "relPath", ",", "[", "lsofEntry", "]", ")", ";", "}", "lsofEntry", "=", "new", "FileHandle", "(", ")", ";", "}", "else", "{", "console", ".", "log", "(", "`lsof reported unknown path: ${", "absPath", "}`", ")", ";", "}", "}", "}", "}", "p0", ".", "on", "(", "'exit'", ",", "(", "code", ")", "=>", "{", "if", "(", "code", "===", "1", ")", "{", "parseStdout", "(", "stdout", ")", ";", "resolve", "(", "p", ")", ";", "}", "else", "{", "reject", "(", "code", ")", ";", "}", "}", ")", ";", "}", ")", ";", "}", "catch", "(", "error", ")", "{", "console", ".", "log", "(", "error", ")", ";", "return", "Promise", ".", "resolve", "(", "new", "Map", "(", ")", ")", ";", "}", "}", "}", "function", "getFilesystem", "(", "drive", ",", "mountpoint", ")", "{", "try", "{", "if", "(", "process", ".", "platform", "===", "'win32'", ")", "{", "return", "new", "Promise", "<", "string", "|", "null", ">", "(", "(", "resolve", ",", "_reject", ")", "=>", "{", "const", "driveLetter", "=", "mountpoint", ".", "endsWith", "(", "'\\\\'", ")", "?", "mountpoint", ".", "substring", "(", "0", ",", "mountpoint", ".", "length", "-", "1", ")", ":", "mountpoint", ";", "exec", "(", "`fsutil fsinfo volumeinfo ${", "driveLetter", "}`", ",", "(", "error", ",", "stdout", ",", "_stderr", ")", "=>", "{", "if", "(", "error", ")", "{", "return", "resolve", "(", "null", ")", ";", "}", "const", "lines", "=", "stdout", ".", "replace", "(", "/\\r\\n/g", ",", "'\\r'", ")", ".", "replace", "(", "/\\n/g", ",", "'\\r'", ")", ".", "split", "(", "/\\r/", ")", ";", "for", "(", "const", "line", "of", "lines", ")", "{", "if", "(", "line", ".", "startsWith", "(", "'File System Name :'", ")", ")", "{", "const", "filesystem", "=", "line", ".", "split", "(", "':'", ",", "2", ")", "[", "1", "]", ".", "trim", "(", ")", ";", "return", "resolve", "(", "filesystem", ")", ";", "}", "}", "return", "resolve", "(", "null", ")", ";", "}", ")", ";", "}", ")", ".", "then", "(", "(", "filesystem", ")", "=>", "{", "if", "(", "filesystem", ")", "{", "switch", "(", "filesystem", ".", "toLowerCase", "(", ")", ")", "{", "case", "'refs'", ":", "return", "FILESYSTEM", ".", "REFS", ";", "case", "'ntfs'", ":", "return", "FILESYSTEM", ".", "NTFS", ";", "case", "'fat16'", ":", "return", "FILESYSTEM", ".", "FAT16", ";", "case", "'fat32'", ":", "case", "'fat'", ":", "return", "FILESYSTEM", ".", "FAT32", ";", "}", "}", "return", "FILESYSTEM", ".", "OTHER", ";", "}", ")", ".", "catch", "(", "(", "error", ")", "=>", "{", "console", ".", "log", "(", "error", ")", ";", "return", "FILESYSTEM", ".", "OTHER", ";", "}", ")", ";", "}", "if", "(", "process", ".", "platform", "===", "'darwin'", ")", "{", "const", "isApfs", "=", "(", "drive", ".", "description", "===", "'AppleAPFSMedia'", ")", ";", "if", "(", "isApfs", ")", "{", "return", "FILESYSTEM", ".", "APFS", ";", "}", "}", "}", "catch", "(", "error", ")", "{", "return", "FILESYSTEM", ".", "OTHER", ";", "}", "return", "FILESYSTEM", ".", "OTHER", ";", "}", "type", "TrashExecutor", "=", "string", "|", "(", "(", "item", ":", "string", "[", "]", "|", "string", ")", "=>", "void", ")", ";", "/**\n * Class to be instantiated to speedup certain I/O operations by acquiring information\n * about all connected storage devices when initialized with [[IoContext.init]].\n * In this case, [[IoContext.CopyFile]] can make use of some optimizations by checking\n * if `src` and `dst` are both on a similar APFS or ReFS storage device to use block cloning\n * operations.\n *\n * ```\n * const ioContext = new IoContext();\n * ioContext.init().then(() => {\n * // perform many I/O operations here\n * return io.copyFile(..);\n * });\n * ```\n */", "export", "class", "IoContext", "{", "/** Path to 'win-access.exe'. If the path is undefined or null the path is set after\n * the first call of [IoContext.calculateAndGetWinAccessPath].\n */", "private", "static", "winAccessPath", ":", "string", ";", "/** Either pass a callback (for Electron environments to use shell.moveItemToTrash) or\n * set a path to the trash executable (e.g. 'recycle-bin.exe', 'trash', ...)\n * of the currently active system. If undefined or null the path is guessed.\n */", "private", "static", "trashExecutor", "?", ":", "TrashExecutor", ";", "/** Original returned object from `drivelist` */", "origDrives", ":", "any", ";", "/** Map of drive objects with mountpoints as the key */", "drives", ":", "Map", "<", "string", ",", "Drive", ">", ";", "/**\n * `true` after [[IoContext.init]] got called, `false`\n * before [[IoContext.init]] and after [[IoContext.invalidate]]\n */", "valid", ":", "boolean", ";", "/** Set of all known mountpoints. Set after [[IoContext.init]] is called */", "mountpoints", ":", "Set", "<", "string", ">", ";", "constructor", "(", ")", "{", "this", ".", "valid", "=", "false", ";", "}", "/**\n * Invalidates the internal device storage information.\n * Normally not needed to explicitly call.\n */", "invalidate", "(", ")", "{", "this", ".", "valid", "=", "false", ";", "this", ".", "mountpoints", "=", "undefined", ";", "}", "checkIfInitialized", "(", ")", "{", "if", "(", "!", "this", ".", "valid", ")", "{", "throw", "new", "Error", "(", "'IoContext is not initialized, did you forget to call IoContext.init(..)?'", ")", ";", "}", "}", "param", "winAccessPath", "throws", "static", "setWin32AccessPath", "(", "winAccessPath", ")", "{", "if", "(", "!", "fse", ".", "pathExistsSync", "(", "winAccessPath", ")", ")", "{", "throw", "new", "Error", "(", "`path ${", "winAccessPath", "} does not exist`", ")", ";", "}", "IoContext", ".", "winAccessPath", "=", "winAccessPath", ";", "}", "returns", "throws", "static", "calculateAndGetWinAccessPath", "(", ")", "{", "let", "winAccess", "=", "IoContext", ".", "winAccessPath", ";", "if", "(", "!", "winAccess", ")", "{", "if", "(", "fse", ".", "pathExistsSync", "(", "join", "(", "dirname", "(", "process", ".", "execPath", ")", ",", "'resources'", ",", "'win-access.exe'", ")", ")", ")", "{", "winAccess", "=", "join", "(", "dirname", "(", "process", ".", "execPath", ")", ",", "'resources'", ",", "'win-access.exe'", ")", ";", "}", "else", "if", "(", "fse", ".", "pathExistsSync", "(", "join", "(", "__dirname", ",", "'..'", ",", "'resources'", ",", "'win-access.exe'", ")", ")", ")", "{", "winAccess", "=", "join", "(", "__dirname", ",", "'..'", ",", "'resources'", ",", "'win-access.exe'", ")", ";", "}", "else", "{", "throw", "new", "Error", "(", "'unable to locate win-access executable'", ")", ";", "}", "IoContext", ".", "winAccessPath", "=", "winAccess", ";", "}", "return", "IoContext", ".", "winAccessPath", ";", "}", "param", "execPath", "static", "setTrashExecutor", "(", "trashExecutor", ")", "{", "if", "(", "typeof", "trashExecutor", "===", "'string'", ")", "{", "if", "(", "!", "fse", ".", "pathExistsSync", "(", "trashExecutor", ")", ")", "{", "throw", "new", "Error", "(", "`path ${", "trashExecutor", "} does not exist`", ")", ";", "}", "if", "(", "fse", ".", "statSync", "(", "trashExecutor", ")", ".", "isDirectory", "(", ")", ")", "{", "throw", "new", "Error", "(", "`path ${", "trashExecutor", "} must not be a directory`", ")", ";", "}", "}", "IoContext", ".", "trashExecutor", "=", "trashExecutor", ";", "}", "init", "(", ")", "{", "const", "tmpDrives", "=", "[", "]", ";", "return", "drivelist", ".", "list", "(", ")", ".", "then", "(", "(", "drives", ")", "=>", "{", "this", ".", "origDrives", "=", "drives", ";", "this", ".", "mountpoints", "=", "new", "Set", "(", ")", ";", "this", ".", "drives", "=", "new", "Map", "(", ")", ";", "for", "(", "const", "drive", "of", "drives", ")", "{", "for", "(", "const", "mountpoint", "of", "drive", ".", "mountpoints", ")", "{", "if", "(", "mountpoint", "&&", "!", "mountpoint", ".", "path", ".", "startsWith", "(", "'/System/'", ")", ")", "{", "this", ".", "mountpoints", ".", "add", "(", "normalize", "(", "mountpoint", ".", "path", ")", ")", ";", "}", "}", "}", "const", "promises", "=", "[", "]", ";", "for", "(", "const", "drive", "of", "drives", ")", "{", "for", "(", "const", "mountpoint", "of", "drive", ".", "mountpoints", ")", "{", "promises", ".", "push", "(", "getFilesystem", "(", "drive", ",", "normalize", "(", "mountpoint", ".", "path", ")", ")", ")", ";", "tmpDrives", ".", "push", "(", "[", "normalize", "(", "mountpoint", ".", "path", ")", ",", "mountpoint", ".", "label", "]", ")", ";", "}", "}", "return", "Promise", ".", "all", "(", "promises", ")", ";", "}", ")", ".", "then", "(", "(", "res", ")", "=>", "{", "let", "i", "=", "0", ";", "res", ".", "forEach", "(", "(", "filesystem", ")", "=>", "{", "if", "(", "!", "tmpDrives", "[", "i", "]", "[", "0", "]", ".", "startsWith", "(", "'/System/'", ")", ")", "{", "this", ".", "drives", ".", "set", "(", "tmpDrives", "[", "i", "]", "[", "0", "]", ",", "new", "Drive", "(", "tmpDrives", "[", "i", "]", "[", "1", "]", ",", "filesystem", ")", ")", ";", "}", "i", "++", ";", "}", ")", ";", "}", ")", ".", "then", "(", "(", ")", "=>", "{", "this", ".", "valid", "=", "true", ";", "}", ")", ";", "}", "param", "file0", "param", "file1", "areFilesOnSameDrive", "(", "file0", ",", "file1", ")", "{", "this", ".", "checkIfInitialized", "(", ")", ";", "let", "i", "=", "0", ";", "let", "j", "=", "0", ";", "this", ".", "mountpoints", ".", "forEach", "(", "(", "mountpoint", ")", "=>", "{", "if", "(", "file0", ".", "startsWith", "(", "mountpoint", ")", ")", "{", "i", "++", ";", "}", "if", "(", "file1", ".", "startsWith", "(", "mountpoint", ")", ")", "{", "j", "++", ";", "}", "}", ")", ";", "return", "i", "===", "j", ";", "}", "private", "copyFileApfs", "(", "src", ",", "dst", ")", "{", "return", "io", ".", "stat", "(", "src", ")", ".", "then", "(", "(", "stat", ")", "=>", "{", "if", "(", "stat", ".", "size", "<", "MB1", ")", "{", "return", "io", ".", "copyFile", "(", "src", ",", "dst", ",", "fse", ".", "constants", ".", "COPYFILE_FICLONE", ")", ";", "}", "const", "p0", "=", "cp", ".", "spawn", "(", "'cp'", ",", "[", "'-c'", ",", "src", ",", "dst", "]", ")", ";", "return", "new", "Promise", "(", "(", "resolve", ",", "reject", ")", "=>", "{", "p0", ".", "on", "(", "'exit'", ",", "(", "code", ")", "=>", "{", "if", "(", "code", "===", "0", ")", "{", "resolve", "(", ")", ";", "}", "else", "{", "reject", "(", "code", ")", ";", "}", "}", ")", ";", "}", ")", ";", "}", ")", ";", "}", "private", "copyFileRefs", "(", "src", ",", "dst", ")", "{", "return", "io", ".", "stat", "(", "src", ")", ".", "then", "(", "(", "stat", ")", "=>", "{", "if", "(", "stat", ".", "size", "<", "MB1", ")", "{", "return", "io", ".", "copyFile", "(", "src", ",", "dst", ",", "fse", ".", "constants", ".", "COPYFILE_FICLONE", ")", ";", "}", "let", "cloneFileViaBlockClonePs1", "=", "'Clone-FileViaBlockClone.ps1'", ";", "if", "(", "fse", ".", "pathExistsSync", "(", "join", "(", "dirname", "(", "process", ".", "execPath", ")", ",", "'resources'", ",", "cloneFileViaBlockClonePs1", ")", ")", ")", "{", "cloneFileViaBlockClonePs1", "=", "join", "(", "dirname", "(", "process", ".", "execPath", ")", ",", "'resources'", ",", "cloneFileViaBlockClonePs1", ")", ";", "}", "else", "if", "(", "fse", ".", "pathExistsSync", "(", "join", "(", "__dirname", ",", "'..'", ",", "'resources'", ",", "cloneFileViaBlockClonePs1", ")", ")", ")", "{", "cloneFileViaBlockClonePs1", "=", "join", "(", "__dirname", ",", "'..'", ",", "'resources'", ",", "cloneFileViaBlockClonePs1", ")", ";", "}", "else", "{", "console", ".", "warn", "(", "`unable to locate ${", "cloneFileViaBlockClonePs1", "}, fallback to fss.copyFile(..)`", ")", ";", "return", "io", ".", "copyFile", "(", "src", ",", "dst", ",", "fse", ".", "constants", ".", "COPYFILE_FICLONE", ")", ";", "}", "const", "p0", "=", "cp", ".", "spawn", "(", "'powershell.exe'", ",", "[", "cloneFileViaBlockClonePs1", ",", "src", ",", "dst", "]", ")", ";", "return", "new", "Promise", "(", "(", "resolve", ",", "reject", ")", "=>", "{", "p0", ".", "stdout", ".", "on", "(", "'data'", ",", "(", "data", ")", "=>", "console", ".", "log", "(", "data", ".", "toString", "(", ")", ")", ")", ";", "p0", ".", "stderr", ".", "on", "(", "'data'", ",", "(", "data", ")", "=>", "console", ".", "log", "(", "data", ".", "toString", "(", ")", ")", ")", ";", "p0", ".", "on", "(", "'exit'", ",", "(", "code", ")", "=>", "{", "if", "(", "code", "===", "0", ")", "{", "resolve", "(", ")", ";", "}", "else", "{", "reject", "(", "code", ")", ";", "}", "}", ")", ";", "}", ")", ";", "}", ")", ";", "}", "param", "src", "param", "dst", "copyFile", "(", "src", ",", "dst", ")", "{", "this", ".", "checkIfInitialized", "(", ")", ";", "const", "srcAndDstOnSameDrive", "=", "this", ".", "areFilesOnSameDrive", "(", "src", ",", "dst", ")", ";", "let", "filesystem", "=", "FILESYSTEM", ".", "OTHER", ";", "if", "(", "srcAndDstOnSameDrive", ")", "{", "for", "(", "const", "mountpoint", "of", "Array", ".", "from", "(", "this", ".", "mountpoints", ")", ")", "{", "if", "(", "src", ".", "startsWith", "(", "mountpoint", ")", ")", "{", "filesystem", "=", "this", ".", "drives", ".", "get", "(", "mountpoint", ")", ".", "filesystem", ";", "break", ";", "}", "}", "}", "switch", "(", "process", ".", "platform", ")", "{", "case", "'darwin'", ":", "if", "(", "srcAndDstOnSameDrive", "&&", "filesystem", "===", "FILESYSTEM", ".", "APFS", ")", "{", "return", "this", ".", "copyFileApfs", "(", "src", ",", "dst", ")", ";", "}", "case", "'win32'", ":", "if", "(", "srcAndDstOnSameDrive", "&&", "filesystem", "===", "FILESYSTEM", ".", "REFS", ")", "{", "return", "this", ".", "copyFileRefs", "(", "src", ",", "dst", ")", ";", "}", "case", "'linux'", ":", "return", "io", ".", "copyFile", "(", "src", ",", "dst", ",", "fse", ".", "constants", ".", "COPYFILE_FICLONE", ")", ";", "default", ":", "throw", "new", "Error", "(", "'Unsupported Operating System'", ")", ";", "}", "}", "param", "dir", "param", "relPaths", "param", "testIf", "throws", "performFileAccessCheck", "(", "dir", ",", "relPaths", ",", "testIf", ")", "{", "function", "checkAccess", "(", "absPaths", ")", "{", "const", "promises", "=", "[", "]", ";", "for", "(", "const", "absPath", "of", "absPaths", ")", "{", "promises", ".", "push", "(", "io", ".", "access", "(", "absPath", ",", "testIf", "===", "TEST_IF", ".", "FILE_CAN_BE_READ_FROM", "?", "fse", ".", "constants", ".", "R_OK", ":", "fse", ".", "constants", ".", "W_OK", ")", ")", ";", "}", "return", "Promise", ".", "all", "(", "promises", ")", ";", "}", "function", "checkWin32", "(", "relPaths", ")", "{", "const", "absPaths", "=", "relPaths", ".", "map", "(", "(", "p", ")", "=>", "join", "(", "dir", ",", "p", ")", ")", ";", "return", "checkAccess", "(", "absPaths", ")", ".", "then", "(", "(", ")", "=>", "{", "switch", "(", "testIf", ")", "{", "case", "TEST_IF", ".", "FILE_CAN_BE_READ_FROM", ":", "return", "checkReadAccess", "(", "absPaths", ",", "relPaths", ")", ";", "case", "TEST_IF", ".", "FILE_CAN_BE_WRITTEN_TO", ":", "default", ":", "if", "(", "absPaths", ".", "length", "<=", "5000", ")", "{", "return", "win32", ".", "checkWriteAccess", "(", "IoContext", ",", "absPaths", ")", ";", "}", "return", "Promise", ".", "resolve", "(", ")", ";", "}", "}", ")", ";", "}", "function", "checkUnixLike", "(", "relPaths", ")", "{", "const", "absPaths", "=", "relPaths", ".", "map", "(", "(", "p", ")", "=>", "join", "(", "dir", ",", "p", ")", ")", ";", "const", "checkIfFilesAreReallyBeingWritten", "=", "new", "Map", "<", "string", ",", "string", ">", "(", ")", ";", "return", "checkAccess", "(", "absPaths", ")", ".", "then", "(", "(", ")", "=>", "{", "return", "unix", ".", "whichFilesInDirAreOpen", "(", "dir", ")", ";", "}", ")", ".", "then", "(", "(", "fileHandles", ")", "=>", "{", "const", "zip", "=", "(", "a", ",", "b", ")", "=>", "a", ".", "map", "(", "(", "k", ",", "i", ")", "=>", "[", "k", ",", "b", "[", "i", "]", "]", ")", ";", "const", "errors", "=", "[", "]", ";", "for", "(", "const", "[", "absPath", ",", "relPath", "]", "of", "zip", "(", "absPaths", ",", "relPaths", ")", ")", "{", "const", "fhs", "=", "fileHandles", ".", "get", "(", "relPath", ")", ";", "if", "(", "fhs", ")", "{", "for", "(", "const", "fh", "of", "fhs", ")", "{", "switch", "(", "fh", ".", "lockType", ")", "{", "case", "unix", ".", "LOCKTYPE", ".", "READ_WRITE_LOCK_FILE", ":", "{", "checkIfFilesAreReallyBeingWritten", ".", "set", "(", "absPath", ",", "relPath", ")", ";", "break", ";", "}", "case", "unix", ".", "LOCKTYPE", ".", "WRITE_LOCK_FILE", ":", "case", "unix", ".", "LOCKTYPE", ".", "WRITE_LOCK_FILE_PART", ":", "{", "const", "msg", "=", "`File '${", "relPath", "}' is being written by ${", "fh", ".", "processname", "??", "'another process'", "}`", ";", "errors", ".", "push", "(", "new", "StacklessError", "(", "msg", ")", ")", ";", "break", ";", "}", "}", "}", "}", "}", "if", "(", "errors", ".", "length", ">", "0", ")", "{", "throw", "new", "AggregateError", "(", "errors", ")", ";", "}", "}", ")", ".", "then", "(", "(", ")", "=>", "{", "const", "absPaths", "=", "Array", ".", "from", "(", "checkIfFilesAreReallyBeingWritten", ".", "keys", "(", ")", ")", ";", "const", "relPaths", "=", "Array", ".", "from", "(", "checkIfFilesAreReallyBeingWritten", ".", "values", "(", ")", ")", ";", "return", "checkReadAccess", "(", "absPaths", ",", "relPaths", ")", ";", "}", ")", ".", "then", "(", "(", ")", "=>", "{", "}", ")", ";", "}", "switch", "(", "process", ".", "platform", ")", "{", "case", "'win32'", ":", "return", "checkWin32", "(", "relPaths", ")", ";", "case", "'darwin'", ":", "case", "'linux'", ":", "return", "checkUnixLike", "(", "relPaths", ")", ";", "default", ":", "throw", "new", "Error", "(", "'Unknown operating system'", ")", ";", "}", "}", "param", "absPaths", "static", "putToTrash", "(", "absPaths", ")", "{", "if", "(", "typeof", "absPaths", "===", "'string'", ")", "{", "absPaths", "=", "[", "absPaths", "]", ";", "}", "if", "(", "!", "Array", ".", "isArray", "(", "absPaths", ")", ")", "{", "return", "Promise", ".", "all", "(", "[", "]", ")", ";", "}", "absPaths", ".", "forEach", "(", "(", "absPath", ")", "=>", "{", "switch", "(", "process", ".", "platform", ")", "{", "case", "'win32'", ":", "{", "if", "(", "absPath", ".", "length", "<=", "3", ")", "{", "throw", "new", "Error", "(", "`cannot move '${", "absPath", "}' to trash`", ")", ";", "}", "break", ";", "}", "case", "'darwin'", ":", "case", "'linux'", ":", "{", "if", "(", "absPath", ".", "length", "<=", "1", ")", "{", "throw", "new", "Error", "(", "`cannot move '${", "absPath", "}' to trash`", ")", ";", "}", "break", ";", "}", "default", ":", "throw", "new", "Error", "(", "'Unsupported operating system'", ")", ";", "}", "}", ")", ";", "if", "(", "IoContext", ".", "trashExecutor", "&&", "typeof", "IoContext", ".", "trashExecutor", "!==", "'string'", ")", "{", "IoContext", ".", "trashExecutor", "(", "absPaths", ")", ";", "return", "Promise", ".", "all", "(", "[", "]", ")", ";", "}", "let", "trashPath", ";", "if", "(", "typeof", "IoContext", ".", "trashExecutor", "===", "'string'", ")", "{", "trashPath", "=", "IoContext", ".", "trashExecutor", ";", "}", "if", "(", "!", "trashPath", ")", "{", "switch", "(", "process", ".", "platform", ")", "{", "case", "'linux'", ":", "{", "return", "trash", "(", "absPaths", ")", ";", "}", "case", "'darwin'", ":", "{", "if", "(", "fse", ".", "pathExistsSync", "(", "join", "(", "dirname", "(", "process", ".", "execPath", ")", ",", "'resources'", ",", "'trash'", ")", ")", ")", "{", "trashPath", "=", "join", "(", "dirname", "(", "process", ".", "execPath", ")", ",", "'resources'", ",", "'trash'", ")", ";", "}", "else", "if", "(", "fse", ".", "pathExistsSync", "(", "join", "(", "__dirname", ",", "'..'", ",", "'resources'", ",", "'trash'", ")", ")", ")", "{", "trashPath", "=", "join", "(", "__dirname", ",", "'..'", ",", "'resources'", ",", "'trash'", ")", ";", "}", "else", "{", "throw", "new", "Error", "(", "'unable to locate trash executable'", ")", ";", "}", "break", ";", "}", "case", "'win32'", ":", "{", "if", "(", "fse", ".", "pathExistsSync", "(", "join", "(", "dirname", "(", "process", ".", "execPath", ")", ",", "'resources'", ",", "'recycle-bin.exe'", ")", ")", ")", "{", "trashPath", "=", "join", "(", "dirname", "(", "process", ".", "execPath", ")", ",", "'resources'", ",", "'recycle-bin.exe'", ")", ";", "}", "else", "if", "(", "fse", ".", "pathExistsSync", "(", "join", "(", "__dirname", ",", "'..'", ",", "'resources'", ",", "'recycle-bin.exe'", ")", ")", ")", "{", "trashPath", "=", "join", "(", "__dirname", ",", "'..'", ",", "'resources'", ",", "'recycle-bin.exe'", ")", ";", "}", "else", "{", "throw", "new", "Error", "(", "'unable to locate trash executable'", ")", ";", "}", "break", ";", "}", "default", ":", "{", "throw", "new", "Error", "(", "'Unknown operating system'", ")", ";", "}", "}", "}", "switch", "(", "process", ".", "platform", ")", "{", "case", "'darwin'", ":", "{", "const", "isOlderThanMountainLion", "=", "Number", "(", "os", ".", "release", "(", ")", ".", "split", "(", "'.'", ")", "[", "0", "]", ")", "<", "12", ";", "if", "(", "isOlderThanMountainLion", ")", "{", "throw", "new", "Error", "(", "'macOS 10.12 or later required'", ")", ";", "}", "break", ";", "}", "case", "'win32'", ":", "{", "break", ";", "}", "default", ":", "{", "throw", "new", "Error", "(", "'Unknown operating system'", ")", ";", "}", "}", "const", "chunks", "=", "[", "]", ";", "let", "currentSize", "=", "0", ";", "let", "currentChunk", "=", "[", "]", ";", "chunks", ".", "push", "(", "currentChunk", ")", ";", "for", "(", "const", "absPath", "of", "absPaths", ")", "{", "if", "(", "currentSize", "+", "absPath", ".", "length", "+", "1", ">", "4096", ")", "{", "currentSize", "=", "0", ";", "currentChunk", "=", "[", "]", ";", "chunks", ".", "push", "(", "currentChunk", ")", ";", "}", "currentSize", "+=", "absPath", ".", "length", "+", "1", ";", "currentChunk", ".", "push", "(", "absPath", ")", ";", "}", "return", "PromisePool", ".", "withConcurrency", "(", "8", ")", ".", "for", "(", "chunks", ")", ".", "handleError", "(", "(", "error", ")", "=>", "{", "throw", "error", ";", "}", ")", ".", "process", "(", "(", "path", ")", "=>", "{", "return", "new", "Promise", "<", "void", ">", "(", "(", "resolve", ",", "reject", ")", "=>", "{", "const", "proc", "=", "spawn", "(", "trashPath", ",", "path", ")", ";", "proc", ".", "on", "(", "'exit'", ",", "(", "code", ")", "=>", "{", "if", "(", "code", "===", "0", ")", "{", "resolve", "(", ")", ";", "}", "else", "{", "const", "stderr", "=", "proc", ".", "stderr", ".", "read", "(", ")", ";", "if", "(", "stderr", ")", "{", "reject", "(", "new", "Error", "(", "stderr", ".", "toString", "(", ")", ")", ")", ";", "}", "else", "{", "reject", "(", "new", "Error", "(", "'deleting files failed'", ")", ")", ";", "}", "}", "}", ")", ";", "}", ")", ";", "}", ")", ";", "}", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 29, null, 2, null, null, null, 104, null, null, null, null, null, null, null, null, null, null, null, null, 701, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 5, null, 5, null, null, null, 5, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 19, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, 5, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, 5, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 4, null, null, null, null, 2, null, null, null, null, 2, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, 29, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 4, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 19, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 2, null, null, null, 7003, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 4, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, 3, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, 2, null, 2, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 2, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, 21745, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 4, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 2, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, 21745, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 4, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 2, null, 2, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 2, null, 5, null, 0, null, null, null, 7, null, 5, null, null, null, 5, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 5, null, null, null, 5, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, 19, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 19, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7003, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, 3, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, 4, null, 4, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1358
[ "import", "*", "as", "fse", "from", "'fs-extra'", ";", "import", "{", "difference", "}", "from", "'lodash'", ";", "import", "{", "isAbsolute", ",", "join", ",", "relative", ",", "basename", ",", "}", "from", "'./path'", ";", "import", "*", "as", "io", "from", "'./io'", ";", "import", "*", "as", "fss", "from", "'./fs-safe'", ";", "import", "{", "IoContext", ",", "TEST_IF", "}", "from", "'./io_context'", ";", "import", "{", "Odb", "}", "from", "'./odb'", ";", "import", "{", "Repository", "}", "from", "'./repository'", ";", "import", "{", "DirItem", ",", "OSWALK", ",", "osWalk", "}", "from", "'./io'", ";", "import", "{", "FileInfo", "}", "from", "'./common'", ";", "import", "PromisePool", "=", "require", "(", "'@supercharge/promise-pool'", ")", ";", "/**\n * Used in [[Index.writeFiles]]. Used to control certain behaviours\n * when files are written to disk.\n */", "export", "enum", "WRITE", "{", "NONE", "=", "0", ",", "/**\n * By default filelocks are checked to ensure none of the given files\n * is being written by another process. Using this flag skips this check.\n */", "SKIP_FILELOCK_CHECKS", "=", "1", "}", "/**\n * A class representing a list of files that is used to create a new Commit object.\n * Every repository contains an individual instance of the Index class which can\n * be acquired by [[Repository.getIndex]]. Files can be then added to, or removed from,\n * the index which is then passed to [[Repository.createCommit]] to create a new commit.\n */", "export", "class", "Index", "{", "/**\n * The repository this instance belongs to.\n */", "repo", ":", "Repository", ";", "/**\n * The object database. Same as [[Repository.getOdb]].\n */", "odb", ":", "Odb", ";", "/**\n * Unique id for the index, used in the filename of the index\n */", "id", ":", "string", ";", "/** Hash map of added files that were written to the odb. Empty by default, and filled\n * after [[Index.writeFiles]] has been called and the hashes of the files have been calculated.\n */", "processedAdded", "=", "new", "Map", "<", "string", ",", "FileInfo", ">", "(", ")", ";", "/**\n * A set of filepaths of new files that will be part of the new commit.\n */", "addRelPaths", ":", "Set", "<", "string", ">", "=", "new", "Set", "(", ")", ";", "/**\n * A set of filepaths of new files that will be removed from the new commit.\n */", "deleteRelPaths", ":", "Set", "<", "string", ">", "=", "new", "Set", "(", ")", ";", "constructor", "(", "repo", ",", "odb", ",", "id", "=", "''", ")", "{", "this", ".", "repo", "=", "repo", ";", "this", ".", "id", "=", "id", ";", "this", ".", "odb", "=", "odb", ";", "}", "/**\n * Reset the entire index object. Used internally after a commit has been created,\n * or can be useful to discard any added or deleted files from the index object.\n */", "invalidate", "(", ")", "{", "if", "(", "this", ".", "repo", ")", "{", "return", "io", ".", "pathExists", "(", "this", ".", "getAbsPath", "(", ")", ")", ".", "then", "(", "(", "exists", ")", "=>", "{", "if", "(", "exists", ")", "{", "return", "fse", ".", "unlink", "(", "this", ".", "getAbsPath", "(", ")", ")", ";", "}", "}", ")", ".", "then", "(", "(", ")", "=>", "{", "this", ".", "repo", ".", "removeIndex", "(", "this", ")", ";", "this", ".", "addRelPaths", "=", "new", "Set", "(", ")", ";", "this", ".", "deleteRelPaths", "=", "new", "Set", "(", ")", ";", "this", ".", "processedAdded", ".", "clear", "(", ")", ";", "this", ".", "id", "=", "undefined", ";", "this", ".", "repo", "=", "null", ";", "this", ".", "odb", "=", "null", ";", "}", ")", ";", "}", "}", "throws", "throwIfNotValid", "(", ")", "{", "if", "(", "!", "this", ".", "id", "&&", "this", ".", "id", "!==", "''", ")", "{", "throw", "new", "Error", "(", "'index object is invalid'", ")", ";", "}", "}", "returns", "static", "getAbsDir", "(", "repo", ")", "{", "const", "indexDir", "=", "join", "(", "repo", ".", "commondir", "(", ")", ",", "'indexes'", ")", ";", "return", "indexDir", ";", "}", "returns", "getAbsPath", "(", ")", "{", "const", "indexPath", "=", "join", "(", "Index", ".", "getAbsDir", "(", "this", ".", "repo", ")", ",", "this", ".", "id", "?", "`index.${", "this", ".", "id", "}`", ":", "'index'", ")", ";", "return", "indexPath", ";", "}", "/**\n * Store the index object to disk. Saved to {workdir}/.snow/index/..\n */", "private", "save", "(", ")", "{", "this", ".", "throwIfNotValid", "(", ")", ";", "const", "processed", "=", "Array", ".", "from", "(", "this", ".", "processedAdded", ".", "entries", "(", ")", ")", ".", "map", "(", "(", "res", ")", "=>", "{", "const", "size", "=", "res", "[", "1", "]", ".", "stat", ".", "size", ";", "const", "ctime", "=", "res", "[", "1", "]", ".", "stat", ".", "ctime", ".", "getTime", "(", ")", ";", "const", "mtime", "=", "res", "[", "1", "]", ".", "stat", ".", "mtime", ".", "getTime", "(", ")", ";", "const", "birthtime", "=", "res", "[", "1", "]", ".", "stat", ".", "birthtime", ".", "getTime", "(", ")", ";", "return", "{", "name", ":", "res", "[", "0", "]", ",", "hash", ":", "res", "[", "1", "]", ".", "hash", ",", "ext", ":", "res", "[", "1", "]", ".", "ext", ",", "stat", ":", "{", "size", ",", "ctime", ",", "mtime", ",", "birthtime", ",", "}", ",", "}", ";", "}", ")", ";", "const", "userData", "=", "JSON", ".", "stringify", "(", "{", "adds", ":", "Array", ".", "from", "(", "this", ".", "addRelPaths", ")", ",", "deletes", ":", "Array", ".", "from", "(", "this", ".", "deleteRelPaths", ")", ",", "processed", ",", "}", ")", ";", "return", "fse", ".", "ensureDir", "(", "Index", ".", "getAbsDir", "(", "this", ".", "repo", ")", ")", ".", "then", "(", "(", ")", "=>", "fss", ".", "writeSafeFile", "(", "this", ".", "getAbsPath", "(", ")", ",", "userData", ")", ")", ".", "then", "(", "(", ")", "=>", "this", ".", "repo", ".", "modified", "(", ")", ")", ";", "}", "/**\n * Load a saved index object from `{workdir}/.snow/index/..`.\n * If the index wasn't saved before, the function does not fail.\n */", "static", "loadAll", "(", "repo", ",", "odb", ")", "{", "return", "fse", ".", "ensureDir", "(", "Index", ".", "getAbsDir", "(", "repo", ")", ")", ".", "then", "(", "(", ")", "=>", "osWalk", "(", "Index", ".", "getAbsDir", "(", "repo", ")", ",", "OSWALK", ".", "FILES", ")", ")", ".", "then", "(", "(", "dirItems", ")", "=>", "{", "const", "readIndexes", "=", "[", "]", ";", "for", "(", "const", "dirItem", "of", "dirItems", ")", "{", "const", "indexName", "=", "basename", "(", "dirItem", ".", "absPath", ")", ";", "if", "(", "indexName", ".", "startsWith", "(", "'index'", ")", "||", "indexName", "===", "'index'", ")", "{", "readIndexes", ".", "push", "(", "fse", ".", "readFile", "(", "dirItem", ".", "absPath", ")", ".", "then", "(", "(", "buf", ")", "=>", "[", "dirItem", ".", "absPath", ",", "buf", "]", ")", ")", ";", "}", "}", "return", "Promise", ".", "all", "(", "readIndexes", ")", ";", "}", ")", ".", "then", "(", "(", "promises", ")", "=>", "{", "const", "parseIndexes", "=", "[", "]", ";", "for", "(", "const", "parseIndex", "of", "promises", ")", "{", "const", "indexName", "=", "basename", "(", "parseIndex", "[", "0", "]", ")", ";", "const", "isMainIndex", "=", "indexName", "===", "'index'", ";", "const", "index", "=", "new", "Index", "(", "repo", ",", "odb", ",", "isMainIndex", "?", "''", ":", "indexName", ".", "substr", "(", "6", ",", "indexName", ".", "length", "-", "6", ")", ")", ";", "const", "content", "=", "parseIndex", "[", "1", "]", ".", "toString", "(", ")", ";", "const", "json", "=", "JSON", ".", "parse", "(", "content", ")", ";", "index", ".", "addRelPaths", "=", "new", "Set", "(", "json", ".", "adds", ")", ";", "index", ".", "deleteRelPaths", "=", "new", "Set", "(", "json", ".", "deletes", ")", ";", "index", ".", "processedAdded", "=", "new", "Map", "(", "json", ".", "processed", ".", "map", "(", "(", "item", ")", "=>", "{", "const", "size", "=", "item", ".", "stat", ".", "size", ";", "const", "ctime", "=", "new", "Date", "(", "item", ".", "stat", ".", "ctime", ")", ";", "const", "mtime", "=", "new", "Date", "(", "item", ".", "stat", ".", "mtime", ")", ";", "const", "birthtime", "=", "new", "Date", "(", "item", ".", "stat", ".", "birthtime", ")", ";", "return", "[", "item", ".", "name", ",", "{", "hash", ":", "item", ".", "hash", ",", "ext", ":", "item", ".", "ext", ",", "stat", ":", "{", "size", ",", "ctime", ",", "mtime", ",", "birthtime", ",", "}", ",", "}", "]", ";", "}", ")", ")", ";", "parseIndexes", ".", "push", "(", "index", ")", ";", "}", "return", "parseIndexes", ";", "}", ")", ";", "}", "param", "filepaths", "addFiles", "(", "filepaths", ")", "{", "this", ".", "throwIfNotValid", "(", ")", ";", "for", "(", "const", "filepath", "of", "filepaths", ")", "{", "const", "relPath", "=", "isAbsolute", "(", "filepath", ")", "?", "relative", "(", "this", ".", "repo", ".", "workdir", "(", ")", ",", "filepath", ")", ":", "filepath", ";", "if", "(", "!", "this", ".", "processedAdded", ".", "has", "(", "relPath", ")", ")", "{", "this", ".", "addRelPaths", ".", "add", "(", "relPath", ")", ";", "}", "}", "}", "param", "filepaths", "deleteFiles", "(", "filepaths", ")", "{", "this", ".", "throwIfNotValid", "(", ")", ";", "for", "(", "const", "filepath", "of", "filepaths", ")", "{", "const", "relPath", "=", "isAbsolute", "(", "filepath", ")", "?", "relative", "(", "this", ".", "repo", ".", "workdir", "(", ")", ",", "filepath", ")", ":", "filepath", ";", "if", "(", "!", "this", ".", "processedAdded", ".", "has", "(", "relPath", ")", ")", "{", "this", ".", "deleteRelPaths", ".", "add", "(", "relPath", ")", ";", "}", "}", "}", "/**\n * Hashes of files. Filled after [[Index.writeFiles]] has been called.\n */", "getFileProcessedMap", "(", ")", "{", "this", ".", "throwIfNotValid", "(", ")", ";", "return", "this", ".", "processedAdded", ";", "}", "/**\n * Write files to object database. Needed before a commit can be made.\n */", "writeFiles", "(", "flags", "=", "WRITE", ".", "NONE", ")", "{", "this", ".", "throwIfNotValid", "(", ")", ";", "const", "ioContext", "=", "new", "IoContext", "(", ")", ";", "let", "unprocessedRelItems", "=", "[", "]", ";", "return", "ioContext", ".", "init", "(", ")", ".", "then", "(", "(", ")", "=>", "{", "const", "relPaths", "=", "difference", "(", "Array", ".", "from", "(", "this", ".", "addRelPaths", ")", ",", "Array", ".", "from", "(", "this", ".", "deleteRelPaths", ")", ")", ";", "unprocessedRelItems", "=", "relPaths", ".", "filter", "(", "(", "p", ")", "=>", "!", "this", ".", "processedAdded", ".", "has", "(", "p", ")", ")", ";", "if", "(", "flags", "&", "WRITE", ".", "SKIP_FILELOCK_CHECKS", ")", "{", "return", "Promise", ".", "resolve", "(", ")", ";", "}", "return", "ioContext", ".", "performFileAccessCheck", "(", "this", ".", "repo", ".", "workdir", "(", ")", ",", "unprocessedRelItems", ",", "TEST_IF", ".", "FILE_CAN_BE_READ_FROM", ")", ";", "}", ")", ".", "then", "(", "(", ")", "=>", "{", "return", "PromisePool", ".", "withConcurrency", "(", "32", ")", ".", "for", "(", "unprocessedRelItems", ")", ".", "handleError", "(", "(", "error", ")", "=>", "{", "throw", "error", ";", "}", ")", ".", "process", "(", "(", "relFilePath", ")", "=>", "{", "const", "filepathAbs", "=", "join", "(", "this", ".", "repo", ".", "repoWorkDir", ",", "relFilePath", ")", ";", "return", "this", ".", "odb", ".", "writeObject", "(", "filepathAbs", ",", "ioContext", ")", ";", "}", ")", ";", "}", ")", ".", "then", "(", "(", "res", ")", "=>", "{", "ioContext", ".", "invalidate", "(", ")", ";", "for", "(", "const", "r", "of", "res", ".", "results", ")", "{", "this", ".", "processedAdded", ".", "set", "(", "r", ".", "file", ",", "r", ".", "fileinfo", ")", ";", "}", "return", "this", ".", "save", "(", ")", ";", "}", ")", ";", "}", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 112, null, 46500, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, 112, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 112, null, 46500, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, 5, null, null, null, null, null, null, null, 19661, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 12, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, 5, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, 488, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, 26, null, null, null, null, null, null, null, null, null, null, null, null, 26, null, null, null, null, null, null, null, null, null, null, null, null, 26, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 5, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 5, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 19, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1359
[ "import", "*", "as", "fse", "from", "'fs-extra'", ";", "import", "*", "as", "readline", "from", "'readline'", ";", "import", "{", "isAbsolute", ",", "join", ",", "resolve", ",", "relative", ",", "normalize", ",", "}", "from", "'./src/path'", ";", "import", "{", "Index", "}", "from", "'./src/index'", ";", "import", "{", "Commit", "}", "from", "'./src/commit'", ";", "import", "{", "Reference", "}", "from", "'./src/reference'", ";", "import", "{", "StatusEntry", ",", "FILTER", ",", "Repository", ",", "RESET", ",", "COMMIT_ORDER", ",", "REFERENCE_TYPE", ",", "}", "from", "'./src/repository'", ";", "import", "{", "TreeDir", ",", "TreeEntry", ",", "TreeFile", "}", "from", "'./src/treedir'", ";", "import", "{", "IoContext", "}", "from", "'./src/io_context'", ";", "const", "program", "=", "require", "(", "'commander'", ")", ";", "const", "chalk", "=", "require", "(", "'chalk'", ")", ";", "const", "drivelist", "=", "require", "(", "'drivelist'", ")", ";", "const", "AggregateError", "=", "require", "(", "'es-aggregate-error'", ")", ";", "const", "versionString", "=", "'0.9.2'", ";", "function", "fileMatch", "(", "relFilepath", ",", "relCwd", ",", "pathPattern", ")", "{", "return", "pathPattern", "===", "'*'", "||", "(", "pathPattern", "===", "'.'", "&&", "relFilepath", ".", "startsWith", "(", "relCwd", ")", ")", "||", "pathPattern", "===", "relative", "(", "relCwd", ",", "relFilepath", ")", ";", "}", "param", "index", "function", "getIndex", "(", "repo", ",", "index", ")", "{", "if", "(", "index", "===", "'create'", ")", "{", "const", "i", "=", "repo", ".", "createIndex", "(", ")", ";", "console", ".", "log", "(", "`Created new index: [${", "i", ".", "id", "}]`", ")", ";", "return", "i", ";", "}", "if", "(", "index", ")", "{", "const", "i", "=", "repo", ".", "getIndex", "(", "index", ")", ";", "if", "(", "!", "i", ")", "{", "throw", "new", "Error", "(", "`unknown index: ${", "index", "}`", ")", ";", "}", "return", "i", ";", "}", "return", "repo", ".", "ensureMainIndex", "(", ")", ";", "}", "param", "opts", "return", "async", "function", "parseOptions", "(", "opts", ")", "{", "let", "tmp", ";", "if", "(", "opts", ".", "input", ")", "{", "if", "(", "opts", ".", "input", "===", "'stdin'", ")", "{", "const", "rl", "=", "readline", ".", "createInterface", "(", "{", "input", ":", "process", ".", "stdin", ",", "output", ":", "process", ".", "stdout", ",", "}", ")", ";", "let", "res", ";", "rl", ".", "question", "(", "''", ",", "(", "answer", ")", "=>", "{", "res", "=", "answer", ";", "rl", ".", "close", "(", ")", ";", "}", ")", ";", "tmp", "=", "await", "new", "Promise", "<", "string", ">", "(", "(", "resolve", ")", "=>", "{", "rl", ".", "on", "(", "'close'", ",", "(", ")", "=>", "{", "resolve", "(", "res", ")", ";", "}", ")", ";", "}", ")", ";", "}", "else", "{", "const", "buf", "=", "fse", ".", "readFileSync", "(", "opts", ".", "input", ")", ";", "tmp", "=", "buf", ".", "toString", "(", ")", ";", "}", "}", "else", "{", "return", "opts", ";", "}", "const", "splitOpts", "=", "tmp", ".", "split", "(", "'\\r\\n\\r\\n\\r\\n\\r\\n'", ")", ";", "for", "(", "const", "splitOpt", "of", "splitOpts", ")", "{", "if", "(", "!", "splitOpt", ".", "startsWith", "(", "'--'", ")", ")", "{", "throw", "new", "Error", "(", "\"option must start with '--', e.g. --option: value\"", ")", ";", "}", "const", "parsed", "=", "splitOpt", ".", "match", "(", "/--([\\w-]+):/g", ")", ";", "if", "(", "!", "parsed", ")", "{", "throw", "new", "Error", "(", "`option '${", "parsed", "}' is invalid`", ")", ";", "}", "const", "parsedOption", "=", "parsed", "[", "0", "]", ".", "substr", "(", "2", ",", "parsed", "[", "0", "]", ".", "length", "-", "3", ")", ".", "replace", "(", "/-([a-z])/g", ",", "(", "g", ")", "=>", "g", "[", "1", "]", ".", "toUpperCase", "(", ")", ")", ";", "opts", "[", "parsedOption", "]", "=", "splitOpt", ".", "substring", "(", "parsed", "[", "0", "]", ".", "length", ",", "splitOpt", ".", "length", ")", ".", "replace", "(", "/^[\\n|\\s]*/", ",", "''", ")", ".", "replace", "(", "/[\\n|\\s]*$/", ",", "''", ")", ";", "}", "return", "opts", ";", "}", "program", ".", "version", "(", "versionString", ")", ".", "description", "(", "'SnowFS - a fast, scalable version control file storage for graphic files.'", ")", ";", "program", ".", "command", "(", "'init [path] [commondir]'", ")", ".", "option", "(", "'--debug'", ",", "'add more debug information on errors'", ")", ".", "description", "(", "'initialize a SnowFS repository'", ")", ".", "action", "(", "async", "(", "path", ",", "commondir", "?", ",", "opts", "?", ")", "=>", "{", "const", "repoPath", "=", "path", "??", "'.'", ";", "try", "{", "await", "Repository", ".", "initExt", "(", "repoPath", ",", "{", "commondir", ",", "additionalConfig", ":", "{", "creator", ":", "'snowfs-cli'", ",", "version", ":", "versionString", ",", "}", ",", "}", ")", ";", "}", "catch", "(", "error", ")", "{", "if", "(", "opts", ".", "debug", ")", "{", "throw", "error", ";", "}", "else", "{", "if", "(", "error", "instanceof", "AggregateError", ")", "{", "process", ".", "stderr", ".", "write", "(", "`fatal: ${", "error", ".", "errors", ".", "map", "(", "(", "e", ")", "=>", "e", ".", "message", ")", ".", "join", "(", "'\\n'", ")", "}`", ")", ";", "}", "else", "{", "process", ".", "stderr", ".", "write", "(", "`fatal: ${", "error", ".", "message", "}\\n`", ")", ";", "}", "process", ".", "exit", "(", "-", "1", ")", ";", "}", "}", "console", ".", "log", "(", "`Initialized empty SnowFS repository at ${", "resolve", "(", "repoPath", ")", "}`", ")", ";", "}", ")", ";", "program", ".", "command", "(", "'rm [path]'", ")", ".", "option", "(", "'--index [id]'", ",", "'use a custom index id'", ")", ".", "option", "(", "'--debug'", ",", "'add more debug information on errors'", ")", ".", "description", "(", "'Remove files from the working tree and from the index'", ")", ".", "action", "(", "async", "(", "path", ",", "opts", "?", ")", "=>", "{", "try", "{", "const", "repo", "=", "await", "Repository", ".", "open", "(", "normalize", "(", "process", ".", "cwd", "(", ")", ")", ")", ";", "const", "filepathAbs", "=", "isAbsolute", "(", "path", ")", "?", "path", ":", "join", "(", "repo", ".", "workdir", "(", ")", ",", "path", ")", ";", "fse", ".", "statSync", "(", "filepathAbs", ")", ";", "await", "IoContext", ".", "putToTrash", "(", "filepathAbs", ")", ";", "const", "index", "=", "getIndex", "(", "repo", ",", "opts", ".", "index", ")", ";", "index", ".", "deleteFiles", "(", "[", "path", "]", ")", ";", "await", "index", ".", "writeFiles", "(", ")", ";", "}", "catch", "(", "error", ")", "{", "if", "(", "opts", ".", "debug", ")", "{", "throw", "error", ";", "}", "else", "{", "if", "(", "error", "instanceof", "AggregateError", ")", "{", "process", ".", "stderr", ".", "write", "(", "`fatal: ${", "error", ".", "errors", ".", "map", "(", "(", "e", ")", "=>", "e", ".", "message", ")", ".", "join", "(", "'\\n'", ")", "}`", ")", ";", "}", "else", "{", "process", ".", "stderr", ".", "write", "(", "`fatal: ${", "error", ".", "message", "}\\n`", ")", ";", "}", "process", ".", "exit", "(", "-", "1", ")", ";", "}", "}", "}", ")", ";", "program", ".", "command", "(", "'add <path>'", ")", ".", "option", "(", "'--index [id]'", ",", "'use a custom index id'", ")", ".", "option", "(", "'--debug'", ",", "'add more debug information on errors'", ")", ".", "description", "(", "'add file contents to the index'", ")", ".", "action", "(", "async", "(", "pathPattern", ",", "opts", "?", ")", "=>", "{", "try", "{", "const", "repo", "=", "await", "Repository", ".", "open", "(", "normalize", "(", "process", ".", "cwd", "(", ")", ")", ")", ";", "const", "statusFiles", "=", "await", "repo", ".", "getStatus", "(", "FILTER", ".", "INCLUDE_MODIFIED", "|", "FILTER", ".", "INCLUDE_DELETED", "|", "FILTER", ".", "INCLUDE_UNTRACKED", ")", ";", "const", "relCwd", "=", "relative", "(", "repo", ".", "workdir", "(", ")", ",", "normalize", "(", "process", ".", "cwd", "(", ")", ")", ")", ";", "const", "index", "=", "getIndex", "(", "repo", ",", "opts", ".", "index", ")", ";", "for", "(", "const", "file", "of", "statusFiles", ")", "{", "if", "(", "file", ".", "isNew", "(", ")", "||", "file", ".", "isModified", "(", ")", ")", "{", "if", "(", "fileMatch", "(", "file", ".", "path", ",", "relCwd", ",", "pathPattern", ")", ")", "{", "index", ".", "addFiles", "(", "[", "file", ".", "path", "]", ")", ";", "}", "}", "}", "for", "(", "const", "file", "of", "statusFiles", ")", "{", "if", "(", "file", ".", "isDeleted", "(", ")", ")", "{", "if", "(", "fileMatch", "(", "file", ".", "path", ",", "relCwd", ",", "pathPattern", ")", ")", "{", "index", ".", "deleteFiles", "(", "[", "file", ".", "path", "]", ")", ";", "}", "}", "}", "await", "index", ".", "writeFiles", "(", ")", ";", "}", "catch", "(", "error", ")", "{", "if", "(", "opts", ".", "debug", ")", "{", "throw", "error", ";", "}", "else", "{", "if", "(", "error", "instanceof", "AggregateError", ")", "{", "process", ".", "stderr", ".", "write", "(", "`fatal: ${", "error", ".", "errors", ".", "map", "(", "(", "e", ")", "=>", "e", ".", "message", ")", ".", "join", "(", "'\\n'", ")", "}`", ")", ";", "}", "else", "{", "process", ".", "stderr", ".", "write", "(", "`fatal: ${", "error", ".", "message", "}\\n`", ")", ";", "}", "process", ".", "exit", "(", "-", "1", ")", ";", "}", "}", "}", ")", ";", "program", ".", "command", "(", "'branch [branch-name] [start-point]'", ")", ".", "option", "(", "'--debug'", ",", "'add more debug information on errors'", ")", ".", "option", "(", "'--delete'", ",", "'delete a branch'", ")", ".", "option", "(", "'--no-color'", ")", ".", "option", "(", "'--user-data'", ",", "'open standard input to apply user data for commit'", ")", ".", "option", "(", "'--input <type>'", ",", "\"type can be 'stdin' or {filepath}\"", ")", ".", "description", "(", "'create a new branch'", ")", ".", "action", "(", "async", "(", "branchName", ",", "startPoint", ",", "opts", ")", "=>", "{", "if", "(", "opts", ".", "noColor", ")", "{", "chalk", ".", "level", "=", "0", ";", "}", "try", "{", "opts", "=", "await", "parseOptions", "(", "opts", ")", ";", "const", "repo", "=", "await", "Repository", ".", "open", "(", "normalize", "(", "process", ".", "cwd", "(", ")", ")", ")", ";", "if", "(", "opts", ".", "delete", ")", "{", "if", "(", "startPoint", ")", "{", "throw", "new", "Error", "(", "'start-point must be empty'", ")", ";", "}", "const", "oldTarget", "=", "await", "repo", ".", "deleteReference", "(", "REFERENCE_TYPE", ".", "BRANCH", ",", "branchName", ")", ";", "console", ".", "log", "(", "`Deleted branch '${", "branchName", "}' (was ${", "oldTarget", "})`", ")", ";", "}", "else", "{", "let", "data", "=", "{", "}", ";", "if", "(", "opts", ".", "userData", ")", "{", "try", "{", "data", "=", "JSON", ".", "parse", "(", "opts", ".", "userData", ")", ";", "}", "catch", "(", "e", ")", "{", "throw", "new", "Error", "(", "`invalid user-data: ${", "e", "}`", ")", ";", "}", "}", "await", "repo", ".", "createNewReference", "(", "REFERENCE_TYPE", ".", "BRANCH", ",", "branchName", ",", "startPoint", ",", "data", ")", ";", "console", ".", "log", "(", "`A branch '${", "branchName", "}' got created.`", ")", ";", "}", "}", "catch", "(", "error", ")", "{", "if", "(", "opts", ".", "debug", ")", "{", "throw", "error", ";", "}", "else", "{", "if", "(", "error", "instanceof", "AggregateError", ")", "{", "process", ".", "stderr", ".", "write", "(", "`fatal: ${", "error", ".", "errors", ".", "map", "(", "(", "e", ")", "=>", "e", ".", "message", ")", ".", "join", "(", "'\\n'", ")", "}`", ")", ";", "}", "else", "{", "process", ".", "stderr", ".", "write", "(", "`fatal: ${", "error", ".", "message", "}\\n`", ")", ";", "}", "process", ".", "exit", "(", "-", "1", ")", ";", "}", "}", "}", ")", ";", "program", ".", "command", "(", "'checkout [target]'", ")", ".", "option", "(", "'--discard-changes'", ",", "'force switch and discard changes in workdir'", ")", ".", "option", "(", "'-k, --keep-changes'", ",", "\"don't reset files in the workdir\"", ")", ".", "option", "(", "'--debug'", ",", "'add more debug information on errors'", ")", ".", "option", "(", "'--no-color'", ")", ".", "option", "(", "'--user-data'", ",", "'open standard input to apply user data for commit'", ")", ".", "option", "(", "'--input <type>'", ",", "\"type can be 'stdin' or {filepath}\"", ")", ".", "description", "(", "'checkout a commit'", ")", ".", "action", "(", "async", "(", "target", ",", "opts", ")", "=>", "{", "if", "(", "opts", ".", "noColor", ")", "{", "chalk", ".", "level", "=", "0", ";", "}", "try", "{", "opts", "=", "await", "parseOptions", "(", "opts", ")", ";", "const", "repo", "=", "await", "Repository", ".", "open", "(", "normalize", "(", "process", ".", "cwd", "(", ")", ")", ")", ";", "const", "targetCommit", "=", "repo", ".", "findCommitByHash", "(", "target", ")", ";", "if", "(", "!", "targetCommit", ")", "{", "if", "(", "repo", ".", "findCommitByReferenceName", "(", "REFERENCE_TYPE", ".", "BRANCH", ",", "target", ")", ")", "{", "throw", "new", "Error", "(", "`target ${", "target", "} seems to be a branch and must be checked out via 'snow switch'`", ")", ";", "}", "throw", "new", "Error", "(", "`cannot find commit '${", "target", "}'`", ")", ";", "}", "if", "(", "target", ")", "{", "if", "(", "opts", ".", "discardChanges", "&&", "opts", ".", "keepChanges", ")", "{", "throw", "new", "Error", "(", "'either --discard-changes or --keep-changes can be used, not both'", ")", ";", "}", "else", "if", "(", "!", "opts", ".", "discardChanges", "&&", "!", "opts", ".", "keepChanges", ")", "{", "const", "statusFiles", "=", "await", "repo", ".", "getStatus", "(", "FILTER", ".", "INCLUDE_UNTRACKED", "|", "FILTER", ".", "INCLUDE_MODIFIED", ")", ";", "let", "criticalChanges", "=", "0", ";", "for", "(", "const", "statusFile", "of", "statusFiles", ")", "{", "if", "(", "statusFile", ".", "isModified", "(", ")", ")", "{", "process", ".", "stdout", ".", "write", "(", "`M ${", "statusFile", ".", "path", "}\\n`", ")", ";", "criticalChanges", "++", ";", "}", "else", "if", "(", "statusFile", ".", "isNew", "(", ")", ")", "{", "process", ".", "stdout", ".", "write", "(", "`A ${", "statusFile", ".", "path", "}\\n`", ")", ";", "criticalChanges", "++", ";", "}", "}", "if", "(", "criticalChanges", ">", "0", ")", "{", "throw", "new", "Error", "(", "`You have local changes to '${", "target", "}'; not switching branches.`", ")", ";", "}", "}", "let", "reset", "=", "RESET", ".", "DETACH", ";", "if", "(", "!", "opts", ".", "keepChanges", ")", "{", "reset", "|=", "RESET", ".", "RESTORE_MODIFIED_ITEMS", "|", "RESET", ".", "DELETE_NEW_ITEMS", "|", "RESET", ".", "RESTORE_DELETED_ITEMS", ";", "}", "await", "repo", ".", "checkout", "(", "target", ",", "reset", ")", ";", "}", "}", "catch", "(", "error", ")", "{", "if", "(", "opts", ".", "debug", ")", "{", "throw", "error", ";", "}", "else", "{", "if", "(", "error", "instanceof", "AggregateError", ")", "{", "process", ".", "stderr", ".", "write", "(", "`fatal: ${", "error", ".", "errors", ".", "map", "(", "(", "e", ")", "=>", "e", ".", "message", ")", ".", "join", "(", "'\\n'", ")", "}`", ")", ";", "}", "else", "{", "process", ".", "stderr", ".", "write", "(", "`fatal: ${", "error", ".", "message", "}\\n`", ")", ";", "}", "process", ".", "exit", "(", "-", "1", ")", ";", "}", "}", "}", ")", ";", "program", ".", "command", "(", "'index [command]'", ")", ".", "action", "(", "async", "(", "command", ",", "opts", ")", "=>", "{", "try", "{", "const", "repo", "=", "await", "Repository", ".", "open", "(", "normalize", "(", "process", ".", "cwd", "(", ")", ")", ")", ";", "if", "(", "command", "===", "'create'", ")", "{", "const", "index", "=", "repo", ".", "createIndex", "(", ")", ";", "await", "index", ".", "writeFiles", "(", ")", ";", "console", ".", "log", "(", "`Created new index: [${", "index", ".", "id", "}]`", ")", ";", "}", "}", "catch", "(", "error", ")", "{", "if", "(", "opts", ".", "debug", ")", "{", "throw", "error", ";", "}", "else", "{", "if", "(", "error", "instanceof", "AggregateError", ")", "{", "process", ".", "stderr", ".", "write", "(", "`fatal: ${", "error", ".", "errors", ".", "map", "(", "(", "e", ")", "=>", "e", ".", "message", ")", ".", "join", "(", "'\\n'", ")", "}`", ")", ";", "}", "else", "{", "process", ".", "stderr", ".", "write", "(", "`fatal: ${", "error", ".", "message", "}\\n`", ")", ";", "}", "process", ".", "exit", "(", "-", "1", ")", ";", "}", "}", "}", ")", ";", "program", ".", "command", "(", "'status'", ")", ".", "option", "(", "'--no-color'", ")", ".", "option", "(", "'--output [format]'", ",", "\"currently supported output formats 'json', 'json-pretty'\"", ")", ".", "option", "(", "'--index [id]'", ",", "'use a custom index id'", ")", ".", "option", "(", "'--debug'", ",", "'add more debug information on errors'", ")", ".", "description", "(", "'show the working tree status'", ")", ".", "action", "(", "async", "(", "opts", ")", "=>", "{", "if", "(", "opts", ".", "noColor", ")", "{", "chalk", ".", "level", "=", "0", ";", "}", "try", "{", "const", "repo", "=", "await", "Repository", ".", "open", "(", "normalize", "(", "process", ".", "cwd", "(", ")", ")", ")", ";", "const", "statuses", "=", "await", "repo", ".", "getStatus", "(", "FILTER", ".", "INCLUDE_MODIFIED", "|", "FILTER", ".", "INCLUDE_DELETED", "|", "FILTER", ".", "INCLUDE_UNTRACKED", "|", "FILTER", ".", "INCLUDE_DIRECTORIES", ")", ";", "const", "newe", "=", "[", "]", ";", "const", "modified", "=", "[", "]", ";", "const", "deleted", "=", "[", "]", ";", "for", "(", "const", "status", "of", "statuses", ")", "{", "if", "(", "status", ".", "isNew", "(", ")", ")", "{", "newe", ".", "push", "(", "status", ")", ";", "}", "else", "if", "(", "status", ".", "isModified", "(", ")", ")", "{", "modified", ".", "push", "(", "status", ")", ";", "}", "else", "if", "(", "status", ".", "isDeleted", "(", ")", ")", "{", "deleted", ".", "push", "(", "status", ")", ";", "}", "}", "const", "index", "=", "getIndex", "(", "repo", ",", "opts", ".", "index", ")", ";", "if", "(", "opts", ".", "output", "===", "'json'", "||", "opts", ".", "output", "===", "'json-pretty'", ")", "{", "const", "o", "=", "{", "new", ":", "newe", ",", "modified", ",", "deleted", "}", ";", "process", ".", "stdout", ".", "write", "(", "JSON", ".", "stringify", "(", "o", ",", "(", "key", ",", "value", ")", "=>", "{", "if", "(", "value", "instanceof", "StatusEntry", ")", "{", "return", "{", "path", ":", "value", ".", "path", ",", "isdir", ":", "value", ".", "isdir", ",", "}", ";", "}", "return", "value", ";", "}", ",", "opts", ".", "output", "===", "'json-pretty'", "?", "' '", ":", "''", ")", ")", ";", "}", "else", "{", "console", ".", "log", "(", "`On branch ${", "repo", ".", "getHead", "(", ")", ".", "getName", "(", ")", "}`", ")", ";", "console", ".", "log", "(", "'Changes not staged for commit:'", ")", ";", "console", ".", "log", "(", "'use \"snow add <rel-path>...\" to update what will be committed'", ")", ";", "for", "(", "const", "modifiedFile", "of", "modified", ")", "{", "console", ".", "log", "(", "modifiedFile", ".", "path", ")", ";", "}", "process", ".", "stdout", ".", "write", "(", "'\\n'", ")", ";", "if", "(", "deleted", ".", "length", ">", "0", ")", "{", "console", ".", "log", "(", "'Deleted:'", ")", ";", "for", "(", "const", "del", "of", "deleted", ")", "{", "console", ".", "log", "(", "del", ".", "path", ")", ";", "}", "}", "else", "{", "console", ".", "log", "(", "'no deleted changes added to commit (use \"snow rm\")'", ")", ";", "}", "process", ".", "stdout", ".", "write", "(", "'\\n'", ")", ";", "if", "(", "newe", ".", "length", ">", "0", ")", "{", "console", ".", "log", "(", "'New:'", ")", ";", "for", "(", "const", "n", "of", "newe", ")", "{", "if", "(", "index", ".", "addRelPaths", ".", "has", "(", "n", ".", "path", ")", ")", "{", "process", ".", "stdout", ".", "write", "(", "chalk", ".", "red", "(", "'+ '", ")", ")", ";", "}", "console", ".", "log", "(", "n", ".", "path", ")", ";", "}", "}", "else", "{", "console", ".", "log", "(", "'no changes added to commit (use \"snow add\"'", ")", ";", "}", "}", "}", "catch", "(", "error", ")", "{", "if", "(", "opts", ".", "debug", ")", "{", "throw", "error", ";", "}", "else", "{", "if", "(", "error", "instanceof", "AggregateError", ")", "{", "process", ".", "stderr", ".", "write", "(", "`fatal: ${", "error", ".", "errors", ".", "map", "(", "(", "e", ")", "=>", "e", ".", "message", ")", ".", "join", "(", "'\\n'", ")", "}`", ")", ";", "}", "else", "{", "process", ".", "stderr", ".", "write", "(", "`fatal: ${", "error", ".", "message", "}\\n`", ")", ";", "}", "process", ".", "exit", "(", "-", "1", ")", ";", "}", "}", "}", ")", ";", "program", ".", "command", "(", "'commit'", ")", ".", "option", "(", "'-m, --message [message]'", ",", "'input file'", ")", ".", "option", "(", "'--allow-empty'", ",", "'allow an empty commit without any changes, not set by default'", ")", ".", "option", "(", "'--debug'", ",", "'add more debug information on errors'", ")", ".", "option", "(", "'--user-data'", ",", "'open standard input to apply user data for commit'", ")", ".", "option", "(", "'--tags [collection]'", ",", "'add user defined tags to commit'", ")", ".", "option", "(", "'--input <type>'", ",", "\"type can be 'stdin' or {filepath}\"", ")", ".", "option", "(", "'--index [id]'", ",", "'use a custom index id'", ")", ".", "description", "(", "'complete the commit'", ")", ".", "action", "(", "async", "(", "opts", ")", "=>", "{", "try", "{", "opts", "=", "await", "parseOptions", "(", "opts", ")", ";", "const", "repo", "=", "await", "Repository", ".", "open", "(", "normalize", "(", "process", ".", "cwd", "(", ")", ")", ")", ";", "const", "index", "=", "getIndex", "(", "repo", ",", "opts", ".", "index", ")", ";", "let", "data", "=", "{", "}", ";", "let", "tags", ";", "if", "(", "opts", ".", "tags", "&&", "opts", ".", "tags", ".", "length", ">", "0", ")", "{", "tags", "=", "String", "(", "opts", ".", "tags", ")", ".", "split", "(", "','", ")", ";", "}", "if", "(", "opts", ".", "userData", ")", "{", "try", "{", "data", "=", "JSON", ".", "parse", "(", "opts", ".", "userData", ")", ";", "}", "catch", "(", "e", ")", "{", "throw", "new", "Error", "(", "`invalid user-data: ${", "e", "}`", ")", ";", "}", "}", "const", "newCommit", "=", "await", "repo", ".", "createCommit", "(", "index", ",", "opts", ".", "message", ",", "opts", ",", "tags", ",", "data", ")", ";", "console", ".", "log", "(", "`[${", "repo", ".", "getHead", "(", ")", ".", "getName", "(", ")", "} (root-commit) ${", "newCommit", ".", "hash", ".", "substr", "(", "0", ",", "6", ")", "}]`", ")", ";", "}", "catch", "(", "error", ")", "{", "if", "(", "opts", ".", "debug", ")", "{", "throw", "error", ";", "}", "else", "{", "if", "(", "error", "instanceof", "AggregateError", ")", "{", "process", ".", "stderr", ".", "write", "(", "`fatal: ${", "error", ".", "errors", ".", "map", "(", "(", "e", ")", "=>", "e", ".", "message", ")", ".", "join", "(", "'\\n'", ")", "}`", ")", ";", "}", "else", "{", "process", ".", "stderr", ".", "write", "(", "`fatal: ${", "error", ".", "message", "}\\n`", ")", ";", "}", "process", ".", "exit", "(", "-", "1", ")", ";", "}", "}", "}", ")", ";", "program", ".", "command", "(", "'log'", ")", ".", "option", "(", "'--no-color'", ")", ".", "option", "(", "'-v, --verbose'", ",", "'verbose'", ")", ".", "option", "(", "'--output [format]'", ",", "\"currently supported output formats 'json', 'json-pretty'\"", ")", ".", "option", "(", "'--debug'", ",", "'add more debug information on errors'", ")", ".", "description", "(", "'print the log to the console'", ")", ".", "action", "(", "async", "(", "opts", ")", "=>", "{", "if", "(", "opts", ".", "noColor", ")", "{", "chalk", ".", "level", "=", "0", ";", "}", "try", "{", "const", "repo", "=", "await", "Repository", ".", "open", "(", "normalize", "(", "process", ".", "cwd", "(", ")", ")", ")", ";", "const", "commits", "=", "repo", ".", "getAllCommits", "(", "COMMIT_ORDER", ".", "NEWEST_FIRST", ")", ";", "const", "refs", "=", "repo", ".", "getAllReferences", "(", ")", ";", "const", "headHash", "=", "repo", ".", "getHead", "(", ")", ".", "hash", ";", "const", "headName", "=", "repo", ".", "getHead", "(", ")", ".", "getName", "(", ")", ";", "if", "(", "opts", ".", "output", "===", "'json'", "||", "opts", ".", "output", "===", "'json-pretty'", ")", "{", "const", "o", "=", "{", "commits", ",", "refs", ",", "head", ":", "repo", ".", "getHead", "(", ")", ".", "isDetached", "(", ")", "?", "headHash", ":", "headName", "}", ";", "process", ".", "stdout", ".", "write", "(", "JSON", ".", "stringify", "(", "o", ",", "(", "key", ",", "value", ")", "=>", "{", "if", "(", "value", "instanceof", "Commit", ")", "{", "return", "{", "hash", ":", "value", ".", "hash", ",", "message", ":", "value", ".", "message", ",", "date", ":", "value", ".", "date", ".", "getTime", "(", ")", "/", "1000.0", ",", "root", ":", "opts", ".", "verbose", "?", "value", ".", "root", ":", "undefined", ",", "tags", ":", "value", ".", "tags", ",", "userData", ":", "value", ".", "userData", "?", "JSON", ".", "parse", "(", "JSON", ".", "stringify", "(", "value", ".", "userData", ")", ")", ":", "{", "}", ",", "}", ";", "}", "if", "(", "value", "instanceof", "TreeDir", ")", "{", "return", "{", "path", ":", "value", ".", "path", ",", "hash", ":", "value", ".", "hash", ",", "children", ":", "value", ".", "children", "}", ";", "}", "if", "(", "value", "instanceof", "TreeFile", ")", "{", "return", "{", "path", ":", "value", ".", "path", ",", "hash", ":", "value", ".", "hash", ",", "ctime", ":", "value", ".", "stats", ".", "ctime", ",", "mtime", ":", "value", ".", "stats", ".", "mtime", ",", "size", ":", "value", ".", "stats", ".", "size", ",", "}", ";", "}", "if", "(", "value", "instanceof", "Reference", ")", "{", "return", "{", "name", ":", "value", ".", "getName", "(", ")", ",", "hash", ":", "value", ".", "hash", ",", "start", ":", "value", ".", "startHash", ",", "userData", ":", "value", ".", "userData", "?", "JSON", ".", "parse", "(", "JSON", ".", "stringify", "(", "value", ".", "userData", ")", ")", ":", "{", "}", ",", "}", ";", "}", "return", "value", ";", "}", ",", "opts", ".", "output", "===", "'json-pretty'", "?", "' '", ":", "''", ")", ")", ";", "}", "else", "{", "for", "(", "const", "commit", "of", "commits", ")", "{", "process", ".", "stdout", ".", "write", "(", "chalk", ".", "magenta", ".", "bold", "(", "`commit: ${", "commit", ".", "hash", "}`", ")", ")", ";", "const", "branchRefs", "=", "refs", ".", "filter", "(", "(", "ref", ")", "=>", "ref", ".", "hash", "===", "commit", ".", "hash", ")", ";", "if", "(", "repo", ".", "getHead", "(", ")", ".", "isDetached", "(", ")", "&&", "commit", ".", "hash", "===", "headHash", ")", "{", "branchRefs", ".", "unshift", "(", "repo", ".", "getHead", "(", ")", ")", ";", "}", "if", "(", "branchRefs", ".", "length", ">", "0", ")", "{", "process", ".", "stdout", ".", "write", "(", "' ('", ")", ";", "process", ".", "stdout", ".", "write", "(", "`${", "branchRefs", ".", "map", "(", "(", "ref", ")", "=>", "{", "if", "(", "ref", ".", "hash", "===", "commit", ".", "hash", ")", "{", "if", "(", "ref", ".", "getName", "(", ")", "===", "headName", ")", "{", "if", "(", "headName", "===", "'HEAD'", ")", "{", "return", "chalk", ".", "blue", ".", "bold", "(", "ref", ".", "getName", "(", ")", ")", ";", "}", "return", "chalk", ".", "blue", ".", "bold", "(", "`HEAD -> ${", "ref", ".", "getName", "(", ")", "}`", ")", ";", "}", "return", "chalk", ".", "rgb", "(", "255", ",", "165", ",", "0", ")", "(", "ref", ".", "getName", "(", ")", ")", ";", "}", "return", "null", ";", "}", ")", ".", "filter", "(", "(", "x", ")", "=>", "!", "!", "x", ")", ".", "join", "(", "', '", ")", "}`", ")", ";", "process", ".", "stdout", ".", "write", "(", "')'", ")", ";", "}", "process", ".", "stdout", ".", "write", "(", "'\\n'", ")", ";", "process", ".", "stdout", ".", "write", "(", "`Date: ${", "commit", ".", "date", "}\\n`", ")", ";", "if", "(", "commit", ".", "tags", "&&", "commit", ".", "tags", ".", "length", ">", "0", ")", "{", "process", ".", "stdout", ".", "write", "(", "'Tags:'", ")", ";", "let", "seperator", "=", "' '", ";", "commit", ".", "tags", ".", "forEach", "(", "(", "tag", ")", "=>", "{", "process", ".", "stdout", ".", "write", "(", "`${", "seperator", "}${", "tag", "}`", ")", ";", "seperator", "=", "', '", ";", "}", ")", ";", "process", ".", "stdout", ".", "write", "(", "'\\n'", ")", ";", "}", "if", "(", "Object", ".", "keys", "(", "commit", ".", "userData", ")", ".", "length", ">", "0", ")", "{", "process", ".", "stdout", ".", "write", "(", "'User Data:'", ")", ";", "let", "seperator", "=", "' '", ";", "for", "(", "const", "key", "in", "commit", ".", "userData", ")", "{", "if", "(", "{", "}", ".", "hasOwnProperty", ".", "call", "(", "commit", ".", "userData", ",", "key", ")", ")", "{", "process", ".", "stdout", ".", "write", "(", "`${", "seperator", "}${", "key", "}=${", "commit", ".", "userData", "[", "key", "]", "}`", ")", ";", "}", "seperator", "=", "', '", ";", "}", "process", ".", "stdout", ".", "write", "(", "'\\n'", ")", ";", "}", "process", ".", "stdout", ".", "write", "(", "`\\n ${", "commit", ".", "message", "}\\n\\n\\n`", ")", ";", "if", "(", "opts", ".", "verbose", ")", "{", "const", "files", "=", "commit", ".", "root", ".", "getAllTreeFiles", "(", "{", "entireHierarchy", ":", "true", ",", "includeDirs", ":", "true", "}", ")", ";", "files", ".", "forEach", "(", "(", "value", ")", "=>", "{", "if", "(", "value", ".", "isDirectory", "(", ")", ")", "{", "process", ".", "stdout", ".", "write", "(", "` [${", "value", ".", "hash", "}] ${", "value", ".", "path", "}\\n`", ")", ";", "}", "else", "if", "(", "value", "instanceof", "TreeFile", ")", "{", "process", ".", "stdout", ".", "write", "(", "` [${", "value", ".", "hash", "}] ${", "value", ".", "path", "} (${", "value", ".", "stats", ".", "size", "}B)\\n`", ")", ";", "}", "}", ")", ";", "if", "(", "files", ".", "size", ">", "0", ")", "{", "process", ".", "stdout", ".", "write", "(", "'\\n'", ")", ";", "}", "}", "}", "}", "}", "catch", "(", "error", ")", "{", "if", "(", "opts", ".", "debug", ")", "{", "throw", "error", ";", "}", "else", "{", "if", "(", "error", "instanceof", "AggregateError", ")", "{", "process", ".", "stderr", ".", "write", "(", "`fatal: ${", "error", ".", "errors", ".", "map", "(", "(", "e", ")", "=>", "e", ".", "message", ")", ".", "join", "(", "'\\n'", ")", "}`", ")", ";", "}", "else", "{", "process", ".", "stderr", ".", "write", "(", "`fatal: ${", "error", ".", "message", "}\\n`", ")", ";", "}", "process", ".", "exit", "(", "-", "1", ")", ";", "}", "}", "}", ")", ";", "program", ".", "command", "(", "'driveinfo'", ")", ".", "option", "(", "'--output [format=json-pretty]'", ",", "\"currently supported output formats 'json', 'json-pretty'\"", ")", ".", "description", "(", "'List all connected drives in your computer, in all major operating systems'", ")", ".", "action", "(", "async", "(", "opts", ")", "=>", "{", "const", "drives", "=", "await", "drivelist", ".", "list", "(", ")", ";", "console", ".", "log", "(", "JSON", ".", "stringify", "(", "drives", ",", "null", ",", "opts", ".", "output", "===", "'json'", "?", "''", ":", "' '", ")", ")", ";", "}", ")", ";", "program", ".", "command", "(", "'switch [branch-name]'", ")", ".", "option", "(", "'--discard-changes'", ",", "'force switch and discard changes in workdir'", ")", ".", "option", "(", "'-k, --keep-changes'", ",", "\"don't reset files in the workdir\"", ")", ".", "option", "(", "'-d, --detach'", ",", "'detach the branch'", ")", ".", "option", "(", "'--debug'", ",", "'add more debug information on errors'", ")", ".", "option", "(", "'--no-color'", ")", ".", "option", "(", "'--user-data'", ",", "'open standard input to apply user data for commit'", ")", ".", "option", "(", "'--input <type>'", ",", "\"type can be 'stdin' or {filepath}\"", ")", ".", "description", "(", "'switch a commit'", ")", ".", "action", "(", "async", "(", "branchName", ",", "opts", ")", "=>", "{", "if", "(", "opts", ".", "noColor", ")", "{", "chalk", ".", "level", "=", "0", ";", "}", "try", "{", "opts", "=", "await", "parseOptions", "(", "opts", ")", ";", "const", "repo", "=", "await", "Repository", ".", "open", "(", "normalize", "(", "process", ".", "cwd", "(", ")", ")", ")", ";", "if", "(", "branchName", ")", "{", "const", "targetCommit", "=", "repo", ".", "findCommitByReferenceName", "(", "REFERENCE_TYPE", ".", "BRANCH", ",", "branchName", ")", ";", "if", "(", "!", "targetCommit", ")", "{", "if", "(", "repo", ".", "findCommitByHash", "(", "branchName", ")", ")", "{", "throw", "new", "Error", "(", "`target ${", "branchName", "} seems to be a commit and must be checked out via 'snow checkout'`", ")", ";", "}", "throw", "new", "Error", "(", "`cannot find branch '${", "branchName", "}'`", ")", ";", "}", "if", "(", "opts", ".", "discardChanges", "&&", "opts", ".", "keepChanges", ")", "{", "throw", "new", "Error", "(", "'either --discard-changes or --keep-changes can be used, not both'", ")", ";", "}", "else", "if", "(", "!", "opts", ".", "discardChanges", "&&", "!", "opts", ".", "keepChanges", ")", "{", "const", "statusFiles", "=", "await", "repo", ".", "getStatus", "(", "FILTER", ".", "INCLUDE_UNTRACKED", "|", "FILTER", ".", "INCLUDE_MODIFIED", ")", ";", "let", "criticalChanges", "=", "0", ";", "for", "(", "const", "statusFile", "of", "statusFiles", ")", "{", "if", "(", "statusFile", ".", "isModified", "(", ")", ")", "{", "process", ".", "stdout", ".", "write", "(", "`M ${", "statusFile", ".", "path", "}\\n`", ")", ";", "criticalChanges", "++", ";", "}", "else", "if", "(", "statusFile", ".", "isNew", "(", ")", ")", "{", "process", ".", "stdout", ".", "write", "(", "`A ${", "statusFile", ".", "path", "}\\n`", ")", ";", "criticalChanges", "++", ";", "}", "}", "if", "(", "criticalChanges", ">", "0", ")", "{", "throw", "new", "Error", "(", "`You have local changes to '${", "branchName", "}'; not switching branches.`", ")", ";", "}", "}", "let", "reset", "=", "RESET", ".", "NONE", ";", "if", "(", "!", "opts", ".", "keepChanges", ")", "{", "reset", "|=", "RESET", ".", "RESTORE_MODIFIED_ITEMS", "|", "RESET", ".", "DELETE_NEW_ITEMS", "|", "RESET", ".", "RESTORE_DELETED_ITEMS", ";", "}", "if", "(", "opts", ".", "detach", ")", "{", "reset", "|=", "RESET", ".", "DETACH", ";", "}", "await", "repo", ".", "checkout", "(", "branchName", ",", "reset", ")", ";", "}", "}", "catch", "(", "error", ")", "{", "if", "(", "opts", ".", "debug", ")", "{", "throw", "error", ";", "}", "else", "{", "if", "(", "error", "instanceof", "AggregateError", ")", "{", "process", ".", "stderr", ".", "write", "(", "`fatal: ${", "error", ".", "errors", ".", "map", "(", "(", "e", ")", "=>", "e", ".", "message", ")", ".", "join", "(", "'\\n'", ")", "}`", ")", ";", "}", "else", "{", "process", ".", "stderr", ".", "write", "(", "`fatal: ${", "error", ".", "message", "}\\n`", ")", ";", "}", "process", ".", "exit", "(", "-", "1", ")", ";", "}", "}", "}", ")", ";", "program", ".", "parse", "(", "process", ".", "argv", ".", "filter", "(", "(", "x", ")", "=>", "x", "!==", "'--'", ")", ")", ";" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, 8, null, 2, null, 2, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 488, null, 112, null, null, null, null, null, null, null, null, null, null, null, null, 488, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 488, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 12, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 63, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, 2, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, 112, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 488, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, 112, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 488, null, null, null, null, null, null, null, null, null, null, null, null, null, 23116, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 23116, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 112, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 112, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, 23116, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 112, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 488, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 112, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, 5, null, null, null, null, null, 5, null, null, null, null, null, null, null, 23116, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 488, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 23116, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 23116, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 23116, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 112, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 488, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1112, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 112, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1112, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, 491, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 491, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 19, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7827, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 112, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1112, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, 23116, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1360
[ "import", "Wallet", "from", "\"@project-serum/sol-wallet-adapter\"", ";", "import", "{", "Connection", ",", "SystemProgram", ",", "Transaction", ",", "PublicKey", ",", "TransactionInstruction", ",", "}", "from", "\"@solana/web3.js\"", ";", "import", "EventEmitter", "from", "\"eventemitter3\"", ";", "export", "interface", "WalletAdapter", "extends", "EventEmitter", "{", "publicKey", ":", "PublicKey", "|", "null", ";", "signTransaction", ":", "(", "transaction", ":", "Transaction", ")", "=>", "Promise", "<", "Transaction", ">", ";", "connect", ":", "(", ")", "=>", "any", ";", "disconnect", ":", "(", ")", "=>", "any", ";", "}", "const", "cluster", "=", "\"http://devnet.solana.com\"", ";", "const", "connection", "=", "new", "Connection", "(", "cluster", ",", "\"confirmed\"", ")", ";", "const", "wallet", "=", "new", "Wallet", "(", "\"https://www.sollet.io\"", ",", "cluster", ")", ";", "export", "async", "function", "initWallet", "(", ")", "{", "await", "wallet", ".", "connect", "(", ")", ";", "console", ".", "log", "(", "\"wallet publicKey\"", ",", "wallet", "?.", "publicKey", "?.", "toBase58", "(", ")", ")", ";", "return", "[", "connection", ",", "wallet", "]", ";", "}", "export", "async", "function", "sendMoney", "(", "destPubkeyStr", ",", "lamports", "=", "500", "*", "1000000", ")", "{", "try", "{", "console", ".", "log", "(", "\"starting sendMoney\"", ")", ";", "const", "destPubkey", "=", "new", "PublicKey", "(", "destPubkeyStr", ")", ";", "const", "walletAccountInfo", "=", "await", "connection", ".", "getAccountInfo", "(", "wallet", "!", ".", "publicKey", "!", ")", ";", "console", ".", "log", "(", "\"wallet data size\"", ",", "walletAccountInfo", "?.", "data", ".", "length", ")", ";", "const", "receiverAccountInfo", "=", "await", "connection", ".", "getAccountInfo", "(", "destPubkey", ")", ";", "console", ".", "log", "(", "\"receiver data size\"", ",", "receiverAccountInfo", "?.", "data", ".", "length", ")", ";", "const", "instruction", "=", "SystemProgram", ".", "transfer", "(", "{", "fromPubkey", ":", "wallet", "!", ".", "publicKey", "!", ",", "toPubkey", ":", "destPubkey", ",", "lamports", ",", "}", ")", ";", "let", "trans", "=", "await", "setWalletTransaction", "(", "instruction", ")", ";", "let", "signature", "=", "await", "signAndSendTransaction", "(", "wallet", ",", "trans", ")", ";", "let", "result", "=", "await", "connection", ".", "confirmTransaction", "(", "signature", ",", "\"singleGossip\"", ")", ";", "console", ".", "log", "(", "\"money sent\"", ",", "result", ")", ";", "}", "catch", "(", "e", ")", "{", "console", ".", "warn", "(", "\"Failed\"", ",", "e", ")", ";", "}", "}", "export", "async", "function", "setWalletTransaction", "(", "instruction", ")", "{", "const", "transaction", "=", "new", "Transaction", "(", ")", ";", "transaction", ".", "add", "(", "instruction", ")", ";", "transaction", ".", "feePayer", "=", "wallet", "!", ".", "publicKey", "!", ";", "let", "hash", "=", "await", "connection", ".", "getRecentBlockhash", "(", ")", ";", "console", ".", "log", "(", "\"blockhash\"", ",", "hash", ")", ";", "transaction", ".", "recentBlockhash", "=", "hash", ".", "blockhash", ";", "return", "transaction", ";", "}", "export", "async", "function", "signAndSendTransaction", "(", "wallet", ",", "transaction", ")", "{", "let", "signedTrans", "=", "await", "wallet", ".", "signTransaction", "(", "transaction", ")", ";", "console", ".", "log", "(", "\"sign transaction\"", ")", ";", "let", "signature", "=", "await", "connection", ".", "sendRawTransaction", "(", "signedTrans", ".", "serialize", "(", ")", ")", ";", "console", ".", "log", "(", "\"send raw transaction\"", ")", ";", "return", "signature", ";", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, 116, null, null, null, null, null, null, null, null, null, null, 20796, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 2, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 120, null, null, null, null, null, null, null, null, 910, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 910, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 899, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 98, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, 8567, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 899, null, null, null, 98, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 20796, null, 98, null, null, null, 98, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1361
[ "import", "React", ",", "{", "useState", "}", "from", "\"react\"", ";", "import", "{", "sendMoney", "}", "from", "\"../helpers/wallet\"", ";", "import", "\"./Sender.css\"", ";", "interface", "SenderProps", "{", "didSendMoney", ":", "(", ")", "=>", "void", ";", "}", "const", "Sender", "=", "(", "{", "didSendMoney", "}", ")", "=>", "{", "const", "[", "amount", ",", "setAmount", "]", "=", "useState", "(", "0", ")", ";", "const", "[", "address", ",", "setAddress", "]", "=", "useState", "(", "\"\"", ")", ";", "const", "onChangeAmount", "=", "(", "e", ")", "=>", "{", "setAmount", "(", "e", ".", "target", ".", "value", "?", "Number", "(", "e", ".", "target", ".", "value", ")", ":", "0", ")", ";", "}", ";", "const", "onChangeAddress", "=", "(", "e", ")", "=>", "{", "setAddress", "(", "e", ".", "target", ".", "value", "?", "e", ".", "target", ".", "value", ".", "toString", "(", ")", ":", "\"\"", ")", ";", "}", ";", "const", "onClickSendMoney", "=", "async", "(", "e", ")", "=>", "{", "e", ".", "preventDefault", "(", ")", ";", "await", "sendMoney", "(", "address", ",", "amount", ")", ";", "didSendMoney", "(", ")", ";", "}", ";", "return", "(", "<", "form", "className", "=", "\"send-container\"", ">", "<", "div", "className", "=", "\"send-inputs\"", ">", "<", "div", "className", "=", "\"send-top-left\"", ">", "<", "label", "htmlFor", "=", "\"amount\"", ">", "Amount", "(", "lamports", ")", "<", "/label>", "<", "/div>", "<", "div", "className", "=", "\"send-mid-left\"", ">", "<", "label", "htmlFor", "=", "\"address\"", ">", "Address", "<", "/label>", "<", "/div>", "<", "div", "className", "=", "\"send-top-right\"", ">", "<", "input", "type", "=", "\"text\"", "value", "=", "{", "amount", "}", "onChange", "=", "{", "onChangeAmount", "}", "/", ">", "<", "/div>", "<", "div", "className", "=", "\"send-mid-right\"", ">", "<", "input", "type", "=", "\"text\"", "value", "=", "{", "address", "}", "onChange", "=", "{", "onChangeAddress", "}", "/", ">", "<", "/div>", "<", "div", "className", "=", "\"send-bottom-right\"", ">", "<", "button", "className", "=", "\"send-buttons\"", "onClick", "=", "{", "onClickSendMoney", "}", ">", "Submit", "<", "/button>", "<", "/div>", "<", "/div>", "<", "/form>);", "}", ";", "export", "default", "Sender", ";" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 28, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, null, 105, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, null, 105, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, 103, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1362
[ "import", "{", "Connection", ",", "PublicKey", ",", "ConfirmedTransaction", "}", "from", "\"@solana/web3.js\"", ";", "export", "class", "TransactionWithSignature", "{", "constructor", "(", "public", "signature", ",", "public", "confirmedTransaction", ")", "{", "}", "}", "export", "async", "function", "getTransactions", "(", "connection", ",", "address", ")", "{", "const", "transSignatures", "=", "await", "connection", ".", "getConfirmedSignaturesForAddress2", "(", "address", ")", ";", "const", "transactions", "=", "new", "Array", "<", "TransactionWithSignature", ">", "(", ")", ";", "for", "(", "let", "i", "=", "0", ";", "i", "<", "transSignatures", ".", "length", ";", "i", "++", ")", "{", "const", "signature", "=", "transSignatures", "[", "i", "]", ".", "signature", ";", "const", "confirmedTransaction", "=", "await", "connection", ".", "getConfirmedTransaction", "(", "signature", ")", ";", "if", "(", "confirmedTransaction", ")", "{", "const", "transWithSignature", "=", "new", "TransactionWithSignature", "(", "signature", ",", "confirmedTransaction", ")", ";", "transactions", ".", "push", "(", "transWithSignature", ")", ";", "}", "}", "return", "transactions", ";", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, 42385, null, null, null, null, null, null, null, 7, null, 116, null, 120, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, 42385, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1363
[ "import", "React", ",", "{", "FC", "}", "from", "\"react\"", ";", "import", "{", "TransactionWithSignature", "}", "from", "\"../helpers/transactions\"", ";", "import", "\"./TransactionView.css\"", ";", "interface", "TransactionsViewProps", "{", "transactions", "?", ":", "Array", "<", "TransactionWithSignature", ">", ";", "}", "const", "TransactionsView", "=", "(", "{", "transactions", "}", ")", "=>", "{", "const", "getTransactions", "=", "(", ")", "=>", "{", "return", "transactions", "?.", "map", "(", "(", "trans", ")", "=>", "{", "return", "<", "TransactionItemView", "key", "=", "{", "trans", ".", "signature", "}", "transaction", "=", "{", "trans", "}", "/", ">", ";", "}", ")", ";", "}", ";", "return", "<", "div", ">", "{", "getTransactions", "(", ")", "}", "<", "/div>;", "}", ";", "interface", "TransactionItemViewProps", "{", "transaction", ":", "TransactionWithSignature", ";", "}", "const", "TransactionItemView", "=", "(", "{", "transaction", "}", ")", "=>", "{", "const", "getTransactionItems", "=", "(", ")", "=>", "{", "const", "signature", "=", "transaction", ".", "signature", "?.", "toString", "(", ")", ";", "const", "meta", "=", "transaction", ".", "confirmedTransaction", ".", "meta", ";", "const", "trans", "=", "transaction", ".", "confirmedTransaction", ".", "transaction", ";", "let", "amount", "=", "0", ";", "if", "(", "meta", ")", "{", "amount", "=", "meta", ".", "preBalances", "[", "0", "]", "-", "meta", ".", "postBalances", "[", "0", "]", ";", "}", "return", "(", "<", ">", "<", "li", "key", "=", "{", "signature", "+", "\"signature\"", "}", ">", "<", "label", ">", "Tx", ":", "<", "/label> &nbsp;", "{", "signature", "}", "<", "/li>", "<", "li", "key", "=", "{", "signature", "+", "\"fee\"", "}", ">", "<", "label", ">", "Fee", ":", "<", "/label>&nbsp;", "{", "meta", "?.", "fee", "}", "<", "/li>", "<", "li", "key", "=", "{", "signature", "+", "\"amount\"", "}", ">", "<", "label", ">", "Sent", "Amount", ":", "<", "/label>&nbsp;", "{", "amount", "}", "<", "/li>", "<", "li", "key", "=", "{", "signature", "+", "\"sender\"", "}", ">", "<", "label", ">", "Sender", ":", "<", "/label>&nbsp;", "{", "trans", ".", "instructions", "[", "0", "]", ".", "keys", "[", "0", "]", ".", "pubkey", ".", "toBase58", "(", ")", "}", "<", "/li>", "<", "li", "key", "=", "{", "signature", "+", "\"sender-balance\"", "}", ">", "<", "label", ">", "Sender", "Balance", ":", "<", "/label>&nbsp;", "{", "meta", "?.", "postBalances", "[", "0", "]", "}", "<", "/li>", "<", "li", "key", "=", "{", "signature", "+", "\"receiver\"", "}", ">", "<", "label", ">", "Receiver", ":", "<", "/label>&nbsp;", "{", "trans", ".", "instructions", "[", "0", "]", ".", "keys", "[", "1", "]", ".", "pubkey", ".", "toBase58", "(", ")", "}", "<", "/li>", "<", "li", "key", "=", "{", "signature", "+", "\"receiver-balance\"", "}", ">", "<", "label", ">", "Receiver", "Balance", ":", "<", "/label>&nbsp;", "{", "meta", "?.", "postBalances", "[", "1", "]", "}", "<", "/li>", "<", "/>);", "}", ";", "return", "(", "<", "div", "className", "=", "\"trans-item\"", ">", "<", "ul", "className", "=", "\"trans-meta\"", ">", "{", "getTransactionItems", "(", ")", "}", "<", "/ul>", "<", "/div>);", "}", ";", "export", "default", "TransactionsView", ";" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 45, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1364
[ "import", "{", "Connection", "}", "from", "\"@solana/web3.js\"", ";", "import", "React", ",", "{", "useEffect", ",", "useState", "}", "from", "\"react\"", ";", "import", "\"./App.css\"", ";", "import", "Sender", "from", "\"./components/Sender\"", ";", "import", "TransactionsView", "from", "\"./components/TransactionView\"", ";", "import", "{", "getTransactions", ",", "TransactionWithSignature", ",", "}", "from", "\"./helpers/transactions\"", ";", "import", "{", "initWallet", ",", "WalletAdapter", "}", "from", "\"./helpers/wallet\"", ";", "function", "App", "(", ")", "{", "const", "[", "transactions", ",", "setTransactions", "]", "=", "useState", "<", "Array", "<", "TransactionWithSignature", ">", ">", "(", ")", ";", "const", "conn", "=", "React", ".", "useRef", "<", "Connection", ">", "(", ")", ";", "const", "wall", "=", "React", ".", "useRef", "<", "WalletAdapter", ">", "(", ")", ";", "useEffect", "(", "(", ")", "=>", "{", "initWallet", "(", ")", ".", "then", "(", "(", "[", "connection", ",", "wallet", "]", ")", "=>", "{", "conn", ".", "current", "=", "connection", ";", "wall", ".", "current", "=", "wallet", ";", "if", "(", "wallet", ".", "publicKey", ")", "{", "getTransactions", "(", "connection", ",", "wallet", ".", "publicKey", ")", ".", "then", "(", "(", "trans", ")", "=>", "{", "setTransactions", "(", "trans", ")", ";", "}", ")", ";", "}", "}", ")", ";", "}", ",", "[", "]", ")", ";", "const", "didSendMoney", "=", "(", ")", "=>", "{", "getTransactions", "(", "conn", ".", "current", "!", ",", "wall", ".", "current", "!", ".", "publicKey", "!", ")", ".", "then", "(", "(", "trans", ")", "=>", "{", "setTransactions", "(", "trans", ")", ";", "}", ")", ";", "}", ";", "return", "(", "<", "div", "className", "=", "\"app-body\"", ">", "<", "div", "className", "=", "\"app-body-top\"", ">", "<", "h3", ">", "Send", "Money", "on", "Solana", "<", "/h3>", "<", "Sender", "didSendMoney", "=", "{", "didSendMoney", "}", "/", ">", "<", "/div>", "<", "div", "className", "=", "\"app-body-mid\"", ">", "<", "TransactionsView", "transactions", "=", "{", "transactions", "}", "/>", "<", "/div>", "<", "/div>);", "}", "export", "default", "App", ";" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 9, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 35, null, null, null, null, null, null, null, null, null, null, null, 35, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1365
[ "import", "{", "Message", ",", "PrismaClient", "}", "from", "'@prisma/client'", ";", "import", "*", "as", "trpc", "from", "'@trpc/server'", ";", "import", "*", "as", "trpcNext", "from", "'@trpc/server/adapters/next'", ";", "import", "{", "z", "}", "from", "'zod'", ";", "import", "superjson", "from", "'superjson'", ";", "const", "prisma", "=", "new", "PrismaClient", "(", ")", ";", "async", "function", "createMessage", "(", "text", ")", "{", "const", "msg", "=", "await", "prisma", ".", "message", ".", "create", "(", "{", "data", ":", "{", "text", ",", "}", ",", "}", ")", ";", "return", "msg", ";", "}", "async", "function", "getMessagesAfter", "(", "timestamp", ")", "{", "return", "prisma", ".", "message", ".", "findMany", "(", "{", "orderBy", ":", "{", "createdAt", ":", "'asc'", ",", "}", ",", "where", ":", "{", "OR", ":", "[", "{", "createdAt", ":", "{", "gt", ":", "timestamp", ",", "}", ",", "}", ",", "{", "updatedAt", ":", "{", "gt", ":", "timestamp", ",", "}", ",", "}", ",", "]", ",", "}", ",", "}", ")", ";", "}", "const", "createContext", "=", "(", "{", "req", ",", "res", "}", ")", "=>", "{", "return", "{", "}", ";", "}", ";", "export", "type", "Context", "=", "trpc", ".", "inferAsyncReturnType", "<", "typeof", "createContext", ">", ";", "function", "createRouter", "(", ")", "{", "return", "trpc", ".", "router", "<", "Context", ">", "(", ")", ";", "}", "export", "const", "appRouter", "=", "createRouter", "(", ")", ".", "transformer", "(", "superjson", ")", ".", "query", "(", "'hello'", ",", "{", "input", ":", "z", ".", "object", "(", "{", "text", ":", "z", ".", "string", "(", ")", ".", "nullish", "(", ")", ",", "}", ")", ".", "nullish", "(", ")", ",", "resolve", "(", "{", "input", "}", ")", "{", "return", "`hello ${", "input", "?.", "text", "??", "'world'", "}`", ";", "}", ",", "}", ")", ".", "merge", "(", "'messages.'", ",", "createRouter", "(", ")", ".", "query", "(", "'list'", ",", "{", "input", ":", "z", ".", "object", "(", "{", "cursor", ":", "z", ".", "date", "(", ")", ".", "nullish", "(", ")", ",", "take", ":", "z", ".", "number", "(", ")", ".", "min", "(", "1", ")", ".", "max", "(", "50", ")", ".", "nullish", "(", ")", ",", "}", ")", ",", "async", "resolve", "(", "{", "input", ":", "{", "take", "=", "10", ",", "cursor", "}", "}", ")", "{", "const", "page", "=", "await", "prisma", ".", "message", ".", "findMany", "(", "{", "orderBy", ":", "{", "createdAt", ":", "'desc'", ",", "}", ",", "cursor", ":", "cursor", "?", "{", "createdAt", ":", "cursor", ",", "}", ":", "undefined", ",", "take", ":", "take", "+", "1", ",", "skip", ":", "0", ",", "}", ")", ";", "const", "items", "=", "page", ".", "reverse", "(", ")", ";", "let", "prevCursor", "=", "null", ";", "if", "(", "items", ".", "length", ">", "take", ")", "{", "const", "prev", "=", "items", ".", "shift", "(", ")", ";", "prevCursor", "=", "prev", "!", ".", "createdAt", ";", "}", "return", "{", "items", ",", "prevCursor", ",", "}", ";", "}", ",", "}", ")", ".", "mutation", "(", "'create'", ",", "{", "input", ":", "z", ".", "object", "(", "{", "text", ":", "z", ".", "string", "(", ")", ".", "min", "(", "2", ")", ",", "}", ")", ",", "resolve", ":", "async", "(", "{", "input", "}", ")", "=>", "{", "const", "msg", "=", "await", "createMessage", "(", "input", ".", "text", ")", ";", "return", "msg", ";", "}", ",", "}", ")", ".", "subscription", "(", "'newMessages'", ",", "{", "input", ":", "z", ".", "object", "(", "{", "timestamp", ":", "z", ".", "date", "(", ")", ",", "}", ")", ",", "resolve", ":", "(", "{", "input", "}", ")", "=>", "{", "const", "{", "timestamp", "}", "=", "input", ";", "return", "trpc", ".", "subscriptionPullFactory", "<", "Message", ">", "(", "{", "intervalMs", ":", "500", ",", "async", "pull", "(", "emit", ")", "{", "const", "msgs", "=", "await", "getMessagesAfter", "(", "timestamp", ")", ";", "for", "(", "const", "msg", "of", "msgs", ")", "{", "emit", ".", "data", "(", "msg", ")", ";", "}", "}", ",", "}", ")", ";", "}", ",", "}", ")", ")", ";", "export", "type", "AppRouter", "=", "typeof", "appRouter", ";", "export", "default", "trpcNext", ".", "createNextApiHandler", "(", "{", "router", ":", "appRouter", ",", "createContext", ",", "teardown", ":", "(", ")", "=>", "prisma", ".", "$disconnect", "(", ")", ",", "onError", "(", "{", "error", "}", ")", "{", "if", "(", "error", ".", "code", "===", "'INTERNAL_SERVER_ERROR'", ")", "{", "}", "}", ",", "batching", ":", "{", "enabled", ":", "true", ",", "}", ",", "}", ")", ";" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 26, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1366
[ "import", "{", "createReactQueryHooks", ",", "CreateTRPCClientOptions", "}", "from", "'@trpc/react'", ";", "import", "type", "{", "inferProcedureOutput", "}", "from", "'@trpc/server'", ";", "import", "superjson", "from", "'superjson'", ";", "import", "type", "{", "AppRouter", "}", "from", "'../pages/api/trpc/[trpc]'", ";", "export", "const", "trpc", "=", "createReactQueryHooks", "<", "AppRouter", ">", "(", ")", ";", "export", "const", "transformer", "=", "superjson", ";", "example", "export", "type", "inferQueryOutput", "<", "TRouteKey", "extends", "keyof", "AppRouter", "[", "'_def'", "]", "[", "'queries'", "]", ">", "=", "inferProcedureOutput", "<", "AppRouter", "[", "'_def'", "]", "[", "'queries'", "]", "[", "TRouteKey", "]", ">", ";" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1367
[ "jest", ".", "setTimeout", "(", "35e3", ")", ";", "test", "(", "'send message'", ",", "async", "(", ")", "=>", "{", "await", "new", "Promise", "(", "(", "resolve", ")", "=>", "setTimeout", "(", "resolve", ",", "1e3", ")", ")", ";", "await", "page", ".", "goto", "(", "'http://localhost:3000'", ")", ";", "const", "viewer", "=", "await", "browser", ".", "newPage", "(", ")", ";", "await", "viewer", ".", "goto", "(", "'http://localhost:3000'", ")", ";", "const", "nonce", "=", "Math", ".", "random", "(", ")", ".", "toString", "(", "36", ")", ".", "replace", "(", "/[^a-z]+/g", ",", "''", ")", ".", "substr", "(", "0", ",", "6", ")", ";", "await", "page", ".", "type", "(", "'[name=text]'", ",", "nonce", ")", ";", "await", "page", ".", "click", "(", "'[type=submit]'", ")", ";", "await", "viewer", ".", "waitForSelector", "(", "`text=${", "nonce", "}`", ")", ";", "viewer", ".", "close", "(", ")", ";", "}", ")", ";", "export", "{", "}", ";" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 203, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1368
[ "import", "{", "withTRPC", "}", "from", "'@trpc/next'", ";", "import", "{", "transformer", "}", "from", "'../utils/trpc'", ";", "import", "{", "httpBatchLink", "}", "from", "'@trpc/client/links/httpBatchLink'", ";", "import", "{", "AppType", "}", "from", "'next/dist/shared/lib/utils'", ";", "const", "MyApp", "=", "(", "{", "Component", ",", "pageProps", "}", ")", "=>", "{", "return", "<", "Component", "{", "...", "pageProps", "}", "/", ">", ";", "}", ";", "export", "default", "withTRPC", "(", "{", "config", "(", ")", "{", "return", "{", "transformer", ",", "links", ":", "[", "httpBatchLink", "(", "{", "url", ":", "process", ".", "browser", "?", "'/api/trpc'", ":", "'http://localhost:3000/api/trpc'", ",", "}", ")", ",", "]", ",", "}", ";", "}", ",", "ssr", ":", "false", ",", "}", ")", "(", "MyApp", ")", ";" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6527, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1369
[ "import", "{", "createSSGHelpers", "}", "from", "'@trpc/react/ssg'", ";", "import", "Head", "from", "'next/head'", ";", "import", "{", "useEffect", ",", "useMemo", ",", "useState", "}", "from", "'react'", ";", "import", "{", "inferQueryOutput", ",", "trpc", ",", "transformer", "}", "from", "'../utils/trpc'", ";", "import", "{", "appRouter", "}", "from", "'./api/trpc/[trpc]'", ";", "type", "MessagesOutput", "=", "inferQueryOutput", "<", "'messages.list'", ">", ";", "type", "Message", "=", "MessagesOutput", "[", "'items'", "]", "[", "number", "]", ";", "function", "maxDate", "(", "dates", ")", "{", "let", "max", "=", "dates", "[", "0", "]", ";", "for", "(", "const", "date", "of", "dates", ")", "{", "if", "(", "date", ".", "getTime", "(", ")", ">", "max", ".", "getTime", "(", ")", ")", "{", "max", "=", "date", ";", "}", "}", "return", "max", "??", "null", ";", "}", "const", "getLatestTimestamp", "=", "(", "m", ")", "=>", "{", "return", "m", ".", "reduce", "(", "(", "ts", ",", "msg", ")", "=>", "{", "return", "maxDate", "(", "[", "ts", ",", "msg", ".", "updatedAt", ",", "msg", ".", "createdAt", "]", ")", ";", "}", ",", "new", "Date", "(", "0", ")", ")", ";", "}", ";", "export", "default", "function", "Home", "(", ")", "{", "const", "{", "data", ",", "hasPreviousPage", ",", "isFetchingPreviousPage", ",", "fetchPreviousPage", "}", "=", "trpc", ".", "useInfiniteQuery", "(", "[", "'messages.list'", ",", "{", "}", "]", ",", "{", "getPreviousPageParam", ":", "(", "d", ")", "=>", "d", ".", "prevCursor", ",", "}", ")", ";", "const", "[", "msgState", ",", "setMessages", "]", "=", "useState", "(", "(", ")", "=>", "[", "]", "as", "Message", "[", "]", ")", ";", "const", "msgs", "=", "useMemo", "(", "(", ")", "=>", "{", "if", "(", "msgState", ".", "length", ")", "{", "return", "msgState", ";", "}", "return", "data", "?", "data", ".", "pages", ".", "map", "(", "(", "p", ")", "=>", "p", ".", "items", ")", ".", "flat", "(", ")", ":", "[", "]", ";", "}", ",", "[", "msgState", ",", "data", "]", ")", ";", "const", "addMessages", "=", "(", "newMessages", "?", ")", "=>", "{", "setMessages", "(", "(", "nowMessages", ")", "=>", "{", "const", "map", "=", "{", "}", ";", "for", "(", "const", "msg", "of", "nowMessages", ")", "{", "map", "[", "msg", ".", "id", "]", "=", "msg", ";", "}", "for", "(", "const", "msg", "of", "newMessages", "??", "[", "]", ")", "{", "map", "[", "msg", ".", "id", "]", "=", "msg", ";", "}", "return", "Object", ".", "values", "(", "map", ")", ".", "sort", "(", "(", "a", ",", "b", ")", "=>", "a", ".", "createdAt", ".", "getTime", "(", ")", "-", "b", ".", "createdAt", ".", "getTime", "(", ")", ")", ";", "}", ")", ";", "}", ";", "useEffect", "(", "(", ")", "=>", "{", "if", "(", "!", "data", ")", "{", "return", ";", "}", "const", "items", "=", "data", ".", "pages", ".", "map", "(", "(", "page", ")", "=>", "page", ".", "items", ")", ".", "flat", "(", ")", ";", "addMessages", "(", "items", ")", ";", "}", ",", "[", "data", "]", ")", ";", "const", "timestamp", "=", "useMemo", "(", "(", ")", "=>", "getLatestTimestamp", "(", "msgs", ")", ",", "[", "msgs", "]", ")", ";", "trpc", ".", "useSubscription", "(", "[", "'messages.newMessages'", ",", "{", "timestamp", "}", "]", ",", "{", "enabled", ":", "!", "!", "data", ",", "onNext", "(", "newMsgs", ")", "{", "addMessages", "(", "[", "newMsgs", "]", ")", ";", "}", ",", "}", ")", ";", "const", "addMessage", "=", "trpc", ".", "useMutation", "(", "'messages.create'", ")", ";", "return", "(", "<", ">", "<", "Head", ">", "<", "title", ">", "Chat", "<", "/title>", "<", "link", "rel", "=", "\"icon\"", "href", "=", "\"/favicon.ico\"", "/", ">", "<", "/Head>", "<", "h1", ">", "Chat", "<", "/h1>", "<", "h2", ">", "Messages", "<", "/h2>", "<", "button", "data", "-", "testid", "=", "\"loadMore\"", "onClick", "=", "{", "(", ")", "=>", "fetchPreviousPage", "(", ")", "}", "disabled", "=", "{", "!", "hasPreviousPage", "||", "isFetchingPreviousPage", "}", ">", "{", "isFetchingPreviousPage", "?", "'Loading more...'", ":", "hasPreviousPage", "?", "'Load More'", ":", "'Nothing more to load'", "}", "<", "/button>", "<", "ul", ">", "{", "msgs", ".", "map", "(", "(", "m", ")", "=>", "(", "<", "li", "key", "=", "{", "m", ".", "id", "}", ">", "{", "m", ".", "createdAt", ".", "toDateString", "(", ")", "}", "{", "m", ".", "createdAt", ".", "toLocaleTimeString", "(", ")", "}", ":", "{", "' '", "}", "{", "m", ".", "text", "}", "<", "/li>))}", "<", "/ul>", "<", "h3", ">", "Add", "message", "<", "/h3>", "<", "form", "onSubmit", "=", "{", "async", "(", "e", ")", "=>", "{", "e", ".", "preventDefault", "(", ")", ";", "const", "$text", "=", "(", "e", "as", "any", ")", ".", "target", ".", "elements", ".", "text", ";", "const", "input", "=", "{", "text", ":", "$text", ".", "value", ",", "}", ";", "try", "{", "const", "res", "=", "await", "addMessage", ".", "mutateAsync", "(", "input", ")", ";", "$text", ".", "value", "=", "''", ";", "addMessages", "(", "[", "res", "]", ")", ";", "}", "catch", "(", "cause", ")", "{", "}", "}", "}", ">", "<", "input", "name", "=", "\"text\"", "type", "=", "\"text\"", "/", ">", "<", "input", "type", "=", "\"submit\"", "disabled", "=", "{", "addMessage", ".", "isLoading", "}", "/", ">", "<", "/form>", "<", "div", "style", "=", "{", "{", "marginTop", ":", "'100px'", "}", "}", ">", "<", "a", "href", "=", "\"https://vercel.com/?utm_source=trpc&amp;utm_campaign=oss\"", "target", "=", "\"_blank\"", "rel", "=", "\"noreferrer\"", ">", "<", "img", "src", "=", "\"/powered-by-vercel.svg\"", "alt", "=", "\"Powered by Vercel\"", "height", "=", "\"25\"", "/", ">", "<", "/a>", "<", "/div>", "<", "/>);", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 26, null, 5, null, null, null, 26, null, null, null, null, null, null, null, null, null, 26, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 9, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, null, 5, null, null, null, null, null, null, null, 5, null, null, null, null, 17, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2757, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1370
[ "import", "{", "customElement", ",", "useView", ",", "PLATFORM", ",", "inject", "}", "from", "'aurelia-framework'", ";", "selector", "@", "inject", "(", "Element", ")", "@", "useView", "(", "PLATFORM", ".", "moduleName", "(", "'./mdc-icon.html'", ")", ")", "@", "customElement", "(", "'mdc-icon'", ")", "export", "class", "MdcIcon", "{", "constructor", "(", "public", "root", ")", "{", "}", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 15, null, null, null, null ]
1371
[ "import", "fontkit", "from", "'@pdf-lib/fontkit'", ";", "import", "{", "Assets", "}", "from", "'..'", ";", "import", "{", "clip", ",", "clipEvenOdd", ",", "closePath", ",", "cmyk", ",", "degrees", ",", "drawRectangle", ",", "endPath", ",", "grayscale", ",", "LineCapStyle", ",", "LineJoinStyle", ",", "lineTo", ",", "moveTo", ",", "PDFDocument", ",", "popGraphicsState", ",", "pushGraphicsState", ",", "rgb", ",", "setLineJoin", ",", "StandardFonts", ",", "typedArrayFor", ",", "AFRelationship", ",", "}", "from", "'../../..'", ";", "const", "ipsumLines", "=", "[", "'Eligendi est pariatur quidem in non excepturi et.'", ",", "'Consectetur non tenetur magnam est corporis tempor.'", ",", "'Labore nisi officiis quia ipsum qui voluptatem omnis.'", ",", "]", ";", "export", "default", "async", "(", "assets", ")", "=>", "{", "const", "pdfDoc", "=", "await", "PDFDocument", ".", "create", "(", ")", ";", "pdfDoc", ".", "setTitle", "(", "'🥚 The Life of an Egg 🍳'", ",", "{", "showInWindowTitleBar", ":", "true", "}", ")", ";", "pdfDoc", ".", "setAuthor", "(", "'Humpty Dumpty'", ")", ";", "pdfDoc", ".", "setSubject", "(", "'📘 An Epic Tale of Woe 📖'", ")", ";", "pdfDoc", ".", "setKeywords", "(", "[", "'eggs'", ",", "'wall'", ",", "'fall'", ",", "'king'", ",", "'horses'", ",", "'men'", "]", ")", ";", "pdfDoc", ".", "setProducer", "(", "'PDF App 9000 🤖'", ")", ";", "pdfDoc", ".", "setCreator", "(", "'PDF App 9000 🤖'", ")", ";", "pdfDoc", ".", "setCreationDate", "(", "new", "Date", "(", "'2018-06-24T01:58:37.228Z'", ")", ")", ";", "pdfDoc", ".", "setModificationDate", "(", "new", "Date", "(", "'2018-12-21T07:00:11.000Z'", ")", ")", ";", "pdfDoc", ".", "registerFontkit", "(", "fontkit", ")", ";", "await", "pdfDoc", ".", "attach", "(", "assets", ".", "images", ".", "png", ".", "greyscale_bird", ",", "'bird.png'", ",", "{", "mimeType", ":", "'image/png'", ",", "description", ":", "'A bird in greyscale 🐦'", ",", "creationDate", ":", "new", "Date", "(", "'2006/06/06'", ")", ",", "modificationDate", ":", "new", "Date", "(", "'2007/07/07'", ")", ",", "afRelationship", ":", "AFRelationship", ".", "Data", ",", "}", ")", ";", "const", "csvString", "=", "[", "'Year,Make,Model'", ",", "'1997,Ford,E350'", ",", "'2000,Mercury,Cougar'", ",", "]", ".", "join", "(", "'\\n'", ")", ";", "await", "pdfDoc", ".", "attach", "(", "typedArrayFor", "(", "csvString", ")", ",", "'cars.csv'", ",", "{", "mimeType", ":", "'text/csv'", ",", "description", ":", "'Some car info 🚗'", ",", "creationDate", ":", "new", "Date", "(", "'2000/01/13'", ")", ",", "modificationDate", ":", "new", "Date", "(", "'2012/12/12'", ")", ",", "afRelationship", ":", "AFRelationship", ".", "Unspecified", ",", "}", ")", ";", "const", "timesRomanFont", "=", "await", "pdfDoc", ".", "embedFont", "(", "StandardFonts", ".", "TimesRoman", ")", ";", "const", "size", "=", "750", ";", "pdfDoc", ".", "addJavaScript", "(", "'main'", ",", "'console.show(); console.println(\"Hello World!\")'", ")", ";", "/********************** Page 1 **********************/", "const", "page1", "=", "pdfDoc", ".", "addPage", "(", "[", "size", ",", "size", "]", ")", ";", "page1", ".", "moveTo", "(", "0", ",", "size", "/", "2", ")", ";", "page1", ".", "drawSquare", "(", "{", "size", ":", "size", "/", "2", ",", "color", ":", "rgb", "(", "1", ",", "0", ",", "0", ")", "}", ")", ";", "page1", ".", "pushOperators", "(", "pushGraphicsState", "(", ")", ",", "moveTo", "(", "0", ",", "size", "/", "2", ")", ",", "lineTo", "(", "0", ",", "size", ")", ",", "lineTo", "(", "size", "/", "2", ",", "size", ")", ",", "closePath", "(", ")", ",", "clip", "(", ")", ",", "endPath", "(", ")", ",", "...", "drawRectangle", "(", "{", "x", ":", "size", "/", "8", ",", "y", ":", "size", "/", "2", "+", "size", "/", "8", ",", "width", ":", "size", "/", "4", ",", "height", ":", "size", "/", "4", ",", "borderWidth", ":", "50", ",", "borderColor", ":", "rgb", "(", "1", ",", "1", ",", "0", ")", ",", "rotate", ":", "degrees", "(", "0", ")", ",", "xSkew", ":", "degrees", "(", "0", ")", ",", "ySkew", ":", "degrees", "(", "0", ")", ",", "color", ":", "undefined", ",", "}", ")", ",", "popGraphicsState", "(", ")", ")", ";", "page1", ".", "pushOperators", "(", "pushGraphicsState", "(", ")", ")", ";", "page1", ".", "moveTo", "(", "size", "/", "2", ",", "size", "/", "2", ")", ";", "page1", ".", "drawSquare", "(", "{", "size", ":", "size", "/", "2", ",", "color", ":", "rgb", "(", "0", ",", "1", ",", "0", ")", "}", ")", ";", "page1", ".", "drawEllipse", "(", "{", "x", ":", "size", "/", "2", "+", "size", "/", "4", ",", "y", ":", "size", "/", "2", "+", "size", "/", "4", ",", "xScale", ":", "25", ",", "yScale", ":", "150", ",", "color", ":", "rgb", "(", "255", "/", "255", ",", "153", "/", "255", ",", "51", "/", "255", ")", ",", "borderWidth", ":", "2", ",", "borderColor", ":", "rgb", "(", "0", ",", "1", ",", "1", ")", ",", "borderDashArray", ":", "[", "10", "]", ",", "}", ")", ";", "page1", ".", "drawEllipse", "(", "{", "x", ":", "size", "/", "2", "+", "size", "/", "4", ",", "y", ":", "size", "/", "2", "+", "size", "/", "4", ",", "xScale", ":", "75", ",", "yScale", ":", "50", ",", "color", ":", "undefined", ",", "}", ")", ";", "page1", ".", "drawEllipse", "(", "{", "x", ":", "size", "/", "2", "+", "size", "/", "4", ",", "y", ":", "size", "/", "2", "+", "size", "/", "4", ",", "xScale", ":", "150", ",", "yScale", ":", "100", ",", "color", ":", "undefined", ",", "}", ")", ";", "page1", ".", "pushOperators", "(", "clipEvenOdd", "(", ")", ",", "endPath", "(", ")", ")", ";", "page1", ".", "setFont", "(", "timesRomanFont", ")", ";", "page1", ".", "setFontColor", "(", "rgb", "(", "1", ",", "0", ",", "1", ")", ")", ";", "page1", ".", "setFontSize", "(", "32", ")", ";", "page1", ".", "setLineHeight", "(", "32", ")", ";", "page1", ".", "moveTo", "(", "size", "/", "2", "+", "5", ",", "size", "-", "5", "-", "25", ")", ";", "page1", ".", "drawText", "(", "[", "...", "ipsumLines", ",", "...", "ipsumLines", ",", "...", "ipsumLines", ",", "...", "ipsumLines", "]", ".", "join", "(", "'\\n'", ")", ")", ";", "page1", ".", "pushOperators", "(", "popGraphicsState", "(", ")", ")", ";", "page1", ".", "moveTo", "(", "0", ",", "0", ")", ";", "page1", ".", "drawSquare", "(", "{", "size", ":", "size", "/", "2", ",", "color", ":", "cmyk", "(", "1", ",", "0", ",", "0", ",", "0", ")", "}", ")", ";", "page1", ".", "drawCircle", "(", "{", "x", ":", "size", "/", "4", ",", "y", ":", "size", "/", "4", ",", "size", ":", "150", ",", "borderWidth", ":", "10", ",", "borderDashArray", ":", "[", "25", "]", ",", "borderDashPhase", ":", "25", ",", "borderColor", ":", "cmyk", "(", "0", ",", "1", ",", "0", ",", "0", ")", ",", "borderLineCap", ":", "LineCapStyle", ".", "Round", ",", "}", ")", ";", "page1", ".", "drawLine", "(", "{", "start", ":", "{", "x", ":", "size", "/", "4", ",", "y", ":", "size", "/", "4", ",", "}", ",", "end", ":", "{", "x", ":", "size", "/", "4", "+", "100", ",", "y", ":", "size", "/", "4", "+", "100", ",", "}", ",", "color", ":", "rgb", "(", "0", ",", "1", ",", "0", ")", ",", "thickness", ":", "3", ",", "dashArray", ":", "[", "12", ",", "6", "]", ",", "lineCap", ":", "LineCapStyle", ".", "Round", ",", "}", ")", ";", "page1", ".", "moveTo", "(", "size", "/", "2", ",", "0", ")", ";", "page1", ".", "drawSquare", "(", "{", "size", ":", "size", "/", "2", ",", "color", ":", "grayscale", "(", "0.8", ")", "}", ")", ";", "page1", ".", "pushOperators", "(", "pushGraphicsState", "(", ")", ",", "setLineJoin", "(", "LineJoinStyle", ".", "Round", ")", ")", ";", "page1", ".", "drawSquare", "(", "{", "x", ":", "size", "/", "2", "+", "size", "/", "4", ",", "y", ":", "25", ",", "size", ":", "size", "/", "2.25", "-", "2", "*", "50", ",", "rotate", ":", "degrees", "(", "45", ")", ",", "borderColor", ":", "grayscale", "(", "0.6", ")", ",", "borderWidth", ":", "15", ",", "}", ")", ";", "page1", ".", "pushOperators", "(", "setLineJoin", "(", "LineJoinStyle", ".", "Bevel", ")", ")", ";", "page1", ".", "drawSquare", "(", "{", "x", ":", "size", "/", "2", "+", "54", ",", "y", ":", "size", "/", "4", "+", "1", ",", "size", ":", "size", "/", "2.25", "-", "2", "*", "100", ",", "rotate", ":", "degrees", "(", "-", "45", ")", ",", "xSkew", ":", "degrees", "(", "45", "/", "2", ")", ",", "ySkew", ":", "degrees", "(", "45", "/", "2", ")", ",", "color", ":", "grayscale", "(", "1", ")", ",", "borderColor", ":", "grayscale", "(", "0", ")", ",", "borderWidth", ":", "15", ",", "}", ")", ";", "page1", ".", "pushOperators", "(", "popGraphicsState", "(", ")", ")", ";", "const", "squareSize", "=", "40", ";", "page1", ".", "drawSquare", "(", "{", "x", ":", "size", "/", "2", "-", "squareSize", "/", "2", ",", "y", ":", "size", "/", "2", "-", "squareSize", "/", "2", ",", "size", ":", "squareSize", ",", "borderWidth", ":", "2", ",", "borderColor", ":", "rgb", "(", "1", ",", "0", ",", "1", ")", ",", "borderDashArray", ":", "[", "2", ",", "4", "]", ",", "}", ")", ";", "const", "rectangleSizeX", "=", "60", ";", "const", "rectangleSizeY", "=", "50", ";", "page1", ".", "drawRectangle", "(", "{", "x", ":", "size", "/", "2", "-", "rectangleSizeX", "/", "2", ",", "y", ":", "size", "/", "2", "-", "rectangleSizeY", "/", "2", ",", "width", ":", "rectangleSizeX", ",", "height", ":", "rectangleSizeY", ",", "borderWidth", ":", "2", ",", "borderColor", ":", "rgb", "(", "1", ",", "1", ",", "1", ")", ",", "borderDashArray", ":", "[", "4", ",", "8", "]", ",", "}", ")", ";", "/********************** Page 2 **********************/", "const", "page2", "=", "pdfDoc", ".", "addPage", "(", "[", "size", ",", "size", "]", ")", ";", "page2", ".", "drawSquare", "(", "{", "size", ",", "color", ":", "rgb", "(", "253", "/", "255", ",", "246", "/", "255", ",", "227", "/", "255", ")", "}", ")", ";", "page2", ".", "setFontColor", "(", "rgb", "(", "101", "/", "255", ",", "123", "/", "255", ",", "131", "/", "255", ")", ")", ";", "const", "{", "fonts", "}", "=", "assets", ";", "const", "ubuntuFont", "=", "await", "pdfDoc", ".", "embedFont", "(", "fonts", ".", "ttf", ".", "ubuntu_r_base64", ",", "{", "subset", ":", "true", ",", "}", ")", ";", "page2", ".", "drawText", "(", "ipsumLines", ".", "join", "(", "'\\n'", ")", ",", "{", "y", ":", "size", "-", "20", ",", "size", ":", "20", ",", "font", ":", "ubuntuFont", ",", "lineHeight", ":", "20", ",", "}", ")", ";", "const", "fantasqueFont", "=", "await", "pdfDoc", ".", "embedFont", "(", "fonts", ".", "otf", ".", "fantasque_sans_mono_bi", ")", ";", "page2", ".", "drawText", "(", "ipsumLines", ".", "join", "(", "'\\n'", ")", ",", "{", "y", ":", "size", "-", "105", ",", "size", ":", "25", ",", "font", ":", "fantasqueFont", ",", "lineHeight", ":", "25", ",", "}", ")", ";", "const", "indieFlowerFont", "=", "await", "pdfDoc", ".", "embedFont", "(", "fonts", ".", "ttf", ".", "indie_flower_r", ",", "{", "subset", ":", "true", ",", "}", ")", ";", "page2", ".", "drawText", "(", "ipsumLines", ".", "join", "(", "'\\n'", ")", ",", "{", "y", ":", "size", "-", "200", ",", "size", ":", "25", ",", "font", ":", "indieFlowerFont", ",", "lineHeight", ":", "25", ",", "}", ")", ";", "const", "greatVibesFont", "=", "await", "pdfDoc", ".", "embedFont", "(", "fonts", ".", "ttf", ".", "great_vibes_r", ",", "{", "subset", ":", "true", ",", "}", ")", ";", "page2", ".", "drawText", "(", "ipsumLines", ".", "join", "(", "'\\n'", ")", ",", "{", "y", ":", "size", "-", "300", ",", "size", ":", "30", ",", "font", ":", "greatVibesFont", ",", "lineHeight", ":", "30", ",", "}", ")", ";", "const", "appleStormFont", "=", "await", "pdfDoc", ".", "embedFont", "(", "fonts", ".", "otf", ".", "apple_storm_r", ")", ";", "page2", ".", "drawText", "(", "ipsumLines", ".", "join", "(", "'\\n'", ")", ",", "{", "y", ":", "size", "-", "425", ",", "size", ":", "25", ",", "font", ":", "appleStormFont", ",", "lineHeight", ":", "25", ",", "}", ")", ";", "const", "bioRhymeFont", "=", "await", "pdfDoc", ".", "embedFont", "(", "fonts", ".", "ttf", ".", "bio_rhyme_r", ",", "{", "subset", ":", "true", ",", "}", ")", ";", "page2", ".", "drawText", "(", "ipsumLines", ".", "join", "(", "'\\n'", ")", ",", "{", "y", ":", "size", "-", "500", ",", "size", ":", "15", ",", "font", ":", "bioRhymeFont", ",", "lineHeight", ":", "15", ",", "}", ")", ";", "const", "pressStart2PFont", "=", "await", "pdfDoc", ".", "embedFont", "(", "fonts", ".", "ttf", ".", "press_start_2p_r", ",", "{", "subset", ":", "true", ",", "}", ")", ";", "page2", ".", "drawText", "(", "ipsumLines", ".", "join", "(", "'\\n'", ")", ",", "{", "y", ":", "size", "-", "575", ",", "size", ":", "15", ",", "font", ":", "pressStart2PFont", ",", "lineHeight", ":", "15", ",", "}", ")", ";", "const", "hussar3DFont", "=", "await", "pdfDoc", ".", "embedFont", "(", "fonts", ".", "otf", ".", "hussar_3d_r", ")", ";", "page2", ".", "drawText", "(", "ipsumLines", ".", "join", "(", "'\\n'", ")", ",", "{", "y", ":", "size", "-", "650", ",", "size", ":", "25", ",", "font", ":", "hussar3DFont", ",", "lineHeight", ":", "25", ",", "}", ")", ";", "/********************** Page 3 **********************/", "const", "page3Height", "=", "1750", ";", "const", "page3", "=", "pdfDoc", ".", "addPage", "(", "[", "size", ",", "page3Height", "]", ")", ";", "const", "{", "jpg", ",", "png", "}", "=", "assets", ".", "images", ";", "const", "catRidingUnicornImage", "=", "await", "pdfDoc", ".", "embedJpg", "(", "jpg", ".", "cat_riding_unicorn_base64", ")", ";", "const", "minionsLaughingImage", "=", "await", "pdfDoc", ".", "embedJpg", "(", "jpg", ".", "minions_laughing", ")", ";", "const", "greyscaleBirdImage", "=", "await", "pdfDoc", ".", "embedPng", "(", "png", ".", "greyscale_bird_base64_uri", ")", ";", "const", "minionsBananaAlphaImage", "=", "await", "pdfDoc", ".", "embedPng", "(", "png", ".", "minions_banana_alpha", ")", ";", "const", "minionsBananaNoAlphaImage", "=", "await", "pdfDoc", ".", "embedPng", "(", "png", ".", "minions_banana_no_alpha", ")", ";", "const", "smallMarioImage", "=", "await", "pdfDoc", ".", "embedPng", "(", "png", ".", "small_mario", ")", ";", "const", "catRidingUnicornDims", "=", "catRidingUnicornImage", ".", "scale", "(", "0.2", ")", ";", "const", "minionsLaughingDims", "=", "minionsLaughingImage", ".", "scale", "(", "0.75", ")", ";", "const", "greyscaleBirdDims", "=", "greyscaleBirdImage", ".", "scale", "(", "0.75", ")", ";", "const", "minionsBananaAlphaDims", "=", "minionsBananaAlphaImage", ".", "scale", "(", "0.5", ")", ";", "const", "minionsBananaNoAlphaDims", "=", "minionsBananaNoAlphaImage", ".", "scale", "(", "0.5", ")", ";", "const", "smallMarioDims", "=", "smallMarioImage", ".", "scale", "(", "0.18", ")", ";", "page3", ".", "moveTo", "(", "0", ",", "0", ")", ";", "page3", ".", "drawRectangle", "(", "{", "width", ":", "minionsBananaAlphaDims", ".", "width", ",", "height", ":", "minionsBananaAlphaDims", ".", "height", "+", "minionsBananaNoAlphaDims", ".", "height", "+", "smallMarioDims", ".", "height", ",", "color", ":", "rgb", "(", "0", ",", "1", ",", "0", ")", ",", "}", ")", ";", "page3", ".", "moveTo", "(", "0", ",", "page3Height", ")", ";", "page3", ".", "moveDown", "(", "catRidingUnicornDims", ".", "height", ")", ";", "page3", ".", "drawImage", "(", "catRidingUnicornImage", ",", "catRidingUnicornDims", ")", ";", "page3", ".", "moveDown", "(", "minionsLaughingDims", ".", "height", ")", ";", "page3", ".", "drawImage", "(", "minionsLaughingImage", ",", "minionsLaughingDims", ")", ";", "page3", ".", "moveDown", "(", "greyscaleBirdDims", ".", "height", ")", ";", "page3", ".", "drawImage", "(", "greyscaleBirdImage", ",", "greyscaleBirdDims", ")", ";", "page3", ".", "moveDown", "(", "minionsBananaAlphaDims", ".", "height", ")", ";", "page3", ".", "drawImage", "(", "minionsBananaAlphaImage", ",", "minionsBananaAlphaDims", ")", ";", "page3", ".", "moveDown", "(", "minionsBananaNoAlphaDims", ".", "height", ")", ";", "page3", ".", "drawImage", "(", "minionsBananaNoAlphaImage", ",", "minionsBananaNoAlphaDims", ")", ";", "page3", ".", "moveDown", "(", "smallMarioDims", ".", "height", ")", ";", "page3", ".", "drawImage", "(", "smallMarioImage", ",", "smallMarioDims", ")", ";", "/********************** Page 4 **********************/", "const", "page4", "=", "pdfDoc", ".", "addPage", "(", "[", "size", ",", "size", "]", ")", ";", "const", "embeddedPage3", "=", "await", "pdfDoc", ".", "embedPage", "(", "page3", ")", ";", "page4", ".", "drawPage", "(", "embeddedPage3", ",", "{", "x", ":", "10", ",", "y", ":", "size", "-", "10", ",", "xScale", ":", "1.52", ",", "yScale", ":", "0.42", ",", "rotate", ":", "degrees", "(", "-", "90", ")", ",", "}", ")", ";", "const", "[", "embeddedPage1", ",", "embeddedPage2", "]", "=", "await", "pdfDoc", ".", "embedPdf", "(", "assets", ".", "pdfs", ".", "normal", ",", "[", "0", ",", "1", "]", ")", ";", "page4", ".", "drawPage", "(", "embeddedPage1", ",", "{", "x", ":", "40", ",", "y", ":", "100", ",", "xScale", ":", "0.5", ",", "yScale", ":", "0.5", ",", "opacity", ":", "0.5", ",", "}", ")", ";", "page4", ".", "drawPage", "(", "embeddedPage2", ",", "{", "x", ":", "400", ",", "y", ":", "100", ",", "xScale", ":", "0.5", ",", "yScale", ":", "0.5", ",", "}", ")", ";", "/********************** Page 5 **********************/", "const", "pastels", "=", "{", "greyishGreen", ":", "rgb", "(", "85", "/", "255", ",", "117", "/", "255", ",", "113", "/", "255", ")", ",", "brownish", ":", "rgb", "(", "212", "/", "255", ",", "154", "/", "255", ",", "137", "/", "255", ")", ",", "tan", ":", "rgb", "(", "247", "/", "255", ",", "209", "/", "255", ",", "186", "/", "255", ")", ",", "whiteish", ":", "rgb", "(", "244", "/", "255", ",", "244", "/", "255", ",", "244", "/", "255", ")", ",", "lightBlue", ":", "rgb", "(", "221", "/", "255", ",", "243", "/", "255", ",", "245", "/", "255", ")", ",", "blue", ":", "rgb", "(", "166", "/", "255", ",", "220", "/", "255", ",", "239", "/", "255", ")", ",", "pinkish", ":", "rgb", "(", "242", "/", "255", ",", "170", "/", "255", ",", "170", "/", "255", ")", ",", "hotPink", ":", "rgb", "(", "227", "/", "255", ",", "99", "/", "255", ",", "135", "/", "255", ")", ",", "yellow", ":", "rgb", "(", "250", "/", "255", ",", "240", "/", "255", ",", "175", "/", "255", ")", ",", "darkBlue", ":", "rgb", "(", "7", "/", "255", ",", "104", "/", "255", ",", "159", "/", "255", ")", ",", "}", ";", "const", "page5", "=", "pdfDoc", ".", "addPage", "(", "[", "size", ",", "size", "]", ")", ";", "const", "form", "=", "pdfDoc", ".", "getForm", "(", ")", ";", "const", "fWidth", "=", "100", ";", "const", "fHeight", "=", "50", ";", "const", "fPadding", "=", "25", ";", "const", "fMax", "=", "Math", ".", "max", "(", "fWidth", ",", "fHeight", ")", ";", "[", "{", "name", ":", "'moi.text.field[0]'", ",", "text", ":", "'Foo'", ",", "font", ":", "ubuntuFont", "}", ",", "{", "name", ":", "'moi.text.field[1]'", ",", "text", ":", "'Bar'", "}", ",", "{", "name", ":", "'moi.text.field[2]'", ",", "text", ":", "'Qux'", ",", "font", ":", "ubuntuFont", "}", ",", "{", "name", ":", "'moi.text.field[3]'", ",", "text", ":", "'Baz'", "}", ",", "]", ".", "forEach", "(", "(", "{", "name", ",", "text", ",", "font", "}", ",", "idx", ")", "=>", "{", "const", "textField", "=", "form", ".", "createTextField", "(", "name", ")", ";", "textField", ".", "setText", "(", "text", ")", ";", "textField", ".", "addToPage", "(", "page5", ",", "{", "x", ":", "fPadding", "+", "fWidth", ",", "y", ":", "size", "-", "fMax", "-", "fPadding", ",", "width", ":", "fWidth", ",", "height", ":", "fHeight", ",", "rotate", ":", "degrees", "(", "90", "*", "idx", ")", ",", "borderWidth", ":", "4", ",", "backgroundColor", ":", "pastels", ".", "pinkish", ",", "borderColor", ":", "pastels", ".", "blue", ",", "textColor", ":", "pastels", ".", "whiteish", ",", "font", ":", "ubuntuFont", ",", "}", ")", ";", "if", "(", "font", ")", "textField", ".", "updateAppearances", "(", "font", ")", ";", "}", ")", ";", "[", "{", "name", ":", "'moi.button.field[0]'", ",", "text", ":", "'Earth'", ",", "font", ":", "ubuntuFont", "}", ",", "{", "name", ":", "'moi.button.field[1]'", ",", "text", ":", "'Mars'", ",", "font", ":", "timesRomanFont", "}", ",", "{", "name", ":", "'moi.button.field[2]'", ",", "text", ":", "'Venus'", ",", "font", ":", "ubuntuFont", "}", ",", "{", "name", ":", "'moi.button.field[3]'", ",", "text", ":", "'Saturn'", ",", "font", ":", "timesRomanFont", "}", ",", "]", ".", "forEach", "(", "(", "{", "name", ",", "text", ",", "font", "}", ",", "idx", ")", "=>", "{", "const", "button", "=", "form", ".", "createButton", "(", "name", ")", ";", "button", ".", "addToPage", "(", "text", ",", "page5", ",", "{", "x", ":", "fPadding", "*", "2", "+", "fWidth", "*", "3", ",", "y", ":", "size", "-", "fMax", "-", "fPadding", ",", "width", ":", "fWidth", ",", "height", ":", "fHeight", ",", "rotate", ":", "degrees", "(", "90", "*", "idx", ")", ",", "borderWidth", ":", "4", ",", "backgroundColor", ":", "pastels", ".", "brownish", ",", "borderColor", ":", "pastels", ".", "tan", ",", "textColor", ":", "pastels", ".", "greyishGreen", ",", "font", ",", "}", ")", ";", "}", ")", ";", "[", "{", "name", ":", "'moi.dropdown.field[0]'", ",", "choice", ":", "'Exia'", ",", "font", ":", "ubuntuFont", "}", ",", "{", "name", ":", "'moi.dropdown.field[1]'", ",", "choice", ":", "'Kyrios'", ",", "font", ":", "timesRomanFont", "}", ",", "{", "name", ":", "'moi.dropdown.field[2]'", ",", "choice", ":", "'Dynames'", ",", "font", ":", "ubuntuFont", "}", ",", "{", "name", ":", "'moi.dropdown.field[3]'", ",", "choice", ":", "'Virtue'", ",", "font", ":", "timesRomanFont", "}", ",", "]", ".", "forEach", "(", "(", "{", "name", ",", "choice", ",", "font", "}", ",", "idx", ")", "=>", "{", "const", "dropdown", "=", "form", ".", "createDropdown", "(", "name", ")", ";", "dropdown", ".", "addOptions", "(", "[", "'Exia'", ",", "'Dynames'", ",", "'Kyrios'", ",", "'Virtue'", "]", ")", ";", "dropdown", ".", "select", "(", "choice", ")", ";", "dropdown", ".", "addToPage", "(", "page5", ",", "{", "x", ":", "fPadding", "*", "3", "+", "fWidth", "*", "5", ",", "y", ":", "size", "-", "fMax", "-", "fPadding", ",", "width", ":", "fWidth", ",", "height", ":", "fHeight", ",", "rotate", ":", "degrees", "(", "90", "*", "idx", ")", ",", "borderWidth", ":", "4", ",", "backgroundColor", ":", "pastels", ".", "greyishGreen", ",", "borderColor", ":", "pastels", ".", "hotPink", ",", "textColor", ":", "pastels", ".", "brownish", ",", "font", ",", "}", ")", ";", "}", ")", ";", "[", "{", "name", ":", "'moi.checkBox.field[0]'", "}", ",", "{", "name", ":", "'moi.checkBox.field[1]'", "}", ",", "{", "name", ":", "'moi.checkBox.field[2]'", "}", ",", "{", "name", ":", "'moi.checkBox.field[3]'", "}", ",", "]", ".", "forEach", "(", "(", "{", "name", "}", ",", "idx", ")", "=>", "{", "const", "checkBox", "=", "form", ".", "createCheckBox", "(", "name", ")", ";", "checkBox", ".", "check", "(", ")", ";", "checkBox", ".", "addToPage", "(", "page5", ",", "{", "x", ":", "fPadding", "+", "fWidth", ",", "y", ":", "size", "-", "fMax", "*", "3", "-", "fPadding", "*", "2", ",", "width", ":", "fHeight", ",", "height", ":", "fHeight", ",", "rotate", ":", "degrees", "(", "90", "*", "idx", ")", ",", "borderWidth", ":", "4", ",", "backgroundColor", ":", "pastels", ".", "whiteish", ",", "borderColor", ":", "pastels", ".", "greyishGreen", ",", "textColor", ":", "pastels", ".", "hotPink", ",", "}", ")", ";", "}", ")", ";", "[", "{", "name", ":", "'moi.optionList.field[0]'", ",", "choice", ":", "'TypeScript'", ",", "font", ":", "ubuntuFont", "}", ",", "{", "name", ":", "'moi.optionList.field[1]'", ",", "choice", ":", "'Kotlin'", ",", "font", ":", "timesRomanFont", "}", ",", "{", "name", ":", "'moi.optionList.field[2]'", ",", "choice", ":", "'Python'", ",", "font", ":", "ubuntuFont", "}", ",", "{", "name", ":", "'moi.optionList.field[3]'", ",", "choice", ":", "'Swift'", ",", "font", ":", "timesRomanFont", "}", ",", "]", ".", "forEach", "(", "(", "{", "name", ",", "choice", ",", "font", "}", ",", "idx", ")", "=>", "{", "const", "optionList", "=", "form", ".", "createOptionList", "(", "name", ")", ";", "optionList", ".", "addOptions", "(", "[", "'TypeScript'", ",", "'Kotlin'", ",", "'Python'", ",", "'Swift'", "]", ")", ";", "optionList", ".", "select", "(", "choice", ")", ";", "optionList", ".", "addToPage", "(", "page5", ",", "{", "x", ":", "fPadding", "*", "2", "+", "fWidth", "*", "3", ",", "y", ":", "size", "-", "fMax", "*", "3", "-", "fPadding", "*", "2", ",", "width", ":", "fWidth", ",", "height", ":", "fHeight", ",", "rotate", ":", "degrees", "(", "90", "*", "idx", ")", ",", "borderWidth", ":", "4", ",", "backgroundColor", ":", "pastels", ".", "tan", ",", "borderColor", ":", "pastels", ".", "yellow", ",", "textColor", ":", "pastels", ".", "hotPink", ",", "font", ",", "}", ")", ";", "}", ")", ";", "const", "radioGroup", "=", "form", ".", "createRadioGroup", "(", "'moi.radioGroup.field[0]'", ")", ";", "[", "{", "option", ":", "'Bing'", "}", ",", "{", "option", ":", "'Boing'", "}", ",", "{", "option", ":", "'Bang'", "}", ",", "{", "option", ":", "'Bloop'", "}", ",", "]", ".", "forEach", "(", "(", "{", "option", "}", ",", "idx", ")", "=>", "{", "radioGroup", ".", "addOptionToPage", "(", "option", ",", "page5", ",", "{", "x", ":", "fPadding", "*", "3", "+", "fWidth", "*", "5", ",", "y", ":", "size", "-", "fMax", "*", "3", "-", "fPadding", "*", "2", ",", "width", ":", "fHeight", ",", "height", ":", "fHeight", ",", "rotate", ":", "degrees", "(", "90", "*", "idx", ")", ",", "borderWidth", ":", "4", ",", "backgroundColor", ":", "pastels", ".", "blue", ",", "borderColor", ":", "pastels", ".", "pinkish", ",", "textColor", ":", "pastels", ".", "yellow", ",", "}", ")", ";", "}", ")", ";", "radioGroup", ".", "select", "(", "'Bing'", ")", ";", "const", "combedTf", "=", "form", ".", "createTextField", "(", "'moi.combed.text.field'", ")", ";", "combedTf", ".", "setMaxLength", "(", "7", ")", ";", "combedTf", ".", "enableCombing", "(", ")", ";", "combedTf", ".", "setText", "(", "'ABC-123'", ")", ";", "combedTf", ".", "addToPage", "(", "page5", ",", "{", "x", ":", "fPadding", "+", "fWidth", "/", "2", ",", "y", ":", "size", "-", "fMax", "*", "5", "-", "fPadding", "*", "3", ",", "width", ":", "fWidth", "*", "2.5", ",", "height", ":", "fHeight", ",", "borderWidth", ":", "4", ",", "backgroundColor", ":", "pastels", ".", "yellow", ",", "borderColor", ":", "pastels", ".", "brownish", ",", "textColor", ":", "pastels", ".", "darkBlue", ",", "font", ":", "ubuntuFont", ",", "}", ")", ";", "const", "multilineTf", "=", "form", ".", "createTextField", "(", "'moi.multiline.text.field'", ")", ";", "multilineTf", ".", "enableMultiline", "(", ")", ";", "multilineTf", ".", "setText", "(", "`In the morning, when you can't get out of bed, tell yourself: \"I'm getting up to do the work only a man can do. How can I possibly hesitate or complain when I'm about to accomplish the task for which I was born? Was I made for lying warm in bed under a pile of blankets?\"\\n\\n\"But I enjoy it here.\"\\n\\nWas it for enjoyment you were born? Are you designed to act or to be acted upon?\\n\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t - Marcus Aurelius`", ")", ";", "multilineTf", ".", "addToPage", "(", "page5", ",", "{", "x", ":", "fPadding", "*", "3", "+", "fWidth", "/", "2", "+", "fWidth", "*", "2.5", ",", "y", ":", "size", "-", "fMax", "*", "5", "-", "fPadding", "*", "3", "-", "fHeight", "*", "3", ",", "width", ":", "fWidth", "*", "2.5", ",", "height", ":", "fHeight", "*", "5", ",", "borderWidth", ":", "4", ",", "backgroundColor", ":", "pastels", ".", "whiteish", ",", "borderColor", ":", "pastels", ".", "brownish", ",", "textColor", ":", "pastels", ".", "greyishGreen", ",", "font", ":", "ubuntuFont", ",", "}", ")", ";", "page5", ".", "drawText", "(", "'There should be no remnant of a field\\nbelow this text!!'", ",", "{", "y", ":", "size", "-", "fMax", "*", "5", "-", "fPadding", "*", "0", "-", "fHeight", "*", "3", ",", "x", ":", "fPadding", ",", "size", ":", "18", ",", "font", ":", "indieFlowerFont", ",", "lineHeight", ":", "18", ",", "}", ")", ";", "const", "textField", "=", "form", ".", "createTextField", "(", "'a.new.text.field'", ")", ";", "textField", ".", "setText", "(", "'This Should Not Be Visible'", ")", ";", "textField", ".", "addToPage", "(", "page5", ",", "{", "x", ":", "fPadding", ",", "y", ":", "size", "-", "fMax", "*", "5", "-", "fPadding", "*", "3.5", "-", "fHeight", "*", "3", ",", "width", ":", "fWidth", "*", "2.5", ",", "height", ":", "fHeight", "*", "1", ",", "borderWidth", ":", "4", ",", "backgroundColor", ":", "pastels", ".", "pinkish", ",", "borderColor", ":", "pastels", ".", "blue", ",", "textColor", ":", "pastels", ".", "darkBlue", ",", "font", ":", "ubuntuFont", ",", "}", ")", ";", "form", ".", "removeField", "(", "textField", ")", ";", "/********************** Print Metadata **********************/", "console", ".", "log", "(", "'Title:'", ",", "pdfDoc", ".", "getTitle", "(", ")", ")", ";", "console", ".", "log", "(", "'Author:'", ",", "pdfDoc", ".", "getAuthor", "(", ")", ")", ";", "console", ".", "log", "(", "'Subject:'", ",", "pdfDoc", ".", "getSubject", "(", ")", ")", ";", "console", ".", "log", "(", "'Creator:'", ",", "pdfDoc", ".", "getCreator", "(", ")", ")", ";", "console", ".", "log", "(", "'Keywords:'", ",", "pdfDoc", ".", "getKeywords", "(", ")", ")", ";", "console", ".", "log", "(", "'Producer:'", ",", "pdfDoc", ".", "getProducer", "(", ")", ")", ";", "console", ".", "log", "(", "'Creation Date:'", ",", "pdfDoc", ".", "getCreationDate", "(", ")", ")", ";", "console", ".", "log", "(", "'Modification Date:'", ",", "pdfDoc", ".", "getModificationDate", "(", ")", ")", ";", "/********************** Export PDF **********************/", "const", "pdfBytes", "=", "await", "pdfDoc", ".", "save", "(", ")", ";", "return", "pdfBytes", ";", "}", ";" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5248, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, 3, null, null, null, null, 3, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1372
[ "import", "fontkit", "from", "'@pdf-lib/fontkit'", ";", "import", "{", "Assets", "}", "from", "'..'", ";", "import", "{", "ParseSpeeds", ",", "PDFDocument", ",", "rgb", "}", "from", "'../../..'", ";", "export", "default", "async", "(", "assets", ")", "=>", "{", "const", "{", "fonts", ",", "images", ",", "pdfs", "}", "=", "assets", ";", "const", "pdfDoc", "=", "await", "PDFDocument", ".", "load", "(", "pdfs", ".", "linearized_with_object_streams", ",", "{", "parseSpeed", ":", "ParseSpeeds", ".", "Fastest", ",", "updateMetadata", ":", "false", ",", "}", ")", ";", "pdfDoc", ".", "registerFontkit", "(", "fontkit", ")", ";", "const", "ubuntuFont", "=", "await", "pdfDoc", ".", "embedFont", "(", "fonts", ".", "ttf", ".", "ubuntu_r", ",", "{", "subset", ":", "true", ",", "}", ")", ";", "const", "smallMarioImage", "=", "await", "pdfDoc", ".", "embedPng", "(", "images", ".", "png", ".", "small_mario", ")", ";", "const", "smallMarioDims", "=", "smallMarioImage", ".", "scale", "(", "0.18", ")", ";", "const", "sourcePdfDoc", "=", "await", "PDFDocument", ".", "load", "(", "assets", ".", "pdfs", ".", "with_large_page_count", ")", ";", "const", "sourcePdfPage", "=", "sourcePdfDoc", ".", "getPage", "(", "73", ")", ";", "const", "embeddedPageFigure", "=", "{", "xOffset", ":", "100", ",", "yOffset", ":", "330", ",", "width", ":", "350", ",", "height", ":", "240", ",", "padding", ":", "10", ",", "}", ";", "const", "embeddedPage", "=", "await", "pdfDoc", ".", "embedPage", "(", "sourcePdfPage", ",", "{", "left", ":", "embeddedPageFigure", ".", "xOffset", ",", "right", ":", "embeddedPageFigure", ".", "xOffset", "+", "embeddedPageFigure", ".", "width", ",", "bottom", ":", "embeddedPageFigure", ".", "yOffset", ",", "top", ":", "embeddedPageFigure", ".", "yOffset", "+", "embeddedPageFigure", ".", "height", ",", "}", ")", ";", "const", "embeddedPageDims", "=", "embeddedPage", ".", "scale", "(", "0.5", ")", ";", "const", "lines", "=", "[", "'This is an image of Mario running.'", ",", "'This image and text was drawn on'", ",", "'top of an existing PDF using pdf-lib!'", ",", "]", ";", "const", "fontSize", "=", "24", ";", "const", "solarizedWhite", "=", "rgb", "(", "253", "/", "255", ",", "246", "/", "255", ",", "227", "/", "255", ")", ";", "const", "solarizedGray", "=", "rgb", "(", "101", "/", "255", ",", "123", "/", "255", ",", "131", "/", "255", ")", ";", "const", "textWidth", "=", "ubuntuFont", ".", "widthOfTextAtSize", "(", "lines", "[", "2", "]", ",", "fontSize", ")", ";", "pdfDoc", ".", "getPages", "(", ")", ".", "forEach", "(", "(", "page", ")", "=>", "{", "const", "{", "width", ",", "height", "}", "=", "page", ".", "getSize", "(", ")", ";", "const", "centerX", "=", "width", "/", "2", ";", "const", "centerY", "=", "height", "/", "2", ";", "page", ".", "drawImage", "(", "smallMarioImage", ",", "{", "...", "smallMarioDims", ",", "x", ":", "centerX", "-", "smallMarioDims", ".", "width", "/", "2", ",", "y", ":", "centerY", "+", "15", ",", "}", ")", ";", "const", "boxHeight", "=", "(", "fontSize", "+", "5", ")", "*", "lines", ".", "length", ";", "page", ".", "drawRectangle", "(", "{", "x", ":", "centerX", "-", "textWidth", "/", "2", "-", "5", ",", "y", ":", "centerY", "-", "15", "-", "boxHeight", "+", "fontSize", "+", "3", ",", "width", ":", "textWidth", "+", "10", ",", "height", ":", "boxHeight", ",", "color", ":", "solarizedWhite", ",", "opacity", ":", "0.85", ",", "borderColor", ":", "solarizedGray", ",", "borderWidth", ":", "3", ",", "}", ")", ";", "page", ".", "setFont", "(", "ubuntuFont", ")", ";", "page", ".", "setFontColor", "(", "solarizedGray", ")", ";", "page", ".", "drawText", "(", "lines", ".", "join", "(", "'\\n'", ")", ",", "{", "x", ":", "centerX", "-", "textWidth", "/", "2", ",", "y", ":", "centerY", "-", "15", ",", "}", ")", ";", "page", ".", "drawRectangle", "(", "{", "x", ":", "10", ",", "y", ":", "10", ",", "width", ":", "embeddedPageFigure", ".", "width", "/", "2", "+", "embeddedPageFigure", ".", "padding", "*", "2", ",", "height", ":", "embeddedPageFigure", ".", "height", "/", "2", "+", "embeddedPageFigure", ".", "padding", "*", "2", ",", "color", ":", "solarizedWhite", ",", "opacity", ":", "0.6", ",", "borderColor", ":", "solarizedGray", ",", "borderWidth", ":", "2", ",", "}", ")", ";", "page", ".", "drawPage", "(", "embeddedPage", ",", "{", "x", ":", "embeddedPageFigure", ".", "padding", "+", "10", ",", "y", ":", "embeddedPageFigure", ".", "padding", "+", "10", ",", "...", "embeddedPageDims", ",", "}", ")", ";", "}", ")", ";", "pdfDoc", ".", "removePage", "(", "1", ")", ";", "console", ".", "log", "(", "'Title:'", ",", "pdfDoc", ".", "getTitle", "(", ")", ")", ";", "console", ".", "log", "(", "'Author:'", ",", "pdfDoc", ".", "getAuthor", "(", ")", ")", ";", "console", ".", "log", "(", "'Subject:'", ",", "pdfDoc", ".", "getSubject", "(", ")", ")", ";", "console", ".", "log", "(", "'Creator:'", ",", "pdfDoc", ".", "getCreator", "(", ")", ")", ";", "console", ".", "log", "(", "'Keywords:'", ",", "pdfDoc", ".", "getKeywords", "(", ")", ")", ";", "console", ".", "log", "(", "'Producer:'", ",", "pdfDoc", ".", "getProducer", "(", ")", ")", ";", "console", ".", "log", "(", "'Creation Date:'", ",", "pdfDoc", ".", "getCreationDate", "(", ")", ")", ";", "console", ".", "log", "(", "'Modification Date:'", ",", "pdfDoc", ".", "getModificationDate", "(", ")", ")", ";", "const", "pdfBytes", "=", "await", "pdfDoc", ".", "save", "(", ")", ";", "return", "pdfBytes", ";", "}", ";" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5248, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1373
[ "import", "{", "Assets", "}", "from", "'..'", ";", "import", "{", "degrees", ",", "ParseSpeeds", ",", "PDFDocument", ",", "rgb", ",", "StandardFonts", ",", "LineCapStyle", ",", "}", "from", "'../../..'", ";", "export", "default", "async", "(", "assets", ")", "=>", "{", "const", "{", "pdfs", ",", "images", "}", "=", "assets", ";", "const", "pdfDoc", "=", "await", "PDFDocument", ".", "load", "(", "pdfs", ".", "with_update_sections_base64_uri", ",", "{", "parseSpeed", ":", "ParseSpeeds", ".", "Fastest", ",", "updateMetadata", ":", "false", ",", "}", ")", ";", "await", "pdfDoc", ".", "attach", "(", "pdfs", ".", "normal_base64", ",", "'tax_form.pdf'", ",", "{", "mimeType", ":", "'application/pdf'", ",", "description", ":", "'D-2210 tax form for 2012 🏦'", ",", "creationDate", ":", "new", "Date", "(", "'2004/04/04'", ")", ",", "modificationDate", ":", "new", "Date", "(", "'2005/05/05'", ")", ",", "}", ")", ";", "const", "helveticaFont", "=", "await", "pdfDoc", ".", "embedFont", "(", "StandardFonts", ".", "HelveticaBold", ")", ";", "const", "catRidingUnicornImage", "=", "await", "pdfDoc", ".", "embedJpg", "(", "images", ".", "jpg", ".", "cat_riding_unicorn", ")", ";", "const", "cmykImage", "=", "await", "pdfDoc", ".", "embedJpg", "(", "images", ".", "jpg", ".", "cmyk_colorspace", ")", ";", "const", "catRidingUnicornDims", "=", "catRidingUnicornImage", ".", "scale", "(", "0.13", ")", ";", "const", "cmykDims", "=", "cmykImage", ".", "scale", "(", "0.5", ")", ";", "const", "page0", "=", "pdfDoc", ".", "insertPage", "(", "0", ",", "[", "305", ",", "250", "]", ")", ";", "const", "page1", "=", "pdfDoc", ".", "getPage", "(", "1", ")", ";", "const", "docWithAnnots", "=", "await", "PDFDocument", ".", "load", "(", "assets", ".", "pdfs", ".", "with_annots", ")", ";", "const", "[", "page2", "]", "=", "await", "pdfDoc", ".", "copyPages", "(", "docWithAnnots", ",", "[", "0", "]", ")", ";", "page2", ".", "scaleContent", "(", "0.5", ",", "0.5", ")", ";", "pdfDoc", ".", "addPage", "(", "page2", ")", ";", "const", "[", "page3", "]", "=", "await", "pdfDoc", ".", "copyPages", "(", "docWithAnnots", ",", "[", "0", "]", ")", ";", "page3", ".", "scaleAnnotations", "(", "0.5", ",", "0.5", ")", ";", "pdfDoc", ".", "addPage", "(", "page3", ")", ";", "const", "[", "page4", "]", "=", "await", "pdfDoc", ".", "copyPages", "(", "docWithAnnots", ",", "[", "0", "]", ")", ";", "page4", ".", "scale", "(", "0.5", ",", "0.5", ")", ";", "pdfDoc", ".", "addPage", "(", "page4", ")", ";", "const", "page5", "=", "pdfDoc", ".", "addPage", "(", "[", "305", ",", "250", "]", ")", ";", "const", "hotPink", "=", "rgb", "(", "1", ",", "0", ",", "1", ")", ";", "const", "red", "=", "rgb", "(", "1", ",", "0", ",", "0", ")", ";", "page0", ".", "drawText", "(", "'This is the new first page!'", ",", "{", "x", ":", "5", ",", "y", ":", "200", ",", "font", ":", "helveticaFont", ",", "color", ":", "hotPink", ",", "}", ")", ";", "page0", ".", "drawLine", "(", "{", "start", ":", "{", "x", ":", "10", ",", "y", ":", "207", "}", ",", "end", ":", "{", "x", ":", "295", ",", "y", ":", "207", "}", ",", "color", ":", "rgb", "(", "0", ",", "1", ",", "1", ")", ",", "thickness", ":", "5", ",", "opacity", ":", "0.7", ",", "}", ")", ";", "page0", ".", "drawImage", "(", "catRidingUnicornImage", ",", "{", "...", "catRidingUnicornDims", ",", "x", ":", "30", ",", "y", ":", "30", ",", "}", ")", ";", "const", "lastPageText", "=", "'This is the last page!'", ";", "const", "lastPageTextWidth", "=", "helveticaFont", ".", "widthOfTextAtSize", "(", "lastPageText", ",", "24", ")", ";", "const", "page1Text", "=", "'pdf-lib is awesome!'", ";", "const", "page1TextWidth", "=", "helveticaFont", ".", "widthOfTextAtSize", "(", "page1Text", ",", "70", ")", ";", "page1", ".", "setFontSize", "(", "70", ")", ";", "page1", ".", "drawText", "(", "page1Text", ",", "{", "x", ":", "page1", ".", "getWidth", "(", ")", "/", "2", "-", "page1TextWidth", "/", "2", "+", "45", ",", "y", ":", "page1", ".", "getHeight", "(", ")", "/", "2", "+", "45", ",", "color", ":", "red", ",", "rotate", ":", "degrees", "(", "-", "30", ")", ",", "xSkew", ":", "degrees", "(", "15", ")", ",", "ySkew", ":", "degrees", "(", "15", ")", ",", "}", ")", ";", "page5", ".", "setFontSize", "(", "24", ")", ";", "page5", ".", "drawText", "(", "'This is the last page!'", ",", "{", "x", ":", "30", ",", "y", ":", "215", ",", "font", ":", "helveticaFont", ",", "color", ":", "hotPink", ",", "}", ")", ";", "page5", ".", "drawLine", "(", "{", "start", ":", "{", "x", ":", "30", ",", "y", ":", "205", "}", ",", "end", ":", "{", "x", ":", "30", "+", "lastPageTextWidth", ",", "y", ":", "205", "}", ",", "color", ":", "hotPink", ",", "thickness", ":", "5", ",", "}", ")", ";", "page5", ".", "drawImage", "(", "cmykImage", ",", "{", "...", "cmykDims", ",", "x", ":", "30", ",", "y", ":", "30", ",", "}", ")", ";", "page5", ".", "drawLine", "(", "{", "start", ":", "{", "x", ":", "30", ",", "y", ":", "240", "}", ",", "end", ":", "{", "x", ":", "30", "+", "lastPageTextWidth", ",", "y", ":", "240", "}", ",", "color", ":", "hotPink", ",", "thickness", ":", "5", ",", "lineCap", ":", "LineCapStyle", ".", "Round", ",", "}", ")", ";", "console", ".", "log", "(", "'Title:'", ",", "pdfDoc", ".", "getTitle", "(", ")", ")", ";", "console", ".", "log", "(", "'Author:'", ",", "pdfDoc", ".", "getAuthor", "(", ")", ")", ";", "console", ".", "log", "(", "'Subject:'", ",", "pdfDoc", ".", "getSubject", "(", ")", ")", ";", "console", ".", "log", "(", "'Creator:'", ",", "pdfDoc", ".", "getCreator", "(", ")", ")", ";", "console", ".", "log", "(", "'Keywords:'", ",", "pdfDoc", ".", "getKeywords", "(", ")", ")", ";", "console", ".", "log", "(", "'Producer:'", ",", "pdfDoc", ".", "getProducer", "(", ")", ")", ";", "console", ".", "log", "(", "'Creation Date:'", ",", "pdfDoc", ".", "getCreationDate", "(", ")", ")", ";", "console", ".", "log", "(", "'Modification Date:'", ",", "pdfDoc", ".", "getModificationDate", "(", ")", ")", ";", "const", "base64Pdf", "=", "await", "pdfDoc", ".", "saveAsBase64", "(", ")", ";", "const", "pdfBytes", "=", "Buffer", ".", "from", "(", "base64Pdf", ",", "'base64'", ")", ";", "return", "pdfBytes", ";", "}", ";" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5248, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 12, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1374
[ "import", "{", "Assets", "}", "from", "'..'", ";", "import", "{", "ParseSpeeds", ",", "PDFDocument", ",", "PDFPage", ",", "radians", ",", "StandardFonts", ",", "rgb", ",", "degrees", ",", "}", "from", "'../../..'", ";", "export", "default", "async", "(", "assets", ")", "=>", "{", "const", "{", "pdfs", ",", "images", "}", "=", "assets", ";", "const", "pdfDoc", "=", "await", "PDFDocument", ".", "load", "(", "pdfs", ".", "normal_base64", ",", "{", "parseSpeed", ":", "ParseSpeeds", ".", "Fastest", ",", "}", ")", ";", "const", "minionsLaughingImage", "=", "await", "pdfDoc", ".", "embedJpg", "(", "images", ".", "jpg", ".", "minions_laughing", ")", ";", "const", "minionsLaughingDims", "=", "minionsLaughingImage", ".", "scale", "(", "0.6", ")", ";", "const", "firstPage", "=", "pdfDoc", ".", "getPage", "(", "0", ")", ";", "const", "middlePage", "=", "pdfDoc", ".", "insertPage", "(", "1", ",", "[", "600", ",", "500", "]", ")", ";", "const", "lastPage", "=", "pdfDoc", ".", "getPage", "(", "2", ")", ";", "const", "fontSize", "=", "20", ";", "middlePage", ".", "setFontSize", "(", "fontSize", ")", ";", "middlePage", ".", "moveTo", "(", "0", ",", "middlePage", ".", "getHeight", "(", ")", ")", ";", "Object", ".", "keys", "(", "StandardFonts", ")", ".", "forEach", "(", "(", "fontNameStr", ",", "idx", ")", "=>", "{", "middlePage", ".", "moveDown", "(", "fontSize", ")", ";", "const", "fontName", "=", "fontNameStr", "as", "keyof", "typeof", "StandardFonts", ";", "const", "fontObj", "=", "StandardFonts", "[", "fontName", "]", ";", "const", "font", "=", "pdfDoc", ".", "embedStandardFont", "(", "fontObj", ")", ";", "middlePage", ".", "setFont", "(", "font", ")", ";", "const", "text", "=", "(", "fontName", "===", "StandardFonts", ".", "Symbol", "?", "`${", "idx", "+", "1", "}. Τηεσε αρε τηε 14 Στανδαρδ Φοντσ.`", ":", "fontName", "===", "StandardFonts", ".", "ZapfDingbats", "?", "`✑✔✎ ✴❈❅▲❅ ❁❒❅ ▼❈❅ ✑✔ ✳▼❁■❄❁❒❄ ✦❏■▼▲✎`", ":", "`${", "idx", "+", "1", "}. These are the 14 Standard Fonts.`", ")", ";", "middlePage", ".", "drawText", "(", "text", ",", "{", "rotate", ":", "radians", "(", "-", "Math", ".", "PI", "/", "6", ")", ",", "xSkew", ":", "radians", "(", "Math", ".", "PI", "/", "10", ")", ",", "ySkew", ":", "radians", "(", "Math", ".", "PI", "/", "10", ")", ",", "}", ")", ";", "}", ")", ";", "middlePage", ".", "drawEllipse", "(", "{", "x", ":", "450", ",", "y", ":", "225", ",", "xScale", ":", "25", ",", "yScale", ":", "150", ",", "color", ":", "rgb", "(", "0", ",", "1", ",", "0", ")", ",", "borderWidth", ":", "2", ",", "borderColor", ":", "rgb", "(", "1", ",", "0", ",", "1", ")", ",", "rotate", ":", "degrees", "(", "45", ")", ",", "opacity", ":", "0.5", ",", "}", ")", ";", "const", "stampImage", "=", "(", "page", ")", "=>", "{", "const", "{", "width", ",", "height", "}", "=", "page", ".", "getSize", "(", ")", ";", "const", "centerX", "=", "width", "/", "2", ";", "const", "centerY", "=", "height", "/", "2", ";", "page", ".", "drawImage", "(", "minionsLaughingImage", ",", "{", "...", "minionsLaughingDims", ",", "x", ":", "centerX", "-", "minionsLaughingDims", ".", "width", "/", "2", ",", "y", ":", "centerY", "-", "minionsLaughingDims", ".", "height", "/", "2", ",", "opacity", ":", "0.75", ",", "}", ")", ";", "}", ";", "stampImage", "(", "firstPage", ")", ";", "stampImage", "(", "lastPage", ")", ";", "const", "pdfBytes", "=", "await", "pdfDoc", ".", "save", "(", ")", ";", "return", "pdfBytes", ";", "}", ";" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5248, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, null, 3392, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1375
[ "import", "{", "Assets", "}", "from", "'..'", ";", "import", "{", "ParseSpeeds", ",", "PDFDocument", ",", "rgb", ",", "StandardFonts", "}", "from", "'../../..'", ";", "export", "default", "async", "(", "assets", ")", "=>", "{", "const", "{", "pdfs", ",", "images", "}", "=", "assets", ";", "const", "pdfDoc", "=", "await", "PDFDocument", ".", "load", "(", "pdfs", ".", "with_large_page_count", ",", "{", "parseSpeed", ":", "ParseSpeeds", ".", "Fastest", ",", "}", ")", ";", "const", "timesRomanFont", "=", "await", "pdfDoc", ".", "embedFont", "(", "StandardFonts", ".", "TimesRomanBoldItalic", ")", ";", "const", "minionsBananaImage", "=", "await", "pdfDoc", ".", "embedPng", "(", "images", ".", "png", ".", "minions_banana_alpha", ")", ";", "const", "minionsBananaDims", "=", "minionsBananaImage", ".", "scale", "(", "0.5", ")", ";", "const", "pages", "=", "pdfDoc", ".", "getPages", "(", ")", ";", "pages", ".", "forEach", "(", "(", "page", ")", "=>", "{", "const", "{", "width", ",", "height", "}", "=", "page", ".", "getSize", "(", ")", ";", "page", ".", "drawImage", "(", "minionsBananaImage", ",", "{", "...", "minionsBananaDims", ",", "x", ":", "width", "/", "2", "-", "minionsBananaDims", ".", "width", "/", "2", ",", "y", ":", "height", "/", "2", "-", "minionsBananaDims", ".", "height", "/", "2", ",", "}", ")", ";", "}", ")", ";", "pages", ".", "forEach", "(", "(", "_", ",", "idx", ")", "=>", "{", "const", "newPage", "=", "pdfDoc", ".", "insertPage", "(", "2", "*", "idx", "+", "1", ",", "[", "500", ",", "150", "]", ")", ";", "const", "fontSize", "=", "24", ";", "const", "{", "width", ",", "height", "}", "=", "newPage", ".", "getSize", "(", ")", ";", "newPage", ".", "setFont", "(", "timesRomanFont", ")", ";", "newPage", ".", "setFontSize", "(", "fontSize", ")", ";", "const", "text", "=", "'This page was interleaved by pdf-lib!'", ";", "const", "textWidth", "=", "timesRomanFont", ".", "widthOfTextAtSize", "(", "text", ",", "fontSize", ")", ";", "const", "textHeight", "=", "timesRomanFont", ".", "heightAtSize", "(", "fontSize", ")", ";", "newPage", ".", "drawText", "(", "text", ",", "{", "x", ":", "width", "/", "2", "-", "textWidth", "/", "2", ",", "y", ":", "height", "/", "2", "-", "textHeight", "/", "2", ",", "color", ":", "rgb", "(", "0.7", ",", "0.4", ",", "0.9", ")", ",", "}", ")", ";", "}", ")", ";", "const", "pdfBytes", "=", "await", "pdfDoc", ".", "save", "(", ")", ";", "return", "pdfBytes", ";", "}", ";" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5248, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1376
[ "import", "fontkit", "from", "'@pdf-lib/fontkit'", ";", "import", "{", "Assets", "}", "from", "'..'", ";", "import", "{", "degrees", ",", "ParseSpeeds", ",", "PDFDocument", ",", "rgb", "}", "from", "'../../..'", ";", "export", "default", "async", "(", "assets", ")", "=>", "{", "const", "{", "pdfs", ",", "images", ",", "fonts", "}", "=", "assets", ";", "const", "pdfDoc", "=", "await", "PDFDocument", ".", "load", "(", "pdfs", ".", "with_missing_endstream_eol_and_polluted_ctm", ",", "{", "parseSpeed", ":", "ParseSpeeds", ".", "Fastest", "}", ")", ";", "pdfDoc", ".", "registerFontkit", "(", "fontkit", ")", ";", "await", "pdfDoc", ".", "attach", "(", "pdfs", ".", "us_constitution", ",", "'us_constitution.pdf'", ",", "{", "mimeType", ":", "'application/pdf'", ",", "description", ":", "'Constitution of the United States 🇺🇸🦅'", ",", "creationDate", ":", "new", "Date", "(", "'1787/09/17'", ")", ",", "modificationDate", ":", "new", "Date", "(", "'1992/05/07'", ")", ",", "}", ")", ";", "await", "pdfDoc", ".", "attach", "(", "images", ".", "jpg", ".", "cat_riding_unicorn_base64", ",", "'cat_riding_unicorn.jpg'", ",", "{", "mimeType", ":", "'image/jpeg'", ",", "description", ":", "'Cool cat riding a unicorn! 🦄🐈🕶️'", ",", "creationDate", ":", "new", "Date", "(", "'2019/12/01'", ")", ",", "modificationDate", ":", "new", "Date", "(", "'2020/04/19'", ")", ",", "}", ")", ";", "const", "nunitoLigaFont", "=", "await", "pdfDoc", ".", "embedFont", "(", "fonts", ".", "ttf", ".", "nunito", ",", "{", "subset", ":", "true", ",", "features", ":", "{", "liga", ":", "true", "}", ",", "}", ")", ";", "const", "nunitoNoLigaFont", "=", "await", "pdfDoc", ".", "embedFont", "(", "fonts", ".", "ttf", ".", "nunito", ",", "{", "subset", ":", "true", ",", "features", ":", "{", "liga", ":", "false", "}", ",", "}", ")", ";", "const", "smallMarioImage", "=", "await", "pdfDoc", ".", "embedPng", "(", "images", ".", "png", ".", "small_mario", ")", ";", "const", "smallMarioDims", "=", "smallMarioImage", ".", "scale", "(", "0.15", ")", ";", "const", "page1", "=", "pdfDoc", ".", "getPage", "(", "0", ")", ";", "const", "text", "=", "'This is an image of Mario running. This image and text was drawn on top of an existing PDF using pdf-lib!'", ";", "const", "fontSize", "=", "24", ";", "const", "solarizedWhite", "=", "rgb", "(", "253", "/", "255", ",", "246", "/", "255", ",", "227", "/", "255", ")", ";", "const", "solarizedGray", "=", "rgb", "(", "101", "/", "255", ",", "123", "/", "255", ",", "131", "/", "255", ")", ";", "const", "boxWidth", "=", "387.5", ";", "const", "{", "width", ",", "height", "}", "=", "page1", ".", "getSize", "(", ")", ";", "const", "centerX", "=", "width", "/", "2", ";", "const", "centerY", "=", "height", "/", "2", ";", "page1", ".", "drawImage", "(", "smallMarioImage", ",", "{", "...", "smallMarioDims", ",", "x", ":", "centerX", "-", "smallMarioDims", ".", "width", "/", "2", ",", "y", ":", "centerY", "-", "15", ",", "}", ")", ";", "page1", ".", "drawImage", "(", "smallMarioImage", ",", "{", "...", "smallMarioDims", ",", "x", ":", "centerX", "+", "smallMarioDims", ".", "width", "/", "2", ",", "y", ":", "centerY", ",", "rotate", ":", "degrees", "(", "180", ")", ",", "xSkew", ":", "degrees", "(", "35", ")", ",", "ySkew", ":", "degrees", "(", "35", ")", ",", "}", ")", ";", "const", "boxHeight", "=", "(", "fontSize", "+", "5", ")", "*", "3", ";", "page1", ".", "drawRectangle", "(", "{", "x", ":", "centerX", "-", "boxWidth", "/", "2", "-", "5", ",", "y", ":", "centerY", "-", "60", "-", "boxHeight", "+", "fontSize", "+", "3", ",", "width", ":", "boxWidth", "+", "10", ",", "height", ":", "boxHeight", ",", "color", ":", "solarizedWhite", ",", "borderColor", ":", "solarizedGray", ",", "borderWidth", ":", "3", ",", "rotate", ":", "degrees", "(", "10", ")", ",", "ySkew", ":", "degrees", "(", "15", ")", ",", "}", ")", ";", "page1", ".", "setFont", "(", "nunitoLigaFont", ")", ";", "page1", ".", "setFontColor", "(", "solarizedGray", ")", ";", "page1", ".", "drawText", "(", "text", ",", "{", "x", ":", "centerX", "-", "boxWidth", "/", "2", "+", "5", ",", "y", ":", "centerY", "-", "60", ",", "rotate", ":", "degrees", "(", "10", ")", ",", "ySkew", ":", "degrees", "(", "15", ")", ",", "maxWidth", ":", "boxWidth", "+", "5", ",", "}", ")", ";", "page1", ".", "setSize", "(", "page1", ".", "getWidth", "(", ")", "+", "100", ",", "page1", ".", "getHeight", "(", ")", "+", "100", ")", ";", "page1", ".", "translateContent", "(", "100", ",", "100", ")", ";", "page1", ".", "setFont", "(", "nunitoLigaFont", ")", ";", "page1", ".", "drawText", "(", "'This text is shifted - fi'", ",", "{", "color", ":", "rgb", "(", "1", ",", "0", ",", "0", ")", ",", "size", ":", "50", ",", "}", ")", ";", "page1", ".", "resetPosition", "(", ")", ";", "page1", ".", "setFont", "(", "nunitoNoLigaFont", ")", ";", "page1", ".", "drawText", "(", "'This text is not shifted - fi'", ",", "{", "color", ":", "rgb", "(", "0", ",", "0", ",", "1", ")", ",", "size", ":", "50", ",", "}", ")", ";", "const", "pdfDocWithCropBox", "=", "await", "PDFDocument", ".", "load", "(", "pdfs", ".", "with_cropbox", ")", ";", "const", "[", "page2", "]", "=", "await", "pdfDoc", ".", "copyPages", "(", "pdfDocWithCropBox", ",", "[", "0", "]", ")", ";", "pdfDoc", ".", "addPage", "(", "page2", ")", ";", "page2", ".", "drawRectangle", "(", "{", "x", ":", "page2", ".", "getWidth", "(", ")", ",", "width", ":", "50", ",", "height", ":", "page2", ".", "getHeight", "(", ")", ",", "color", ":", "rgb", "(", "1", ",", "0", ",", "0", ")", ",", "}", ")", ";", "page2", ".", "drawRectangle", "(", "{", "y", ":", "page2", ".", "getHeight", "(", ")", ",", "height", ":", "50", ",", "width", ":", "page2", ".", "getWidth", "(", ")", ",", "color", ":", "rgb", "(", "0", ",", "1", ",", "0", ")", ",", "}", ")", ";", "page2", ".", "setSize", "(", "page2", ".", "getWidth", "(", ")", "+", "50", ",", "page2", ".", "getHeight", "(", ")", "+", "50", ")", ";", "const", "pdfBytes", "=", "await", "pdfDoc", ".", "save", "(", ")", ";", "return", "pdfBytes", ";", "}", ";" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5248, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1377
[ "import", "{", "Assets", "}", "from", "'..'", ";", "import", "{", "degrees", ",", "ParseSpeeds", ",", "PDFDocument", ",", "StandardFonts", "}", "from", "'../../..'", ";", "const", "createDonorPdf", "=", "async", "(", ")", "=>", "{", "const", "pdfDoc", "=", "await", "PDFDocument", ".", "create", "(", ")", ";", "const", "helveticaFont", "=", "await", "pdfDoc", ".", "embedFont", "(", "StandardFonts", ".", "Helvetica", ")", ";", "const", "page", "=", "pdfDoc", ".", "addPage", "(", "[", "500", ",", "500", "]", ")", ";", "page", ".", "moveTo", "(", "50", ",", "225", ")", ";", "page", ".", "setFont", "(", "helveticaFont", ")", ";", "page", ".", "setFontSize", "(", "50", ")", ";", "page", ".", "drawText", "(", "'I am upside down!'", ")", ";", "page", ".", "setRotation", "(", "degrees", "(", "180", ")", ")", ";", "return", "pdfDoc", ";", "}", ";", "export", "default", "async", "(", "assets", ")", "=>", "{", "const", "{", "pdfs", "}", "=", "assets", ";", "const", "pdfDoc", "=", "await", "PDFDocument", ".", "load", "(", "pdfs", ".", "with_missing_endstream_eol_and_polluted_ctm", ",", "{", "parseSpeed", ":", "ParseSpeeds", ".", "Fastest", "}", ")", ";", "const", "allDonorPdfBytes", "=", "[", "assets", ".", "pdfs", ".", "normal", ",", "assets", ".", "pdfs", ".", "with_update_sections", ",", "assets", ".", "pdfs", ".", "linearized_with_object_streams", ",", "assets", ".", "pdfs", ".", "with_large_page_count", ",", "]", ";", "for", "(", "let", "idx", "=", "0", ",", "len", "=", "allDonorPdfBytes", ".", "length", ";", "idx", "<", "len", ";", "idx", "++", ")", "{", "const", "donorBytes", "=", "allDonorPdfBytes", "[", "idx", "]", ";", "const", "donorPdf", "=", "await", "PDFDocument", ".", "load", "(", "donorBytes", ")", ";", "const", "[", "donorPage", "]", "=", "await", "pdfDoc", ".", "copyPages", "(", "donorPdf", ",", "[", "0", "]", ")", ";", "pdfDoc", ".", "addPage", "(", "donorPage", ")", ";", "}", "const", "anotherDonorPdf", "=", "await", "createDonorPdf", "(", ")", ";", "const", "[", "anotherDonorPage", "]", "=", "await", "pdfDoc", ".", "copyPages", "(", "anotherDonorPdf", ",", "[", "0", "]", ")", ";", "pdfDoc", ".", "insertPage", "(", "1", ",", "anotherDonorPage", ")", ";", "const", "savedBytes", "=", "await", "pdfDoc", ".", "save", "(", ")", ";", "const", "sizeOfCreatedPdf", "=", "savedBytes", ".", "length", ";", "let", "sizeOfAllDonorPdfs", "=", "(", "await", "anotherDonorPdf", ".", "save", "(", ")", ")", ".", "length", ";", "for", "(", "let", "idx", "=", "0", ",", "len", "=", "allDonorPdfBytes", ".", "length", ";", "idx", "<", "len", ";", "idx", "++", ")", "{", "sizeOfAllDonorPdfs", "+=", "allDonorPdfBytes", "[", "idx", "]", ".", "length", ";", "}", "console", ".", "log", "(", ")", ";", "console", ".", "log", "(", "'Since pdf-lib only copies the minimum necessary resources from a donor PDF needed to show a copied page, the size of the PDF we create from copied pages should be smaller than the size of all the donor PDFs added together:'", ")", ";", "console", ".", "log", "(", ")", ";", "console", ".", "log", "(", "' sizeOfRecipientPdf / sizeOfAllDonorPdfs = '", ",", "(", "sizeOfCreatedPdf", "/", "sizeOfAllDonorPdfs", ")", ".", "toFixed", "(", "2", ")", ")", ";", "return", "savedBytes", ";", "}", ";" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5248, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 29, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1378
[ "import", "{", "Assets", "}", "from", "'..'", ";", "import", "{", "ParseSpeeds", ",", "PDFDocument", ",", "rgb", ",", "StandardFonts", "}", "from", "'../../..'", ";", "export", "default", "async", "(", "assets", ")", "=>", "{", "const", "{", "pdfs", "}", "=", "assets", ";", "const", "pdfDoc", "=", "await", "PDFDocument", ".", "load", "(", "pdfs", ".", "with_newline_whitespace_in_indirect_object_numbers", ",", "{", "parseSpeed", ":", "ParseSpeeds", ".", "Fastest", "}", ")", ";", "const", "helveticaFont", "=", "await", "pdfDoc", ".", "embedFont", "(", "StandardFonts", ".", "Helvetica", ")", ";", "const", "pages", "=", "pdfDoc", ".", "getPages", "(", ")", ";", "const", "[", "firstPage", "]", "=", "pages", ";", "const", "{", "width", ",", "height", "}", "=", "firstPage", ".", "getSize", "(", ")", ";", "const", "text", "=", "'pdf-lib is awesome!'", ";", "const", "textWidth", "=", "helveticaFont", ".", "widthOfTextAtSize", "(", "text", ",", "75", ")", ";", "firstPage", ".", "moveTo", "(", "width", "/", "2", "-", "textWidth", "/", "2", ",", "height", "-", "100", ")", ";", "firstPage", ".", "setFont", "(", "helveticaFont", ")", ";", "firstPage", ".", "setFontSize", "(", "75", ")", ";", "firstPage", ".", "setFontColor", "(", "rgb", "(", "1", ",", "0", ",", "0", ")", ")", ";", "firstPage", ".", "drawText", "(", "text", ")", ";", "pages", ".", "forEach", "(", "(", "page", ",", "idx", ")", "=>", "{", "page", ".", "moveTo", "(", "10", ",", "10", ")", ";", "page", ".", "setFont", "(", "helveticaFont", ")", ";", "page", ".", "setFontSize", "(", "17", ")", ";", "page", ".", "setFontColor", "(", "rgb", "(", "1", ",", "0", ",", "0", ")", ")", ";", "page", ".", "drawText", "(", "`${", "idx", "+", "1", "} / ${", "pages", ".", "length", "}`", ")", ";", "}", ")", ";", "const", "pdfBytes", "=", "await", "pdfDoc", ".", "save", "(", ")", ";", "return", "pdfBytes", ";", "}", ";" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5248, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1379
[ "import", "fontkit", "from", "'@pdf-lib/fontkit'", ";", "import", "{", "Assets", "}", "from", "'..'", ";", "import", "{", "ParseSpeeds", ",", "PDFDocument", ",", "rgb", "}", "from", "'../../..'", ";", "export", "default", "async", "(", "assets", ")", "=>", "{", "const", "{", "pdfs", ",", "fonts", ",", "images", "}", "=", "assets", ";", "const", "pdfDoc", "=", "await", "PDFDocument", ".", "load", "(", "pdfs", ".", "with_comments", ",", "{", "parseSpeed", ":", "ParseSpeeds", ".", "Fastest", ",", "}", ")", ";", "pdfDoc", ".", "registerFontkit", "(", "fontkit", ")", ";", "const", "ubuntuFont", "=", "await", "pdfDoc", ".", "embedFont", "(", "fonts", ".", "ttf", ".", "ubuntu_r", ",", "{", "subset", ":", "true", ",", "}", ")", ";", "const", "smallMarioImage", "=", "await", "pdfDoc", ".", "embedPng", "(", "images", ".", "png", ".", "small_mario", ")", ";", "const", "smallMarioDims", "=", "smallMarioImage", ".", "scale", "(", "0.15", ")", ";", "const", "pages", "=", "pdfDoc", ".", "getPages", "(", ")", ";", "const", "lines", "=", "[", "'This is an image of Mario running.'", ",", "'This image and text was drawn on'", ",", "'top of an existing PDF using pdf-lib!'", ",", "]", ";", "const", "fontSize", "=", "24", ";", "const", "solarizedWhite", "=", "rgb", "(", "253", "/", "255", ",", "246", "/", "255", ",", "227", "/", "255", ")", ";", "const", "solarizedGray", "=", "rgb", "(", "101", "/", "255", ",", "123", "/", "255", ",", "131", "/", "255", ")", ";", "const", "textWidth", "=", "ubuntuFont", ".", "widthOfTextAtSize", "(", "lines", "[", "2", "]", ",", "fontSize", ")", ";", "pages", ".", "forEach", "(", "(", "page", ")", "=>", "{", "const", "{", "width", ",", "height", "}", "=", "page", ".", "getSize", "(", ")", ";", "const", "centerX", "=", "width", "/", "2", ";", "const", "centerY", "=", "height", "/", "2", "-", "250", ";", "page", ".", "drawImage", "(", "smallMarioImage", ",", "{", "...", "smallMarioDims", ",", "x", ":", "centerX", "-", "smallMarioDims", ".", "width", "/", "2", ",", "y", ":", "centerY", "+", "15", ",", "}", ")", ";", "const", "boxHeight", "=", "(", "fontSize", "+", "5", ")", "*", "lines", ".", "length", ";", "page", ".", "drawRectangle", "(", "{", "x", ":", "centerX", "-", "textWidth", "/", "2", "-", "5", ",", "y", ":", "centerY", "-", "15", "-", "boxHeight", "+", "fontSize", "+", "3", ",", "width", ":", "textWidth", "+", "10", ",", "height", ":", "boxHeight", ",", "color", ":", "solarizedWhite", ",", "borderColor", ":", "solarizedGray", ",", "borderWidth", ":", "3", ",", "}", ")", ";", "page", ".", "setFont", "(", "ubuntuFont", ")", ";", "page", ".", "setFontColor", "(", "solarizedGray", ")", ";", "page", ".", "drawText", "(", "lines", ".", "join", "(", "'\\n'", ")", ",", "{", "x", ":", "centerX", "-", "textWidth", "/", "2", ",", "y", ":", "centerY", "-", "15", ",", "}", ")", ";", "}", ")", ";", "const", "pdfBytes", "=", "await", "pdfDoc", ".", "save", "(", ")", ";", "return", "pdfBytes", ";", "}", ";" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5248, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1380
[ "import", "{", "Assets", "}", "from", "'..'", ";", "import", "{", "PDFDocument", ",", "StandardFonts", ",", "PDFFont", "}", "from", "'../../..'", ";", "const", "winAnsiCodePoints", "=", "[", "0x0020", ",", "0x0021", ",", "0x0022", ",", "0x0023", ",", "0x0024", ",", "0x0025", ",", "0x0026", ",", "0x0027", ",", "0x0028", ",", "0x0029", ",", "0x002a", ",", "0x002b", ",", "0x002c", ",", "0x002d", ",", "0x002e", ",", "0x002f", ",", "0x0030", ",", "0x0031", ",", "0x0032", ",", "0x0033", ",", "0x0034", ",", "0x0035", ",", "0x0036", ",", "0x0037", ",", "0x0038", ",", "0x0039", ",", "0x003a", ",", "0x003b", ",", "0x003c", ",", "0x003d", ",", "0x003e", ",", "0x003f", ",", "0x0040", ",", "0x0041", ",", "0x0042", ",", "0x0043", ",", "0x0044", ",", "0x0045", ",", "0x0046", ",", "0x0047", ",", "0x0048", ",", "0x0049", ",", "0x004a", ",", "0x004b", ",", "0x004c", ",", "0x004d", ",", "0x004e", ",", "0x004f", ",", "0x0050", ",", "0x0051", ",", "0x0052", ",", "0x0053", ",", "0x0054", ",", "0x0055", ",", "0x0056", ",", "0x0057", ",", "0x0058", ",", "0x0059", ",", "0x005a", ",", "0x005b", ",", "0x005c", ",", "0x005d", ",", "0x005e", ",", "0x005f", ",", "0x0060", ",", "0x0061", ",", "0x0062", ",", "0x0063", ",", "0x0064", ",", "0x0065", ",", "0x0066", ",", "0x0067", ",", "0x0068", ",", "0x0069", ",", "0x006a", ",", "0x006b", ",", "0x006c", ",", "0x006d", ",", "0x006e", ",", "0x006f", ",", "0x0070", ",", "0x0071", ",", "0x0072", ",", "0x0073", ",", "0x0074", ",", "0x0075", ",", "0x0076", ",", "0x0077", ",", "0x0078", ",", "0x0079", ",", "0x007a", ",", "0x007b", ",", "0x007c", ",", "0x007d", ",", "0x007e", ",", "0x00a0", ",", "0x00a1", ",", "0x00a2", ",", "0x00a3", ",", "0x00a4", ",", "0x00a5", ",", "0x00a6", ",", "0x00a7", ",", "0x00a8", ",", "0x00a9", ",", "0x00aa", ",", "0x00ab", ",", "0x00ac", ",", "0x00ad", ",", "0x00ae", ",", "0x00af", ",", "0x00b0", ",", "0x00b1", ",", "0x00b2", ",", "0x00b3", ",", "0x00b4", ",", "0x00b5", ",", "0x00b6", ",", "0x00b7", ",", "0x00b8", ",", "0x00b9", ",", "0x00ba", ",", "0x00bb", ",", "0x00bc", ",", "0x00bd", ",", "0x00be", ",", "0x00bf", ",", "0x00c0", ",", "0x00c1", ",", "0x00c2", ",", "0x00c3", ",", "0x00c4", ",", "0x00c5", ",", "0x00c6", ",", "0x00c7", ",", "0x00c8", ",", "0x00c9", ",", "0x00ca", ",", "0x00cb", ",", "0x00cc", ",", "0x00cd", ",", "0x00ce", ",", "0x00cf", ",", "0x00d0", ",", "0x00d1", ",", "0x00d2", ",", "0x00d3", ",", "0x00d4", ",", "0x00d5", ",", "0x00d6", ",", "0x00d7", ",", "0x00d8", ",", "0x00d9", ",", "0x00da", ",", "0x00db", ",", "0x00dc", ",", "0x00dd", ",", "0x00de", ",", "0x00df", ",", "0x00e0", ",", "0x00e1", ",", "0x00e2", ",", "0x00e3", ",", "0x00e4", ",", "0x00e5", ",", "0x00e6", ",", "0x00e7", ",", "0x00e8", ",", "0x00e9", ",", "0x00ea", ",", "0x00eb", ",", "0x00ec", ",", "0x00ed", ",", "0x00ee", ",", "0x00ef", ",", "0x00f0", ",", "0x00f1", ",", "0x00f2", ",", "0x00f3", ",", "0x00f4", ",", "0x00f5", ",", "0x00f6", ",", "0x00f7", ",", "0x00f8", ",", "0x00f9", ",", "0x00fa", ",", "0x00fb", ",", "0x00fc", ",", "0x00fd", ",", "0x00fe", ",", "0x00ff", ",", "0x0152", ",", "0x0153", ",", "0x0160", ",", "0x0161", ",", "0x0178", ",", "0x017d", ",", "0x017e", ",", "0x0192", ",", "0x02c6", ",", "0x02dc", ",", "0x2013", ",", "0x2014", ",", "0x2018", ",", "0x2019", ",", "0x201a", ",", "0x201c", ",", "0x201d", ",", "0x201e", ",", "0x2020", ",", "0x2021", ",", "0x2022", ",", "0x2026", ",", "0x2030", ",", "0x2039", ",", "0x203a", ",", "0x20ac", ",", "0x2122", ",", "]", ";", "const", "winAnsiString", "=", "String", ".", "fromCodePoint", "(", "...", "winAnsiCodePoints", ")", ".", "split", "(", "''", ")", ".", "join", "(", "' '", ")", ";", "const", "zapfDingbatsCodePoints", "=", "[", "0x0020", ",", "0x00a0", ",", "0x2192", ",", "0x2194", ",", "0x2195", ",", "0x2460", ",", "0x2461", ",", "0x2462", ",", "0x2463", ",", "0x2464", ",", "0x2465", ",", "0x2466", ",", "0x2467", ",", "0x2468", ",", "0x2469", ",", "0x25a0", ",", "0x25b2", ",", "0x25bc", ",", "0x25c6", ",", "0x25cf", ",", "0x25d7", ",", "0x2605", ",", "0x260e", ",", "0x261b", ",", "0x261e", ",", "0x2660", ",", "0x2663", ",", "0x2665", ",", "0x2666", ",", "0x2701", ",", "0x2702", ",", "0x2703", ",", "0x2704", ",", "0x2706", ",", "0x2707", ",", "0x2708", ",", "0x2709", ",", "0x270c", ",", "0x270d", ",", "0x270e", ",", "0x270f", ",", "0x2710", ",", "0x2711", ",", "0x2712", ",", "0x2713", ",", "0x2714", ",", "0x2715", ",", "0x2716", ",", "0x2717", ",", "0x2718", ",", "0x2719", ",", "0x271a", ",", "0x271b", ",", "0x271c", ",", "0x271d", ",", "0x271e", ",", "0x271f", ",", "0x2720", ",", "0x2721", ",", "0x2722", ",", "0x2723", ",", "0x2724", ",", "0x2725", ",", "0x2726", ",", "0x2727", ",", "0x2729", ",", "0x272a", ",", "0x272b", ",", "0x272c", ",", "0x272d", ",", "0x272e", ",", "0x272f", ",", "0x2730", ",", "0x2731", ",", "0x2732", ",", "0x2733", ",", "0x2734", ",", "0x2735", ",", "0x2736", ",", "0x2737", ",", "0x2738", ",", "0x2739", ",", "0x273a", ",", "0x273b", ",", "0x273c", ",", "0x273d", ",", "0x273e", ",", "0x273f", ",", "0x2740", ",", "0x2741", ",", "0x2742", ",", "0x2743", ",", "0x2744", ",", "0x2745", ",", "0x2746", ",", "0x2747", ",", "0x2748", ",", "0x2749", ",", "0x274a", ",", "0x274b", ",", "0x274d", ",", "0x274f", ",", "0x2750", ",", "0x2751", ",", "0x2752", ",", "0x2756", ",", "0x2758", ",", "0x2759", ",", "0x275a", ",", "0x275b", ",", "0x275c", ",", "0x275d", ",", "0x275e", ",", "0x2761", ",", "0x2762", ",", "0x2763", ",", "0x2764", ",", "0x2765", ",", "0x2766", ",", "0x2767", ",", "0x2776", ",", "0x2777", ",", "0x2778", ",", "0x2779", ",", "0x277a", ",", "0x277b", ",", "0x277c", ",", "0x277d", ",", "0x277e", ",", "0x277f", ",", "0x2780", ",", "0x2781", ",", "0x2782", ",", "0x2783", ",", "0x2784", ",", "0x2785", ",", "0x2786", ",", "0x2787", ",", "0x2788", ",", "0x2789", ",", "0x278a", ",", "0x278b", ",", "0x278c", ",", "0x278d", ",", "0x278e", ",", "0x278f", ",", "0x2790", ",", "0x2791", ",", "0x2792", ",", "0x2793", ",", "0x2794", ",", "0x2798", ",", "0x2799", ",", "0x279a", ",", "0x279b", ",", "0x279c", ",", "0x279d", ",", "0x279e", ",", "0x279f", ",", "0x27a0", ",", "0x27a1", ",", "0x27a2", ",", "0x27a3", ",", "0x27a4", ",", "0x27a5", ",", "0x27a6", ",", "0x27a7", ",", "0x27a8", ",", "0x27a9", ",", "0x27aa", ",", "0x27ab", ",", "0x27ac", ",", "0x27ad", ",", "0x27ae", ",", "0x27af", ",", "0x27b1", ",", "0x27b2", ",", "0x27b3", ",", "0x27b4", ",", "0x27b5", ",", "0x27b6", ",", "0x27b7", ",", "0x27b8", ",", "0x27b9", ",", "0x27ba", ",", "0x27bb", ",", "0x27bc", ",", "0x27bd", ",", "0x27be", ",", "0xf8d7", ",", "0xf8d8", ",", "0xf8d9", ",", "0xf8da", ",", "0xf8db", ",", "0xf8dc", ",", "0xf8dd", ",", "0xf8de", ",", "0xf8df", ",", "0xf8e0", ",", "0xf8e1", ",", "0xf8e2", ",", "0xf8e3", ",", "0xf8e4", ",", "]", ";", "const", "zapfDingbatsString", "=", "String", ".", "fromCodePoint", "(", "...", "zapfDingbatsCodePoints", ")", ".", "split", "(", "''", ")", ".", "join", "(", "' '", ")", ";", "const", "symbolCodePoints", "=", "[", "0x0020", ",", "0x0021", ",", "0x0023", ",", "0x0025", ",", "0x0026", ",", "0x0028", ",", "0x0029", ",", "0x002b", ",", "0x002c", ",", "0x002e", ",", "0x002f", ",", "0x0030", ",", "0x0031", ",", "0x0032", ",", "0x0033", ",", "0x0034", ",", "0x0035", ",", "0x0036", ",", "0x0037", ",", "0x0038", ",", "0x0039", ",", "0x003a", ",", "0x003b", ",", "0x003c", ",", "0x003d", ",", "0x003e", ",", "0x003f", ",", "0x005b", ",", "0x005d", ",", "0x005f", ",", "0x007b", ",", "0x007c", ",", "0x007d", ",", "0x00a0", ",", "0x00ac", ",", "0x00b0", ",", "0x00b1", ",", "0x00b5", ",", "0x00d7", ",", "0x00f7", ",", "0x0192", ",", "0x0391", ",", "0x0392", ",", "0x0393", ",", "0x0394", ",", "0x0395", ",", "0x0396", ",", "0x0397", ",", "0x0398", ",", "0x0399", ",", "0x039a", ",", "0x039b", ",", "0x039c", ",", "0x039d", ",", "0x039e", ",", "0x039f", ",", "0x03a0", ",", "0x03a1", ",", "0x03a3", ",", "0x03a4", ",", "0x03a5", ",", "0x03a6", ",", "0x03a7", ",", "0x03a8", ",", "0x03a9", ",", "0x03b1", ",", "0x03b2", ",", "0x03b3", ",", "0x03b4", ",", "0x03b5", ",", "0x03b6", ",", "0x03b7", ",", "0x03b8", ",", "0x03b9", ",", "0x03ba", ",", "0x03bb", ",", "0x03bc", ",", "0x03bd", ",", "0x03be", ",", "0x03bf", ",", "0x03c0", ",", "0x03c1", ",", "0x03c2", ",", "0x03c3", ",", "0x03c4", ",", "0x03c5", ",", "0x03c6", ",", "0x03c7", ",", "0x03c8", ",", "0x03c9", ",", "0x03d1", ",", "0x03d2", ",", "0x03d5", ",", "0x03d6", ",", "0x2022", ",", "0x2026", ",", "0x2032", ",", "0x2033", ",", "0x2044", ",", "0x20ac", ",", "0x2111", ",", "0x2118", ",", "0x211c", ",", "0x2126", ",", "0x2135", ",", "0x2190", ",", "0x2191", ",", "0x2192", ",", "0x2193", ",", "0x2194", ",", "0x21b5", ",", "0x21d0", ",", "0x21d1", ",", "0x21d2", ",", "0x21d3", ",", "0x21d4", ",", "0x2200", ",", "0x2202", ",", "0x2203", ",", "0x2205", ",", "0x2206", ",", "0x2207", ",", "0x2208", ",", "0x2209", ",", "0x220b", ",", "0x220f", ",", "0x2211", ",", "0x2212", ",", "0x2215", ",", "0x2217", ",", "0x221a", ",", "0x221d", ",", "0x221e", ",", "0x2220", ",", "0x2227", ",", "0x2228", ",", "0x2229", ",", "0x222a", ",", "0x222b", ",", "0x2234", ",", "0x223c", ",", "0x2245", ",", "0x2248", ",", "0x2260", ",", "0x2261", ",", "0x2264", ",", "0x2265", ",", "0x2282", ",", "0x2283", ",", "0x2284", ",", "0x2286", ",", "0x2287", ",", "0x2295", ",", "0x2297", ",", "0x22a5", ",", "0x22c5", ",", "0x2320", ",", "0x2321", ",", "0x2329", ",", "0x232a", ",", "0x25ca", ",", "0x2660", ",", "0x2663", ",", "0x2665", ",", "0x2666", ",", "0xf6d9", ",", "0xf6da", ",", "0xf6db", ",", "0xf8e5", ",", "0xf8e6", ",", "0xf8e7", ",", "0xf8e8", ",", "0xf8e9", ",", "0xf8ea", ",", "0xf8eb", ",", "0xf8ec", ",", "0xf8ed", ",", "0xf8ee", ",", "0xf8ef", ",", "0xf8f0", ",", "0xf8f1", ",", "0xf8f2", ",", "0xf8f3", ",", "0xf8f4", ",", "0xf8f5", ",", "0xf8f6", ",", "0xf8f7", ",", "0xf8f8", ",", "0xf8f9", ",", "0xf8fa", ",", "0xf8fb", ",", "0xf8fc", ",", "0xf8fd", ",", "0xf8fe", ",", "]", ";", "const", "symbolString", "=", "String", ".", "fromCodePoint", "(", "...", "symbolCodePoints", ")", ".", "split", "(", "''", ")", ".", "join", "(", "' '", ")", ";", "const", "addPageWithFonts", "=", "(", "pdfDoc", ",", "text", ",", "fontSize", ",", "gapAmt", ",", "fontNames", ")", "=>", "{", "const", "page", "=", "pdfDoc", ".", "addPage", "(", "[", "650", ",", "700", "]", ")", ";", "page", ".", "moveTo", "(", "0", ",", "675", ")", ";", "fontNames", ".", "forEach", "(", "(", "fontName", ")", "=>", "{", "const", "font", "=", "pdfDoc", ".", "embedStandardFont", "(", "fontName", ")", ";", "const", "lines", "=", "breakTextIntoLines", "(", "text", ",", "fontSize", ",", "font", ",", "600", ")", ";", "page", ".", "drawText", "(", "fontName", ",", "{", "font", ",", "size", ":", "fontSize", ",", "x", ":", "650", "/", "2", "-", "font", ".", "widthOfTextAtSize", "(", "fontName", ",", "fontSize", ")", "/", "2", ",", "}", ")", ";", "page", ".", "moveTo", "(", "0", ",", "page", ".", "getY", "(", ")", "-", "font", ".", "heightAtSize", "(", "fontSize", ")", "-", "10", ")", ";", "page", ".", "drawText", "(", "lines", ".", "join", "(", "'\\n'", ")", ",", "{", "font", ",", "size", ":", "fontSize", ",", "x", ":", "25", ",", "lineHeight", ":", "font", ".", "heightAtSize", "(", "fontSize", ")", "+", "10", ",", "}", ")", ";", "page", ".", "moveDown", "(", "(", "font", ".", "heightAtSize", "(", "fontSize", ")", "+", "10", ")", "*", "(", "lines", ".", "length", "-", "1", "+", "gapAmt", ")", ")", ";", "}", ")", ";", "}", ";", "const", "breakTextIntoLines", "=", "(", "text", ",", "size", ",", "font", ",", "maxWidth", ")", "=>", "{", "const", "lines", "=", "[", "]", ";", "let", "textIdx", "=", "0", ";", "while", "(", "textIdx", "<", "text", ".", "length", ")", "{", "let", "line", "=", "''", ";", "while", "(", "textIdx", "<", "text", ".", "length", ")", "{", "if", "(", "text", ".", "charAt", "(", "textIdx", ")", "===", "'\\n'", ")", "{", "lines", ".", "push", "(", "line", ")", ";", "textIdx", "+=", "1", ";", "line", "=", "''", ";", "continue", ";", "}", "const", "newLine", "=", "line", "+", "text", ".", "charAt", "(", "textIdx", ")", ";", "if", "(", "font", ".", "widthOfTextAtSize", "(", "newLine", ",", "size", ")", ">", "maxWidth", ")", "break", ";", "line", "=", "newLine", ";", "textIdx", "+=", "1", ";", "}", "lines", ".", "push", "(", "line", ")", ";", "}", "return", "lines", ";", "}", ";", "export", "default", "async", "(", "_assets", ")", "=>", "{", "const", "pdfDoc", "=", "await", "PDFDocument", ".", "create", "(", ")", ";", "const", "helveticaFont", "=", "await", "pdfDoc", ".", "embedFont", "(", "StandardFonts", ".", "Helvetica", ")", ";", "const", "helveticaBoldFont", "=", "await", "pdfDoc", ".", "embedFont", "(", "StandardFonts", ".", "HelveticaBold", ")", ";", "const", "title", "=", "'Standard 14 Fonts Demo'", ";", "const", "description", "=", "`\n The PDF specification requires that PDF readers provide 14 standard fonts. \n PDF documents may use these fonts without having to embed the fonts \n themselves in the document. The fonts are as follows:\n\n • Times Roman (serif) in regular, bold, italic, and bold italic variants.\n • Helvetica (sans-serif) in regular, bold, oblique, and bold oblique variants.\n • Courier (monospace serif) in regular, bold, oblique, and bold oblique variants.\n • ZapfDingbats (symbolic) in regular variant.\n • Symbol (symbolic) in regular variant.\n\n The Times Roman, Helvetica, and Courier fonts use WinAnsi encoding\n (Windows-1252). ZapfDingbats and Symbol each use their own special \n encodings. \n\n Note that none of these fonts support anything near the entire Unicode \n character set. The WinAnsi fonts include most glyphs in the Latin alphabet.\n The ZapfDingbat font includes an odd assortment of glyphs that don't below \n to any particular language or region. And the Symbol font includes \n mathematical symbols and glyphs for the greek alphabet.\n \n The following pages contain examples of each of the standard 14 fonts. Each \n glyph supported by a given font's encoding is rendered to the page under a\n header naming the font in use.`", ";", "const", "descriptionLines", "=", "breakTextIntoLines", "(", "description", ",", "16", ",", "helveticaFont", ",", "600", ")", ";", "const", "titlePage", "=", "pdfDoc", ".", "addPage", "(", "[", "650", ",", "700", "]", ")", ";", "titlePage", ".", "drawText", "(", "title", ",", "{", "font", ":", "helveticaBoldFont", ",", "size", ":", "35", ",", "y", ":", "700", "-", "100", ",", "x", ":", "650", "/", "2", "-", "helveticaBoldFont", ".", "widthOfTextAtSize", "(", "title", ",", "35", ")", "/", "2", ",", "lineHeight", ":", "35", ",", "}", ")", ";", "titlePage", ".", "drawText", "(", "descriptionLines", ".", "join", "(", "'\\n'", ")", ",", "{", "font", ":", "helveticaFont", ",", "size", ":", "16", ",", "y", ":", "525", ",", "x", ":", "25", ",", "lineHeight", ":", "16", ",", "}", ")", ";", "addPageWithFonts", "(", "pdfDoc", ",", "winAnsiString", ",", "18", ",", "0.25", ",", "[", "StandardFonts", ".", "TimesRoman", ",", "StandardFonts", ".", "TimesRomanBold", ",", "StandardFonts", ".", "TimesRomanItalic", ",", "StandardFonts", ".", "TimesRomanBoldItalic", ",", "]", ")", ";", "addPageWithFonts", "(", "pdfDoc", ",", "winAnsiString", ",", "16.75", ",", "0.4", ",", "[", "StandardFonts", ".", "Helvetica", ",", "StandardFonts", ".", "HelveticaBold", ",", "StandardFonts", ".", "HelveticaOblique", ",", "StandardFonts", ".", "HelveticaBoldOblique", ",", "]", ")", ";", "addPageWithFonts", "(", "pdfDoc", ",", "winAnsiString", ",", "14.25", ",", "0.75", ",", "[", "StandardFonts", ".", "Courier", ",", "StandardFonts", ".", "CourierBold", ",", "StandardFonts", ".", "CourierOblique", ",", "StandardFonts", ".", "CourierBoldOblique", ",", "]", ")", ";", "const", "zapfDingbatsFont", "=", "await", "pdfDoc", ".", "embedFont", "(", "StandardFonts", ".", "ZapfDingbats", ")", ";", "const", "zapfDingbatsFontSize", "=", "20", ";", "const", "zapfDingbatsLines", "=", "breakTextIntoLines", "(", "zapfDingbatsString", ",", "zapfDingbatsFontSize", ",", "zapfDingbatsFont", ",", "600", ")", ";", "const", "page", "=", "pdfDoc", ".", "addPage", "(", "[", "650", ",", "700", "]", ")", ";", "page", ".", "moveTo", "(", "0", ",", "700", ")", ";", "page", ".", "moveDown", "(", "100", ")", ";", "page", ".", "drawText", "(", "'ZapfDingbats'", ",", "{", "font", ":", "helveticaFont", ",", "size", ":", "zapfDingbatsFontSize", ",", "x", ":", "650", "/", "2", "-", "helveticaFont", ".", "widthOfTextAtSize", "(", "'ZapfDingbats'", ",", "zapfDingbatsFontSize", ")", "/", "2", ",", "}", ")", ";", "page", ".", "moveDown", "(", "zapfDingbatsFont", ".", "heightAtSize", "(", "zapfDingbatsFontSize", ")", "+", "10", ")", ";", "page", ".", "drawText", "(", "zapfDingbatsLines", ".", "join", "(", "'\\n'", ")", ",", "{", "font", ":", "zapfDingbatsFont", ",", "size", ":", "zapfDingbatsFontSize", ",", "x", ":", "25", ",", "lineHeight", ":", "zapfDingbatsFont", ".", "heightAtSize", "(", "zapfDingbatsFontSize", ")", "+", "10", ",", "}", ")", ";", "const", "symbolFont", "=", "await", "pdfDoc", ".", "embedFont", "(", "StandardFonts", ".", "Symbol", ")", ";", "const", "symbolFontSize", "=", "20", ";", "const", "symbolLines", "=", "breakTextIntoLines", "(", "symbolString", ",", "symbolFontSize", ",", "symbolFont", ",", "600", ")", ";", "page", ".", "moveDown", "(", "275", ")", ";", "page", ".", "drawText", "(", "'Symbol'", ",", "{", "font", ":", "helveticaFont", ",", "size", ":", "symbolFontSize", ",", "x", ":", "650", "/", "2", "-", "helveticaFont", ".", "widthOfTextAtSize", "(", "'Symbol'", ",", "symbolFontSize", ")", "/", "2", ",", "}", ")", ";", "page", ".", "moveDown", "(", "symbolFont", ".", "heightAtSize", "(", "symbolFontSize", ")", "+", "10", ")", ";", "page", ".", "drawText", "(", "symbolLines", ".", "join", "(", "'\\n'", ")", ",", "{", "font", ":", "symbolFont", ",", "size", ":", "symbolFontSize", ",", "x", ":", "25", ",", "lineHeight", ":", "symbolFont", ".", "heightAtSize", "(", "symbolFontSize", ")", "+", "10", ",", "}", ")", ";", "const", "pdfBytes", "=", "await", "pdfDoc", ".", "save", "(", ")", ";", "return", "pdfBytes", ";", "}", ";" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, null, 1887, null, 2, null, 3, null, 3, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, 2, null, 3, null, 3136, null, 3, null, null, null, null, 5, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5248, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, 2, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1381
[ "import", "fontkit", "from", "'@pdf-lib/fontkit'", ";", "import", "{", "Assets", "}", "from", "'..'", ";", "import", "{", "last", ",", "PDFDocument", ",", "PDFFont", ",", "StandardFonts", ",", "charAtIndex", ",", "}", "from", "'../../..'", ";", "const", "breakTextIntoLines", "=", "(", "text", ",", "size", ",", "font", ",", "maxWidth", ")", "=>", "{", "const", "lines", "=", "[", "]", ";", "let", "textIdx", "=", "0", ";", "while", "(", "textIdx", "<", "text", ".", "length", ")", "{", "let", "line", "=", "''", ";", "while", "(", "textIdx", "<", "text", ".", "length", ")", "{", "if", "(", "text", ".", "charAt", "(", "textIdx", ")", "===", "'\\n'", ")", "{", "lines", ".", "push", "(", "line", ")", ";", "textIdx", "+=", "1", ";", "line", "=", "''", ";", "continue", ";", "}", "const", "[", "glyph", "]", "=", "charAtIndex", "(", "text", ",", "textIdx", ")", ";", "const", "newLine", "=", "line", "+", "glyph", ";", "if", "(", "font", ".", "widthOfTextAtSize", "(", "newLine", ",", "size", ")", ">", "maxWidth", ")", "break", ";", "line", "=", "newLine", ";", "textIdx", "+=", "glyph", ".", "length", ";", "}", "lines", ".", "push", "(", "line", ")", ";", "}", "return", "lines", ";", "}", ";", "const", "breakLinesIntoGroups", "=", "(", "lines", ",", "lineHeight", ",", "maxHeight", ")", "=>", "{", "const", "linesPerGroup", "=", "Math", ".", "floor", "(", "maxHeight", "/", "lineHeight", ")", ";", "const", "groups", "=", "[", "[", "]", "]", ";", "for", "(", "let", "idx", "=", "0", ",", "len", "=", "lines", ".", "length", ";", "idx", "<", "len", ";", "idx", "++", ")", "{", "const", "line", "=", "lines", "[", "idx", "]", ";", "if", "(", "last", "(", "groups", ")", ".", "length", "===", "linesPerGroup", ")", "{", "groups", ".", "push", "(", "[", "]", ")", ";", "}", "last", "(", "groups", ")", ".", "push", "(", "line", ")", ";", "}", "return", "groups", ";", "}", ";", "export", "default", "async", "(", "assets", ")", "=>", "{", "const", "{", "fonts", "}", "=", "assets", ";", "const", "pdfDoc", "=", "await", "PDFDocument", ".", "create", "(", ")", ";", "pdfDoc", ".", "registerFontkit", "(", "fontkit", ")", ";", "const", "helveticaFont", "=", "await", "pdfDoc", ".", "embedFont", "(", "StandardFonts", ".", "Helvetica", ")", ";", "const", "helveticaBoldFont", "=", "await", "pdfDoc", ".", "embedFont", "(", "StandardFonts", ".", "HelveticaBold", ")", ";", "const", "title", "=", "'Embedded UTF-16 Font Demo'", ";", "const", "description", "=", "`\n In addition to the standard 14 fonts provided by PDF readers, the PDF\n specification allows PDF documents to embed their own fonts. The standard\n 14 fonts only support a very limited latin and symbolic character set, but\n embedded fonts can support arbitrary character sets and glyphs.\n \n This document is a demonstration of an embedded font. Specifically, the\n Source Han Serif Japanese Regular font. The following pages render all\n characters supported by this font.\n\n The characters are rendered from greatest to least (ordered by their\n code points). Take special note of the first 1.25 pages of glyphs, as these\n glyphs represent UTF-16 code points (the rest of the glyphs in this document\n are UTF-8).`", ";", "const", "descriptionLines", "=", "breakTextIntoLines", "(", "description", ",", "16", ",", "helveticaFont", ",", "600", ")", ";", "const", "titlePage", "=", "pdfDoc", ".", "addPage", "(", "[", "650", ",", "700", "]", ")", ";", "titlePage", ".", "drawText", "(", "title", ",", "{", "font", ":", "helveticaBoldFont", ",", "size", ":", "35", ",", "y", ":", "700", "-", "100", ",", "x", ":", "650", "/", "2", "-", "helveticaBoldFont", ".", "widthOfTextAtSize", "(", "title", ",", "35", ")", "/", "2", ",", "}", ")", ";", "titlePage", ".", "drawText", "(", "descriptionLines", ".", "join", "(", "'\\n'", ")", ",", "{", "font", ":", "helveticaFont", ",", "size", ":", "16", ",", "y", ":", "525", ",", "x", ":", "25", ",", "}", ")", ";", "const", "sourceHanFont", "=", "await", "pdfDoc", ".", "embedFont", "(", "fonts", ".", "otf", ".", "source_hans_jp", ")", ";", "const", "sourceHanFontSize", "=", "20", ";", "const", "sourceHanString", "=", "String", ".", "fromCodePoint", "(", "...", "sourceHanFont", ".", "getCharacterSet", "(", ")", ".", "reverse", "(", ")", ")", ";", "const", "sourceHanLines", "=", "breakTextIntoLines", "(", "sourceHanString", ",", "sourceHanFontSize", ",", "sourceHanFont", ",", "600", ")", ";", "const", "sourceHanLineGroups", "=", "breakLinesIntoGroups", "(", "sourceHanLines", ",", "sourceHanFont", ".", "heightAtSize", "(", "sourceHanFontSize", ")", "+", "10", ",", "675", ")", ";", "sourceHanLineGroups", ".", "forEach", "(", "(", "lines", ")", "=>", "{", "const", "page", "=", "pdfDoc", ".", "addPage", "(", "[", "650", ",", "700", "]", ")", ";", "page", ".", "drawText", "(", "lines", ".", "join", "(", "'\\n'", ")", ",", "{", "font", ":", "sourceHanFont", ",", "size", ":", "sourceHanFontSize", ",", "x", ":", "25", ",", "y", ":", "700", "-", "25", "-", "sourceHanFontSize", ",", "lineHeight", ":", "sourceHanFont", ".", "heightAtSize", "(", "sourceHanFontSize", ")", "+", "10", ",", "}", ")", ";", "}", ")", ";", "const", "pdfBytes", "=", "await", "pdfDoc", ".", "save", "(", ")", ";", "return", "pdfBytes", ";", "}", ";" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, 2, null, 3, null, 3136, null, 3, null, null, null, null, 5, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, 5, null, 3, null, 3, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, 3, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5248, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, 2, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1382
[ "import", "{", "Assets", "}", "from", "'..'", ";", "import", "{", "PageSizes", ",", "PDFDocument", ",", "BlendMode", ",", "LineCapStyle", ",", "cmyk", ",", "degrees", ",", "rgb", ",", "values", ",", "}", "from", "'../../..'", ";", "const", "inchToPt", "=", "(", "inches", ")", "=>", "Math", ".", "round", "(", "inches", "*", "72", ")", ";", "const", "firstPage", "=", "async", "(", "pdfDoc", ")", "=>", "{", "const", "page", "=", "pdfDoc", ".", "addPage", "(", "PageSizes", ".", "Letter", ")", ";", "page", ".", "drawSvgPath", "(", "'M100,200 C100,100 250,100 250,200 S400,300 400,200'", ",", "{", "x", ":", "inchToPt", "(", "0.25", ")", ",", "y", ":", "inchToPt", "(", "12", ")", ",", "}", ")", ";", "page", ".", "drawSvgPath", "(", "'M 100 100 L 300 100 L 200 300 z'", ",", "{", "x", ":", "inchToPt", "(", "-", "1", ")", ",", "y", ":", "inchToPt", "(", "12", ")", ",", "color", ":", "rgb", "(", "1", ",", "0", ",", "0", ")", ",", "borderColor", ":", "rgb", "(", "0", ",", "0", ",", "1", ")", ",", "borderWidth", ":", "1", ",", "opacity", ":", "0.7", ",", "borderOpacity", ":", "0.7", ",", "}", ")", ";", "page", ".", "drawSvgPath", "(", "'M100,200 C100,100 400,100 400,200'", ",", "{", "x", ":", "inchToPt", "(", "-", "1", ")", ",", "y", ":", "inchToPt", "(", "9.25", ")", ",", "}", ")", ";", "page", ".", "drawSvgPath", "(", "'M600,200 C675,100 975,100 900,200'", ",", "{", "x", ":", "inchToPt", "(", "-", "4.5", ")", ",", "y", ":", "inchToPt", "(", "8.25", ")", ",", "}", ")", ";", "page", ".", "drawSvgPath", "(", "'M100,500 C25,400 475,400 400,500'", ",", "{", "x", ":", "inchToPt", "(", "-", "1", ")", ",", "y", ":", "inchToPt", "(", "11.25", ")", ",", "}", ")", ";", "page", ".", "drawSvgPath", "(", "'M600,500 C600,350 900,650 900,500'", ",", "{", "x", ":", "inchToPt", "(", "-", "4.5", ")", ",", "y", ":", "inchToPt", "(", "10.25", ")", ",", "}", ")", ";", "page", ".", "drawSvgPath", "(", "'M100,800 C175,700 325,700 400,800'", ",", "{", "x", ":", "inchToPt", "(", "-", "1", ")", ",", "y", ":", "inchToPt", "(", "13.35", ")", ",", "}", ")", ";", "page", ".", "drawSvgPath", "(", "'M600,800 C625,700 725,700 750,800 S875,900 900,800'", ",", "{", "x", ":", "inchToPt", "(", "-", "4.5", ")", ",", "y", ":", "inchToPt", "(", "12.25", ")", ",", "}", ")", ";", "}", ";", "const", "secondPage", "=", "async", "(", "pdfDoc", ")", "=>", "{", "const", "page", "=", "pdfDoc", ".", "addPage", "(", "PageSizes", ".", "Letter", ")", ";", "page", ".", "drawSvgPath", "(", "'M200,300 Q400,50 600,300 T1000,300'", ",", "{", "x", ":", "100", ",", "y", ":", "700", ",", "scale", ":", "0.5", ",", "borderWidth", ":", "4", ",", "borderDashArray", ":", "[", "24", ",", "12", "]", ",", "borderLineCap", ":", "LineCapStyle", ".", "Round", ",", "rotate", ":", "degrees", "(", "30", ")", ",", "}", ")", ";", "page", ".", "drawSvgPath", "(", "'M200,300 L400,50 L600,300 L800,550 L1000,300'", ",", "{", "x", ":", "inchToPt", "(", "-", "1", ")", ",", "y", ":", "inchToPt", "(", "9", ")", ",", "scale", ":", "0.5", ",", "borderWidth", ":", "2", ",", "}", ")", ";", "page", ".", "drawSvgPath", "(", "'M300,200 h-150 a150,150 0 1,0 150,-150 z'", ",", "{", "x", ":", "inchToPt", "(", "-", "1", ")", ",", "y", ":", "inchToPt", "(", "5.5", ")", ",", "color", ":", "rgb", "(", "1", ",", "0", ",", "0", ")", ",", "borderColor", ":", "rgb", "(", "0", ",", "0", ",", "1", ")", ",", "borderWidth", ":", "1", ",", "}", ")", ";", "page", ".", "drawSvgPath", "(", "'M275,175 v-150 a150,150 0 0,0 -150,150 z'", ",", "{", "x", ":", "inchToPt", "(", "-", "1", ")", ",", "y", ":", "inchToPt", "(", "5.5", ")", ",", "color", ":", "rgb", "(", "1", ",", "1", ",", "0", ")", ",", "borderColor", ":", "rgb", "(", "0", ",", "0", ",", "1", ")", ",", "borderWidth", ":", "1", ",", "}", ")", ";", "page", ".", "drawSvgPath", "(", "'M600,350 l 50,-25 a25,25 -30 0,1 50,-25 l 50,-25 a25,50 -30 0,1 50,-25 l 50,-25 a25,75 -30 0,1 50,-25 l 50,-25 a25,100 -30 0,1 50,-25 l 50,-25'", ",", "{", "x", ":", "inchToPt", "(", "1", ")", ",", "y", ":", "inchToPt", "(", "3", ")", ",", "scale", ":", "0.5", ",", "borderColor", ":", "rgb", "(", "1", ",", "0", ",", "0", ")", ",", "borderWidth", ":", "2", ",", "}", ")", ";", "page", ".", "drawCircle", "(", "{", "x", ":", "inchToPt", "(", "3", ")", ",", "y", ":", "inchToPt", "(", "5", ")", ",", "color", ":", "rgb", "(", "0", ",", "1", ",", "1", ")", ",", "opacity", ":", "0.1", ",", "borderWidth", ":", "3", ",", "borderColor", ":", "rgb", "(", "1", ",", "0", ",", "1", ")", ",", "borderOpacity", ":", "0.2", ",", "}", ")", ";", "page", ".", "drawText", "(", "'Semi-Transparent Text'", ",", "{", "color", ":", "rgb", "(", "0", ",", "1", ",", "1", ")", ",", "opacity", ":", "0.5", ",", "x", ":", "inchToPt", "(", "1", ")", ",", "y", ":", "inchToPt", "(", "2.5", ")", ",", "size", ":", "50", ",", "}", ")", ";", "}", ";", "const", "thirdPage", "=", "async", "(", "pdfDoc", ",", "assets", ")", "=>", "{", "const", "page", "=", "pdfDoc", ".", "addPage", "(", "PageSizes", ".", "Letter", ")", ";", "const", "modeNames", "=", "values", "(", "BlendMode", ")", ";", "page", ".", "drawRectangle", "(", "{", "x", ":", "30", ",", "y", ":", "30", ",", "width", ":", "100", ",", "height", ":", "732", ",", "color", ":", "cmyk", "(", "0", ",", "0.7", ",", "0.3", ",", "0", ")", ",", "blendMode", ":", "BlendMode", ".", "Normal", ",", "}", ")", ";", "page", ".", "drawRectangle", "(", "{", "x", ":", "340", ",", "y", ":", "30", ",", "width", ":", "100", ",", "height", ":", "732", ",", "color", ":", "cmyk", "(", "0.6", ",", "0", ",", "0.3", ",", "0", ")", ",", "blendMode", ":", "BlendMode", ".", "Normal", ",", "}", ")", ";", "page", ".", "drawText", "(", "`pdf-lib Blend Mode Test`", ",", "{", "size", ":", "24", ",", "x", ":", "45", ",", "y", ":", "735", ",", "color", ":", "cmyk", "(", "0.75", ",", "0", ",", "0", ",", "0", ")", ",", "blendMode", ":", "BlendMode", ".", "Multiply", ",", "}", ")", ";", "modeNames", ".", "forEach", "(", "(", "m", ",", "i", ")", "=>", "{", "page", ".", "drawText", "(", "`blendMode: ${", "m", "}`", ",", "{", "size", ":", "14", ",", "x", ":", "40", ",", "y", ":", "700", "-", "i", "*", "20", ",", "color", ":", "cmyk", "(", "0", ",", "0", ",", "0", ",", "0.65", ")", ",", "blendMode", ":", "m", "as", "BlendMode", ",", "}", ")", ";", "}", ")", ";", "page", ".", "drawSvgPath", "(", "'M200,300 Q400,50 600,300 T1000,300'", ",", "{", "x", ":", "inchToPt", "(", "-", "1", ")", ",", "y", ":", "inchToPt", "(", "10", ")", ",", "scale", ":", "0.5", ",", "borderWidth", ":", "6", ",", "borderColor", ":", "cmyk", "(", "0", ",", "0", ",", "0", ",", "1", ")", ",", "blendMode", ":", "BlendMode", ".", "Overlay", ",", "}", ")", ";", "page", ".", "drawSvgPath", "(", "'M300,200 h-150 a150,150 0 1,0 150,-150 z'", ",", "{", "x", ":", "inchToPt", "(", "-", "1", ")", ",", "y", ":", "inchToPt", "(", "5.5", ")", ",", "color", ":", "cmyk", "(", "0", ",", "1", ",", "1", ",", "0", ")", ",", "borderColor", ":", "cmyk", "(", "1", ",", "0.7", ",", "0", ",", "0", ")", ",", "borderWidth", ":", "2", ",", "blendMode", ":", "BlendMode", ".", "HardLight", ",", "}", ")", ";", "page", ".", "drawSvgPath", "(", "'M275,175 v-150 a150,150 0 0,0 -150,150 z'", ",", "{", "x", ":", "inchToPt", "(", "-", "1", ")", ",", "y", ":", "inchToPt", "(", "5.5", ")", ",", "color", ":", "cmyk", "(", "0", ",", "0.3", ",", "1", ",", "0", ")", ",", "borderColor", ":", "cmyk", "(", "0", ",", "0", ",", "0", ",", "1", ")", ",", "borderWidth", ":", "2", ",", "blendMode", ":", "BlendMode", ".", "Darken", ",", "}", ")", ";", "page", ".", "drawRectangle", "(", "{", "x", ":", "350", ",", "y", ":", "220", ",", "width", ":", "60", ",", "height", ":", "160", ",", "rotate", ":", "degrees", "(", "-", "30", ")", ",", "color", ":", "cmyk", "(", "0.4", ",", "0", ",", "1", ",", "0", ")", ",", "borderColor", ":", "cmyk", "(", "0", ",", "1", ",", "1", ",", "0", ")", ",", "borderWidth", ":", "2", ",", "blendMode", ":", "BlendMode", ".", "ColorBurn", ",", "}", ")", ";", "page", ".", "drawCircle", "(", "{", "x", ":", "inchToPt", "(", "3", ")", ",", "y", ":", "inchToPt", "(", "5", ")", ",", "color", ":", "cmyk", "(", "0.7", ",", "1", ",", "0.5", ",", "0", ")", ",", "blendMode", ":", "BlendMode", ".", "ColorDodge", ",", "}", ")", ";", "const", "pngImage", "=", "await", "pdfDoc", ".", "embedPng", "(", "assets", ".", "images", ".", "png", ".", "self_drive", ")", ";", "const", "pngDims", "=", "pngImage", ".", "scale", "(", "1.0", ")", ";", "const", "cx", "=", "page", ".", "getWidth", "(", ")", "/", "2", "-", "70", ";", "const", "cy", "=", "page", ".", "getHeight", "(", ")", "/", "2", ";", "page", ".", "drawImage", "(", "pngImage", ",", "{", "x", ":", "cx", "-", "pngDims", ".", "width", "/", "2", ",", "y", ":", "cy", "-", "pngDims", ".", "height", "/", "2", ",", "width", ":", "pngDims", ".", "width", ",", "height", ":", "pngDims", ".", "height", ",", "blendMode", ":", "BlendMode", ".", "Screen", ",", "}", ")", ";", "const", "[", "embeddedPage", "]", "=", "await", "pdfDoc", ".", "embedPdf", "(", "assets", ".", "pdfs", ".", "simple_pdf_2_example", ",", "[", "0", "]", ")", ";", "const", "[", "px", ",", "py", ",", "scale", "]", "=", "[", "300", ",", "100", ",", "0.33", "]", ";", "const", "{", "width", ",", "height", "}", "=", "embeddedPage", ".", "scale", "(", "scale", ")", ";", "page", ".", "drawPage", "(", "embeddedPage", ",", "{", "x", ":", "px", ",", "y", ":", "py", ",", "xScale", ":", "scale", ",", "yScale", ":", "scale", ",", "blendMode", ":", "BlendMode", ".", "Multiply", ",", "}", ")", ";", "page", ".", "drawRectangle", "(", "{", "x", ":", "px", ",", "y", ":", "py", ",", "width", ",", "height", ",", "borderColor", ":", "cmyk", "(", "0", ",", "1", ",", "1", ",", "0", ")", ",", "borderWidth", ":", "2", ",", "blendMode", ":", "BlendMode", ".", "Normal", ",", "}", ")", ";", "page", ".", "drawText", "(", "'Embedded PDF document (blendMode: Multiply)'", ",", "{", "size", ":", "9", ",", "x", ":", "px", ",", "y", ":", "py", "-", "12", ",", "color", ":", "cmyk", "(", "0", ",", "0", ",", "0", ",", "1", ")", ",", "blendMode", ":", "BlendMode", ".", "Multiply", ",", "}", ")", ";", "}", ";", "export", "default", "async", "(", "assets", ")", "=>", "{", "const", "pdfDoc", "=", "await", "PDFDocument", ".", "create", "(", ")", ";", "await", "firstPage", "(", "pdfDoc", ")", ";", "await", "secondPage", "(", "pdfDoc", ")", ";", "await", "thirdPage", "(", "pdfDoc", ",", "assets", ")", ";", "const", "pdfBytes", "=", "await", "pdfDoc", ".", "save", "(", ")", ";", "return", "pdfBytes", ";", "}", ";" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, 1887, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, 1887, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, 1887, null, 5248, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5248, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1383
[ "import", "fs", "from", "'fs'", ";", "import", "{", "Assets", "}", "from", "'..'", ";", "import", "{", "PDFDocument", ",", "rgb", "}", "from", "'../../..'", ";", "const", "pngSuite", "=", "[", "'PngSuite.png'", ",", "'basi0g01.png'", ",", "'basi0g02.png'", ",", "'basi0g04.png'", ",", "'basi0g08.png'", ",", "'basi0g16.png'", ",", "'basi2c08.png'", ",", "'basi2c16.png'", ",", "'basi3p01.png'", ",", "'basi3p02.png'", ",", "'basi3p04.png'", ",", "'basi3p08.png'", ",", "'basi4a08.png'", ",", "'basi4a16.png'", ",", "'basi6a08.png'", ",", "'basi6a16.png'", ",", "'basn0g01.png'", ",", "'basn0g02.png'", ",", "'basn0g04.png'", ",", "'basn0g08.png'", ",", "'basn0g16.png'", ",", "'basn2c08.png'", ",", "'basn2c16.png'", ",", "'basn3p01.png'", ",", "'basn3p02.png'", ",", "'basn3p04.png'", ",", "'basn3p08.png'", ",", "'basn4a08.png'", ",", "'basn4a16.png'", ",", "'basn6a08.png'", ",", "'basn6a16.png'", ",", "'bgai4a08.png'", ",", "'bgai4a16.png'", ",", "'bgan6a08.png'", ",", "'bgan6a16.png'", ",", "'bgbn4a08.png'", ",", "'bggn4a16.png'", ",", "'bgwn6a08.png'", ",", "'bgyn6a16.png'", ",", "'ccwn2c08.png'", ",", "'ccwn3p08.png'", ",", "'cdfn2c08.png'", ",", "'cdhn2c08.png'", ",", "'cdsn2c08.png'", ",", "'cdun2c08.png'", ",", "'ch1n3p04.png'", ",", "'ch2n3p08.png'", ",", "'cm0n0g04.png'", ",", "'cm7n0g04.png'", ",", "'cm9n0g04.png'", ",", "'cs3n2c16.png'", ",", "'cs3n3p08.png'", ",", "'cs5n2c08.png'", ",", "'cs5n3p08.png'", ",", "'cs8n2c08.png'", ",", "'cs8n3p08.png'", ",", "'ct0n0g04.png'", ",", "'ct1n0g04.png'", ",", "'cten0g04.png'", ",", "'ctfn0g04.png'", ",", "'ctgn0g04.png'", ",", "'cthn0g04.png'", ",", "'ctjn0g04.png'", ",", "'ctzn0g04.png'", ",", "'exif2c08.png'", ",", "'f00n0g08.png'", ",", "'f00n2c08.png'", ",", "'f01n0g08.png'", ",", "'f01n2c08.png'", ",", "'f02n0g08.png'", ",", "'f02n2c08.png'", ",", "'f03n0g08.png'", ",", "'f03n2c08.png'", ",", "'f04n0g08.png'", ",", "'f04n2c08.png'", ",", "'f99n0g04.png'", ",", "'g03n0g16.png'", ",", "'g03n2c08.png'", ",", "'g03n3p04.png'", ",", "'g04n0g16.png'", ",", "'g04n2c08.png'", ",", "'g04n3p04.png'", ",", "'g05n0g16.png'", ",", "'g05n2c08.png'", ",", "'g05n3p04.png'", ",", "'g07n0g16.png'", ",", "'g07n2c08.png'", ",", "'g07n3p04.png'", ",", "'g10n0g16.png'", ",", "'g10n2c08.png'", ",", "'g10n3p04.png'", ",", "'g25n0g16.png'", ",", "'g25n2c08.png'", ",", "'g25n3p04.png'", ",", "'oi1n0g16.png'", ",", "'oi1n2c16.png'", ",", "'oi2n0g16.png'", ",", "'oi2n2c16.png'", ",", "'oi4n0g16.png'", ",", "'oi4n2c16.png'", ",", "'oi9n0g16.png'", ",", "'oi9n2c16.png'", ",", "'pp0n2c16.png'", ",", "'pp0n6a08.png'", ",", "'ps1n0g08.png'", ",", "'ps1n2c16.png'", ",", "'ps2n0g08.png'", ",", "'ps2n2c16.png'", ",", "'s01i3p01.png'", ",", "'s01n3p01.png'", ",", "'s02i3p01.png'", ",", "'s02n3p01.png'", ",", "'s03i3p01.png'", ",", "'s03n3p01.png'", ",", "'s04i3p01.png'", ",", "'s04n3p01.png'", ",", "'s05i3p02.png'", ",", "'s05n3p02.png'", ",", "'s06i3p02.png'", ",", "'s06n3p02.png'", ",", "'s07i3p02.png'", ",", "'s07n3p02.png'", ",", "'s08i3p02.png'", ",", "'s08n3p02.png'", ",", "'s09i3p02.png'", ",", "'s09n3p02.png'", ",", "'s32i3p04.png'", ",", "'s32n3p04.png'", ",", "'s33i3p04.png'", ",", "'s33n3p04.png'", ",", "'s34i3p04.png'", ",", "'s34n3p04.png'", ",", "'s35i3p04.png'", ",", "'s35n3p04.png'", ",", "'s36i3p04.png'", ",", "'s36n3p04.png'", ",", "'s37i3p04.png'", ",", "'s37n3p04.png'", ",", "'s38i3p04.png'", ",", "'s38n3p04.png'", ",", "'s39i3p04.png'", ",", "'s39n3p04.png'", ",", "'s40i3p04.png'", ",", "'s40n3p04.png'", ",", "'tbbn0g04.png'", ",", "'tbbn2c16.png'", ",", "'tbbn3p08.png'", ",", "'tbgn2c16.png'", ",", "'tbgn3p08.png'", ",", "'tbrn2c08.png'", ",", "'tbwn0g16.png'", ",", "'tbwn3p08.png'", ",", "'tbyn3p08.png'", ",", "'tm3n3p02.png'", ",", "'tp0n0g08.png'", ",", "'tp0n2c08.png'", ",", "'tp0n3p08.png'", ",", "'tp1n3p08.png'", ",", "'z00n2c08.png'", ",", "'z03n2c08.png'", ",", "'z06n2c08.png'", ",", "'z09n2c08.png'", ",", "]", ";", "export", "default", "async", "(", "assets", ")", "=>", "{", "const", "pdfDoc", "=", "await", "PDFDocument", ".", "create", "(", ")", ";", "const", "page", "=", "pdfDoc", ".", "addPage", "(", ")", ";", "const", "solarizedWhite", "=", "rgb", "(", "253", "/", "255", ",", "246", "/", "255", ",", "227", "/", "255", ")", ";", "page", ".", "drawRectangle", "(", "{", "...", "page", ".", "getSize", "(", ")", ",", "color", ":", "solarizedWhite", "}", ")", ";", "const", "etweImg", "=", "await", "pdfDoc", ".", "embedPng", "(", "assets", ".", "images", ".", "png", ".", "etwe", ")", ";", "page", ".", "drawImage", "(", "etweImg", ",", "{", "x", ":", "25", ",", "y", ":", "page", ".", "getHeight", "(", ")", "-", "80", ",", "...", "etweImg", ".", "scale", "(", "0.2", ")", ",", "}", ")", ";", "const", "selfDriveImg", "=", "await", "pdfDoc", ".", "embedPng", "(", "assets", ".", "images", ".", "png", ".", "self_drive", ")", ";", "page", ".", "drawImage", "(", "selfDriveImg", ",", "{", "x", ":", "page", ".", "getWidth", "(", ")", "/", "2", ",", "y", ":", "page", ".", "getHeight", "(", ")", "-", "80", ",", "...", "selfDriveImg", ".", "scale", "(", "0.7", ")", ",", "}", ")", ";", "const", "size", "=", "45", ";", "let", "x", "=", "25", ";", "let", "y", "=", "5", ";", "for", "(", "const", "path", "of", "pngSuite", ")", "{", "const", "png", "=", "fs", ".", "readFileSync", "(", "`assets/images/pngsuite/${", "path", "}`", ")", ";", "const", "img", "=", "await", "pdfDoc", ".", "embedPng", "(", "png", ")", ";", "page", ".", "drawImage", "(", "img", ",", "{", "x", ",", "y", ",", "width", ":", "size", ",", "height", ":", "size", "}", ")", ";", "y", "+=", "size", "+", "5", ";", "if", "(", "y", "+", "size", ">=", "page", ".", "getHeight", "(", ")", "-", "80", ")", "{", "y", "=", "5", ";", "x", "+=", "size", "+", "5", ";", "}", "}", "const", "pdfBytes", "=", "await", "pdfDoc", ".", "save", "(", ")", ";", "return", "pdfBytes", ";", "}", ";" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5248, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, 3, null, null, null, null, 3, null, null, null, null, null, null, 2, null, null, null, null, null, 12, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1384
[ "import", "{", "Assets", "}", "from", "'..'", ";", "import", "{", "PDFDocument", ",", "values", ",", "PDFTextField", "}", "from", "'../../..'", ";", "const", "fieldNames", "=", "{", "LegalName", ":", "'form1[0].Page1[0].BeforeYouBegin[0].BusinessInfo[0].LegalName[0]'", ",", "BusinessNumber1", ":", "'form1[0].Page1[0].BeforeYouBegin[0].BusinessInfo[0].AccountNumber[0].BusinessNumber_RT1[0]'", ",", "BusinessNumber2", ":", "'form1[0].Page1[0].BeforeYouBegin[0].BusinessInfo[0].AccountNumber[0].BusinessNumber_RT2[0]'", ",", "BusinessAddress", ":", "'form1[0].Page1[0].BeforeYouBegin[0].PhysicalAddress[0].BusinessAddress[0]'", ",", "City", ":", "'form1[0].Page1[0].BeforeYouBegin[0].PhysicalAddress[0].City[0]'", ",", "Province", ":", "'form1[0].Page1[0].BeforeYouBegin[0].PhysicalAddress[0].Province[0]'", ",", "PostalCode", ":", "'form1[0].Page1[0].BeforeYouBegin[0].PhysicalAddress[0].PostalCode[0]'", ",", "TypeOfReturn", ":", "'form1[0].Page1[0].BeforeYouBegin[0].Type[0].RadioButtonGroup[0]'", ",", "FromDate", ":", "'form1[0].Page1[0].BeforeYouBegin[0].Period[0].FromToDates_Comb_Adv_EN[0].FromDate[0]'", ",", "ToDate", ":", "'form1[0].Page1[0].BeforeYouBegin[0].Period[0].FromToDates_Comb_Adv_EN[0].ToDate[0]'", ",", "Amount1", ":", "'form1[0].Page12[0].SalesDutyPage12[0].AmountDue[0].DutyPayable[0].DutyPayable[0].Amount[0]'", ",", "Amount2", ":", "'form1[0].Page12[0].SalesDutyPage12[0].AmountDue[0].AdditionalDutyPayable[0].AdditionalDutyPayable[0].Amount[0]'", ",", "Amount3", ":", "'form1[0].Page12[0].SalesDutyPage12[0].AmountDue[0].AjustmentAdditionalDutyPayable[0].AjustmentAdditionalDutyPayable[0].Amount[0]'", ",", "Amount4", ":", "'form1[0].Page12[0].SalesDutyPage12[0].AmountDue[0].NetPayable[0].NetPayable[0].Amount[0]'", ",", "Amount5", ":", "'form1[0].Page12[0].SalesDutyPage12[0].AmountDue[0].Refund[0].Refund[0].Amount[0]'", ",", "Amount6", ":", "'form1[0].Page12[0].SalesDutyPage12[0].AmountDue[0].AmountDue[0].AmountDue[0].Amount[0]'", ",", "ByDueDate", ":", "'form1[0].Page12[0].SalesDutyPage12[0].ByDueDate[0]'", ",", "Name", ":", "'form1[0].Page12[0].Certification[0].Signature[0].Name[0]'", ",", "Title", ":", "'form1[0].Page12[0].Certification[0].Signature[0].Title[0]'", ",", "PhoneNumber", ":", "'form1[0].Page12[0].Certification[0].Signature[0].Phone_Ext[0].TelephoneNumberSplit[0].PhoneNumber[0]'", ",", "PhoneExt", ":", "'form1[0].Page12[0].Certification[0].Signature[0].Phone_Ext[0].Ext[0]'", ",", "SignatureDate", ":", "'form1[0].Page12[0].Certification[0].Signature[0].Date[0].DateYYYYMMDD_Comb[0]'", ",", "}", ";", "export", "default", "async", "(", "assets", ")", "=>", "{", "const", "pdfDoc", "=", "await", "PDFDocument", ".", "load", "(", "assets", ".", "pdfs", ".", "with_combed_fields", ")", ";", "const", "form", "=", "pdfDoc", ".", "getForm", "(", ")", ";", "const", "legalName", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "LegalName", ")", ";", "legalName", ".", "setText", "(", "'Purple People Eater'", ")", ";", "const", "businessNumber1", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "BusinessNumber1", ")", ";", "businessNumber1", ".", "setText", "(", "'123456789'", ")", ";", "const", "businessNumber2", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "BusinessNumber2", ")", ";", "businessNumber2", ".", "setText", "(", "'9876'", ")", ";", "const", "businessAddress", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "BusinessAddress", ")", ";", "businessAddress", ".", "setText", "(", "'873 Lantern Lane'", ")", ";", "const", "city", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "City", ")", ";", "city", ".", "setText", "(", "'Tuckerton'", ")", ";", "const", "province", "=", "form", ".", "getDropdown", "(", "fieldNames", ".", "Province", ")", ";", "province", ".", "select", "(", "'Saskatchewan'", ")", ";", "const", "postalCode", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "PostalCode", ")", ";", "postalCode", ".", "setText", "(", "'08087'", ")", ";", "const", "typeOfReturn", "=", "form", ".", "getRadioGroup", "(", "fieldNames", ".", "TypeOfReturn", ")", ";", "typeOfReturn", ".", "select", "(", "'1'", ")", ";", "const", "fromDate", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "FromDate", ")", ";", "fromDate", ".", "setText", "(", "[", "'2019'", ",", "'11'", ",", "'05'", "]", ".", "join", "(", "''", ")", ")", ";", "const", "toDate", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "ToDate", ")", ";", "toDate", ".", "setText", "(", "[", "'2020'", ",", "'01'", ",", "'18'", "]", ".", "join", "(", "''", ")", ")", ";", "const", "amount1", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "Amount1", ")", ";", "amount1", ".", "setText", "(", "'100'", ")", ";", "const", "amount2", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "Amount2", ")", ";", "amount2", ".", "setText", "(", "'200'", ")", ";", "const", "amount3", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "Amount3", ")", ";", "amount3", ".", "setText", "(", "'300'", ")", ";", "const", "amount4", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "Amount4", ")", ";", "amount4", ".", "setText", "(", "'400'", ")", ";", "const", "amount5", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "Amount5", ")", ";", "amount5", ".", "setText", "(", "'500'", ")", ";", "const", "amount6", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "Amount6", ")", ";", "amount6", ".", "setText", "(", "'600'", ")", ";", "const", "byDueDate", "=", "form", ".", "getRadioGroup", "(", "fieldNames", ".", "ByDueDate", ")", ";", "byDueDate", ".", "select", "(", "'2'", ")", ";", "const", "name", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "Name", ")", ";", "name", ".", "setText", "(", "'Arthur Pendragon'", ")", ";", "const", "title", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "Title", ")", ";", "title", ".", "setText", "(", "'King'", ")", ";", "const", "phoneNumber", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "PhoneNumber", ")", ";", "phoneNumber", ".", "setText", "(", "'(123) 456-7890'", ")", ";", "const", "phoneExt", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "PhoneExt", ")", ";", "phoneExt", ".", "setText", "(", "'1'", ")", ";", "const", "signatureDate", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "SignatureDate", ")", ";", "signatureDate", ".", "setText", "(", "[", "'2020'", ",", "'07'", ",", "'13'", "]", ".", "join", "(", "''", ")", ")", ";", "const", "fieldNameValues", "=", "values", "(", "fieldNames", ")", ";", "const", "fields", "=", "form", ".", "getFields", "(", ")", ";", "fields", ".", "forEach", "(", "(", "field", ")", "=>", "{", "if", "(", "!", "fieldNameValues", ".", "includes", "(", "field", ".", "getName", "(", ")", ")", ")", "{", "if", "(", "field", "instanceof", "PDFTextField", ")", "{", "const", "value", "=", "String", "(", "Math", ".", "floor", "(", "Math", ".", "random", "(", ")", "*", "1000000", ")", "/", "100", ")", ";", "field", ".", "setText", "(", "value", ".", "substring", "(", "0", ",", "field", ".", "getMaxLength", "(", ")", ")", ")", ";", "}", "}", "}", ")", ";", "const", "pdfBytes", "=", "await", "pdfDoc", ".", "save", "(", ")", ";", "return", "pdfBytes", ";", "}", ";" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5248, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1385
[ "import", "{", "Assets", "}", "from", "'..'", ";", "import", "{", "PDFDocument", ",", "rgb", ",", "TextAlignment", "}", "from", "'../../..'", ";", "export", "default", "async", "(", "assets", ")", "=>", "{", "const", "pdfDoc", "=", "await", "PDFDocument", ".", "load", "(", "assets", ".", "pdfs", ".", "dod_character", ")", ";", "const", "marioImage", "=", "await", "pdfDoc", ".", "embedPng", "(", "assets", ".", "images", ".", "png", ".", "small_mario", ")", ";", "const", "emblemImage", "=", "await", "pdfDoc", ".", "embedPng", "(", "assets", ".", "images", ".", "png", ".", "mario_emblem", ")", ";", "const", "form", "=", "pdfDoc", ".", "getForm", "(", ")", ";", "form", ".", "getTextField", "(", "'CharacterName 2'", ")", ".", "setText", "(", "'Mario'", ")", ";", "form", ".", "getTextField", "(", "'Age'", ")", ".", "setText", "(", "'24 years'", ")", ";", "form", ".", "getTextField", "(", "'Height'", ")", ".", "setText", "(", "`5' 1\"`", ")", ";", "form", ".", "getTextField", "(", "'Weight'", ")", ".", "setText", "(", "'196 lbs'", ")", ";", "form", ".", "getTextField", "(", "'Eyes'", ")", ".", "setText", "(", "'blue'", ")", ";", "form", ".", "getTextField", "(", "'Skin'", ")", ".", "setText", "(", "'white'", ")", ";", "form", ".", "getTextField", "(", "'Hair'", ")", ".", "setText", "(", "'brown'", ")", ";", "form", ".", "getButton", "(", "'CHARACTER IMAGE'", ")", ".", "setImage", "(", "marioImage", ")", ";", "form", ".", "getTextField", "(", "'Allies'", ")", ".", "setText", "(", "[", "`Allies:`", ",", "` • Princess Daisy`", ",", "` • Princess Peach`", ",", "` • Rosalina`", ",", "` • Geno`", ",", "` • Luigi`", ",", "` • Donkey Kong`", ",", "` • Yoshi`", ",", "` • Diddy Kong`", ",", "``", ",", "`Organizations:`", ",", "` • Italian Plumbers Association`", ",", "]", ".", "join", "(", "'\\n'", ")", ")", ";", "form", ".", "getTextField", "(", "'FactionName'", ")", ".", "setText", "(", "`Mario's Emblem`", ")", ";", "form", ".", "getTextField", "(", "'Faction Symbol Image'", ")", ".", "setImage", "(", "emblemImage", ")", ";", "form", ".", "getTextField", "(", "'Backstory'", ")", ".", "setText", "(", "`Mario is a fictional character in the Mario video game franchise, owned by Nintendo and created by Japanese video game designer Shigeru Miyamoto. Serving as the company's mascot and the eponymous protagonist of the series, Mario has appeared in over 200 video games since his creation. Depicted as a short, pudgy, Italian plumber who resides in the Mushroom Kingdom, his adventures generally center upon rescuing Princess Peach from the Koopa villain Bowser. His younger brother and sidekick is Luigi.`", ")", ";", "form", ".", "getTextField", "(", "'Feat+Traits'", ")", ".", "setText", "(", "[", "`Mario can use three basic three power-ups:`", ",", "` • the Super Mushroom, which causes Mario to grow larger`", ",", "` • the Fire Flower, which allows Mario to throw fireballs`", ",", "` • the Starman, which gives Mario temporary invincibility`", ",", "]", ".", "join", "(", "'\\n'", ")", ")", ";", "form", ".", "getTextField", "(", "'Treasure'", ")", ".", "setText", "(", "[", "'• Gold coins'", ",", "'• Treasure chests'", "]", ".", "join", "(", "'\\n'", ")", ")", ";", "const", "{", "width", ",", "height", "}", "=", "pdfDoc", ".", "getPage", "(", "0", ")", ".", "getSize", "(", ")", ";", "const", "page2", "=", "pdfDoc", ".", "addPage", "(", "[", "width", ",", "height", "]", ")", ";", "const", "singlelineCenteredTf", "=", "form", ".", "createTextField", "(", "'singleline.centered.tf'", ")", ";", "singlelineCenteredTf", ".", "setAlignment", "(", "TextAlignment", ".", "Center", ")", ";", "singlelineCenteredTf", ".", "setText", "(", "'Sum centered text yo'", ")", ";", "singlelineCenteredTf", ".", "addToPage", "(", "page2", ",", "{", "y", ":", "height", "-", "50", ",", "width", ":", "250", ",", "height", ":", "25", ",", "borderWidth", ":", "3", ",", "borderColor", ":", "rgb", "(", "1", ",", "0", ",", "1", ")", ",", "}", ")", ";", "const", "multilineCenteredTf", "=", "form", ".", "createTextField", "(", "'multiline.centered.tf'", ")", ";", "multilineCenteredTf", ".", "enableMultiline", "(", ")", ";", "multilineCenteredTf", ".", "setAlignment", "(", "TextAlignment", ".", "Center", ")", ";", "multilineCenteredTf", ".", "setText", "(", "'Sum\\ncentered\\rtext\\nyo'", ")", ";", "multilineCenteredTf", ".", "addToPage", "(", "page2", ",", "{", "y", ":", "height", "-", "50", "-", "150", ",", "width", ":", "250", ",", "height", ":", "100", ",", "borderWidth", ":", "3", ",", "borderColor", ":", "rgb", "(", "1", ",", "0", ",", "1", ")", ",", "}", ")", ";", "const", "singlelineRightTf", "=", "form", ".", "createTextField", "(", "'singleline.right.tf'", ")", ";", "singlelineRightTf", ".", "setAlignment", "(", "TextAlignment", ".", "Right", ")", ";", "singlelineRightTf", ".", "setText", "(", "'Sum right justified text yo'", ")", ";", "singlelineRightTf", ".", "addToPage", "(", "page2", ",", "{", "y", ":", "height", "-", "50", ",", "x", ":", "300", ",", "width", ":", "250", ",", "height", ":", "25", ",", "borderWidth", ":", "3", ",", "borderColor", ":", "rgb", "(", "1", ",", "0", ",", "1", ")", ",", "}", ")", ";", "const", "multilineRightTf", "=", "form", ".", "createTextField", "(", "'multiline.right.tf'", ")", ";", "multilineRightTf", ".", "enableMultiline", "(", ")", ";", "multilineRightTf", ".", "setAlignment", "(", "TextAlignment", ".", "Right", ")", ";", "multilineRightTf", ".", "setText", "(", "'Sum\\nright justified\\rtext\\nyo'", ")", ";", "multilineRightTf", ".", "addToPage", "(", "page2", ",", "{", "y", ":", "height", "-", "50", "-", "150", ",", "x", ":", "300", ",", "width", ":", "250", ",", "height", ":", "100", ",", "borderWidth", ":", "3", ",", "borderColor", ":", "rgb", "(", "1", ",", "0", ",", "1", ")", ",", "}", ")", ";", "const", "optionList", "=", "form", ".", "createOptionList", "(", "'option.list'", ")", ";", "optionList", ".", "addToPage", "(", "page2", ",", "{", "y", ":", "height", "-", "50", "-", "150", "-", "250", ",", "width", ":", "250", ",", "height", ":", "200", ",", "backgroundColor", ":", "rgb", "(", "1", ",", "0.25", ",", "0.25", ")", ",", "borderWidth", ":", "5", ",", "borderColor", ":", "rgb", "(", "1", ",", "0", ",", "1", ")", ",", "}", ")", ";", "optionList", ".", "setOptions", "(", "[", "'Sojourner'", ",", "'Spirit'", ",", "'Opportunity'", ",", "'Curiosity'", ",", "'Perseverance'", ",", "]", ")", ";", "optionList", ".", "enableMultiselect", "(", ")", ";", "optionList", ".", "select", "(", "[", "'Sojourner'", ",", "'Curiosity'", ",", "'Perseverance'", "]", ")", ";", "const", "pdfBytes", "=", "await", "pdfDoc", ".", "save", "(", ")", ";", "return", "pdfBytes", ";", "}", ";" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5248, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1386
[ "import", "{", "Assets", "}", "from", "'..'", ";", "import", "{", "PDFDocument", "}", "from", "'../../..'", ";", "const", "fieldNames", "=", "{", "Single", ":", "'topmostSubform[0].Page1[0].FilingStatus[0].c1_01[0]'", ",", "MarriedFilingJointly", ":", "'topmostSubform[0].Page1[0].FilingStatus[0].c1_01[1]'", ",", "MarriedFilingSeparately", ":", "'topmostSubform[0].Page1[0].FilingStatus[0].c1_01[2]'", ",", "HeadOfHousehold", ":", "'topmostSubform[0].Page1[0].FilingStatus[0].c1_01[3]'", ",", "QualifyingWidow", ":", "'topmostSubform[0].Page1[0].FilingStatus[0].c1_01[4]'", ",", "FilingPartner", ":", "'topmostSubform[0].Page1[0].FilingStatus[0].f1_01[0]'", ",", "FirstNameAndMiddleInitial", ":", "'topmostSubform[0].Page1[0].f1_02[0]'", ",", "LastName", ":", "'topmostSubform[0].Page1[0].f1_03[0]'", ",", "SSN", ":", "'topmostSubform[0].Page1[0].YourSocial_ReadOrderControl[0].f1_04[0]'", ",", "SpouseFirstNameAndMiddleInitial", ":", "'topmostSubform[0].Page1[0].YourSocial_ReadOrderControl[0].f1_05[0]'", ",", "SpouseLastName", ":", "'topmostSubform[0].Page1[0].YourSocial_ReadOrderControl[0].f1_06[0]'", ",", "SpouseSSN", ":", "'topmostSubform[0].Page1[0].ReadOrderControl[0].f1_07[0]'", ",", "HomeAddress", ":", "'topmostSubform[0].Page1[0].ReadOrderControl[0].Address[0].f1_08[0]'", ",", "AptNo", ":", "'topmostSubform[0].Page1[0].ReadOrderControl[0].Address[0].f1_09[0]'", ",", "CityTownStateZip", ":", "'topmostSubform[0].Page1[0].ReadOrderControl[0].Address[0].f1_10[0]'", ",", "ForeignCountryName", ":", "'topmostSubform[0].Page1[0].ReadOrderControl[0].Address[0].f1_11[0]'", ",", "ForeignProvince", ":", "'topmostSubform[0].Page1[0].ReadOrderControl[0].Address[0].f1_12[0]'", ",", "ForeignPostalCode", ":", "'topmostSubform[0].Page1[0].ReadOrderControl[0].Address[0].f1_13[0]'", ",", "Dependents", ":", "{", "FirstAndLastName", ":", "[", "'topmostSubform[0].Page1[0].Dependents[0].Table_Dependents[0].Row1[0].f1_14[0]'", ",", "'topmostSubform[0].Page1[0].Dependents[0].Table_Dependents[0].Row2[0].f1_17[0]'", ",", "'topmostSubform[0].Page1[0].Dependents[0].Table_Dependents[0].Row3[0].f1_20[0]'", ",", "'topmostSubform[0].Page1[0].Dependents[0].Table_Dependents[0].Row4[0].f1_23[0]'", ",", "]", ",", "SSN", ":", "[", "'topmostSubform[0].Page1[0].Dependents[0].Table_Dependents[0].Row1[0].f1_15[0]'", ",", "'topmostSubform[0].Page1[0].Dependents[0].Table_Dependents[0].Row2[0].f1_18[0]'", ",", "'topmostSubform[0].Page1[0].Dependents[0].Table_Dependents[0].Row3[0].f1_21[0]'", ",", "'topmostSubform[0].Page1[0].Dependents[0].Table_Dependents[0].Row4[0].f1_24[0]'", ",", "]", ",", "Relationship", ":", "[", "'topmostSubform[0].Page1[0].Dependents[0].Table_Dependents[0].Row1[0].f1_16[0]'", ",", "'topmostSubform[0].Page1[0].Dependents[0].Table_Dependents[0].Row2[0].f1_19[0]'", ",", "'topmostSubform[0].Page1[0].Dependents[0].Table_Dependents[0].Row3[0].f1_22[0]'", ",", "'topmostSubform[0].Page1[0].Dependents[0].Table_Dependents[0].Row4[0].f1_25[0]'", ",", "]", ",", "ChildTaxCredit", ":", "[", "'topmostSubform[0].Page1[0].Dependents[0].Table_Dependents[0].Row1[0].c1_12[0]'", ",", "'topmostSubform[0].Page1[0].Dependents[0].Table_Dependents[0].Row2[0].c1_14[0]'", ",", "'topmostSubform[0].Page1[0].Dependents[0].Table_Dependents[0].Row3[0].c1_16[0]'", ",", "'topmostSubform[0].Page1[0].Dependents[0].Table_Dependents[0].Row4[0].c1_18[0]'", ",", "]", ",", "OtherDependentsCredit", ":", "[", "'topmostSubform[0].Page1[0].Dependents[0].Table_Dependents[0].Row1[0].c1_13[0]'", ",", "'topmostSubform[0].Page1[0].Dependents[0].Table_Dependents[0].Row2[0].c1_15[0]'", ",", "'topmostSubform[0].Page1[0].Dependents[0].Table_Dependents[0].Row3[0].c1_17[0]'", ",", "'topmostSubform[0].Page1[0].Dependents[0].Table_Dependents[0].Row4[0].c1_19[0]'", ",", "]", ",", "}", ",", "TaxExemptInterest", ":", "'topmostSubform[0].Page1[0].ReadOrderControl_Lns1-8b[0].f1_27[0]'", ",", "QualifiedDividends", ":", "'topmostSubform[0].Page1[0].ReadOrderControl_Lns1-8b[0].f1_29[0]'", ",", "IraDistributions", ":", "'topmostSubform[0].Page1[0].ReadOrderControl_Lns1-8b[0].f1_31[0]'", ",", "Pensions", ":", "'topmostSubform[0].Page1[0].ReadOrderControl_Lns1-8b[0].f1_33[0]'", ",", "SocialSecurity", ":", "'topmostSubform[0].Page1[0].ReadOrderControl_Lns1-8b[0].f1_35[0]'", ",", "Wages", ":", "'topmostSubform[0].Page1[0].ReadOrderControl_Lns1-8b[0].f1_26[0]'", ",", "TaxableInterest", ":", "'topmostSubform[0].Page1[0].ReadOrderControl_Lns1-8b[0].f1_28[0]'", ",", "OrdinaryDividends", ":", "'topmostSubform[0].Page1[0].ReadOrderControl_Lns1-8b[0].f1_30[0]'", ",", "TaxableIraDistributions", ":", "'topmostSubform[0].Page1[0].ReadOrderControl_Lns1-8b[0].f1_32[0]'", ",", "TaxablePensions", ":", "'topmostSubform[0].Page1[0].ReadOrderControl_Lns1-8b[0].f1_34[0]'", ",", "TaxableSocialSecurity", ":", "'topmostSubform[0].Page1[0].ReadOrderControl_Lns1-8b[0].f1_36[0]'", ",", "CapitalGainOrLoss", ":", "'topmostSubform[0].Page1[0].ReadOrderControl_Lns1-8b[0].f1_37[0]'", ",", "OtherIncome", ":", "'topmostSubform[0].Page1[0].ReadOrderControl_Lns1-8b[0].f1_38[0]'", ",", "TotalIncome", ":", "'topmostSubform[0].Page1[0].ReadOrderControl_Lns1-8b[0].f1_39[0]'", ",", "IncomeAdjustments", ":", "'topmostSubform[0].Page1[0].ReadOrderControl_Lns1-8b[0].f1_40[0]'", ",", "AdjustedGrossIncome", ":", "'topmostSubform[0].Page1[0].ReadOrderControl_Lns1-8b[0].f1_41[0]'", ",", "StandardDeduction", ":", "'topmostSubform[0].Page1[0].f1_42[0]'", ",", "QualifiedBusinessDeduction", ":", "'topmostSubform[0].Page1[0].f1_43[0]'", ",", "SumOf9And10", ":", "'topmostSubform[0].Page1[0].f1_44[0]'", ",", "TaxableIncome", ":", "'topmostSubform[0].Page1[0].f1_45[0]'", ",", "TaxFormLabel", ":", "'topmostSubform[0].Page2[0].Lines12a-12b_ReadOrder[0].f2_01[0]'", ",", "TaxFormValue", ":", "'topmostSubform[0].Page2[0].Lines12a-12b_ReadOrder[0].f2_02[0]'", ",", "ScheduleTotal12b", ":", "'topmostSubform[0].Page2[0].f2_03[0]'", ",", "ChildTaxCredit", ":", "'topmostSubform[0].Page2[0].Lines13a-13b_ReadOrder[0].f2_04[0]'", ",", "ScheduleTotal13b", ":", "'topmostSubform[0].Page2[0].f2_05[0]'", ",", "Subtract14", ":", "'topmostSubform[0].Page2[0].f2_06[0]'", ",", "OtherTaxes", ":", "'topmostSubform[0].Page2[0].f2_07[0]'", ",", "TotalTax", ":", "'topmostSubform[0].Page2[0].f2_08[0]'", ",", "WithheldIncomeTax", ":", "'topmostSubform[0].Page2[0].f2_09[0]'", ",", "EarnedIncomeCredit", ":", "'topmostSubform[0].Page2[0].Line18_ReadOrder[0].f2_10[0]'", ",", "AdditionalChildTaxCredit", ":", "'topmostSubform[0].Page2[0].Line18_ReadOrder[0].f2_11[0]'", ",", "OpportunityCredit", ":", "'topmostSubform[0].Page2[0].Line18_ReadOrder[0].f2_12[0]'", ",", "Schedule18d", ":", "'topmostSubform[0].Page2[0].Line18_ReadOrder[0].f2_13[0]'", ",", "RefundableCredits", ":", "'topmostSubform[0].Page2[0].f2_14[0]'", ",", "TotalPayments", ":", "'topmostSubform[0].Page2[0].f2_15[0]'", ",", "AmountOverpaid", ":", "'topmostSubform[0].Page2[0].f2_16[0]'", ",", "AmountRefunded", ":", "'topmostSubform[0].Page2[0].f2_17[0]'", ",", "RoutingNumber", ":", "'topmostSubform[0].Page2[0].RoutingNo[0].f2_18[0]'", ",", "AccountNumber", ":", "'topmostSubform[0].Page2[0].AccountNo[0].f2_19[0]'", ",", "EstimatedTax2020", ":", "'topmostSubform[0].Page2[0].f2_20[0]'", ",", "AmountYouOwe", ":", "'topmostSubform[0].Page2[0].f2_21[0]'", ",", "EstimatedTaxPenalty", ":", "'topmostSubform[0].Page2[0].f2_22[0]'", ",", "DesigneeName", ":", "'topmostSubform[0].Page2[0].ThirdPartyDesignee[0].f2_23[0]'", ",", "DesigneePhoneNo", ":", "'topmostSubform[0].Page2[0].ThirdPartyDesignee[0].f2_24[0]'", ",", "DesigneePIN", ":", "'topmostSubform[0].Page2[0].ThirdPartyDesignee[0].f2_25[0]'", ",", "YourOccupation", ":", "'topmostSubform[0].Page2[0].Signatures[0].f2_26[0]'", ",", "YourIdentityPIN", ":", "'topmostSubform[0].Page2[0].Signatures[0].f2_27[0]'", ",", "SpouseOccupation", ":", "'topmostSubform[0].Page2[0].Signatures[0].f2_28[0]'", ",", "SpouseIdentityPIN", ":", "'topmostSubform[0].Page2[0].Signatures[0].f2_29[0]'", ",", "PhoneNo", ":", "'topmostSubform[0].Page2[0].Signatures[0].f2_30[0]'", ",", "EmailAddress", ":", "'topmostSubform[0].Page2[0].Signatures[0].f2_31[0]'", ",", "PreparerName", ":", "'topmostSubform[0].Page2[0].PaidPreparer[0].Preparer[0].f2_32[0]'", ",", "PTIN", ":", "'topmostSubform[0].Page2[0].PaidPreparer[0].Preparer[0].f2_33[0]'", ",", "PreparerFirmName", ":", "'topmostSubform[0].Page2[0].PaidPreparer[0].Preparer[0].f2_34[0]'", ",", "PreparerPhoneNo", ":", "'topmostSubform[0].Page2[0].PaidPreparer[0].Preparer[0].f2_35[0]'", ",", "PreparerAddress", ":", "'topmostSubform[0].Page2[0].PaidPreparer[0].Preparer[0].f2_36[0]'", ",", "PreparerEIN", ":", "'topmostSubform[0].Page2[0].PaidPreparer[0].Preparer[0].f2_37[0]'", ",", "PresidentialElectionFund", ":", "'topmostSubform[0].Page1[0].ReadOrderControl[1].PresidentialElection[0].c1_02[0]'", ",", "PresidentialElectionFundSpouse", ":", "'topmostSubform[0].Page1[0].ReadOrderControl[1].PresidentialElection[0].c1_03[0]'", ",", "YouAsDependent", ":", "'topmostSubform[0].Page1[0].ReadOrderControl[1].StandardDeduction[0].c1_04[0]'", ",", "SpouseAsDependent", ":", "'topmostSubform[0].Page1[0].ReadOrderControl[1].StandardDeduction[0].c1_05[0]'", ",", "SpouseItemizes", ":", "'topmostSubform[0].Page1[0].ReadOrderControl[1].StandardDeduction[0].c1_06[0]'", ",", "BlindBefore1995", ":", "'topmostSubform[0].Page1[0].ReadOrderControl[1].AgeBlindness[0].c1_07[0]'", ",", "AreBlind", ":", "'topmostSubform[0].Page1[0].ReadOrderControl[1].AgeBlindness[0].c1_08[0]'", ",", "SpouseBlindBefore1995", ":", "'topmostSubform[0].Page1[0].ReadOrderControl[1].AgeBlindness[0].c1_09[0]'", ",", "SpouseIsBlind", ":", "'topmostSubform[0].Page1[0].ReadOrderControl[1].AgeBlindness[0].c1_10[0]'", ",", "MoreThanFourDependents", ":", "'topmostSubform[0].Page1[0].IfMoreThanFour[0].c1_11[0]'", ",", "CapitalGainOrLossRequired", ":", "'topmostSubform[0].Page1[0].ReadOrderControl_Lns1-8b[0].c1_20[0]'", ",", "TaxForm8814", ":", "'topmostSubform[0].Page2[0].Lines12a-12b_ReadOrder[0].c2_01[0]'", ",", "TaxForm4972", ":", "'topmostSubform[0].Page2[0].Lines12a-12b_ReadOrder[0].c2_02[0]'", ",", "TaxFormCustom", ":", "'topmostSubform[0].Page2[0].Lines12a-12b_ReadOrder[0].c2_03[0]'", ",", "Form8888Attached", ":", "'topmostSubform[0].Page2[0].c2_04[0]'", ",", "CheckingAccountType", ":", "'topmostSubform[0].Page2[0].c2_05[0]'", ",", "SavingsAccountType", ":", "'topmostSubform[0].Page2[0].c2_05[1]'", ",", "AllowOthersToDiscussReturn", ":", "'topmostSubform[0].Page2[0].ThirdPartyDesignee[0].c2_06[0]'", ",", "DoNotAllowOthersToDiscussReturn", ":", "'topmostSubform[0].Page2[0].ThirdPartyDesignee[0].c2_06[1]'", ",", "Is3rdPartyDesignee", ":", "'topmostSubform[0].Page2[0].PaidPreparer[0].Preparer[0].CheckIf[0].c2_07[0]'", ",", "IsSelfEmployed", ":", "'topmostSubform[0].Page2[0].PaidPreparer[0].Preparer[0].CheckIf[0].c2_07[1]'", ",", "}", ";", "export", "default", "async", "(", "assets", ")", "=>", "{", "const", "pdfDoc", "=", "await", "PDFDocument", ".", "load", "(", "assets", ".", "pdfs", ".", "with_xfa_fields", ")", ";", "const", "form", "=", "pdfDoc", ".", "getForm", "(", ")", ";", "const", "mfs", "=", "form", ".", "getCheckBox", "(", "fieldNames", ".", "MarriedFilingSeparately", ")", ";", "mfs", ".", "check", "(", ")", ";", "const", "filingPartner", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "FilingPartner", ")", ";", "filingPartner", ".", "setText", "(", "'Guinevere Pendragon'", ")", ";", "filingPartner", ".", "setFontSize", "(", "4", ")", ";", "const", "firstName", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "FirstNameAndMiddleInitial", ")", ";", "firstName", ".", "setText", "(", "'Arthur F'", ")", ";", "firstName", ".", "setFontSize", "(", "20", ")", ";", "const", "lastName", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "LastName", ")", ";", "lastName", ".", "setText", "(", "'Pendragon'", ")", ";", "lastName", ".", "setFontSize", "(", "30", ")", ";", "const", "ssn", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "SSN", ")", ";", "ssn", ".", "setText", "(", "'123456789'", ")", ";", "const", "spouseFirst", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "SpouseFirstNameAndMiddleInitial", ")", ";", "spouseFirst", ".", "setText", "(", "'Guinevere Q'", ")", ";", "const", "spouseLast", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "SpouseLastName", ")", ";", "spouseLast", ".", "setText", "(", "'Pendragon'", ")", ";", "const", "spouseSsn", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "SpouseSSN", ")", ";", "spouseSsn", ".", "setText", "(", "'987654321'", ")", ";", "const", "standardDeduction", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "StandardDeduction", ")", ";", "standardDeduction", ".", "setText", "(", "'42.36'", ")", ";", "const", "businessDeduction", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "QualifiedBusinessDeduction", ")", ";", "businessDeduction", ".", "setText", "(", "'91.48'", ")", ";", "const", "sumOf9And10", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "SumOf9And10", ")", ";", "sumOf9And10", ".", "setText", "(", "'133.84'", ")", ";", "const", "taxableIncome", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "TaxableIncome", ")", ";", "taxableIncome", ".", "setText", "(", "'9000.01'", ")", ";", "const", "homeAddress", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "HomeAddress", ")", ";", "homeAddress", ".", "setText", "(", "'Camelot'", ")", ";", "const", "aptNo", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "AptNo", ")", ";", "aptNo", ".", "setText", "(", "'42'", ")", ";", "const", "cityTownStateZip", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "CityTownStateZip", ")", ";", "cityTownStateZip", ".", "setText", "(", "'Yorkshire 29381'", ")", ";", "const", "foreignCountryName", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "ForeignCountryName", ")", ";", "foreignCountryName", ".", "setText", "(", "'England'", ")", ";", "const", "foreignProvince", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "ForeignProvince", ")", ";", "foreignProvince", ".", "setText", "(", "'Yorkshire and the Humber'", ")", ";", "const", "foreignPostalCode", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "ForeignPostalCode", ")", ";", "foreignPostalCode", ".", "setText", "(", "'29381'", ")", ";", "[", "'Caesar Augustus'", ",", "'Marcus Aurelius'", ",", "'Livia Augustus'", ",", "'Claudia Octavia'", ",", "]", ".", "forEach", "(", "(", "firstAndLast", ",", "idx", ")", "=>", "{", "const", "field", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "Dependents", ".", "FirstAndLastName", "[", "idx", "]", ")", ";", "field", ".", "setText", "(", "firstAndLast", ")", ";", "}", ")", ";", "[", "'917073905'", ",", "'671723254'", ",", "'261182980'", ",", "'629137689'", "]", ".", "forEach", "(", "(", "dependentSsn", ",", "idx", ")", "=>", "{", "const", "field", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "Dependents", ".", "SSN", "[", "idx", "]", ")", ";", "field", ".", "setText", "(", "dependentSsn", ")", ";", "}", ")", ";", "[", "'Son'", ",", "'Grandson'", ",", "'Daughter'", ",", "'Granddaughter'", "]", ".", "forEach", "(", "(", "relationship", ",", "idx", ")", "=>", "{", "const", "field", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "Dependents", ".", "Relationship", "[", "idx", "]", ")", ";", "field", ".", "setText", "(", "relationship", ")", ";", "}", ")", ";", "const", "taxExemptInterest", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "TaxExemptInterest", ")", ";", "taxExemptInterest", ".", "setText", "(", "'6359.25'", ")", ";", "const", "qualifiedDividends", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "QualifiedDividends", ")", ";", "qualifiedDividends", ".", "setText", "(", "'7116.60'", ")", ";", "const", "iraDistributions", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "IraDistributions", ")", ";", "iraDistributions", ".", "setText", "(", "'8903.54'", ")", ";", "const", "pensions", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "Pensions", ")", ";", "pensions", ".", "setText", "(", "'3996.73'", ")", ";", "const", "socialSecurity", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "SocialSecurity", ")", ";", "socialSecurity", ".", "setText", "(", "'3633.69'", ")", ";", "const", "wages", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "Wages", ")", ";", "wages", ".", "setText", "(", "'1600.61'", ")", ";", "const", "taxableInterest", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "TaxableInterest", ")", ";", "taxableInterest", ".", "setText", "(", "'9705.03'", ")", ";", "const", "ordinaryDividends", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "OrdinaryDividends", ")", ";", "ordinaryDividends", ".", "setText", "(", "'1567.57'", ")", ";", "const", "taxableIraDistributions", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "TaxableIraDistributions", ")", ";", "taxableIraDistributions", ".", "setText", "(", "'4142.40'", ")", ";", "const", "taxablePensions", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "TaxablePensions", ")", ";", "taxablePensions", ".", "setText", "(", "'6272.80'", ")", ";", "const", "taxableSocialSecurity", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "TaxableSocialSecurity", ")", ";", "taxableSocialSecurity", ".", "setText", "(", "'8576.60'", ")", ";", "const", "capitalGainOrLoss", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "CapitalGainOrLoss", ")", ";", "capitalGainOrLoss", ".", "setText", "(", "'6313.00'", ")", ";", "const", "otherIncome", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "OtherIncome", ")", ";", "otherIncome", ".", "setText", "(", "'7818.66'", ")", ";", "const", "totalIncome", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "TotalIncome", ")", ";", "totalIncome", ".", "setText", "(", "'8738.83'", ")", ";", "const", "incomeAdjustments", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "IncomeAdjustments", ")", ";", "incomeAdjustments", ".", "setText", "(", "'4287.15'", ")", ";", "const", "adjustedGrossIncome", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "AdjustedGrossIncome", ")", ";", "adjustedGrossIncome", ".", "setText", "(", "'3931.94'", ")", ";", "const", "taxFormLabel", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "TaxFormLabel", ")", ";", "taxFormLabel", ".", "setText", "(", "'XZ91'", ")", ";", "const", "taxFormValue", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "TaxFormValue", ")", ";", "taxFormValue", ".", "setText", "(", "'8891.81'", ")", ";", "const", "scheduleTotal12b", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "ScheduleTotal12b", ")", ";", "scheduleTotal12b", ".", "setText", "(", "'3554.12'", ")", ";", "const", "childTaxCredit", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "ChildTaxCredit", ")", ";", "childTaxCredit", ".", "setText", "(", "'1639.05'", ")", ";", "const", "scheduleTotal13b", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "ScheduleTotal13b", ")", ";", "scheduleTotal13b", ".", "setText", "(", "'2618.78'", ")", ";", "const", "subtract14", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "Subtract14", ")", ";", "subtract14", ".", "setText", "(", "'4756.35'", ")", ";", "const", "otherTaxes", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "OtherTaxes", ")", ";", "otherTaxes", ".", "setText", "(", "'2203.54'", ")", ";", "const", "totalTax", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "TotalTax", ")", ";", "totalTax", ".", "setText", "(", "'5741.44'", ")", ";", "const", "withheldIncomeTax", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "WithheldIncomeTax", ")", ";", "withheldIncomeTax", ".", "setText", "(", "'842.48'", ")", ";", "const", "earnedIncomeCredit", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "EarnedIncomeCredit", ")", ";", "earnedIncomeCredit", ".", "setText", "(", "'3614.21'", ")", ";", "const", "additionalChildTaxCredit", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "AdditionalChildTaxCredit", ")", ";", "additionalChildTaxCredit", ".", "setText", "(", "'4945.15'", ")", ";", "const", "opportunityCredit", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "OpportunityCredit", ")", ";", "opportunityCredit", ".", "setText", "(", "'5695.93'", ")", ";", "const", "schedule18d", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "Schedule18d", ")", ";", "schedule18d", ".", "setText", "(", "'6428.47'", ")", ";", "const", "refundableCredits", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "RefundableCredits", ")", ";", "refundableCredits", ".", "setText", "(", "'9735.55'", ")", ";", "const", "totalPayments", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "TotalPayments", ")", ";", "totalPayments", ".", "setText", "(", "'448.04'", ")", ";", "const", "amountOverpaid", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "AmountOverpaid", ")", ";", "amountOverpaid", ".", "setText", "(", "'9800.47'", ")", ";", "const", "amountRefunded", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "AmountRefunded", ")", ";", "amountRefunded", ".", "setText", "(", "'1499.83'", ")", ";", "const", "routingNumber", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "RoutingNumber", ")", ";", "routingNumber", ".", "setText", "(", "'804717479'", ")", ";", "const", "accountNumber", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "AccountNumber", ")", ";", "accountNumber", ".", "setText", "(", "'10647533083123501'", ")", ";", "const", "estimatedTax2020", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "EstimatedTax2020", ")", ";", "estimatedTax2020", ".", "setText", "(", "'5100.81'", ")", ";", "const", "amountYouOwe", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "AmountYouOwe", ")", ";", "amountYouOwe", ".", "setText", "(", "'3560.83'", ")", ";", "const", "estimatedTaxPenalty", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "EstimatedTaxPenalty", ")", ";", "estimatedTaxPenalty", ".", "setText", "(", "'1895.78'", ")", ";", "const", "designeeName", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "DesigneeName", ")", ";", "designeeName", ".", "setText", "(", "'Solomon Draper'", ")", ";", "const", "designeePhoneNo", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "DesigneePhoneNo", ")", ";", "designeePhoneNo", ".", "setText", "(", "'(123) 456-7890'", ")", ";", "const", "designeePIN", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "DesigneePIN", ")", ";", "designeePIN", ".", "setText", "(", "'12757'", ")", ";", "const", "yourOccupation", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "YourOccupation", ")", ";", "yourOccupation", ".", "setText", "(", "'Mythical English King'", ")", ";", "const", "yourIdentityPIN", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "YourIdentityPIN", ")", ";", "yourIdentityPIN", ".", "setText", "(", "'427830'", ")", ";", "const", "spouseOccupation", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "SpouseOccupation", ")", ";", "spouseOccupation", ".", "setText", "(", "'Mythical English Queen'", ")", ";", "const", "spouseIdentityPIN", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "SpouseIdentityPIN", ")", ";", "spouseIdentityPIN", ".", "setText", "(", "'387495'", ")", ";", "const", "phoneNo", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "PhoneNo", ")", ";", "phoneNo", ".", "setText", "(", "'(173) 103-1048'", ")", ";", "const", "emailAddress", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "EmailAddress", ")", ";", "emailAddress", ".", "setText", "(", "'[email protected]'", ")", ";", "const", "preparerName", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "PreparerName", ")", ";", "preparerName", ".", "setText", "(", "'Sashenka Knight'", ")", ";", "const", "ptin", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "PTIN", ")", ";", "ptin", ".", "setText", "(", "'190783'", ")", ";", "const", "preparerFirmName", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "PreparerFirmName", ")", ";", "preparerFirmName", ".", "setText", "(", "'Qux Baz Preparationz'", ")", ";", "const", "preparerPhoneNo", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "PreparerPhoneNo", ")", ";", "preparerPhoneNo", ".", "setText", "(", "'(378) 102-1947'", ")", ";", "const", "preparerAddress", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "PreparerAddress", ")", ";", "preparerAddress", ".", "setText", "(", "'8545 Rockland Drive Fairburn, GA 30213'", ")", ";", "const", "preparerEIN", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "PreparerEIN", ")", ";", "preparerEIN", ".", "setText", "(", "'218932783'", ")", ";", "[", "'Son'", ",", "'Grandson'", ",", "'Daughter'", ",", "'Granddaughter'", "]", ".", "forEach", "(", "(", "relationship", ",", "idx", ")", "=>", "{", "const", "field", "=", "form", ".", "getTextField", "(", "fieldNames", ".", "Dependents", ".", "Relationship", "[", "idx", "]", ")", ";", "field", ".", "setText", "(", "relationship", ")", ";", "}", ")", ";", "const", "ctc0", "=", "form", ".", "getCheckBox", "(", "fieldNames", ".", "Dependents", ".", "ChildTaxCredit", "[", "0", "]", ")", ";", "ctc0", ".", "check", "(", ")", ";", "const", "ctc2", "=", "form", ".", "getCheckBox", "(", "fieldNames", ".", "Dependents", ".", "ChildTaxCredit", "[", "2", "]", ")", ";", "ctc2", ".", "check", "(", ")", ";", "const", "odc1", "=", "form", ".", "getCheckBox", "(", "fieldNames", ".", "Dependents", ".", "OtherDependentsCredit", "[", "1", "]", ")", ";", "odc1", ".", "check", "(", ")", ";", "const", "odc3", "=", "form", ".", "getCheckBox", "(", "fieldNames", ".", "Dependents", ".", "OtherDependentsCredit", "[", "3", "]", ")", ";", "odc3", ".", "check", "(", ")", ";", "const", "pefs", "=", "form", ".", "getCheckBox", "(", "fieldNames", ".", "PresidentialElectionFundSpouse", ")", ";", "pefs", ".", "check", "(", ")", ";", "const", "mtfd", "=", "form", ".", "getCheckBox", "(", "fieldNames", ".", "MoreThanFourDependents", ")", ";", "mtfd", ".", "check", "(", ")", ";", "const", "si", "=", "form", ".", "getCheckBox", "(", "fieldNames", ".", "SpouseItemizes", ")", ";", "si", ".", "check", "(", ")", ";", "const", "ab", "=", "form", ".", "getCheckBox", "(", "fieldNames", ".", "AreBlind", ")", ";", "ab", ".", "check", "(", ")", ";", "const", "sib", "=", "form", ".", "getCheckBox", "(", "fieldNames", ".", "SpouseIsBlind", ")", ";", "sib", ".", "check", "(", ")", ";", "const", "cgolr", "=", "form", ".", "getCheckBox", "(", "fieldNames", ".", "CapitalGainOrLossRequired", ")", ";", "cgolr", ".", "check", "(", ")", ";", "const", "f888a", "=", "form", ".", "getCheckBox", "(", "fieldNames", ".", "Form8888Attached", ")", ";", "f888a", ".", "check", "(", ")", ";", "const", "cat", "=", "form", ".", "getCheckBox", "(", "fieldNames", ".", "CheckingAccountType", ")", ";", "cat", ".", "check", "(", ")", ";", "const", "aotdr", "=", "form", ".", "getCheckBox", "(", "fieldNames", ".", "AllowOthersToDiscussReturn", ")", ";", "aotdr", ".", "check", "(", ")", ";", "const", "ise", "=", "form", ".", "getCheckBox", "(", "fieldNames", ".", "IsSelfEmployed", ")", ";", "ise", ".", "check", "(", ")", ";", "const", "pdfBytes", "=", "await", "pdfDoc", ".", "save", "(", ")", ";", "return", "pdfBytes", ";", "}", ";" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5248, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1387
[ "import", "{", "Assets", "}", "from", "'..'", ";", "import", "{", "PDFDocument", ",", "StandardFonts", ",", "drawRectangle", ",", "rgb", ",", "degrees", ",", "drawText", ",", "PDFFont", ",", "drawEllipse", ",", "PDFWidgetAnnotation", ",", "}", "from", "'../../..'", ";", "import", "fontkit", "from", "'@pdf-lib/fontkit'", ";", "export", "default", "async", "(", "assets", ")", "=>", "{", "const", "pdfDoc", "=", "await", "PDFDocument", ".", "load", "(", "assets", ".", "pdfs", ".", "fancy_fields", ")", ";", "pdfDoc", ".", "registerFontkit", "(", "fontkit", ")", ";", "const", "ubuntuFont", "=", "await", "pdfDoc", ".", "embedFont", "(", "assets", ".", "fonts", ".", "ttf", ".", "ubuntu_r", ")", ";", "const", "form", "=", "pdfDoc", ".", "getForm", "(", ")", ";", "const", "prefix", "=", "form", ".", "getTextField", "(", "'Prefix ⚽️'", ")", ";", "prefix", ".", "updateAppearances", "(", "ubuntuFont", ")", ";", "const", "firstName", "=", "form", ".", "getTextField", "(", "'First Name 🚀'", ")", ";", "firstName", ".", "updateAppearances", "(", "ubuntuFont", ")", ";", "const", "middleInitial", "=", "form", ".", "getTextField", "(", "'MiddleInitial 🎳'", ")", ";", "middleInitial", ".", "updateAppearances", "(", "ubuntuFont", ")", ";", "const", "lastName", "=", "form", ".", "getTextField", "(", "'LastName 🛩'", ")", ";", "lastName", ".", "updateAppearances", "(", "ubuntuFont", ")", ";", "const", "isAFairy", "=", "form", ".", "getCheckBox", "(", "'Are You A Fairy? 🌿'", ")", ";", "isAFairy", ".", "updateAppearances", "(", ")", ";", "const", "isPowerLevelOver9000", "=", "form", ".", "getCheckBox", "(", "'Is Your Power Level Over 9000? 💪'", ")", ";", "isPowerLevelOver9000", ".", "updateAppearances", "(", ")", ";", "const", "onePunch", "=", "form", ".", "getCheckBox", "(", "'Can You Defeat Enemies In One Punch? 👊'", ")", ";", "onePunch", ".", "updateAppearances", "(", ")", ";", "const", "everLetMeDown", "=", "form", ".", "getCheckBox", "(", "'Will You Ever Let Me Down? ☕️'", ")", ";", "everLetMeDown", ".", "updateAppearances", "(", ")", ";", "const", "eject", "=", "form", ".", "getButton", "(", "'Eject 📼'", ")", ";", "eject", ".", "updateAppearances", "(", "ubuntuFont", ")", ";", "const", "submit", "=", "form", ".", "getButton", "(", "'Submit 📝'", ")", ";", "submit", ".", "updateAppearances", "(", "ubuntuFont", ")", ";", "const", "play", "=", "form", ".", "getButton", "(", "'Play ▶️'", ")", ";", "play", ".", "updateAppearances", "(", "ubuntuFont", ")", ";", "const", "launch", "=", "form", ".", "getButton", "(", "'Launch 🚀'", ")", ";", "launch", ".", "updateAppearances", "(", "ubuntuFont", ")", ";", "const", "historicalFigures", "=", "form", ".", "getRadioGroup", "(", "'Historical Figures 🐺'", ")", ";", "historicalFigures", ".", "updateAppearances", "(", ")", ";", "const", "planets", "=", "form", ".", "getOptionList", "(", "'Which Are Planets? 🌎'", ")", ";", "planets", ".", "updateAppearances", "(", "ubuntuFont", ")", ";", "const", "gundams", "=", "form", ".", "getDropdown", "(", "'Choose A Gundam 🤖'", ")", ";", "gundams", ".", "select", "(", "'One Punch Man'", ")", ";", "gundams", ".", "updateAppearances", "(", "ubuntuFont", ")", ";", "const", "page", "=", "pdfDoc", ".", "addPage", "(", ")", ";", "const", "symbol", "=", "await", "pdfDoc", ".", "embedFont", "(", "StandardFonts", ".", "Symbol", ")", ";", "const", "btn", "=", "form", ".", "createButton", "(", "'custom.button.field'", ")", ";", "const", "cb", "=", "form", ".", "createCheckBox", "(", "'custom.checkbox.field'", ")", ";", "const", "dd", "=", "form", ".", "createDropdown", "(", "'custom.dropdown.field'", ")", ";", "const", "ol", "=", "form", ".", "createOptionList", "(", "'custom.optionlist.field'", ")", ";", "const", "rg", "=", "form", ".", "createRadioGroup", "(", "'custom.radiogroup.field'", ")", ";", "const", "tf", "=", "form", ".", "createTextField", "(", "'custom.text.field'", ")", ";", "const", "tfFontSize", "=", "form", ".", "createTextField", "(", "'custom.text.fieldFontSize'", ")", ";", "dd", ".", "addOptions", "(", "'∑'", ")", ";", "ol", ".", "addOptions", "(", "'∑'", ")", ";", "const", "width", "=", "100", ";", "const", "height", "=", "50", ";", "const", "x", "=", "page", ".", "getWidth", "(", ")", "/", "2", "-", "width", "/", "2", ";", "let", "y", "=", "page", ".", "getHeight", "(", ")", ";", "y", "-=", "height", "+", "25", ";", "btn", ".", "addToPage", "(", "'∑'", ",", "page", ",", "{", "x", ",", "y", ",", "width", ",", "height", ",", "font", ":", "symbol", "}", ")", ";", "y", "-=", "height", "+", "25", ";", "cb", ".", "addToPage", "(", "page", ",", "{", "x", ",", "y", ",", "width", ",", "height", "}", ")", ";", "y", "-=", "height", "+", "25", ";", "dd", ".", "addToPage", "(", "page", ",", "{", "x", ",", "y", ",", "width", ",", "height", ",", "font", ":", "symbol", "}", ")", ";", "y", "-=", "height", "+", "25", ";", "ol", ".", "addToPage", "(", "page", ",", "{", "x", ",", "y", ",", "width", ",", "height", ",", "font", ":", "symbol", "}", ")", ";", "y", "-=", "height", "+", "25", ";", "rg", ".", "addOptionToPage", "(", "'bar'", ",", "page", ",", "{", "x", ",", "y", ",", "width", ",", "height", "}", ")", ";", "y", "-=", "height", "+", "25", ";", "tf", ".", "addToPage", "(", "page", ",", "{", "x", ",", "y", ",", "width", ",", "height", ",", "font", ":", "symbol", "}", ")", ";", "y", "-=", "height", "*", "4", "+", "25", ";", "tfFontSize", ".", "addToPage", "(", "page", ",", "{", "x", ":", "x", "-", "width", "*", "2", ",", "y", ",", "width", ":", "width", "*", "5", ",", "height", ":", "height", "*", "4", ",", "font", ":", "ubuntuFont", ",", "}", ")", ";", "tfFontSize", ".", "enableMultiline", "(", ")", ";", "tfFontSize", ".", "setFontSize", "(", "71.999", ")", ";", "tfFontSize", ".", "setText", "(", "'This text should be huge'", ")", ";", "const", "rectangle", "=", "drawRectangle", "(", "{", "x", ":", "0", ",", "y", ":", "0", ",", "width", ",", "height", ",", "borderWidth", ":", "2", ",", "color", ":", "rgb", "(", "1", ",", "0.1", ",", "0.75", ")", ",", "borderColor", ":", "rgb", "(", "0", ",", "0.1", ",", "1", ")", ",", "rotate", ":", "degrees", "(", "0", ")", ",", "xSkew", ":", "degrees", "(", "0", ")", ",", "ySkew", ":", "degrees", "(", "0", ")", ",", "}", ")", ";", "const", "circle", "=", "drawEllipse", "(", "{", "x", ":", "15", ",", "y", ":", "height", "-", "15", ",", "xScale", ":", "15", ",", "yScale", ":", "15", ",", "borderWidth", ":", "0", ",", "color", ":", "rgb", "(", "0", ",", "0", ",", "0", ")", ",", "borderColor", ":", "undefined", ",", "rotate", ":", "degrees", "(", "0", ")", ",", "}", ")", ";", "const", "text", "=", "symbol", ".", "encodeText", "(", "'ℑ'", ")", ";", "const", "textW", "=", "symbol", ".", "widthOfTextAtSize", "(", "'ℑ'", ",", "35", ")", ";", "const", "textH", "=", "symbol", ".", "heightAtSize", "(", "35", ")", ";", "const", "symbolText", "=", "(", "font", ")", "=>", "drawText", "(", "text", ",", "{", "x", ":", "width", "/", "2", "-", "textW", "/", "2", ",", "y", ":", "height", "/", "2", "-", "textH", "/", "2", "+", "10", ",", "color", ":", "rgb", "(", "0", ",", "0", ",", "0", ")", ",", "font", ":", "font", ".", "name", ",", "size", ":", "35", ",", "rotate", ":", "degrees", "(", "0", ")", ",", "xSkew", ":", "degrees", "(", "0", ")", ",", "ySkew", ":", "degrees", "(", "0", ")", ",", "}", ")", ";", "const", "assert", "=", "(", "condition", ",", "msg", "=", "''", ")", "=>", "{", "if", "(", "!", "condition", ")", "throw", "new", "Error", "(", "msg", "||", "'Assertion failed'", ")", ";", "}", ";", "btn", ".", "updateAppearances", "(", "symbol", ",", "(", "field", ",", "widget", ",", "font", ")", "=>", "{", "assert", "(", "field", "===", "btn", ")", ";", "assert", "(", "widget", "instanceof", "PDFWidgetAnnotation", ")", ";", "return", "[", "...", "rectangle", ",", "...", "symbolText", "(", "font", ")", "]", ";", "}", ")", ";", "cb", ".", "updateAppearances", "(", "(", "field", ",", "widget", ")", "=>", "{", "assert", "(", "field", "===", "cb", ")", ";", "assert", "(", "widget", "instanceof", "PDFWidgetAnnotation", ")", ";", "return", "{", "on", ":", "[", "...", "rectangle", ",", "...", "circle", "]", ",", "off", ":", "[", "...", "rectangle", ",", "...", "circle", "]", "}", ";", "}", ")", ";", "dd", ".", "updateAppearances", "(", "symbol", ",", "(", "field", ",", "widget", ",", "font", ")", "=>", "{", "assert", "(", "field", "===", "dd", ")", ";", "assert", "(", "widget", "instanceof", "PDFWidgetAnnotation", ")", ";", "return", "[", "...", "rectangle", ",", "...", "symbolText", "(", "font", ")", "]", ";", "}", ")", ";", "ol", ".", "updateAppearances", "(", "symbol", ",", "(", "field", ",", "widget", ",", "font", ")", "=>", "{", "assert", "(", "field", "===", "ol", ")", ";", "assert", "(", "widget", "instanceof", "PDFWidgetAnnotation", ")", ";", "return", "[", "...", "rectangle", ",", "...", "symbolText", "(", "font", ")", "]", ";", "}", ")", ";", "rg", ".", "updateAppearances", "(", "(", "field", ",", "widget", ")", "=>", "{", "assert", "(", "field", "===", "rg", ")", ";", "assert", "(", "widget", "instanceof", "PDFWidgetAnnotation", ")", ";", "return", "{", "on", ":", "[", "...", "rectangle", ",", "...", "circle", "]", ",", "off", ":", "[", "...", "rectangle", ",", "...", "circle", "]", "}", ";", "}", ")", ";", "tf", ".", "updateAppearances", "(", "symbol", ",", "(", "field", ",", "widget", ",", "font", ")", "=>", "{", "assert", "(", "field", "===", "tf", ")", ";", "assert", "(", "widget", "instanceof", "PDFWidgetAnnotation", ")", ";", "return", "[", "...", "rectangle", ",", "...", "symbolText", "(", "font", ")", "]", ";", "}", ")", ";", "const", "pdfBytes", "=", "await", "pdfDoc", ".", "save", "(", ")", ";", "return", "pdfBytes", ";", "}", ";" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5248, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, 3, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3136, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, null, 8, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1388
[ "import", "{", "Assets", "}", "from", "'..'", ";", "import", "{", "PDFDocument", "}", "from", "'../../..'", ";", "import", "fontkit", "from", "'@pdf-lib/fontkit'", ";", "const", "loadA", "=", "async", "(", "assets", ")", "=>", "{", "const", "pdfDoc", "=", "await", "PDFDocument", ".", "load", "(", "assets", ".", "pdfs", ".", "with_combed_fields", ")", ";", "const", "form", "=", "pdfDoc", ".", "getForm", "(", ")", ";", "form", ".", "getTextField", "(", "'form1[0].Page1[0].BeforeYouBegin[0].BusinessInfo[0].LegalName[0]'", ")", ".", "setText", "(", "'Purple People Eater'", ")", ";", "form", ".", "getTextField", "(", "'form1[0].Page1[0].BeforeYouBegin[0].BusinessInfo[0].AccountNumber[0].BusinessNumber_RT1[0]'", ")", ".", "setText", "(", "'123456789'", ")", ";", "form", ".", "getTextField", "(", "'form1[0].Page1[0].BeforeYouBegin[0].BusinessInfo[0].AccountNumber[0].BusinessNumber_RT2[0]'", ")", ".", "setText", "(", "'9876'", ")", ";", "form", ".", "getTextField", "(", "'form1[0].Page1[0].BeforeYouBegin[0].PhysicalAddress[0].BusinessAddress[0]'", ")", ".", "setText", "(", "'873 Lantern Lane'", ")", ";", "form", ".", "getTextField", "(", "'form1[0].Page1[0].BeforeYouBegin[0].PhysicalAddress[0].City[0]'", ")", ".", "setText", "(", "'Tuckerton'", ")", ";", "form", ".", "getDropdown", "(", "'form1[0].Page1[0].BeforeYouBegin[0].PhysicalAddress[0].Province[0]'", ")", ".", "select", "(", "'Saskatchewan'", ")", ";", "form", ".", "getTextField", "(", "'form1[0].Page1[0].BeforeYouBegin[0].PhysicalAddress[0].PostalCode[0]'", ")", ".", "setText", "(", "'08087'", ")", ";", "form", ".", "flatten", "(", ")", ";", "return", "pdfDoc", ";", "}", ";", "const", "loadB", "=", "async", "(", "assets", ")", "=>", "{", "const", "pdfDoc", "=", "await", "PDFDocument", ".", "load", "(", "assets", ".", "pdfs", ".", "dod_character", ")", ";", "const", "form", "=", "pdfDoc", ".", "getForm", "(", ")", ";", "const", "marioImage", "=", "await", "pdfDoc", ".", "embedPng", "(", "assets", ".", "images", ".", "png", ".", "small_mario", ")", ";", "form", ".", "getTextField", "(", "'CharacterName 2'", ")", ".", "setText", "(", "'Mario'", ")", ";", "form", ".", "getTextField", "(", "'Age'", ")", ".", "setText", "(", "'24 years'", ")", ";", "form", ".", "getTextField", "(", "'Height'", ")", ".", "setText", "(", "`5' 1\"`", ")", ";", "form", ".", "getTextField", "(", "'Weight'", ")", ".", "setText", "(", "'196 lbs'", ")", ";", "form", ".", "getTextField", "(", "'Eyes'", ")", ".", "setText", "(", "'blue'", ")", ";", "form", ".", "getTextField", "(", "'Skin'", ")", ".", "setText", "(", "'white'", ")", ";", "form", ".", "getTextField", "(", "'Hair'", ")", ".", "setText", "(", "'brown'", ")", ";", "form", ".", "getButton", "(", "'CHARACTER IMAGE'", ")", ".", "setImage", "(", "marioImage", ")", ";", "form", ".", "flatten", "(", ")", ";", "return", "pdfDoc", ";", "}", ";", "const", "loadC", "=", "async", "(", "assets", ")", "=>", "{", "const", "pdfDoc", "=", "await", "PDFDocument", ".", "load", "(", "assets", ".", "pdfs", ".", "with_xfa_fields", ")", ";", "const", "form", "=", "pdfDoc", ".", "getForm", "(", ")", ";", "form", ".", "getCheckBox", "(", "'topmostSubform[0].Page1[0].FilingStatus[0].c1_01[2]'", ")", ".", "check", "(", ")", ";", "form", ".", "getTextField", "(", "'topmostSubform[0].Page1[0].FilingStatus[0].f1_01[0]'", ")", ".", "setText", "(", "'Guinevere Pendragon'", ")", ";", "form", ".", "getTextField", "(", "'topmostSubform[0].Page1[0].f1_02[0]'", ")", ".", "setText", "(", "'Arthur F'", ")", ";", "form", ".", "getTextField", "(", "'topmostSubform[0].Page1[0].f1_03[0]'", ")", ".", "setText", "(", "'Pendragon'", ")", ";", "form", ".", "getTextField", "(", "'topmostSubform[0].Page1[0].YourSocial_ReadOrderControl[0].f1_04[0]'", ")", ".", "setText", "(", "'123456789'", ")", ";", "form", ".", "getTextField", "(", "'topmostSubform[0].Page1[0].YourSocial_ReadOrderControl[0].f1_05[0]'", ")", ".", "setText", "(", "'Guinevere Q'", ")", ";", "form", ".", "getTextField", "(", "'topmostSubform[0].Page1[0].YourSocial_ReadOrderControl[0].f1_06[0]'", ")", ".", "setText", "(", "'Pendragon'", ")", ";", "form", ".", "getTextField", "(", "'topmostSubform[0].Page1[0].ReadOrderControl[0].f1_07[0]'", ")", ".", "setText", "(", "'987654321'", ")", ";", "form", ".", "flatten", "(", ")", ";", "return", "pdfDoc", ";", "}", ";", "const", "loadD", "=", "async", "(", "assets", ")", "=>", "{", "const", "pdfDoc", "=", "await", "PDFDocument", ".", "load", "(", "assets", ".", "pdfs", ".", "fancy_fields", ")", ";", "pdfDoc", ".", "registerFontkit", "(", "fontkit", ")", ";", "const", "ubuntuFont", "=", "await", "pdfDoc", ".", "embedFont", "(", "assets", ".", "fonts", ".", "ttf", ".", "ubuntu_r", ")", ";", "const", "form", "=", "pdfDoc", ".", "getForm", "(", ")", ";", "form", ".", "getTextField", "(", "'Prefix ⚽️'", ")", ".", "updateAppearances", "(", "ubuntuFont", ")", ";", "form", ".", "getTextField", "(", "'First Name 🚀'", ")", ".", "updateAppearances", "(", "ubuntuFont", ")", ";", "form", ".", "getTextField", "(", "'MiddleInitial 🎳'", ")", ".", "updateAppearances", "(", "ubuntuFont", ")", ";", "form", ".", "getTextField", "(", "'LastName 🛩'", ")", ".", "updateAppearances", "(", "ubuntuFont", ")", ";", "form", ".", "getCheckBox", "(", "'Are You A Fairy? 🌿'", ")", ".", "updateAppearances", "(", ")", ";", "form", ".", "getCheckBox", "(", "'Is Your Power Level Over 9000? 💪'", ")", ".", "updateAppearances", "(", ")", ";", "form", ".", "getCheckBox", "(", "'Can You Defeat Enemies In One Punch? 👊'", ")", ".", "updateAppearances", "(", ")", ";", "form", ".", "getCheckBox", "(", "'Will You Ever Let Me Down? ☕️'", ")", ".", "updateAppearances", "(", ")", ";", "form", ".", "getButton", "(", "'Eject 📼'", ")", ".", "updateAppearances", "(", "ubuntuFont", ")", ";", "form", ".", "getButton", "(", "'Submit 📝'", ")", ".", "updateAppearances", "(", "ubuntuFont", ")", ";", "form", ".", "getButton", "(", "'Play ▶️'", ")", ".", "updateAppearances", "(", "ubuntuFont", ")", ";", "form", ".", "getButton", "(", "'Launch 🚀'", ")", ".", "updateAppearances", "(", "ubuntuFont", ")", ";", "form", ".", "getRadioGroup", "(", "'Historical Figures 🐺'", ")", ".", "updateAppearances", "(", ")", ";", "form", ".", "getOptionList", "(", "'Which Are Planets? 🌎'", ")", ".", "updateAppearances", "(", "ubuntuFont", ")", ";", "const", "gundams", "=", "form", ".", "getDropdown", "(", "'Choose A Gundam 🤖'", ")", ";", "gundams", ".", "select", "(", "'One Punch Man'", ")", ";", "gundams", ".", "updateAppearances", "(", "ubuntuFont", ")", ";", "form", ".", "flatten", "(", ")", ";", "return", "pdfDoc", ";", "}", ";", "const", "loadE", "=", "async", "(", "_assets", ")", "=>", "{", "const", "pdfDoc", "=", "await", "PDFDocument", ".", "create", "(", ")", ";", "const", "page", "=", "pdfDoc", ".", "addPage", "(", "[", "550", ",", "750", "]", ")", ";", "const", "form", "=", "pdfDoc", ".", "getForm", "(", ")", ";", "page", ".", "drawText", "(", "'Enter your favorite superhero:'", ",", "{", "x", ":", "50", ",", "y", ":", "700", ",", "size", ":", "20", "}", ")", ";", "const", "superheroField", "=", "form", ".", "createTextField", "(", "'favorite.superhero'", ")", ";", "superheroField", ".", "setText", "(", "'One Punch Man'", ")", ";", "superheroField", ".", "addToPage", "(", "page", ",", "{", "x", ":", "55", ",", "y", ":", "640", "}", ")", ";", "page", ".", "drawText", "(", "'Select your favorite rocket:'", ",", "{", "x", ":", "50", ",", "y", ":", "600", ",", "size", ":", "20", "}", ")", ";", "page", ".", "drawText", "(", "'Falcon Heavy'", ",", "{", "x", ":", "120", ",", "y", ":", "560", ",", "size", ":", "18", "}", ")", ";", "const", "rocketField", "=", "form", ".", "createRadioGroup", "(", "'favorite.rocket'", ")", ";", "rocketField", ".", "addOptionToPage", "(", "'Saturn IV'", ",", "page", ",", "{", "x", ":", "55", ",", "y", ":", "540", "}", ")", ";", "rocketField", ".", "select", "(", "'Saturn IV'", ")", ";", "page", ".", "drawText", "(", "'Select your favorite gundams:'", ",", "{", "x", ":", "50", ",", "y", ":", "440", ",", "size", ":", "20", "}", ")", ";", "page", ".", "drawText", "(", "'Exia'", ",", "{", "x", ":", "120", ",", "y", ":", "400", ",", "size", ":", "18", "}", ")", ";", "const", "exiaField", "=", "form", ".", "createCheckBox", "(", "'gundam.exia'", ")", ";", "exiaField", ".", "addToPage", "(", "page", ",", "{", "x", ":", "55", ",", "y", ":", "380", "}", ")", ";", "exiaField", ".", "check", "(", ")", ";", "page", ".", "drawText", "(", "'Select your favorite planet:'", ",", "{", "x", ":", "50", ",", "y", ":", "280", ",", "size", ":", "20", "}", ")", ";", "const", "planetsField", "=", "form", ".", "createDropdown", "(", "'favorite.planet'", ")", ";", "planetsField", ".", "addOptions", "(", "[", "'Venus'", ",", "'Earth'", ",", "'Mars'", ",", "'Pluto'", "]", ")", ";", "planetsField", ".", "select", "(", "'Pluto'", ")", ";", "planetsField", ".", "addToPage", "(", "page", ",", "{", "x", ":", "55", ",", "y", ":", "220", "}", ")", ";", "page", ".", "drawText", "(", "'Select your favorite person:'", ",", "{", "x", ":", "50", ",", "y", ":", "180", ",", "size", ":", "18", "}", ")", ";", "const", "personField", "=", "form", ".", "createOptionList", "(", "'favorite.person'", ")", ";", "personField", ".", "addOptions", "(", "[", "'Julius Caesar'", ",", "'Ada Lovelace'", ",", "'Cleopatra'", ",", "'Aaron Burr'", ",", "'Mark Antony'", ",", "]", ")", ";", "personField", ".", "select", "(", "'Ada Lovelace'", ")", ";", "personField", ".", "addToPage", "(", "page", ",", "{", "x", ":", "55", ",", "y", ":", "70", "}", ")", ";", "form", ".", "flatten", "(", ")", ";", "return", "pdfDoc", ";", "}", ";", "export", "default", "async", "(", "assets", ")", "=>", "{", "const", "pdfDoc", "=", "await", "PDFDocument", ".", "load", "(", "assets", ".", "pdfs", ".", "form_to_flatten", ")", ";", "const", "form", "=", "pdfDoc", ".", "getForm", "(", ")", ";", "form", ".", "getTextField", "(", "'Text1'", ")", ".", "setText", "(", "'Some Text'", ")", ";", "form", ".", "getRadioGroup", "(", "'Group2'", ")", ".", "select", "(", "'Choice1'", ")", ";", "form", ".", "getRadioGroup", "(", "'Group3'", ")", ".", "select", "(", "'Choice3'", ")", ";", "form", ".", "getRadioGroup", "(", "'Group4'", ")", ".", "select", "(", "'Choice1'", ")", ";", "form", ".", "getCheckBox", "(", "'Check Box3'", ")", ".", "check", "(", ")", ";", "form", ".", "getCheckBox", "(", "'Check Box4'", ")", ".", "uncheck", "(", ")", ";", "form", ".", "getDropdown", "(", "'Dropdown7'", ")", ".", "select", "(", "'Infinity'", ")", ";", "form", ".", "getOptionList", "(", "'List Box6'", ")", ".", "select", "(", "'Honda'", ")", ";", "const", "fieldToRemove", "=", "form", ".", "getRadioGroup", "(", "'Group4'", ")", ";", "form", ".", "removeField", "(", "fieldToRemove", ")", ";", "if", "(", "form", ".", "getFieldMaybe", "(", "'Group4'", ")", "!==", "undefined", ")", "{", "throw", "new", "Error", "(", "'Failed to remove field'", ")", ";", "}", "form", ".", "flatten", "(", ")", ";", "const", "formDocs", "=", "[", "await", "loadA", "(", "assets", ")", ",", "await", "loadB", "(", "assets", ")", ",", "await", "loadC", "(", "assets", ")", ",", "await", "loadD", "(", "assets", ")", ",", "await", "loadE", "(", "assets", ")", ",", "]", ";", "for", "(", "const", "formDoc", "of", "formDocs", ")", "{", "const", "[", "page1", "]", "=", "await", "pdfDoc", ".", "copyPages", "(", "formDoc", ",", "[", "0", "]", ")", ";", "pdfDoc", ".", "addPage", "(", "page1", ")", ";", "}", "const", "pdfBytes", "=", "await", "pdfDoc", ".", "save", "(", ")", ";", "return", "pdfBytes", ";", "}", ";" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, 5248, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, 5248, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, 5248, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, 5248, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, 5248, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5248, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1389
[ "import", "{", "execSync", "}", "from", "'child_process'", ";", "import", "fs", "from", "'fs'", ";", "import", "os", "from", "'os'", ";", "import", "{", "sep", "}", "from", "'path'", ";", "import", "readline", "from", "'readline'", ";", "import", "test1", "from", "'./tests/test1'", ";", "import", "test2", "from", "'./tests/test2'", ";", "import", "test3", "from", "'./tests/test3'", ";", "import", "test4", "from", "'./tests/test4'", ";", "import", "test5", "from", "'./tests/test5'", ";", "import", "test6", "from", "'./tests/test6'", ";", "import", "test7", "from", "'./tests/test7'", ";", "import", "test8", "from", "'./tests/test8'", ";", "import", "test9", "from", "'./tests/test9'", ";", "import", "test10", "from", "'./tests/test10'", ";", "import", "test11", "from", "'./tests/test11'", ";", "import", "test12", "from", "'./tests/test12'", ";", "import", "test13", "from", "'./tests/test13'", ";", "import", "test14", "from", "'./tests/test14'", ";", "import", "test15", "from", "'./tests/test15'", ";", "import", "test16", "from", "'./tests/test16'", ";", "import", "test17", "from", "'./tests/test17'", ";", "import", "test18", "from", "'./tests/test18'", ";", "const", "cli", "=", "readline", ".", "createInterface", "(", "{", "input", ":", "process", ".", "stdin", ",", "output", ":", "process", ".", "stdout", ",", "}", ")", ";", "const", "prompt", "=", "`Press <enter> to run the next test...`", ";", "const", "promptToContinue", "=", "(", ")", "=>", "new", "Promise", "(", "(", "resolve", ")", "=>", "cli", ".", "question", "(", "prompt", ",", "(", "_answer", ")", "=>", "resolve", "(", ")", ")", ")", ";", "const", "openPdf", "=", "(", "path", ",", "_reader", "?", ")", "=>", "{", "if", "(", "process", ".", "platform", "===", "'darwin'", ")", "{", "execSync", "(", "`open -a \"${", "_reader", "||", "'Preview'", "}\" '${", "path", "}'`", ")", ";", "}", "else", "if", "(", "process", ".", "platform", "===", "'win32'", ")", "{", "execSync", "(", "`start ${", "path", "}`", ")", ";", "}", "else", "{", "const", "msg1", "=", "`Note: Automatically opening PDFs currently only works on Macs and Windows. If you're using a Linux machine, please consider contributing to expand support for this feature`", ";", "const", "msg2", "=", "`(https://github.com/Hopding/pdf-lib/blob/master/apps/node/index.ts#L8-L17)\\n`", ";", "console", ".", "warn", "(", "msg1", ")", ";", "console", ".", "warn", "(", "msg2", ")", ";", "}", "}", ";", "const", "writePdfToTmp", "=", "(", "pdf", ")", "=>", "{", "const", "path", "=", "`${", "os", ".", "tmpdir", "(", ")", "}${", "sep", "}${", "Date", ".", "now", "(", ")", "}.pdf`", ";", "fs", ".", "writeFileSync", "(", "path", ",", "pdf", ")", ";", "return", "path", ";", "}", ";", "const", "readFont", "=", "(", "font", ")", "=>", "fs", ".", "readFileSync", "(", "`assets/fonts/${", "font", "}`", ")", ";", "const", "readImage", "=", "(", "image", ")", "=>", "fs", ".", "readFileSync", "(", "`assets/images/${", "image", "}`", ")", ";", "const", "readPdf", "=", "(", "pdf", ")", "=>", "fs", ".", "readFileSync", "(", "`assets/pdfs/${", "pdf", "}`", ")", ";", "const", "assets", "=", "{", "fonts", ":", "{", "ttf", ":", "{", "ubuntu_r", ":", "readFont", "(", "'ubuntu/Ubuntu-R.ttf'", ")", ",", "ubuntu_r_base64", ":", "String", "(", "readFont", "(", "'ubuntu/Ubuntu-R.ttf.base64'", ")", ")", ",", "bio_rhyme_r", ":", "readFont", "(", "'bio_rhyme/BioRhymeExpanded-Regular.ttf'", ")", ",", "press_start_2p_r", ":", "readFont", "(", "'press_start_2p/PressStart2P-Regular.ttf'", ")", ",", "indie_flower_r", ":", "readFont", "(", "'indie_flower/IndieFlower.ttf'", ")", ",", "great_vibes_r", ":", "readFont", "(", "'great_vibes/GreatVibes-Regular.ttf'", ")", ",", "nunito", ":", "readFont", "(", "'nunito/Nunito-Regular.ttf'", ")", ",", "}", ",", "otf", ":", "{", "fantasque_sans_mono_bi", ":", "readFont", "(", "'fantasque/OTF/FantasqueSansMono-BoldItalic.otf'", ")", ",", "apple_storm_r", ":", "readFont", "(", "'apple_storm/AppleStormCBo.otf'", ")", ",", "hussar_3d_r", ":", "readFont", "(", "'hussar_3d/Hussar3DFour.otf'", ")", ",", "source_hans_jp", ":", "readFont", "(", "'source_hans_jp/SourceHanSerifJP-Regular.otf'", ")", ",", "}", ",", "}", ",", "images", ":", "{", "jpg", ":", "{", "cat_riding_unicorn", ":", "readImage", "(", "'cat_riding_unicorn.jpg'", ")", ",", "cat_riding_unicorn_base64", ":", "String", "(", "readImage", "(", "'cat_riding_unicorn.jpg.base64'", ")", ")", ",", "minions_laughing", ":", "readImage", "(", "'minions_laughing.jpg'", ")", ",", "cmyk_colorspace", ":", "readImage", "(", "'cmyk_colorspace.jpg'", ")", ",", "}", ",", "png", ":", "{", "greyscale_bird", ":", "readImage", "(", "'greyscale_bird.png'", ")", ",", "greyscale_bird_base64_uri", ":", "String", "(", "readImage", "(", "'greyscale_bird.png.base64.uri'", ")", ")", ",", "minions_banana_alpha", ":", "readImage", "(", "'minions_banana_alpha.png'", ")", ",", "minions_banana_no_alpha", ":", "readImage", "(", "'minions_banana_no_alpha.png'", ")", ",", "small_mario", ":", "readImage", "(", "'small_mario.png'", ")", ",", "etwe", ":", "readImage", "(", "'etwe.png'", ")", ",", "self_drive", ":", "readImage", "(", "'self_drive.png'", ")", ",", "mario_emblem", ":", "readImage", "(", "'mario_emblem.png'", ")", ",", "}", ",", "}", ",", "pdfs", ":", "{", "normal", ":", "readPdf", "(", "'normal.pdf'", ")", ",", "normal_base64", ":", "String", "(", "readPdf", "(", "'normal.pdf.base64'", ")", ")", ",", "with_update_sections", ":", "readPdf", "(", "'with_update_sections.pdf'", ")", ",", "with_update_sections_base64_uri", ":", "String", "(", "readPdf", "(", "'with_update_sections.pdf.base64.uri'", ")", ")", ",", "linearized_with_object_streams", ":", "readPdf", "(", "'linearized_with_object_streams.pdf'", ")", ",", "with_large_page_count", ":", "readPdf", "(", "'with_large_page_count.pdf'", ")", ",", "with_missing_endstream_eol_and_polluted_ctm", ":", "readPdf", "(", "'with_missing_endstream_eol_and_polluted_ctm.pdf'", ")", ",", "with_newline_whitespace_in_indirect_object_numbers", ":", "readPdf", "(", "'with_newline_whitespace_in_indirect_object_numbers.pdf'", ")", ",", "with_comments", ":", "readPdf", "(", "'with_comments.pdf'", ")", ",", "with_cropbox", ":", "readPdf", "(", "'with_cropbox.pdf'", ")", ",", "us_constitution", ":", "readPdf", "(", "'us_constitution.pdf'", ")", ",", "simple_pdf_2_example", ":", "readPdf", "(", "'pdf20examples/Simple PDF 2.0 file.pdf'", ")", ",", "with_combed_fields", ":", "readPdf", "(", "'with_combed_fields.pdf'", ")", ",", "dod_character", ":", "readPdf", "(", "'dod_character.pdf'", ")", ",", "with_xfa_fields", ":", "readPdf", "(", "'with_xfa_fields.pdf'", ")", ",", "fancy_fields", ":", "readPdf", "(", "'fancy_fields.pdf'", ")", ",", "form_to_flatten", ":", "readPdf", "(", "'form_to_flatten.pdf'", ")", ",", "with_annots", ":", "readPdf", "(", "'with_annots.pdf'", ")", ",", "}", ",", "}", ";", "export", "type", "Assets", "=", "typeof", "assets", ";", "const", "loadCliArgs", "=", "(", ")", ":", "{", "testIdx", "?", ":", "number", ";", "reader", "?", ":", "string", ";", "}", "=>", "{", "const", "[", ",", ",", "...", "args", "]", "=", "process", ".", "argv", ";", "if", "(", "args", ".", "length", "===", "0", ")", "return", "{", "}", ";", "if", "(", "args", ".", "length", "===", "1", ")", "{", "if", "(", "isFinite", "(", "Number", "(", "args", "[", "0", "]", ")", ")", ")", "return", "{", "testIdx", ":", "Number", "(", "args", "[", "0", "]", ")", "}", ";", "else", "return", "{", "reader", ":", "args", "[", "0", "]", "}", ";", "}", "return", "{", "testIdx", ":", "Number", "(", "args", "[", "0", "]", ")", ",", "reader", ":", "args", "[", "1", "]", "}", ";", "}", ";", "const", "main", "=", "async", "(", ")", "=>", "{", "try", "{", "const", "{", "testIdx", ",", "reader", "}", "=", "loadCliArgs", "(", ")", ";", "const", "allTests", "=", "[", "test1", ",", "test2", ",", "test3", ",", "test4", ",", "test5", ",", "test6", ",", "test7", ",", "test8", ",", "test9", ",", "test10", ",", "test11", ",", "test12", ",", "test13", ",", "test14", ",", "test15", ",", "test16", ",", "test17", ",", "test18", ",", "]", ";", "const", "tests", "=", "testIdx", "?", "[", "allTests", "[", "testIdx", "-", "1", "]", "]", ":", "allTests", ";", "let", "idx", "=", "testIdx", "||", "1", ";", "for", "(", "const", "test", "of", "tests", ")", "{", "console", ".", "log", "(", "`Running test #${", "idx", "}`", ")", ";", "const", "pdfBytes", "=", "await", "test", "(", "assets", ")", ";", "const", "path", "=", "writePdfToTmp", "(", "pdfBytes", ")", ";", "console", ".", "log", "(", "`> PDF file written to: ${", "path", "}`", ")", ";", "openPdf", "(", "path", ",", "reader", ")", ";", "idx", "+=", "1", ";", "await", "promptToContinue", "(", ")", ";", "console", ".", "log", "(", ")", ";", "}", "console", ".", "log", "(", "'Done!'", ")", ";", "}", "finally", "{", "cli", ".", "close", "(", ")", ";", "}", "}", ";", "main", "(", ")", ";" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 258, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, 7, null, null, null, null, null, null, null, null, 4, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, 4, null, null, 2, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, 29, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 12, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, 12, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, 12, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1390
[ "import", "{", "ConsoleLogger", ",", "DefaultDeviceController", ",", "MeetingSessionConfiguration", ",", "DefaultMeetingSession", ",", "LogLevel", ",", "AudioVideoObserver", ",", "MeetingSessionStatus", ",", "VideoTileState", ",", "AudioVideoFacade", ",", "MeetingSession", ",", "Versioning", ",", "MeetingSessionStatusCode", ",", "VideoPriorityBasedPolicy", ",", "VideoPreference", ",", "VideoPreferences", ",", "TargetDisplaySize", ",", "}", "from", "'amazon-chime-sdk-js'", ";", "export", "class", "DemoMeetingApp", "implements", "AudioVideoObserver", "{", "static", "readonly", "BASE_URL", ":", "string", "=", "[", "location", ".", "protocol", ",", "'//'", ",", "location", ".", "host", ",", "location", ".", "pathname", ".", "replace", "(", "/\\/*$/", ",", "'/'", ")", ".", "replace", "(", "'/v2'", ",", "''", ")", "]", ".", "join", "(", "''", ")", ";", "meeting", ":", "string", "|", "null", "=", "null", ";", "name", ":", "string", "|", "null", "=", "'Tester'", ";", "region", ":", "string", "|", "null", "=", "'us-east-1'", ";", "audioVideo", ":", "AudioVideoFacade", "|", "null", "=", "null", ";", "meetingSession", ":", "MeetingSession", "|", "null", "=", "null", ";", "priorityBasedDownlinkPolicy", ":", "VideoPriorityBasedPolicy", "|", "null", "=", "null", ";", "previousTileState", ":", "{", "[", "tileId", "]", ":", "VideoTileState", ";", "}", "=", "{", "}", ";", "constructor", "(", ")", "{", "(", "global", "as", "any", ")", ".", "app", "=", "this", ";", "try", "{", "this", ".", "initEventListeners", "(", ")", ";", "document", ".", "getElementById", "(", "'button-container'", ")", ".", "style", ".", "display", "=", "'none'", ";", "}", "catch", "(", "error", ")", "{", "console", ".", "log", "(", "error", ")", ";", "return", ";", "}", "}", "async", "authenticate", "(", ")", "{", "let", "joinInfo", "=", "(", "await", "this", ".", "joinMeeting", "(", ")", ")", ".", "JoinInfo", ";", "const", "configuration", "=", "new", "MeetingSessionConfiguration", "(", "joinInfo", ".", "Meeting", ",", "joinInfo", ".", "Attendee", ")", ";", "this", ".", "initializeMeetingSession", "(", "configuration", ")", ";", "const", "url", "=", "new", "URL", "(", "window", ".", "location", ".", "href", ")", ";", "url", ".", "searchParams", ".", "set", "(", "'m'", ",", "this", ".", "meeting", ")", ";", "history", ".", "replaceState", "(", "{", "}", ",", "`${", "this", ".", "meeting", "}`", ",", "url", ".", "toString", "(", ")", ")", ";", "return", "configuration", ".", "meetingId", ";", "}", "async", "initializeMeetingSession", "(", "configuration", ")", "{", "let", "logger", "=", "new", "ConsoleLogger", "(", "'SDK'", ",", "LogLevel", ".", "INFO", ")", ";", "const", "deviceController", "=", "new", "DefaultDeviceController", "(", "logger", ")", ";", "this", ".", "meetingSession", "=", "new", "DefaultMeetingSession", "(", "configuration", ",", "logger", ",", "deviceController", ")", ";", "this", ".", "audioVideo", "=", "this", ".", "meetingSession", ".", "audioVideo", ";", "this", ".", "audioVideo", ".", "addObserver", "(", "this", ")", ";", "(", "document", ".", "getElementById", "(", "'sdk-version'", ")", "as", "HTMLSpanElement", ")", ".", "innerText", "=", "\"amazon-chime-sdk-js@\"", "+", "Versioning", ".", "sdkVersion", ";", "const", "videoInputDevices", "=", "await", "this", ".", "audioVideo", ".", "listVideoInputDevices", "(", ")", ";", "await", "this", ".", "audioVideo", ".", "chooseAudioInputDevice", "(", "null", ")", ";", "await", "this", ".", "audioVideo", ".", "chooseAudioOutputDevice", "(", "null", ")", ";", "const", "videoInputDeviceInfo", "=", "videoInputDevices", "[", "0", "]", ";", "await", "this", ".", "audioVideo", ".", "chooseVideoInputDevice", "(", "videoInputDeviceInfo", ".", "deviceId", ")", ";", "this", ".", "priorityBasedDownlinkPolicy", "=", "new", "VideoPriorityBasedPolicy", "(", "logger", ")", ";", "}", "initEventListeners", "(", ")", "{", "const", "joinMeetingForm", "=", "document", ".", "getElementById", "(", "'form-join-meeting'", ")", "as", "HTMLFormElement", ";", "joinMeetingForm", ".", "addEventListener", "(", "'submit'", ",", "async", "(", "e", ")", "=>", "{", "e", ".", "preventDefault", "(", ")", ";", "this", ".", "meeting", "=", "(", "document", ".", "getElementById", "(", "'inputMeeting'", ")", "as", "HTMLInputElement", ")", ".", "value", ";", "this", ".", "name", "=", "(", "document", ".", "getElementById", "(", "'inputName'", ")", "as", "HTMLInputElement", ")", ".", "value", ";", "let", "chimeMeetingId", "=", "await", "this", ".", "authenticate", "(", ")", ";", "await", "this", ".", "join", "(", ")", ";", "(", "document", ".", "getElementById", "(", "'chime-meeting-id'", ")", "as", "HTMLSpanElement", ")", ".", "innerText", "=", "`Meeting ID: ${", "chimeMeetingId", "}`", ";", "joinMeetingForm", ".", "reset", "(", ")", ";", "}", ")", ";", "const", "startLocalVideoButton", "=", "document", ".", "getElementById", "(", "'start-local-video'", ")", ";", "startLocalVideoButton", ".", "addEventListener", "(", "'click'", ",", "async", "(", "e", ")", "=>", "{", "try", "{", "const", "videoInputList", "=", "await", "this", ".", "audioVideo", ".", "listVideoInputDevices", "(", ")", ";", "const", "device", "=", "videoInputList", "&&", "videoInputList", "[", "0", "]", ";", "await", "this", ".", "audioVideo", ".", "chooseVideoInputDevice", "(", "device", ")", ";", "this", ".", "audioVideo", ".", "startLocalVideoTile", "(", ")", ";", "}", "catch", "(", "err", ")", "{", "console", ".", "error", "(", "`no video input device selected: ${", "err", "}`", ")", ";", "}", "}", ")", ";", "const", "stopLocalVideoButton", "=", "document", ".", "getElementById", "(", "'stop-local-video'", ")", ";", "stopLocalVideoButton", ".", "addEventListener", "(", "'click'", ",", "async", "(", "e", ")", "=>", "{", "this", ".", "audioVideo", ".", "stopLocalVideoTile", "(", ")", ";", "}", ")", ";", "const", "bindVideoElementForm", "=", "document", ".", "getElementById", "(", "'bind-video-element-form'", ")", "as", "HTMLFormElement", ";", "const", "bindVideoElementTile", "=", "document", ".", "getElementById", "(", "'bind-video-element-tile-id'", ")", "as", "HTMLInputElement", ";", "const", "bindVideoElementVideoElement", "=", "document", ".", "getElementById", "(", "'bind-video-element-video-element'", ")", "as", "HTMLInputElement", ";", "bindVideoElementForm", ".", "addEventListener", "(", "'submit'", ",", "async", "(", "e", ")", "=>", "{", "e", ".", "preventDefault", "(", ")", ";", "this", ".", "audioVideo", ".", "bindVideoElement", "(", "parseInt", "(", "bindVideoElementTile", ".", "value", ")", ",", "document", ".", "getElementById", "(", "bindVideoElementVideoElement", ".", "value", ")", "as", "HTMLVideoElement", ")", ";", "bindVideoElementForm", ".", "reset", "(", ")", ";", "}", ")", ";", "const", "unbindVideoElementForm", "=", "document", ".", "getElementById", "(", "'unbind-video-element-form'", ")", "as", "HTMLFormElement", ";", "const", "unbindVideoElementTile", "=", "document", ".", "getElementById", "(", "'unbind-video-element-tile-id'", ")", "as", "HTMLInputElement", ";", "unbindVideoElementForm", ".", "addEventListener", "(", "'submit'", ",", "e", "=>", "{", "e", ".", "preventDefault", "(", ")", ";", "this", ".", "audioVideo", ".", "unbindVideoElement", "(", "parseInt", "(", "unbindVideoElementTile", ".", "value", ")", ")", ";", "unbindVideoElementForm", ".", "reset", "(", ")", ";", "}", ")", ";", "const", "pinVideoTileForm", "=", "document", ".", "getElementById", "(", "'pin-video-tile-form'", ")", "as", "HTMLFormElement", ";", "const", "pinAttendeeId", "=", "document", ".", "getElementById", "(", "'pin-attendee-id'", ")", "as", "HTMLInputElement", ";", "pinVideoTileForm", ".", "addEventListener", "(", "'submit'", ",", "e", "=>", "{", "e", ".", "preventDefault", "(", ")", ";", "const", "videoPreferences", "=", "VideoPreferences", ".", "prepare", "(", ")", ";", "videoPreferences", ".", "add", "(", "new", "VideoPreference", "(", "pinAttendeeId", ".", "value", ",", "1", ",", "TargetDisplaySize", ".", "High", ")", ")", ";", "this", ".", "priorityBasedDownlinkPolicy", ".", "chooseRemoteVideoSources", "(", "videoPreferences", ".", "build", "(", ")", ")", ";", "const", "videoPreferenceObject", "=", "document", ".", "getElementById", "(", "`video-preference`", ")", ";", "videoPreferenceObject", ".", "innerText", "=", "''", ";", "for", "(", "const", "preference", "of", "videoPreferences", ".", "build", "(", ")", ")", "{", "videoPreferenceObject", ".", "innerText", "+=", "JSON", ".", "stringify", "(", "preference", ",", "null", ",", "' '", ")", ";", "}", "pinVideoTileForm", ".", "reset", "(", ")", ";", "}", ")", ";", "const", "unpinVideoTileForm", "=", "document", ".", "getElementById", "(", "'unpin-video-tile-form'", ")", "as", "HTMLFormElement", ";", "const", "unpinAttendeeId", "=", "document", ".", "getElementById", "(", "'unpin-attendee-id'", ")", "as", "HTMLInputElement", ";", "unpinVideoTileForm", ".", "addEventListener", "(", "'submit'", ",", "e", "=>", "{", "e", ".", "preventDefault", "(", ")", ";", "const", "videoPreferences", "=", "VideoPreferences", ".", "prepare", "(", ")", ";", "videoPreferences", ".", "add", "(", "new", "VideoPreference", "(", "unpinAttendeeId", ".", "value", ",", "2", ",", "TargetDisplaySize", ".", "High", ")", ")", ";", "this", ".", "priorityBasedDownlinkPolicy", ".", "chooseRemoteVideoSources", "(", "videoPreferences", ".", "build", "(", ")", ")", ";", "const", "videoPreferenceObject", "=", "document", ".", "getElementById", "(", "`video-preference`", ")", ";", "videoPreferenceObject", ".", "innerText", "=", "''", ";", "for", "(", "const", "preference", "of", "videoPreferences", ".", "build", "(", ")", ")", "{", "videoPreferenceObject", ".", "innerText", "+=", "JSON", ".", "stringify", "(", "preference", ",", "null", ",", "' '", ")", ";", "}", "unpinVideoTileForm", ".", "reset", "(", ")", ";", "}", ")", ";", "const", "addVideoTileForm", "=", "document", ".", "getElementById", "(", "'add-video-tile-form'", ")", "as", "HTMLFormElement", ";", "addVideoTileForm", ".", "addEventListener", "(", "'submit'", ",", "e", "=>", "{", "e", ".", "preventDefault", "(", ")", ";", "const", "tileId", "=", "this", ".", "audioVideo", ".", "addVideoTile", "(", ")", ".", "id", "(", ")", ";", "let", "videoTileIdObject", "=", "document", ".", "getElementById", "(", "`video-tile-id`", ")", ";", "videoTileIdObject", ".", "innerText", "=", "JSON", ".", "stringify", "(", "tileId", ",", "null", ",", "' '", ")", ";", ";", "addVideoTileForm", ".", "reset", "(", ")", ";", "}", ")", ";", "const", "hasStartedLocalVideoTileForm", "=", "document", ".", "getElementById", "(", "'has-started-local-video-tile-form'", ")", "as", "HTMLFormElement", ";", "hasStartedLocalVideoTileForm", ".", "addEventListener", "(", "'submit'", ",", "e", "=>", "{", "e", ".", "preventDefault", "(", ")", ";", "const", "hasStartedLocalVideoTileValue", "=", "this", ".", "audioVideo", ".", "hasStartedLocalVideoTile", "(", ")", ";", "let", "hasStartedLocalVideoTileBooleanObject", "=", "document", ".", "getElementById", "(", "`has-started-local-video-tile-boolean`", ")", ";", "hasStartedLocalVideoTileBooleanObject", ".", "innerText", "=", "JSON", ".", "stringify", "(", "hasStartedLocalVideoTileValue", ",", "null", ",", "' '", ")", ";", ";", "hasStartedLocalVideoTileForm", ".", "reset", "(", ")", ";", "}", ")", ";", "const", "getLocalVideoTileForm", "=", "document", ".", "getElementById", "(", "'get-local-video-tile-form'", ")", "as", "HTMLFormElement", ";", "getLocalVideoTileForm", ".", "addEventListener", "(", "'submit'", ",", "e", "=>", "{", "e", ".", "preventDefault", "(", ")", ";", "const", "localVideoTile", "=", "this", ".", "audioVideo", ".", "getLocalVideoTile", "(", ")", ".", "id", "(", ")", ";", "let", "videoTileIdObject", "=", "document", ".", "getElementById", "(", "`local-video-tile-id`", ")", ";", "videoTileIdObject", ".", "innerText", "=", "JSON", ".", "stringify", "(", "localVideoTile", ",", "null", ",", "' '", ")", ";", ";", "getLocalVideoTileForm", ".", "reset", "(", ")", ";", "}", ")", ";", "const", "getAllVideoTilesForm", "=", "document", ".", "getElementById", "(", "'get-all-video-tiles-form'", ")", "as", "HTMLFormElement", ";", "getAllVideoTilesForm", ".", "addEventListener", "(", "'submit'", ",", "e", "=>", "{", "e", ".", "preventDefault", "(", ")", ";", "const", "videoTiles", "=", "this", ".", "audioVideo", ".", "getAllVideoTiles", "(", ")", ";", "let", "videoTilesCountObject", "=", "document", ".", "getElementById", "(", "`total-video-tiles-count`", ")", ";", "videoTilesCountObject", ".", "innerText", "=", "JSON", ".", "stringify", "(", "videoTiles", ".", "length", ",", "null", ",", "' '", ")", ";", ";", "getAllVideoTilesForm", ".", "reset", "(", ")", ";", "let", "videoTilesListObject", "=", "document", ".", "getElementById", "(", "`all-video-tiles`", ")", ";", "for", "(", "const", "videoTile", "of", "videoTiles", ")", "{", "videoTilesListObject", ".", "innerText", "+=", "JSON", ".", "stringify", "(", "videoTile", ".", "state", "(", ")", ",", "null", ",", "' '", ")", ";", "}", "}", ")", ";", "const", "getAllRemoteVideoTilesForm", "=", "document", ".", "getElementById", "(", "'get-all-remote-video-tiles-form'", ")", "as", "HTMLFormElement", ";", "getAllRemoteVideoTilesForm", ".", "addEventListener", "(", "'submit'", ",", "e", "=>", "{", "e", ".", "preventDefault", "(", ")", ";", "const", "totalRemoteVideoTilesCount", "=", "this", ".", "audioVideo", ".", "getAllRemoteVideoTiles", "(", ")", ".", "length", ";", "let", "remoteVideoTilesCountObject", "=", "document", ".", "getElementById", "(", "`total-remote-video-tiles-count`", ")", ";", "remoteVideoTilesCountObject", ".", "innerText", "=", "JSON", ".", "stringify", "(", "totalRemoteVideoTilesCount", ",", "null", ",", "' '", ")", ";", ";", "getAllRemoteVideoTilesForm", ".", "reset", "(", ")", ";", "}", ")", ";", "const", "haveVideoTileForAttendeeIdForm", "=", "document", ".", "getElementById", "(", "'have-video-tile-for-attendeeId-form'", ")", "as", "HTMLFormElement", ";", "haveVideoTileForAttendeeIdForm", ".", "addEventListener", "(", "'submit'", ",", "e", "=>", "{", "e", ".", "preventDefault", "(", ")", ";", "const", "attendeeIdInput", "=", "document", ".", "getElementById", "(", "'have-video-tile-for-attendee-id'", ")", "as", "HTMLInputElement", ";", "const", "haveVideoTileForAttendeeIdValue", "=", "this", ".", "audioVideo", ".", "videoTileController", ".", "haveVideoTileForAttendeeId", "(", "attendeeIdInput", ".", "value", ")", ";", "let", "haveVideoTileForAttendeeIdValueObject", "=", "document", ".", "getElementById", "(", "`have-video-tile-for-attendeeId-boolean`", ")", ";", "haveVideoTileForAttendeeIdValueObject", ".", "innerText", "=", "JSON", ".", "stringify", "(", "haveVideoTileForAttendeeIdValue", ",", "null", ",", "' '", ")", ";", ";", "haveVideoTileForAttendeeIdForm", ".", "reset", "(", ")", ";", "}", ")", ";", "const", "haveVideoTilesWithStreamsForm", "=", "document", ".", "getElementById", "(", "'have-video-tiles-with-streams-form'", ")", "as", "HTMLFormElement", ";", "haveVideoTilesWithStreamsForm", ".", "addEventListener", "(", "'submit'", ",", "e", "=>", "{", "e", ".", "preventDefault", "(", ")", ";", "const", "haveVideoTilesWithStreamsBoolean", "=", "this", ".", "audioVideo", ".", "videoTileController", ".", "haveVideoTilesWithStreams", "(", ")", ";", "let", "haveVideoTilesWithStreamsBooleanObject", "=", "document", ".", "getElementById", "(", "`have-video-tiles-with-streams-boolean`", ")", ";", "haveVideoTilesWithStreamsBooleanObject", ".", "innerText", "=", "JSON", ".", "stringify", "(", "haveVideoTilesWithStreamsBoolean", ",", "null", ",", "' '", ")", ";", ";", "haveVideoTilesWithStreamsForm", ".", "reset", "(", ")", ";", "}", ")", ";", "const", "removeAllVideoTilesForm", "=", "document", ".", "getElementById", "(", "'remove-all-video-tiles-form'", ")", "as", "HTMLFormElement", ";", "removeAllVideoTilesForm", ".", "addEventListener", "(", "'submit'", ",", "e", "=>", "{", "e", ".", "preventDefault", "(", ")", ";", "this", ".", "audioVideo", ".", "removeAllVideoTiles", "(", ")", ";", "removeAllVideoTilesForm", ".", "reset", "(", ")", ";", "const", "videoTilesListObject", "=", "document", ".", "getElementById", "(", "'video-tiles'", ")", ";", "videoTilesListObject", ".", "innerText", "=", "''", ";", "}", ")", ";", "}", "async", "joinMeeting", "(", ")", "{", "const", "response", "=", "await", "fetch", "(", "`${", "DemoMeetingApp", ".", "BASE_URL", "}join?title=${", "encodeURIComponent", "(", "this", ".", "meeting", ")", "}&name=${", "encodeURIComponent", "(", "this", ".", "name", ")", "}&region=${", "encodeURIComponent", "(", "this", ".", "region", ")", "}`", ",", "{", "method", ":", "'POST'", ",", "}", ")", ";", "const", "json", "=", "await", "response", ".", "json", "(", ")", ";", "if", "(", "json", ".", "error", ")", "{", "throw", "new", "Error", "(", "`Server error: ${", "json", ".", "error", "}`", ")", ";", "}", "return", "json", ";", "}", ";", "async", "join", "(", ")", "{", "window", ".", "addEventListener", "(", "'unhandledrejection'", ",", "(", "event", ")", "=>", "{", "console", ".", "error", "(", "event", ".", "reason", ")", ";", "}", ")", ";", "this", ".", "audioVideo", ".", "start", "(", ")", ";", "}", ";", "audioVideoDidStartConnecting", "(", "reconnecting", ")", "{", "console", ".", "log", "(", "`AudioVideoDidStartConnecting was called. Reconnecting: ${", "reconnecting", "}`", ")", ";", "}", ";", "audioVideoDidStart", "(", ")", "{", "console", ".", "log", "(", "'AudioVideoDidStart was called'", ")", ";", "document", ".", "getElementById", "(", "'button-container'", ")", ".", "style", ".", "display", "=", "'block'", ";", "}", ";", "audioVideoDidStop", "(", "sessionStatus", ")", "{", "console", ".", "log", "(", "'AudioVideoDidStop was called'", ")", ";", "const", "sessionStatusCode", "=", "sessionStatus", ".", "statusCode", "(", ")", ";", "if", "(", "sessionStatusCode", "===", "MeetingSessionStatusCode", ".", "Left", ")", "{", "console", ".", "log", "(", "'You left the session'", ")", ";", "}", "else", "if", "(", "sessionStatusCode", "===", "MeetingSessionStatusCode", ".", "MeetingEnded", ")", "{", "console", ".", "log", "(", "'Meeting Ended'", ")", ";", "}", "else", "{", "console", ".", "log", "(", "'Stopped with a session status code: '", ",", "sessionStatusCode", ")", ";", "}", "(", "document", ".", "getElementById", "(", "'chime-meeting-id'", ")", "as", "HTMLSpanElement", ")", ".", "innerText", "=", "`Meeting ID:`", ";", "document", ".", "getElementById", "(", "'button-container'", ")", ".", "style", ".", "display", "=", "'none'", ";", "}", "videoTileDidUpdate", "(", "tileState", ")", "{", "console", ".", "log", "(", "`Video Tile Updated: ${", "JSON", ".", "stringify", "(", "tileState", ",", "null", ",", "' '", ")", "}`", ")", ";", "if", "(", "!", "tileState", ".", "boundAttendeeId", ")", "{", "return", ";", "}", "const", "boundVideoElementId", "=", "tileState", ".", "boundVideoElement", "&&", "tileState", ".", "boundVideoElement", ".", "id", ";", "const", "boundVideoStreamId", "=", "tileState", ".", "boundVideoStream", "&&", "tileState", ".", "boundVideoStream", ".", "id", ";", "const", "videoTileState", "=", "{", "...", "tileState", ",", "boundVideoElementId", ":", "boundVideoElementId", ",", "boundVideoStreamId", ":", "boundVideoStreamId", "}", ";", "let", "videoTileStateObject", ";", "if", "(", "tileState", ".", "localTile", ")", "{", "videoTileStateObject", "=", "document", ".", "getElementById", "(", "`tile-1-state`", ")", ";", "videoTileStateObject", ".", "innerText", "=", "JSON", ".", "stringify", "(", "videoTileState", ",", "null", ",", "' '", ")", ";", "}", "else", "{", "videoTileStateObject", "=", "document", ".", "getElementById", "(", "`tile-2-state`", ")", ";", "videoTileStateObject", ".", "innerText", "=", "JSON", ".", "stringify", "(", "videoTileState", ",", "null", ",", "' '", ")", ";", "}", "}", ";", "videoTileWasRemoved", "(", "tileId", ")", "{", "const", "localVideoTileState", "=", "document", ".", "getElementById", "(", "'tile-1-state'", ")", ";", "localVideoTileState", ".", "innerText", "=", "''", ";", "const", "remoteVideoTileState", "=", "document", ".", "getElementById", "(", "'tile-2-state'", ")", ";", "remoteVideoTileState", ".", "innerText", "=", "''", ";", "console", ".", "log", "(", "`video tileId removed: ${", "tileId", "}`", ")", ";", "}", "}", "window", ".", "addEventListener", "(", "'load'", ",", "(", ")", "=>", "{", "new", "DemoMeetingApp", "(", ")", ";", "}", ")", ";" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 113, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 10437, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, null, null, null, 1190, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 37, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 15, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 41, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 15, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 41, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1190, null, null, null, null, null, null, null, null, null, null, null, 83, null, null, null, null, null, null, null, null, null, null, null, 83, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 37, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1190, null, null, null, null, null, null, null, null, null, null, null, 83, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 37, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1190, null, null, null, null, null, null, null, null, null, null, null, 83, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 37, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 15, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1190, null, null, null, null, null, null, null, null, null, null, null, 83, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 37, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 15, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1190, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 37, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 15, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1190, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 37, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 15, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1190, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 37, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 15, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1190, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 37, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 15, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 15, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1190, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 37, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 15, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1190, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 37, null, null, null, null, null, null, null, null, null, 83, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 15, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1190, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 37, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 15, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1190, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 37, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 15, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, 16, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, 10985, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 6313, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 4472, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 3, null, null, null, 15, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 15, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1391
[ "import", "{", "publish", ",", "SVGWidget", "}", "from", "\"@hpcc-js/common\"", ";", "import", "{", "axisBottom", "as", "d3AxisBottom", ",", "axisLeft", "as", "d3AxisLeft", ",", "axisRight", "as", "d3AxisRight", ",", "axisTop", "as", "d3AxisTop", "}", "from", "\"d3-axis\"", ";", "import", "{", "format", "as", "d3Format", "}", "from", "\"d3-format\"", ";", "import", "{", "scaleBand", "as", "d3ScaleBand", ",", "scaleLinear", "as", "d3ScaleLinear", ",", "scaleLog", "as", "d3ScaleLog", ",", "scalePow", "as", "d3ScalePow", ",", "scaleTime", "as", "d3ScaleTime", "}", "from", "\"d3-scale\"", ";", "import", "{", "select", "as", "d3Select", "}", "from", "\"d3-selection\"", ";", "import", "{", "timeFormat", "as", "d3TimeFormat", ",", "timeParse", "as", "d3TimeParse", "}", "from", "\"d3-time-format\"", ";", "import", "\"../src/Axis.css\"", ";", "export", "interface", "IOverflow", "{", "left", ":", "number", ";", "top", ":", "number", ";", "right", ":", "number", ";", "bottom", ":", "number", ";", "depth", ":", "number", ";", "tickOverlapModulus", ":", "number", ";", "}", "export", "class", "Axis", "extends", "SVGWidget", "{", "protected", "parser", ";", "protected", "parserInvert", ";", "protected", "formatter", ":", "(", "date", ":", "Date", ")", "=>", "string", ";", "protected", "d3Scale", ";", "protected", "d3Axis", ";", "protected", "d3Guides", ";", "protected", "_guideElement", ";", "protected", "svg", ";", "protected", "svgAxis", ";", "protected", "svgGuides", ";", "@", "publish", "(", "\"linear\"", ",", "\"set\"", ",", "\"Type\"", ",", "[", "\"none\"", ",", "\"ordinal\"", ",", "\"linear\"", ",", "\"pow\"", ",", "\"log\"", ",", "\"time\"", "]", ")", "_type", ":", "string", ";", "type", "(", ")", ";", "type", "(", "_", ")", ";", "type", "(", "_", "?", ")", "{", "if", "(", "!", "arguments", ".", "length", ")", "return", "this", ".", "_type", ";", "this", ".", "_type", "=", "_", ";", "this", ".", "updateScale", "(", ")", ";", "return", "this", ";", "}", "@", "publish", "(", "\"%Y-%m-%d\"", ",", "\"string\"", ",", "\"Time Series Pattern\"", ",", "null", ",", "{", "disable", ":", "(", "w", ")", "=>", "w", ".", "type", "(", ")", "!==", "\"time\"", "}", ")", "_timePattern", ":", "string", ";", "timePattern", "(", ")", ";", "timePattern", "(", "_", ")", ";", "timePattern", "(", "_", "?", ")", "{", "if", "(", "!", "arguments", ".", "length", ")", "return", "this", ".", "_timePattern", ";", "this", ".", "_timePattern", "=", "_", ";", "this", ".", "updateScale", "(", ")", ";", "return", "this", ";", "}", "timePattern_exists", ":", "(", ")", "=>", "boolean", ";", "@", "publish", "(", "false", ",", "\"boolean\"", ",", "\"Reverse\"", ")", "reverse", ":", "publish", "<", "this", ",", "boolean", ">", ";", "constructor", "(", "drawStartPosition", "=", "\"origin\"", ")", "{", "super", "(", ")", ";", "this", ".", "_drawStartPos", "=", "drawStartPosition", ";", "this", ".", "updateScale", "(", ")", ";", "}", "lowValue", "(", ")", "{", "return", "this", ".", "parse", "(", "this", ".", "low", "(", ")", ")", ";", "}", "highValue", "(", ")", "{", "return", "this", ".", "parse", "(", "this", ".", "high", "(", ")", ")", ";", "}", "parse", "(", "d", ",", "forceNumeric", "?", ")", "{", "if", "(", "d", "instanceof", "Array", ")", "{", "return", "d", ".", "map", "(", "function", "(", "d2", ")", "{", "return", "this", ".", "parse", "(", "d2", ")", ";", "}", ",", "this", ")", ";", "}", "if", "(", "d", "!==", "undefined", "&&", "d", "!==", "null", ")", "{", "if", "(", "this", ".", "parser", ")", "{", "return", "this", ".", "parser", "(", "typeof", "d", "===", "\"number\"", "?", "d", ".", "toString", "(", ")", ":", "d", ")", ";", "}", "if", "(", "forceNumeric", "&&", "typeof", "d", "===", "\"string\"", ")", "{", "return", "+", "d", ";", "}", "}", "return", "d", ";", "}", "parseInvert", "(", "d", ")", "{", "if", "(", "d", "instanceof", "Array", ")", "{", "return", "d", ".", "map", "(", "function", "(", "d2", ")", "{", "return", "this", ".", "parseInvert", "(", "d2", ")", ";", "}", ",", "this", ")", ";", "}", "if", "(", "this", ".", "parserInvert", "&&", "d", ")", "{", "return", "this", ".", "parserInvert", "(", "d", ")", ";", "}", "return", "d", ";", "}", "format", "(", "d", ")", "{", "if", "(", "d", "instanceof", "Array", ")", "{", "return", "d", ".", "map", "(", "function", "(", "d2", ")", "{", "return", "this", ".", "format", "(", "d2", ")", ";", "}", ",", "this", ")", ";", "}", "if", "(", "d", "!==", "undefined", "&&", "d", "!==", "null", "&&", "this", ".", "formatter", ")", "{", "return", "this", ".", "formatter", "(", "d", ")", ";", "}", "return", "d", ";", "}", "parseFormat", "(", "d", ")", "{", "return", "this", ".", "format", "(", "this", ".", "parse", "(", "d", ")", ")", ";", "}", "scalePos", "(", "d", ")", "{", "let", "retVal", "=", "this", ".", "d3Scale", "(", "this", ".", "parse", "(", "d", ")", ")", ";", "if", "(", "this", ".", "type", "(", ")", "===", "\"ordinal\"", ")", "{", "retVal", "+=", "this", ".", "bandwidth", "(", ")", "/", "2", ";", "}", "return", "retVal", ";", "}", "bandwidth", "(", ")", "{", "return", "this", ".", "d3Scale", ".", "bandwidth", "?", "this", ".", "d3Scale", ".", "bandwidth", "(", ")", ":", "0", ";", "}", "isHorizontal", "(", ")", "{", "switch", "(", "this", ".", "orientation", "(", ")", ")", "{", "case", "\"left\"", ":", "case", "\"right\"", ":", "return", "false", ";", "default", ":", "}", "return", "true", ";", "}", "domain", "(", "_", ")", "{", "if", "(", "!", "arguments", ".", "length", ")", "return", "this", ".", "d3Scale", ".", "domain", "(", ")", ";", "this", ".", "d3Scale", ".", "domain", "(", "_", ")", ";", "return", "this", ";", "}", "range", "(", "_", ")", "{", "if", "(", "!", "arguments", ".", "length", ")", "{", "if", "(", "this", ".", "d3Scale", ".", "rangeRoundBands", ")", "{", "return", "this", ".", "d3Scale", ".", "rangeExtent", "(", ")", ";", "}", "else", "if", "(", "this", ".", "d3Scale", ".", "rangeRound", ")", "{", "return", "this", ".", "d3Scale", ".", "range", "(", ")", ";", "}", "}", "if", "(", "this", ".", "d3Scale", ".", "rangeRoundBands", ")", "{", "this", ".", "d3Scale", ".", "rangeRoundBands", "(", "_", ",", "0.1", ")", ";", "}", "else", "if", "(", "this", ".", "d3Scale", ".", "rangeRound", ")", "{", "this", ".", "d3Scale", ".", "range", "(", "_", ")", ";", "}", "return", "this", ";", "}", "invert", "(", "pos", ")", "{", "return", "this", ".", "d3Scale", ".", "invert", "(", "pos", ")", ";", "}", "guideTarget", "(", "_", ")", "{", "this", ".", "_guideElement", "=", "d3Select", "(", "_", ")", ".", "attr", "(", "\"class\"", ",", "this", ".", "_class", ")", ";", "return", "this", ";", "}", "enter", "(", "domNode", ",", "element", ")", "{", "super", ".", "enter", "(", "domNode", ",", "element", ")", ";", "this", ".", "svg", "=", "element", ".", "append", "(", "\"g\"", ")", ";", "this", ".", "svgAxis", "=", "this", ".", "svg", ".", "append", "(", "\"g\"", ")", ".", "attr", "(", "\"class\"", ",", "\"axis\"", ")", ";", "this", ".", "svgGuides", "=", "(", "this", ".", "_guideElement", "||", "element", ")", ".", "append", "(", "\"g\"", ")", ".", "attr", "(", "\"class\"", ",", "\"guide\"", ")", ";", "}", "protected", "_prevOrientation", ";", "updateScale", "(", ")", "{", "switch", "(", "this", ".", "type", "(", ")", ")", "{", "case", "\"ordinal\"", ":", "this", ".", "d3Scale", "=", "d3ScaleBand", "(", ")", ".", "paddingInner", "(", "this", ".", "ordinalPaddingInner", "(", ")", ")", ".", "paddingOuter", "(", "this", ".", "ordinalPaddingOuter", "(", ")", ")", ";", "if", "(", "this", ".", "ordinals_exists", "(", ")", ")", "{", "this", ".", "d3Scale", ".", "domain", "(", "this", ".", "ordinals", "(", ")", ")", ";", "}", "this", ".", "parser", "=", "null", ";", "if", "(", "this", ".", "ordinalMappings_exists", "(", ")", ")", "{", "const", "mappings", "=", "this", ".", "ordinalMappings", "(", ")", ";", "this", ".", "formatter", "=", "(", "_", ")", "=>", "mappings", "[", "_", "]", "||", "_", ";", "}", "else", "{", "this", ".", "formatter", "=", "null", ";", "}", "break", ";", "case", "\"linear\"", ":", "this", ".", "d3Scale", "=", "d3ScaleLinear", "(", ")", ";", "if", "(", "this", ".", "low_exists", "(", ")", "&&", "this", ".", "high_exists", "(", ")", ")", "{", "this", ".", "d3Scale", ".", "domain", "(", "[", "this", ".", "lowValue", "(", ")", ",", "this", ".", "highValue", "(", ")", "]", ")", ";", "}", "this", ".", "parser", "=", "null", ";", "this", ".", "formatter", "=", "this", ".", "tickFormat_exists", "(", ")", "?", "d3Format", "(", "this", ".", "tickFormat", "(", ")", ")", ":", "null", ";", "break", ";", "case", "\"pow\"", ":", "this", ".", "d3Scale", "=", "d3ScalePow", "(", ")", ".", "exponent", "(", "this", ".", "powExponent", "(", ")", ")", ";", "if", "(", "this", ".", "low_exists", "(", ")", "&&", "this", ".", "high_exists", "(", ")", ")", "{", "this", ".", "d3Scale", ".", "domain", "(", "[", "this", ".", "lowValue", "(", ")", ",", "this", ".", "highValue", "(", ")", "]", ")", ";", "}", "this", ".", "parser", "=", "null", ";", "this", ".", "formatter", "=", "this", ".", "tickFormat_exists", "(", ")", "?", "d3Format", "(", "this", ".", "tickFormat", "(", ")", ")", ":", "null", ";", "break", ";", "case", "\"log\"", ":", "this", ".", "d3Scale", "=", "d3ScaleLog", "(", ")", ".", "base", "(", "this", ".", "logBase", "(", ")", ")", ";", "if", "(", "this", ".", "low_exists", "(", ")", "&&", "this", ".", "high_exists", "(", ")", ")", "{", "this", ".", "d3Scale", ".", "domain", "(", "[", "this", ".", "lowValue", "(", ")", ",", "this", ".", "highValue", "(", ")", "]", ")", ";", "}", "this", ".", "parser", "=", "null", ";", "this", ".", "formatter", "=", "this", ".", "tickFormat_exists", "(", ")", "?", "d3Format", "(", "this", ".", "tickFormat", "(", ")", ")", ":", "null", ";", "break", ";", "case", "\"time\"", ":", "this", ".", "d3Scale", "=", "d3ScaleTime", "(", ")", ";", "if", "(", "this", ".", "low_exists", "(", ")", "&&", "this", ".", "high_exists", "(", ")", ")", "{", "this", ".", "d3Scale", ".", "domain", "(", "[", "this", ".", "lowValue", "(", ")", ",", "this", ".", "highValue", "(", ")", "]", ")", ";", "}", "this", ".", "parser", "=", "this", ".", "timePattern_exists", "(", ")", "?", "d3TimeParse", "(", "this", ".", "timePattern", "(", ")", ")", ":", "null", ";", "this", ".", "parserInvert", "=", "this", ".", "timePattern_exists", "(", ")", "?", "d3TimeFormat", "(", "this", ".", "timePattern", "(", ")", ")", ":", "null", ";", "this", ".", "formatter", "=", "this", ".", "tickFormat_exists", "(", ")", "?", "d3TimeFormat", "(", "this", ".", "tickFormat", "(", ")", ")", ":", "null", ";", "break", ";", "default", ":", "}", "if", "(", "this", ".", "_prevOrientation", "!==", "this", ".", "orientation", "(", ")", ")", "{", "switch", "(", "this", ".", "orientation", "(", ")", ")", "{", "case", "\"left\"", ":", "this", ".", "d3Axis", "=", "d3AxisLeft", "(", "this", ".", "d3Scale", ")", ";", "this", ".", "d3Guides", "=", "d3AxisLeft", "(", "this", ".", "d3Scale", ")", ";", "break", ";", "case", "\"top\"", ":", "this", ".", "d3Axis", "=", "d3AxisTop", "(", "this", ".", "d3Scale", ")", ";", "this", ".", "d3Guides", "=", "d3AxisTop", "(", "this", ".", "d3Scale", ")", ";", "break", ";", "case", "\"right\"", ":", "this", ".", "d3Axis", "=", "d3AxisRight", "(", "this", ".", "d3Scale", ")", ";", "this", ".", "d3Guides", "=", "d3AxisRight", "(", "this", ".", "d3Scale", ")", ";", "break", ";", "case", "\"bottom\"", ":", "default", ":", "this", ".", "d3Axis", "=", "d3AxisBottom", "(", "this", ".", "d3Scale", ")", ";", "this", ".", "d3Guides", "=", "d3AxisBottom", "(", "this", ".", "d3Scale", ")", ";", "break", ";", "}", "this", ".", "_prevOrientation", "=", "this", ".", "orientation", "(", ")", ";", "if", "(", "this", ".", "svgAxis", ")", "{", "this", ".", "svgAxis", ".", "html", "(", "\"\"", ")", ";", "}", "if", "(", "this", ".", "svgGuides", ")", "{", "this", ".", "svgGuides", ".", "html", "(", "\"\"", ")", ";", "}", "}", "if", "(", "this", ".", "extend", "(", ")", ")", "{", "switch", "(", "this", ".", "type", "(", ")", ")", "{", "case", "\"ordinal\"", ":", "break", ";", "default", ":", "let", "length", ";", "let", "delta", ";", "let", "low", ";", "let", "high", ";", "let", "newLow", ";", "let", "newHigh", ";", "if", "(", "this", ".", "isHorizontal", "(", ")", ")", "{", "length", "=", "this", ".", "width", "(", ")", ";", "this", ".", "d3Scale", ".", "range", "(", "[", "0", ",", "length", "]", ")", ";", "delta", "=", "length", "*", "this", ".", "extend", "(", ")", "/", "100", ";", "low", "=", "this", ".", "d3Scale", ".", "invert", "(", "0", ")", ";", "newLow", "=", "this", ".", "d3Scale", ".", "invert", "(", "-", "delta", ")", ";", "high", "=", "this", ".", "d3Scale", ".", "invert", "(", "length", ")", ";", "newHigh", "=", "this", ".", "d3Scale", ".", "invert", "(", "length", "+", "delta", ")", ";", "}", "else", "{", "length", "=", "this", ".", "height", "(", ")", ";", "this", ".", "d3Scale", ".", "range", "(", "[", "length", ",", "0", "]", ")", ";", "delta", "=", "length", "*", "this", ".", "extend", "(", ")", "/", "100", ";", "low", "=", "this", ".", "d3Scale", ".", "invert", "(", "length", ")", ";", "newLow", "=", "this", ".", "d3Scale", ".", "invert", "(", "length", "+", "delta", ")", ";", "high", "=", "this", ".", "d3Scale", ".", "invert", "(", "0", ")", ";", "newHigh", "=", "this", ".", "d3Scale", ".", "invert", "(", "-", "delta", ")", ";", "}", "if", "(", "newLow", "===", "low", ")", "{", "newLow", "=", "low", "-", "low", "*", "this", ".", "extend", "(", ")", "/", "100", ";", "}", "if", "(", "newHigh", "===", "high", ")", "{", "newHigh", "=", "high", "+", "high", "*", "this", ".", "extend", "(", ")", "/", "100", ";", "}", "if", "(", "(", "Math", "as", "any", ")", ".", "sign", "(", "low", ")", "!==", "(", "Math", "as", "any", ")", ".", "sign", "(", "newLow", ")", ")", "{", "newLow", "=", "0", ";", "}", "if", "(", "(", "Math", "as", "any", ")", ".", "sign", "(", "high", ")", "!==", "(", "Math", "as", "any", ")", ".", "sign", "(", "newHigh", ")", ")", "{", "newHigh", "=", "0", ";", "}", "this", ".", "d3Scale", ".", "domain", "(", "[", "newLow", ",", "newHigh", "]", ")", ";", "break", ";", "}", "}", "this", ".", "d3Axis", ".", "scale", "(", "this", ".", "d3Scale", ")", ".", "tickFormat", "(", "this", ".", "formatter", ")", ".", "ticks", "(", "this", ".", "tickCount", "(", ")", ")", ";", "this", ".", "d3Guides", ".", "scale", "(", "this", ".", "d3Scale", ")", ".", "tickSize", "(", "this", ".", "tickLength_exists", "(", ")", "?", "-", "this", ".", "tickLength", "(", ")", ":", "0", ")", ".", "tickFormat", "(", "\"\"", ")", ".", "ticks", "(", "this", ".", "tickCount", "(", ")", ")", ";", "const", "customTicks", "=", "this", ".", "ticks", "(", ")", ";", "if", "(", "customTicks", ".", "length", ")", "{", "this", ".", "d3Axis", ".", "tickValues", "(", "customTicks", ".", "map", "(", "d", "=>", "this", ".", "parse", "(", "d", ".", "value", ")", ")", ")", ".", "tickFormat", "(", "(", "_d", ",", "i", ")", "=>", "{", "return", "customTicks", "[", "i", "]", ".", "label", ";", "}", ")", ";", "this", ".", "d3Guides", ".", "tickValues", "(", "customTicks", ".", "map", "(", "d", "=>", "this", ".", "parse", "(", "d", ".", "value", ")", ")", ")", ";", "}", "return", "this", ";", "}", "adjustText", "(", "svg", ",", "tickOverlapModulus", ")", "{", "const", "isHoriztontal", "=", "this", ".", "isHorizontal", "(", ")", ";", "const", "isLeft", "=", "this", ".", "orientation", "(", ")", "===", "\"left\"", ";", "const", "isBottom", "=", "this", ".", "orientation", "(", ")", "===", "\"bottom\"", ";", "const", "context", "=", "this", ";", "const", "textSelection", "=", "svg", ".", "selectAll", "(", "\".tick > text\"", ")", ".", "style", "(", "\"font-family\"", ",", "this", ".", "fontFamily", "(", ")", ")", ".", "style", "(", "\"font-size\"", ",", "this", ".", "fontSize_exists", "(", ")", "?", "this", ".", "fontSize", "(", ")", "+", "\"px\"", ":", "null", ")", ";", "if", "(", "this", ".", "overlapMode", "(", ")", "===", "\"linebreak\"", ")", "{", "if", "(", "this", ".", "type", "(", ")", "===", "\"ordinal\"", ")", "{", "textSelection", ".", "call", "(", "function", "(", ")", "{", "return", "context", ".", "linebreak", ".", "apply", "(", "context", ",", "arguments", ")", ";", "}", ",", "this", ".", "bandwidth", "(", ")", ")", ";", "}", "}", "else", "if", "(", "this", ".", "overlapMode", "(", ")", "===", "\"wrap\"", ")", "{", "if", "(", "this", ".", "type", "(", ")", "===", "\"ordinal\"", ")", "{", "textSelection", ".", "call", "(", "function", "(", ")", "{", "return", "context", ".", "wrap", ".", "apply", "(", "context", ",", "arguments", ")", ";", "}", ",", "this", ".", "bandwidth", "(", ")", ")", ";", "}", "}", "else", "{", "switch", "(", "isHoriztontal", "?", "this", ".", "overlapMode", "(", ")", ":", "\"none\"", ")", "{", "case", "\"stagger\"", ":", "textSelection", ".", "style", "(", "\"text-anchor\"", ",", "\"middle\"", ")", ".", "attr", "(", "\"dy\"", ",", "function", "(", "_d", ",", "i", ")", "{", "return", "(", "isBottom", "?", "1", ":", "-", "1", ")", "*", "(", "(", "isBottom", "?", "0.71", ":", "0", ")", "+", "i", "%", "tickOverlapModulus", ")", "+", "\"em\"", ";", "}", ")", ".", "attr", "(", "\"dx\"", ",", "0", ")", ".", "attr", "(", "\"visibility\"", ",", "null", ")", ".", "attr", "(", "\"transform\"", ",", "\"rotate(0)\"", ")", ";", "break", ";", "case", "\"hide\"", ":", "textSelection", ".", "style", "(", "\"text-anchor\"", ",", "\"middle\"", ")", ".", "attr", "(", "\"dy\"", ",", "(", "isBottom", "?", "0.71", ":", "0", ")", "+", "\"em\"", ")", ".", "attr", "(", "\"dx\"", ",", "0", ")", ".", "attr", "(", "\"visibility\"", ",", "function", "(", "_d", ",", "i", ")", "{", "return", "i", "%", "tickOverlapModulus", "?", "\"hidden\"", ":", "null", ";", "}", ")", ".", "attr", "(", "\"transform\"", ",", "\"rotate(0)\"", ")", ";", "break", ";", "case", "\"rotate\"", ":", "const", "deg", "=", "-", "(", "this", ".", "labelRotation", "(", ")", ")", "||", "0", ";", "if", "(", "deg", "!==", "0", "&&", "tickOverlapModulus", ">", "1", ")", "{", "textSelection", ".", "each", "(", "function", "(", ")", "{", "const", "elm", "=", "d3Select", "(", "this", ")", ";", "const", "bbox", "=", "elm", ".", "node", "(", ")", ".", "getBBox", "(", ")", ";", "const", "dyOff", "=", "(", "isBottom", "?", "1", ":", "-", "1", ")", "*", "Math", ".", "sin", "(", "Math", ".", "PI", "*", "(", "-", "Math", ".", "abs", "(", "deg", ")", "/", "180", ")", ")", ";", "elm", ".", "style", "(", "\"text-anchor\"", ",", "deg", ">", "0", "?", "(", "isBottom", "?", "\"start\"", ":", "\"end\"", ")", ":", "(", "isBottom", "?", "\"end\"", ":", "\"start\"", ")", ")", ".", "attr", "(", "\"dy\"", ",", "(", "bbox", ".", "height", "/", "2", "*", "dyOff", ")", "+", "\"px\"", ")", ".", "attr", "(", "\"dx\"", ",", "deg", ">", "0", "?", "(", "isBottom", "?", "\"0.71em\"", ":", "\"-0.71em\"", ")", ":", "(", "isBottom", "?", "\"-0.71em\"", ":", "\"0.71em\"", ")", ")", ".", "attr", "(", "\"transform\"", ",", "\"rotate(\"", "+", "deg", "+", "\")\"", ")", ".", "attr", "(", "\"visibility\"", ",", "null", ")", ";", "}", ")", ";", "break", ";", "}", "default", ":", "textSelection", ".", "style", "(", "\"text-anchor\"", ",", "isHoriztontal", "?", "\"middle\"", ":", "isLeft", "?", "\"end\"", ":", "\"start\"", ")", ".", "attr", "(", "\"dy\"", ",", "isHoriztontal", "?", "(", "(", "isBottom", "?", "0.71", ":", "0", ")", "+", "\"em\"", ")", ":", "\"0.32em\"", ")", ".", "attr", "(", "\"dx\"", ",", "0", ")", ".", "attr", "(", "\"visibility\"", ",", "null", ")", ".", "attr", "(", "\"transform\"", ",", "\"rotate(0)\"", ")", ";", "}", "}", "}", "calcTickOverlapModulus", "(", "element", ")", "{", "let", "retVal", "=", "1", ";", "switch", "(", "this", ".", "overlapMode", "(", ")", ")", "{", "case", "\"rotate\"", ":", "case", "\"stagger\"", ":", "case", "\"hide\"", ":", "const", "bboxArr", "=", "[", "]", ";", "element", ".", "selectAll", "(", "\".tick > text\"", ")", ".", "each", "(", "function", "(", ")", "{", "const", "bbox", "=", "this", ".", "getBoundingClientRect", "(", ")", ";", "for", "(", "let", "i", "=", "bboxArr", ".", "length", "-", "1", ";", "i", ">=", "0", ";", "--", "i", ")", "{", "if", "(", "bboxArr", "[", "i", "]", ".", "right", "<", "bbox", ".", "left", ")", "{", "break", ";", "}", "if", "(", "bboxArr", ".", "length", "+", "1", "-", "i", ">", "retVal", ")", "{", "retVal", "=", "bboxArr", ".", "length", "+", "1", "-", "i", ";", "}", "}", "bboxArr", ".", "push", "(", "bbox", ")", ";", "}", ")", ";", "break", ";", "default", ":", "}", "return", "retVal", ";", "}", "calcOverflow", "(", "element", ",", "ignoreText", "?", ")", "{", "this", ".", "updateScale", "(", ")", ";", "if", "(", "this", ".", "hidden", "(", ")", ")", "{", "return", "{", "left", ":", "0", ",", "top", ":", "0", ",", "right", ":", "0", ",", "bottom", ":", "0", ",", "depth", ":", "0", ",", "tickOverlapModulus", ":", "1", "}", ";", "}", "const", "isHorizontal", "=", "this", ".", "isHorizontal", "(", ")", ";", "this", ".", "range", "(", "isHorizontal", "?", "[", "0", ",", "this", ".", "width", "(", ")", "]", ":", "[", "this", ".", "height", "(", ")", ",", "0", "]", ")", ";", "const", "tmpSvg", "=", "element", ".", "append", "(", "\"g\"", ")", ".", "attr", "(", "\"class\"", ",", "this", ".", "classID", "(", ")", ")", ";", "const", "tmpSvgG", "=", "tmpSvg", ".", "append", "(", "\"g\"", ")", ";", "tmpSvgG", ".", "attr", "(", "\"class\"", ",", "isHorizontal", "?", "\"x\"", ":", "\"y\"", ")", ".", "call", "(", "this", ".", "d3Axis", ")", ";", "if", "(", "ignoreText", ")", "{", "element", ".", "selectAll", "(", "\".tick > text\"", ")", ".", "remove", "(", ")", ";", "}", "const", "retVal", "=", "{", "left", ":", "0", ",", "top", ":", "0", ",", "right", ":", "0", ",", "bottom", ":", "0", ",", "depth", ":", "0", ",", "tickOverlapModulus", ":", "this", ".", "calcTickOverlapModulus", "(", "tmpSvgG", ")", "}", ";", "this", ".", "adjustText", "(", "tmpSvgG", ",", "retVal", ".", "tickOverlapModulus", ")", ";", "const", "bbox", "=", "tmpSvgG", ".", "node", "(", ")", ".", "getBBox", "(", ")", ";", "retVal", ".", "depth", "=", "isHorizontal", "?", "bbox", ".", "height", ":", "bbox", ".", "width", ";", "switch", "(", "this", ".", "shrinkToFit", "(", ")", ")", "{", "case", "\"low\"", ":", "case", "\"both\"", ":", "retVal", ".", "left", "=", "isHorizontal", "?", "-", "bbox", ".", "x", ":", "0", ";", "retVal", ".", "bottom", "=", "isHorizontal", "?", "0", ":", "-", "(", "this", ".", "height", "(", ")", "-", "(", "bbox", ".", "height", "+", "bbox", ".", "y", ")", ")", ";", "break", ";", "default", ":", "}", "switch", "(", "this", ".", "shrinkToFit", "(", ")", ")", "{", "case", "\"high\"", ":", "case", "\"both\"", ":", "retVal", ".", "top", "=", "isHorizontal", "?", "0", ":", "-", "bbox", ".", "y", ";", "retVal", ".", "right", "=", "isHorizontal", "?", "-", "(", "this", ".", "width", "(", ")", "-", "bbox", ".", "x", "-", "bbox", ".", "width", ")", ":", "0", ";", "break", ";", "default", ":", "}", "tmpSvg", ".", "remove", "(", ")", ";", "return", "retVal", ";", "}", "wrap", "(", "_text", ",", "bandSize", ",", "re", ")", "{", "re", "=", "re", "||", "/\\s+/", ";", "const", "context", "=", "this", ";", "_text", ".", "each", "(", "function", "(", ")", "{", "const", "text", "=", "d3Select", "(", "this", ")", ";", "const", "words", "=", "text", ".", "text", "(", ")", ".", "split", "(", "re", ")", ".", "reverse", "(", ")", ";", "let", "line", "=", "[", "]", ";", "let", "lineNumber", "=", "0", ";", "const", "lineHeight", "=", "1.1", ";", "const", "x", "=", "text", ".", "attr", "(", "\"x\"", ")", ";", "const", "y", "=", "text", ".", "attr", "(", "\"y\"", ")", ";", "const", "fs", "=", "parseFloat", "(", "text", ".", "style", "(", "\"font-size\"", ")", ")", "||", "10", ";", "const", "maxLinesPerBand", "=", "Math", ".", "floor", "(", "bandSize", "/", "(", "fs", "*", "lineHeight", ")", ")", "-", "1", ";", "const", "minWordsPerLine", "=", "context", ".", "isHorizontal", "(", ")", "?", "1", ":", "Math", ".", "ceil", "(", "words", ".", "length", "/", "maxLinesPerBand", ")", ";", "const", "dy", "=", "parseFloat", "(", "text", ".", "attr", "(", "\"dy\"", ")", ")", ";", "let", "tspan", "=", "text", ".", "text", "(", "null", ")", ".", "append", "(", "\"tspan\"", ")", ".", "attr", "(", "\"x\"", ",", "x", ")", ".", "attr", "(", "\"y\"", ",", "y", ")", ".", "attr", "(", "\"dy\"", ",", "dy", "+", "\"em\"", ")", ";", "let", "wordsOnLine", "=", "0", ";", "let", "word", "=", "words", ".", "pop", "(", ")", ";", "while", "(", "word", ")", "{", "line", ".", "push", "(", "word", ")", ";", "tspan", ".", "text", "(", "line", ".", "join", "(", "\" \"", ")", ")", ";", "wordsOnLine", "++", ";", "if", "(", "(", "tspan", ".", "node", "(", ")", "as", "any", ")", ".", "getComputedTextLength", "(", ")", ">", "bandSize", "&&", "wordsOnLine", ">=", "minWordsPerLine", ")", "{", "line", ".", "pop", "(", ")", ";", "tspan", ".", "text", "(", "line", ".", "join", "(", "\" \"", ")", ")", ";", "line", "=", "[", "word", "]", ";", "tspan", "=", "text", ".", "append", "(", "\"tspan\"", ")", ".", "attr", "(", "\"x\"", ",", "x", ")", ".", "attr", "(", "\"y\"", ",", "y", ")", ".", "attr", "(", "\"dy\"", ",", "++", "lineNumber", "*", "lineHeight", "+", "dy", "+", "\"em\"", ")", ".", "text", "(", "word", ")", ";", "wordsOnLine", "=", "0", ";", "}", "word", "=", "words", ".", "pop", "(", ")", ";", "}", "if", "(", "!", "context", ".", "isHorizontal", "(", ")", ")", "{", "text", ".", "selectAll", "(", "\"tspan\"", ")", ".", "attr", "(", "\"y\"", ",", "(", "-", "lineNumber", "/", "2", ")", "+", "\"em\"", ")", ";", "}", "}", ")", ";", "}", "linebreak", "(", "text", ",", "bandSize", ")", "{", "this", ".", "wrap", "(", "text", ",", "bandSize", ",", "\"\\n\"", ")", ";", "}", "update", "(", "domNode", ",", "element", ")", "{", "super", ".", "update", "(", "domNode", ",", "element", ")", ";", "this", ".", "svg", ".", "style", "(", "\"display\"", ",", "this", ".", "hidden", "(", ")", "?", "\"none\"", ":", "null", ")", ";", "const", "overlap", "=", "this", ".", "calcOverflow", "(", "element", ")", ";", "const", "lowerPos", "=", "this", ".", "isHorizontal", "(", ")", "?", "overlap", ".", "left", ":", "this", ".", "height", "(", ")", "-", "overlap", ".", "top", "-", "overlap", ".", "bottom", ";", "const", "upperPos", "=", "this", ".", "isHorizontal", "(", ")", "?", "this", ".", "width", "(", ")", "-", "overlap", ".", "right", ":", "0", ";", "this", ".", "range", "(", "this", ".", "reverse", "(", ")", "?", "[", "upperPos", ",", "lowerPos", "]", ":", "[", "lowerPos", ",", "upperPos", "]", ")", ";", "const", "context", "=", "this", ";", "function", "doPosition", "(", "element", ")", "{", "element", ".", "attr", "(", "\"transform\"", ",", "function", "(", ")", "{", "switch", "(", "context", ".", "orientation", "(", ")", ")", "{", "case", "\"left\"", ":", "return", "\"translate(\"", "+", "overlap", ".", "depth", "+", "\", \"", "+", "overlap", ".", "top", "+", "\")\"", ";", "case", "\"top\"", ":", "return", "\"translate(0,\"", "+", "overlap", ".", "depth", "+", "\")\"", ";", "case", "\"right\"", ":", "return", "\"translate(\"", "+", "(", "context", ".", "width", "(", ")", "-", "overlap", ".", "depth", ")", "+", "\", \"", "+", "overlap", ".", "top", "+", "\")\"", ";", "case", "\"bottom\"", ":", "return", "\"translate(0,\"", "+", "(", "context", ".", "height", "(", ")", "-", "overlap", ".", "depth", ")", "+", "\")\"", ";", "default", ":", "}", "return", "\"translate(0,0)\"", ";", "}", ")", ";", "}", "this", ".", "svg", ".", "style", "(", "\"visibility\"", ",", "this", ".", "type", "(", ")", "===", "\"none\"", "?", "\"hidden\"", ":", "null", ")", ".", "transition", "(", ")", ".", "call", "(", "doPosition", ")", ";", "if", "(", "this", ".", "_guideElement", ")", "{", "this", ".", "svgGuides", ".", "transition", "(", ")", ".", "call", "(", "doPosition", ")", ";", "}", "this", ".", "svgAxis", ".", "call", "(", "this", ".", "d3Axis", ")", ";", "this", ".", "adjustText", "(", "this", ".", "svgAxis", ",", "overlap", ".", "tickOverlapModulus", ")", ";", "const", "svgLineBBox", "=", "{", "x", ":", "this", ".", "pos", "(", ")", ".", "x", ",", "width", ":", "this", ".", "width", "(", ")", "}", ";", "const", "svgText", "=", "this", ".", "svgAxis", ".", "selectAll", "(", "\".axisTitle\"", ")", ".", "data", "(", "this", ".", "title", "(", ")", "?", "[", "this", ".", "title", "(", ")", "]", ":", "[", "]", ")", ";", "const", "svgTextUpdate", "=", "svgText", ".", "enter", "(", ")", ".", "append", "(", "\"text\"", ")", ".", "attr", "(", "\"class\"", ",", "\"axisTitle\"", ")", ".", "merge", "(", "svgText", ")", ";", "const", "svgTitleTransition", "=", "svgTextUpdate", ".", "transition", "(", ")", ".", "attr", "(", "\"dx\"", ",", "null", ")", ".", "style", "(", "\"text-anchor\"", ",", "\"end\"", ")", ";", "switch", "(", "this", ".", "orientation", "(", ")", ")", "{", "case", "\"left\"", ":", "svgTitleTransition", ".", "attr", "(", "\"transform\"", ",", "\"rotate(-90)\"", ")", ".", "attr", "(", "\"x\"", ",", "-", "2", ")", ".", "attr", "(", "\"y\"", ",", "2", ")", ".", "attr", "(", "\"dy\"", ",", "\".71em\"", ")", ";", "break", ";", "case", "\"right\"", ":", "svgTitleTransition", ".", "attr", "(", "\"transform\"", ",", "\"rotate(-90)\"", ")", ".", "attr", "(", "\"x\"", ",", "-", "2", ")", ".", "attr", "(", "\"y\"", ",", "4", ")", ".", "attr", "(", "\"dx\"", ",", "null", ")", ".", "attr", "(", "\"dy\"", ",", "\"-.71em\"", ")", ";", "break", ";", "case", "\"top\"", ":", "svgTitleTransition", ".", "attr", "(", "\"transform\"", ",", "\"rotate(0)\"", ")", ".", "attr", "(", "\"x\"", ",", "svgLineBBox", ".", "width", "-", "2", ")", ".", "attr", "(", "\"y\"", ",", "2", ")", ".", "attr", "(", "\"dx\"", ",", "null", ")", ".", "attr", "(", "\"dy\"", ",", "\".71em\"", ")", ";", "break", ";", "case", "\"bottom\"", ":", "svgTitleTransition", ".", "attr", "(", "\"transform\"", ",", "\"rotate(0)\"", ")", ".", "attr", "(", "\"x\"", ",", "svgLineBBox", ".", "width", "-", "2", ")", ".", "attr", "(", "\"y\"", ",", "-", "2", ")", ".", "attr", "(", "\"dy\"", ",", "null", ")", ";", "break", ";", "default", ":", "}", "svgTitleTransition", ".", "text", "(", "this", ".", "title_exists", "(", ")", "?", "this", ".", "title", "(", ")", ":", "\"\"", ")", ";", "svgText", ".", "exit", "(", ")", ".", "remove", "(", ")", ";", "this", ".", "svgGuides", ".", "call", "(", "this", ".", "d3Guides", ")", ".", "selectAll", "(", "\".tick\"", ")", ".", "classed", "(", "\"guide-0\"", ",", "d", "=>", "d", "===", "0", "&&", "this", ".", "low", "(", ")", "<", "0", ")", ";", "}", "rerender", "(", ")", "{", "this", ".", "svgAxis", ".", "call", "(", "this", ".", "d3Axis", ")", ";", "this", ".", "svgGuides", ".", "call", "(", "this", ".", "d3Guides", ")", ";", "}", "postUpdate", "(", "domNode", ",", "element", ")", "{", "super", ".", "postUpdate", "(", "domNode", ",", "element", ")", ";", "if", "(", "this", ".", "_guideElement", ")", "{", "this", ".", "_guideElement", ".", "attr", "(", "\"transform\"", ",", "this", ".", "_element", ".", "attr", "(", "\"transform\"", ")", ")", ";", "}", "}", "title", ":", "{", "(", ")", ":", "string", ";", "(", "_", ")", ":", "Axis", ";", "}", ";", "orientation", ":", "{", "(", ")", ":", "string", ";", "(", "_", ")", ":", "Axis", ";", "}", ";", "orientation_default", ":", "{", "(", ")", ":", "string", ";", "(", "_", ")", ":", "Axis", ";", "}", ";", "powExponent", ":", "{", "(", ")", ":", "number", ";", "(", "_", ")", ":", "Axis", ";", "}", ";", "logBase", ":", "{", "(", ")", ":", "number", ";", "(", "_", ")", ":", "Axis", ";", "}", ";", "ordinals", ":", "{", "(", ")", ":", "string", "[", "]", ";", "(", "_", ")", ":", "Axis", ";", "}", ";", "ordinals_exists", ":", "(", ")", "=>", "boolean", ";", "fontSize", ":", "{", "(", ")", ":", "number", ";", "(", "_", ")", ":", "Axis", ";", "}", ";", "fontSize_exists", ":", "(", ")", "=>", "boolean", ";", "fontFamily", ":", "{", "(", ")", ":", "string", ";", "(", "_", ")", ":", "Axis", ";", "}", ";", "tickCount", ":", "{", "(", ")", ":", "number", ";", "(", "_", ")", ":", "Axis", ";", "}", ";", "tickFormat", ":", "{", "(", ")", ":", "string", ";", "(", "_", ")", ":", "Axis", ";", "}", ";", "tickFormat_exists", ":", "(", ")", "=>", "boolean", ";", "tickLength", ":", "{", "(", ")", ":", "number", ";", "(", "_", ")", ":", "Axis", ";", "}", ";", "tickLength_exists", ":", "(", ")", "=>", "boolean", ";", "ticks", ":", "{", "(", ")", ":", "Array", "<", "{", "value", ":", "string", ";", "label", ":", "string", ";", "}", ">", ";", "(", "_", ")", ":", "Axis", ";", "}", ";", "xAxisDomainLow", ":", "{", "(", ")", ":", "string", ";", "(", "_", ")", ":", "Axis", ";", "}", ";", "xAxisDomainHigh", ":", "{", "(", ")", ":", "string", ";", "(", "_", ")", ":", "Axis", ";", "}", ";", "low", ":", "{", "(", ")", ":", "any", ";", "(", "_", ")", ":", "Axis", ";", "}", ";", "low_exists", ":", "(", ")", "=>", "boolean", ";", "high", ":", "{", "(", ")", ":", "any", ";", "(", "_", ")", ":", "Axis", ";", "}", ";", "high_exists", ":", "(", ")", "=>", "boolean", ";", "overlapMode", ":", "{", "(", ")", ":", "string", ";", "(", "_", ")", ":", "Axis", ";", "}", ";", "overlapMode_default", ":", "{", "(", ")", ":", "string", ";", "(", "_", ")", ":", "Axis", ";", "}", ";", "labelRotation", ":", "{", "(", ")", ":", "number", ";", "(", "_", ")", ":", "Axis", ";", "}", ";", "shrinkToFit", ":", "{", "(", ")", ":", "string", ";", "(", "_", ")", ":", "Axis", ";", "}", ";", "shrinkToFit_default", ":", "{", "(", ")", ":", "string", ";", "(", "_", ")", ":", "Axis", ";", "}", ";", "extend", ":", "{", "(", ")", ":", "number", ";", "(", "_", ")", ":", "Axis", ";", "}", ";", "extend_default", ":", "{", "(", ")", ":", "number", ";", "(", "_", ")", ":", "Axis", ";", "}", ";", "hidden", ":", "{", "(", ")", ":", "boolean", ";", "(", "_", ")", ":", "Axis", ";", "}", ";", "}", "Axis", ".", "prototype", ".", "_class", "+=", "\" chart_Axis\"", ";", "export", "interface", "Axis", "{", "title_exists", "(", ")", ":", "boolean", ";", "ordinalPaddingInner", "(", ")", ":", "number", ";", "ordinalPaddingInner", "(", "_", ")", ":", "this", ";", "ordinalPaddingOuter", "(", ")", ":", "number", ";", "ordinalPaddingOuter", "(", "_", ")", ":", "this", ";", "ordinalMappings", "(", "_", ")", ":", "this", ";", "ordinalMappings", "(", ")", ":", "{", "[", "key", "]", ":", "string", ";", "}", ";", "ordinalMappings_exists", "(", ")", ":", "boolean", ";", "}", "Axis", ".", "prototype", ".", "publish", "(", "\"title\"", ",", "null", ",", "\"string\"", ",", "\"Title\"", ")", ";", "Axis", ".", "prototype", ".", "publish", "(", "\"orientation\"", ",", "\"bottom\"", ",", "\"set\"", ",", "\"Placement/orientation of the axis\"", ",", "[", "\"left\"", ",", "\"top\"", ",", "\"right\"", ",", "\"bottom\"", "]", ")", ";", "Axis", ".", "prototype", ".", "publish", "(", "\"powExponent\"", ",", "2", ",", "\"number\"", ",", "\"Power exponent (disabled when type is not 'pow')\"", ",", "null", ",", "{", "disable", ":", "(", "w", ")", "=>", "w", ".", "type", "(", ")", "!==", "\"pow\"", "}", ")", ";", "Axis", ".", "prototype", ".", "publish", "(", "\"logBase\"", ",", "10", ",", "\"number\"", ",", "\"Logarithmic base (disabled when type is not 'log')\"", ",", "null", ",", "{", "disable", ":", "(", "w", ")", "=>", "w", ".", "type", "(", ")", "!==", "\"log\"", "}", ")", ";", "Axis", ".", "prototype", ".", "publish", "(", "\"ordinals\"", ",", "[", "]", ",", "\"array\"", ",", "\"Array of ordinal values to display (disabled when type is not 'ordinal')\"", ",", "null", ",", "{", "disable", ":", "(", "w", ")", "=>", "w", ".", "type", "(", ")", "!==", "\"ordinal\"", "}", ")", ";", "Axis", ".", "prototype", ".", "publish", "(", "\"fontSize\"", ",", "null", ",", "\"number\"", ",", "\"Size of tick label font (pixels)\"", ",", "null", ",", "{", "optional", ":", "true", "}", ")", ";", "Axis", ".", "prototype", ".", "publish", "(", "\"fontFamily\"", ",", "null", ",", "\"string\"", ",", "\"Font family of tick labels\"", ",", "null", ",", "{", "optional", ":", "true", "}", ")", ";", "Axis", ".", "prototype", ".", "publish", "(", "\"tickCount\"", ",", "null", ",", "\"number\"", ",", "\"Number of ticks to display (disabled when type is 'ordinal')\"", ",", "null", ",", "{", "optional", ":", "true", ",", "disable", ":", "(", "w", ")", "=>", "w", ".", "type", "(", ")", "===", "\"ordinal\"", "}", ")", ";", "Axis", ".", "prototype", ".", "publish", "(", "\"tickFormat\"", ",", "null", ",", "\"string\"", ",", "\"Format rules for tick text (disabled when type is 'ordinal')\"", ",", "null", ",", "{", "optional", ":", "true", ",", "disable", ":", "(", "w", ")", "=>", "w", ".", "type", "(", ")", "===", "\"ordinal\"", "}", ")", ";", "Axis", ".", "prototype", ".", "publish", "(", "\"tickLength\"", ",", "null", ",", "\"number\"", ",", "\"Height (or width for left/right orientations) of the axis ticks (in pixels)\"", ",", "null", ",", "{", "optional", ":", "true", "}", ")", ";", "Axis", ".", "prototype", ".", "publish", "(", "\"ticks\"", ",", "[", "]", ",", "\"array\"", ",", "\"Custom tick labels\"", ",", "null", ",", "{", "optional", ":", "true", "}", ")", ";", "Axis", ".", "prototype", ".", "publish", "(", "\"low\"", ",", "null", ",", "\"any\"", ",", "\"Minimum tick value (disabled when type is ordinal)\"", ",", "null", ",", "{", "optional", ":", "true", ",", "disable", ":", "(", "w", ")", "=>", "w", ".", "type", "(", ")", "===", "\"ordinal\"", "}", ")", ";", "Axis", ".", "prototype", ".", "publish", "(", "\"high\"", ",", "null", ",", "\"any\"", ",", "\"Maximum tick value (disabled when type is ordinal)\"", ",", "null", ",", "{", "optional", ":", "true", ",", "disable", ":", "(", "w", ")", "=>", "w", ".", "type", "(", ")", "===", "\"ordinal\"", "}", ")", ";", "Axis", ".", "prototype", ".", "publish", "(", "\"overlapMode\"", ",", "\"none\"", ",", "\"set\"", ",", "\"Specifies the behavior when tick labels overlap\"", ",", "[", "\"none\"", ",", "\"stagger\"", ",", "\"hide\"", ",", "\"rotate\"", ",", "\"linebreak\"", ",", "\"wrap\"", "]", ")", ";", "Axis", ".", "prototype", ".", "publish", "(", "\"labelRotation\"", ",", "33", ",", "\"number\"", ",", "\"Angle of rotation for tick labels (disabled when overlapMode is not 'rotate')\"", ",", "null", ",", "{", "optional", ":", "true", ",", "disable", ":", "(", "w", ")", "=>", "w", ".", "overlapMode", "(", ")", "!==", "\"rotate\"", "}", ")", ";", "Axis", ".", "prototype", ".", "publish", "(", "\"shrinkToFit\"", ",", "\"both\"", ",", "\"set\"", ",", "\"shrinkToFit\"", ",", "[", "\"none\"", ",", "\"low\"", ",", "\"high\"", ",", "\"both\"", "]", ")", ";", "Axis", ".", "prototype", ".", "publish", "(", "\"extend\"", ",", "5", ",", "\"number\"", ",", "\"Extend the axis range by this % beyond what is needed to display the data (disabled when type is 'ordinal')\"", ",", "null", ",", "{", "optional", ":", "true", ",", "disable", ":", "(", "w", ")", "=>", "w", ".", "type", "(", ")", "===", "\"ordinal\"", "}", ")", ";", "Axis", ".", "prototype", ".", "publish", "(", "\"hidden\"", ",", "false", ",", "\"boolean\"", ",", "\"Hides axis when 'true'\"", ")", ";", "Axis", ".", "prototype", ".", "publish", "(", "\"ordinalPaddingInner\"", ",", "0.1", ",", "\"number\"", ",", "\"Determines the ratio of the range that is reserved for blank space between band (0->1)\"", ",", "null", ",", "{", "disable", ":", "(", "w", ")", "=>", "w", ".", "type", "(", ")", "!==", "\"ordinal\"", "}", ")", ";", "Axis", ".", "prototype", ".", "publish", "(", "\"ordinalPaddingOuter\"", ",", "0.1", ",", "\"number\"", ",", "\"Determines the ratio of the range that is reserved for blank space before the first band and after the last band (0->1)\"", ",", "null", ",", "{", "disable", ":", "(", "w", ")", "=>", "w", ".", "type", "(", ")", "!==", "\"ordinal\"", "}", ")", ";", "Axis", ".", "prototype", ".", "publish", "(", "\"ordinalMappings\"", ",", "null", ",", "\"object\"", ",", "\"Alternative label mappings (icons)\"", ",", "null", ",", "{", "optional", ":", "true", "}", ")", ";" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, 2, null, null, 2, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, 2, null, null, 2, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 125, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 125, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, 3, null, null, null, null, 3, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, 125, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 13, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 765, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 765, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1392
[ "import", "{", "d3Event", ",", "select", "as", "d3Select", ",", "SVGWidget", ",", "Utility", "}", "from", "\"@hpcc-js/common\"", ";", "import", "{", "max", "as", "d3Max", ",", "min", "as", "d3Min", "}", "from", "\"d3-array\"", ";", "import", "{", "brush", "as", "d3Brush", ",", "brushSelection", "as", "d3BrushSelection", ",", "brushX", "as", "d3BrushX", ",", "brushY", "as", "d3BrushY", "}", "from", "\"d3-brush\"", ";", "import", "{", "hsl", "as", "d3Hsl", "}", "from", "\"d3-color\"", ";", "import", "{", "Axis", "}", "from", "\"./Axis\"", ";", "import", "\"../src/XYAxis.css\"", ";", "export", "class", "XYAxis", "extends", "SVGWidget", "{", "protected", "domainAxis", ":", "Axis", ";", "protected", "valueAxis", ":", "Axis", ";", "protected", "xAxis", ":", "Axis", ";", "protected", "yAxis", ":", "Axis", ";", "protected", "xyBrush", ";", "protected", "xBrush", ";", "protected", "yBrush", ";", "protected", "margin", ";", "protected", "focusChart", ":", "XYAxis", ";", "_palette", ";", "constructor", "(", ")", "{", "super", "(", ")", ";", "Utility", ".", "SimpleSelectionMixin", ".", "call", "(", "this", ")", ";", "this", ".", "_drawStartPos", "=", "\"origin\"", ";", "this", ".", "domainAxis", "=", "new", "Axis", "(", ")", ".", "classed", "(", "{", "domain", ":", "true", "}", ")", ".", "orientation_default", "(", "\"bottom\"", ")", ".", "type", "(", "\"ordinal\"", ")", ".", "overlapMode_default", "(", "\"stagger\"", ")", ".", "shrinkToFit_default", "(", "\"high\"", ")", ".", "extend_default", "(", "0", ")", ";", "this", ".", "valueAxis", "=", "new", "Axis", "(", ")", ".", "classed", "(", "{", "value", ":", "true", "}", ")", ".", "orientation_default", "(", "\"left\"", ")", ".", "type", "(", "\"linear\"", ")", ".", "shrinkToFit_default", "(", "\"high\"", ")", ";", "this", ".", "xyBrush", "=", "d3Brush", "(", ")", ".", "on", "(", "\"end\"", ",", "(", ")", "=>", "{", "return", "this", ".", "brushMoved", "(", ")", ";", "}", ")", ".", "on", "(", "\"start.handle brush.handle end.handle\"", ",", "(", ")", "=>", "{", "return", "this", ".", "brushMoved2", "(", ")", ";", "}", ")", ";", "this", ".", "xBrush", "=", "d3BrushX", "(", ")", ".", "on", "(", "\"end\"", ",", "(", ")", "=>", "{", "return", "this", ".", "brushMoved", "(", ")", ";", "}", ")", ".", "on", "(", "\"start.handle brush.handle end.handle\"", ",", "(", ")", "=>", "{", "return", "this", ".", "brushMoved2", "(", ")", ";", "}", ")", ";", "this", ".", "yBrush", "=", "d3BrushY", "(", ")", ".", "on", "(", "\"end\"", ",", "(", ")", "=>", "{", "return", "this", ".", "brushMoved", "(", ")", ";", "}", ")", ".", "on", "(", "\"start.handle brush.handle end.handle\"", ",", "(", ")", "=>", "{", "return", "this", ".", "brushMoved2", "(", ")", ";", "}", ")", ";", "}", "protected", "_prevBrush", ";", "resetSelection", "(", ")", "{", "this", ".", "_prevBrush", "=", "null", ";", "return", "this", ";", "}", "parseData", "(", "d", ")", "{", "return", "this", ".", "domainAxis", ".", "parse", "(", "d", ")", ";", "}", "parseValue", "(", "d", ")", "{", "return", "this", ".", "valueAxis", ".", "parse", "(", "d", ",", "true", ")", ";", "}", "formatData", "(", "d", ")", "{", "return", "this", ".", "domainAxis", ".", "format", "(", "d", ")", ";", "}", "formatValue", "(", "d", ")", "{", "return", "this", ".", "valueAxis", ".", "format", "(", "d", ")", ";", "}", "parsedData", "(", ")", "{", "const", "retVal", "=", "this", ".", "data", "(", ")", ".", "map", "(", "function", "(", "row", ")", "{", "let", "prevValue", "=", "0", ";", "return", "row", ".", "map", "(", "function", "(", "cell", ",", "idx", ")", "{", "if", "(", "idx", "===", "0", ")", "{", "return", "this", ".", "parseData", "(", "cell", ")", ";", "}", "if", "(", "idx", ">=", "this", ".", "columns", "(", ")", ".", "length", ")", "{", "return", "cell", ";", "}", "const", "_retVal", "=", "this", ".", "yAxisStacked", "(", ")", "?", "[", "prevValue", ",", "prevValue", "+", "this", ".", "parseValue", "(", "cell", ")", "]", ":", "this", ".", "parseValue", "(", "cell", ")", ";", "prevValue", "+=", "this", ".", "parseValue", "(", "cell", ")", ";", "return", "_retVal", ";", "}", ",", "this", ")", ";", "}", ",", "this", ")", ";", "return", "retVal", ";", "}", "bandwidth", "(", ")", "{", "return", "this", ".", "domainAxis", ".", "bandwidth", "(", ")", ";", "}", "protected", "svg", ";", "protected", "svgRegions", ";", "protected", "svgDomainGuide", ";", "protected", "svgValueGuide", ";", "protected", "svgData", ";", "protected", "svgDataClipRect", ";", "protected", "svgFocus", ";", "protected", "svgBrush", ";", "enter", "(", "domNode", ",", "element", ")", "{", "super", ".", "enter", "(", "domNode", ",", "element", ")", ";", "this", ".", "svg", "=", "element", ".", "append", "(", "\"g\"", ")", ";", "this", ".", "svgRegions", "=", "element", ".", "append", "(", "\"g\"", ")", ";", "this", ".", "svgDomainGuide", "=", "this", ".", "svg", ".", "append", "(", "\"g\"", ")", ";", "this", ".", "svgValueGuide", "=", "this", ".", "svg", ".", "append", "(", "\"g\"", ")", ";", "this", ".", "svgData", "=", "this", ".", "svg", ".", "append", "(", "\"g\"", ")", ";", "this", ".", "svgDataClipRect", "=", "this", ".", "svg", ".", "append", "(", "\"clipPath\"", ")", ".", "attr", "(", "\"id\"", ",", "this", ".", "id", "(", ")", "+", "\"_clippath\"", ")", ".", "append", "(", "\"rect\"", ")", ".", "attr", "(", "\"x\"", ",", "0", ")", ".", "attr", "(", "\"y\"", ",", "0", ")", ";", "this", ".", "svgData", "=", "this", ".", "svg", ".", "append", "(", "\"g\"", ")", ".", "attr", "(", "\"clip-path\"", ",", "\"url(#\"", "+", "this", ".", "id", "(", ")", "+", "\"_clippath)\"", ")", ";", "this", ".", "_selection", ".", "widgetElement", "(", "this", ".", "svgData", ")", ";", "this", ".", "svgFocus", "=", "element", ".", "append", "(", "\"g\"", ")", ";", "this", ".", "domainAxis", ".", "target", "(", "this", ".", "svg", ".", "node", "(", ")", ")", ".", "guideTarget", "(", "this", ".", "svgDomainGuide", ".", "node", "(", ")", ")", ";", "this", ".", "valueAxis", ".", "target", "(", "this", ".", "svg", ".", "node", "(", ")", ")", ".", "guideTarget", "(", "this", ".", "svgValueGuide", ".", "node", "(", ")", ")", ";", "this", ".", "svgBrush", "=", "element", ".", "append", "(", "\"g\"", ")", ".", "attr", "(", "\"class\"", ",", "\"brush\"", ")", ";", "this", ".", "chartsEnter", "(", "this", ",", "this", ".", "svgData", ",", "250", ")", ";", "}", "resizeBrushHandle", "(", "d", ",", "width", ",", "height", ")", "{", "let", "e", ";", "let", "x", ";", "let", "y", ";", "if", "(", "d", ".", "type", "===", "\"e\"", "||", "d", ".", "type", "===", "\"w\"", ")", "{", "e", "=", "+", "(", "d", ".", "type", "===", "\"e\"", ")", ";", "x", "=", "e", "?", "1", ":", "-", "1", ";", "y", "=", "height", "/", "3", ";", "return", "\"M\"", "+", "(", "0.5", "*", "x", ")", "+", "\",\"", "+", "y", "+", "\"A6,6 0 0 \"", "+", "e", "+", "\" \"", "+", "(", "6.5", "*", "x", ")", "+", "\",\"", "+", "(", "y", "+", "6", ")", "+", "\"V\"", "+", "(", "2", "*", "y", "-", "6", ")", "+", "\"A6,6 0 0 \"", "+", "e", "+", "\" \"", "+", "(", "0.5", "*", "x", ")", "+", "\",\"", "+", "(", "2", "*", "y", ")", "+", "\"Z\"", "+", "\"M\"", "+", "(", "2.5", "*", "x", ")", "+", "\",\"", "+", "(", "y", "+", "8", ")", "+", "\"V\"", "+", "(", "2", "*", "y", "-", "8", ")", "+", "\"M\"", "+", "(", "4.5", "*", "x", ")", "+", "\",\"", "+", "(", "y", "+", "8", ")", "+", "\"V\"", "+", "(", "2", "*", "y", "-", "8", ")", ";", "}", "else", "{", "e", "=", "+", "(", "d", ".", "type", "===", "\"s\"", ")", ";", "y", "=", "e", "?", "1", ":", "-", "1", ";", "x", "=", "width", "/", "3", ";", "return", "\"M\"", "+", "x", "+", "\", \"", "+", "(", "0.5", "*", "y", ")", "+", "\"A6,6 0 0 \"", "+", "(", "e", "+", "1", ")", "%", "2", "+", "\" \"", "+", "(", "x", "+", "6", ")", "+", "\",\"", "+", "(", "6.5", "*", "y", ")", "+", "\"H\"", "+", "(", "2", "*", "x", "-", "6", ")", "+", "\"A6,6 0 0 \"", "+", "(", "e", "+", "1", ")", "%", "2", "+", "\" \"", "+", "(", "2", "*", "x", ")", "+", "\",\"", "+", "(", "0.5", "*", "y", ")", "+", "\"Z\"", "+", "\"M\"", "+", "(", "x", "+", "8", ")", "+", "\",\"", "+", "(", "2.5", "*", "y", ")", "+", "\"H\"", "+", "(", "2", "*", "x", "-", "8", ")", "+", "\"M\"", "+", "(", "x", "+", "8", ")", "+", "\",\"", "+", "(", "4.5", "*", "y", ")", "+", "\"H\"", "+", "(", "2", "*", "x", "-", "8", ")", ";", "}", "}", "private", "_skipSelection", "=", "false", ";", "skipSelection", "(", ")", ";", "skipSelection", "(", "_", ")", ";", "skipSelection", "(", "_", "?", ")", "{", "if", "(", "!", "arguments", ".", "length", ")", "return", "this", ".", "_skipSelection", ";", "this", ".", "_skipSelection", "=", "_", ";", "return", "this", ";", "}", "brushMoved", "(", ")", "{", "if", "(", "this", ".", "_skipSelection", ")", "return", ";", "let", "selected", "=", "[", "]", ";", "const", "context", "=", "this", ";", "const", "currSel", "=", "d3BrushSelection", "(", "this", ".", "svgBrush", ".", "node", "(", ")", ")", ";", "if", "(", "currSel", ")", "{", "selected", "=", "this", ".", "data", "(", ")", ".", "filter", "(", "function", "(", "d", ")", "{", "const", "pos", "=", "context", ".", "dataPos", "(", "d", "[", "0", "]", ")", ";", "if", "(", "context", ".", "use2dSelection", "(", ")", ")", "{", "const", "pos2", "=", "context", ".", "valuePos", "(", "d", "[", "1", "]", ")", "+", "context", ".", "valueAxis", ".", "bandwidth", "(", ")", "/", "2", ";", "return", "pos", ">=", "currSel", "[", "0", "]", "[", "0", "]", "&&", "pos", "<=", "currSel", "[", "1", "]", "[", "0", "]", "&&", "pos2", ">=", "currSel", "[", "0", "]", "[", "1", "]", "&&", "pos2", "<=", "currSel", "[", "1", "]", "[", "1", "]", ";", "}", "else", "{", "return", "pos", ">=", "currSel", "[", "0", "]", "&&", "pos", "<=", "currSel", "[", "1", "]", ";", "}", "}", ")", ";", "}", "this", ".", "selection", "(", "selected", ")", ";", "}", "brushMoved2", "(", ")", "{", "const", "isHorizontal", "=", "this", ".", "orientation", "(", ")", "===", "\"horizontal\"", ";", "const", "handleTypes", "=", "this", ".", "use2dSelection", "(", ")", "?", "[", "]", ":", "isHorizontal", "?", "[", "{", "type", ":", "\"w\"", "}", ",", "{", "type", ":", "\"e\"", "}", "]", ":", "[", "{", "type", ":", "\"n\"", "}", ",", "{", "type", ":", "\"s\"", "}", "]", ";", "const", "handlePath", "=", "this", ".", "svgBrush", ".", "selectAll", "(", "\".handle--custom\"", ")", ".", "data", "(", "handleTypes", ")", ";", "const", "s", "=", "d3Event", "(", ")", ".", "selection", ";", "if", "(", "s", "==", "null", ")", "{", "handlePath", ".", "attr", "(", "\"display\"", ",", "\"none\"", ")", ";", "}", "else", "if", "(", "isHorizontal", ")", "{", "handlePath", ".", "attr", "(", "\"display\"", ",", "null", ")", ".", "attr", "(", "\"transform\"", ",", "(", "_d", ",", "i", ")", "=>", "\"translate(\"", "+", "s", "[", "i", "]", "+", "\",\"", "+", "0", "+", "\")\"", ")", ";", "}", "else", "{", "handlePath", ".", "attr", "(", "\"display\"", ",", "null", ")", ".", "attr", "(", "\"transform\"", ",", "(", "_d", ",", "i", ")", "=>", "\"translate(\"", "+", "0", "+", "\", \"", "+", "s", "[", "i", "]", "+", "\")\"", ")", ";", "}", "}", "dataPos", "(", "d", ")", "{", "return", "this", ".", "domainAxis", ".", "scalePos", "(", "d", ")", ";", "}", "valuePos", "(", "d", ")", "{", "return", "this", ".", "valueAxis", ".", "scalePos", "(", "d", ")", ";", "}", "getAxisSize", "(", "host", ")", "{", "return", "{", "width", ":", "!", "this", ".", "xAxis", "?", "host", ".", "xAxis", ".", "width", "(", ")", ":", "this", ".", "xAxis", ".", "width", "(", ")", ",", "height", ":", "!", "this", ".", "yAxis", "?", "host", ".", "yAxis", ".", "width", "(", ")", ":", "this", ".", "yAxis", ".", "height", "(", ")", "}", ";", "}", "calcMargin", "(", "_domNode", ",", "element", ",", "isHorizontal", ")", "{", "const", "margin", "=", "{", "top", ":", "!", "isHorizontal", "&&", "this", ".", "selectionMode", "(", ")", "?", "10", ":", "2", ",", "right", ":", "isHorizontal", "&&", "(", "this", ".", "selectionMode", "(", ")", "||", "this", ".", "xAxisFocus", "(", ")", ")", "?", "10", ":", "2", ",", "bottom", ":", "(", "this", ".", "xAxisFocus", "(", ")", "?", "this", ".", "xAxisFocusHeight", "(", ")", ":", "0", ")", "+", "2", ",", "left", ":", "2", "}", ";", "const", "width", "=", "this", ".", "width", "(", ")", "-", "margin", ".", "left", "-", "margin", ".", "right", ";", "const", "height", "=", "this", ".", "height", "(", ")", "-", "margin", ".", "top", "-", "margin", ".", "bottom", ";", "let", "xRight", "=", "0", ";", "let", "xHeight", "=", "30", ";", "let", "yTop", "=", "0", ";", "let", "yWidth", "=", "30", ";", "for", "(", "let", "i", "=", "0", ";", "i", "<", "10", ";", "++", "i", ")", "{", "this", ".", "xAxis", ".", "width", "(", "width", "-", "yWidth", ")", ".", "height", "(", "0", ")", ";", "const", "xAxisOverlap", "=", "this", ".", "xAxis", ".", "calcOverflow", "(", "element", ")", ";", "const", "newXHeight", "=", "xAxisOverlap", ".", "depth", ";", "this", ".", "yAxis", ".", "width", "(", "0", ")", ".", "height", "(", "height", "-", "xHeight", ")", ";", "const", "yAxisOverlap", "=", "this", ".", "yAxis", ".", "calcOverflow", "(", "element", ")", ";", "const", "newYWidth", "=", "yAxisOverlap", ".", "depth", ";", "xRight", "=", "xAxisOverlap", ".", "right", ";", "yTop", "=", "yAxisOverlap", ".", "top", ";", "if", "(", "newXHeight", "===", "xHeight", "&&", "newYWidth", "===", "yWidth", ")", "{", "break", ";", "}", "xHeight", "=", "newXHeight", ";", "yWidth", "=", "newYWidth", ";", "}", "this", ".", "xAxis", ".", "x", "(", "width", "/", "2", "+", "yWidth", "/", "2", "+", "margin", ".", "left", ")", ".", "y", "(", "height", "+", "margin", ".", "top", ")", ".", "width", "(", "width", "-", "yWidth", ")", ";", "this", ".", "yAxis", ".", "x", "(", "margin", ".", "left", ")", ".", "y", "(", "height", "/", "2", "-", "xHeight", "/", "2", "+", "margin", ".", "top", ")", ".", "height", "(", "height", "-", "xHeight", ")", ";", "margin", ".", "left", "+=", "yWidth", ";", "margin", ".", "top", "+=", "yTop", ";", "margin", ".", "right", "+=", "xRight", ";", "margin", ".", "bottom", "+=", "xHeight", ";", "return", "margin", ";", "}", "updateRegions", "(", "_domNode", ",", "_element", ",", "isHorizontal", ")", "{", "const", "context", "=", "this", ";", "const", "regions", "=", "this", ".", "svgRegions", ".", "selectAll", "(", "\".region\"", ")", ".", "data", "(", "this", ".", "regions", "(", ")", ")", ";", "regions", ".", "enter", "(", ")", ".", "append", "(", "\"rect\"", ")", ".", "attr", "(", "\"class\"", ",", "\"region\"", ")", ";", "if", "(", "isHorizontal", ")", "{", "regions", ".", "attr", "(", "\"x\"", ",", "function", "(", "d", ")", "{", "return", "context", ".", "dataPos", "(", "d", ".", "x0", ")", ";", "}", ")", ".", "attr", "(", "\"y\"", ",", "0", ")", ".", "attr", "(", "\"width\"", ",", "function", "(", "d", ")", "{", "return", "context", ".", "dataPos", "(", "d", ".", "x1", ")", "-", "context", ".", "dataPos", "(", "d", ".", "x0", ")", ";", "}", ")", ".", "attr", "(", "\"height\"", ",", "this", ".", "height", "(", ")", ")", ".", "style", "(", "\"stroke\"", ",", "function", "(", "d", ")", "{", "return", "context", ".", "_palette", "(", "d", ".", "colorID", ")", ";", "}", ")", ".", "style", "(", "\"fill\"", ",", "function", "(", "d", ")", "{", "return", "d3Hsl", "(", "context", ".", "_palette", "(", "d", ".", "colorID", ")", ")", ".", "brighter", "(", ")", ";", "}", ")", ";", "}", "else", "{", "regions", ".", "attr", "(", "\"x\"", ",", "0", ")", ".", "attr", "(", "\"y\"", ",", "function", "(", "d", ")", "{", "return", "context", ".", "dataPos", "(", "d", ".", "x0", ")", ";", "}", ")", ".", "attr", "(", "\"width\"", ",", "this", ".", "width", "(", ")", ")", ".", "attr", "(", "\"height\"", ",", "function", "(", "d", ")", "{", "return", "context", ".", "dataPos", "(", "d", ".", "x0", ")", "-", "context", ".", "dataPos", "(", "d", ".", "x1", ")", ";", "}", ")", ".", "style", "(", "\"stroke\"", ",", "function", "(", "d", ")", "{", "return", "context", ".", "_palette", "(", "d", ".", "colorID", ")", ";", "}", ")", ".", "style", "(", "\"fill\"", ",", "function", "(", "d", ")", "{", "return", "d3Hsl", "(", "context", ".", "_palette", "(", "d", ".", "colorID", ")", ")", ".", "brighter", "(", ")", ";", "}", ")", ";", "}", "regions", ".", "exit", "(", ")", ".", "remove", "(", ")", ";", "}", "protected", "_prevXAxisType", ";", "update", "(", "domNode", ",", "element", ")", "{", "super", ".", "update", "(", "domNode", ",", "element", ")", ";", "const", "context", "=", "this", ";", "const", "isHorizontal", "=", "this", ".", "orientation", "(", ")", "===", "\"horizontal\"", ";", "this", ".", "updateRegions", "(", "domNode", ",", "element", ",", "isHorizontal", ")", ";", "this", ".", "domainAxis", ".", "orientation", "(", "isHorizontal", "?", "\"bottom\"", ":", "\"left\"", ")", ".", "title", "(", "this", ".", "xAxisTitle_exists", "(", ")", "?", "this", ".", "xAxisTitle", "(", ")", ":", "this", ".", "columns", "(", ")", "[", "0", "]", ")", ";", "this", ".", "valueAxis", ".", "orientation", "(", "isHorizontal", "?", "\"left\"", ":", "\"bottom\"", ")", ";", "this", ".", "xAxis", "=", "isHorizontal", "?", "this", ".", "domainAxis", ":", "this", ".", "valueAxis", ";", "this", ".", "yAxis", "=", "isHorizontal", "?", "this", ".", "valueAxis", ":", "this", ".", "domainAxis", ";", "switch", "(", "this", ".", "xAxisType", "(", ")", ")", "{", "case", "\"ordinal\"", ":", "const", "colLen", "=", "this", ".", "columns", "(", ")", ".", "length", ";", "const", "ordinalMappings", "=", "{", "}", ";", "this", ".", "domainAxis", ".", "ordinals", "(", "this", ".", "data", "(", ")", ".", "map", "(", "function", "(", "d", ")", "{", "ordinalMappings", "[", "d", "[", "0", "]", "]", "=", "context", ".", "xAxisOrdinalMapping", "(", "d", ",", "d", "[", "colLen", "]", ")", ";", "return", "d", "[", "0", "]", ";", "}", ")", ")", ".", "ordinalMappings", "(", "ordinalMappings", ")", ";", "break", ";", "default", ":", "const", "domainMin", "=", "this", ".", "xAxisDomainLow", "(", ")", "?", "this", ".", "xAxisDomainLow", "(", ")", ":", "this", ".", "domainAxis", ".", "parseInvert", "(", "d3Min", "(", "this", ".", "parsedData", "(", ")", ",", "function", "(", "data", ")", "{", "return", "data", "[", "0", "]", ";", "}", ")", ")", ";", "const", "domainMax", "=", "this", ".", "xAxisDomainHigh", "(", ")", "?", "this", ".", "xAxisDomainHigh", "(", ")", ":", "this", ".", "domainAxis", ".", "parseInvert", "(", "d3Max", "(", "this", ".", "parsedData", "(", ")", ",", "function", "(", "data", ")", "{", "return", "data", "[", "0", "]", ";", "}", ")", ")", ";", "if", "(", "domainMin", "!==", "undefined", "&&", "domainMax", "!==", "undefined", ")", "{", "this", ".", "domainAxis", ".", "low", "(", "domainMin", ")", ".", "high", "(", "domainMax", ")", ";", "}", "break", ";", "}", "const", "min", "=", "this", ".", "yAxisDomainLow", "(", ")", "?", "this", ".", "yAxisDomainLow", "(", ")", ":", "this", ".", "valueAxis", ".", "parseInvert", "(", "d3Min", "(", "this", ".", "parsedData", "(", ")", ",", "function", "(", "data", ")", "{", "return", "d3Min", "(", "data", ".", "filter", "(", "function", "(", "cell", ",", "i", ")", "{", "return", "i", ">", "0", "&&", "context", ".", "columns", "(", ")", "[", "i", "]", "&&", "context", ".", "columns", "(", ")", "[", "i", "]", ".", "indexOf", "(", "\"__\"", ")", "!==", "0", "&&", "cell", "!==", "null", ";", "}", ")", ",", "function", "(", "d", ")", "{", "return", "d", "instanceof", "Array", "?", "d", "[", "0", "]", ":", "d", ";", "}", ")", ";", "}", ")", ")", ";", "const", "max", "=", "this", ".", "yAxisDomainHigh", "(", ")", "?", "this", ".", "yAxisDomainHigh", "(", ")", ":", "this", ".", "valueAxis", ".", "parseInvert", "(", "d3Max", "(", "this", ".", "parsedData", "(", ")", ",", "function", "(", "data", ")", "{", "return", "d3Max", "(", "data", ".", "filter", "(", "function", "(", "cell", ",", "i", ")", "{", "return", "i", ">", "0", "&&", "context", ".", "columns", "(", ")", "[", "i", "]", "&&", "context", ".", "columns", "(", ")", "[", "i", "]", ".", "indexOf", "(", "\"__\"", ")", "!==", "0", "&&", "cell", "!==", "null", ";", "}", ")", ",", "function", "(", "d", ")", "{", "return", "d", "instanceof", "Array", "?", "d", "[", "1", "]", ":", "d", ";", "}", ")", ";", "}", ")", ")", ";", "this", ".", "valueAxis", ".", "low", "(", "min", ")", ".", "high", "(", "max", ")", ";", "this", ".", "margin", "=", "this", ".", "calcMargin", "(", "domNode", ",", "element", ",", "isHorizontal", ")", ";", "let", "width", "=", "this", ".", "width", "(", ")", "-", "this", ".", "margin", ".", "left", "-", "this", ".", "margin", ".", "right", ";", "if", "(", "width", "<", "0", ")", "width", "=", "0", ";", "let", "height", "=", "this", ".", "height", "(", ")", "-", "this", ".", "margin", ".", "top", "-", "this", ".", "margin", ".", "bottom", ";", "if", "(", "height", "<", "0", ")", "height", "=", "0", ";", "const", "maxCurrExtent", "=", "isHorizontal", "?", "width", ":", "height", ";", "const", "maxOtherExtent", "=", "isHorizontal", "?", "height", ":", "width", ";", "this", ".", "domainAxis", ".", "tickLength", "(", "this", ".", "xAxisGuideLines", "(", ")", "?", "maxOtherExtent", ":", "0", ")", ".", "render", "(", ")", ";", "this", ".", "valueAxis", ".", "tickLength", "(", "this", ".", "yAxisGuideLines", "(", ")", "?", "maxCurrExtent", ":", "0", ")", ".", "render", "(", ")", ";", "this", ".", "svgDataClipRect", ".", "attr", "(", "\"width\"", ",", "width", ")", ".", "attr", "(", "\"height\"", ",", "height", ")", ";", "this", ".", "svgData", ".", "transition", "(", ")", ".", "attr", "(", "\"transform\"", ",", "\"translate(\"", "+", "this", ".", "margin", ".", "left", "+", "\",\"", "+", "this", ".", "margin", ".", "top", "+", "\")\"", ")", ";", "this", ".", "updateBrush", "(", "width", ",", "height", ",", "maxCurrExtent", ",", "isHorizontal", ")", ";", "this", ".", "updateFocusChart", "(", "domNode", ",", "element", ",", "this", ".", "margin", ",", "width", ",", "height", ",", "isHorizontal", ")", ";", "this", ".", "chartsUpdate", "(", "width", ",", "height", ",", "250", ")", ";", "if", "(", "this", ".", "selectionMode", "(", ")", ")", "{", "return", "this", ".", "brushMoved", "(", ")", ";", "}", "}", "updateBrush", "(", "width", ",", "height", ",", "maxCurrExtent", ",", "isHorizontal", ")", "{", "const", "currBrush", "=", "this", ".", "use2dSelection", "(", ")", "?", "this", ".", "xyBrush", ":", "isHorizontal", "?", "this", ".", "xBrush", ":", "this", ".", "yBrush", ";", "const", "prevBrushSel", "=", "d3BrushSelection", "(", "this", ".", "svgBrush", ".", "node", "(", ")", ")", ";", "currBrush", ".", "extent", "(", "[", "[", "0", ",", "0", "]", ",", "[", "width", ",", "height", "]", "]", ")", ";", "this", ".", "svgBrush", ".", "attr", "(", "\"transform\"", ",", "\"translate(\"", "+", "this", ".", "margin", ".", "left", "+", "\", \"", "+", "this", ".", "margin", ".", "top", "+", "\")\"", ")", ".", "style", "(", "\"display\"", ",", "this", ".", "selectionMode", "(", ")", "?", "null", ":", "\"none\"", ")", ".", "call", "(", "currBrush", ")", ";", "const", "handleTypes", "=", "this", ".", "use2dSelection", "(", ")", "?", "[", "]", ":", "isHorizontal", "?", "[", "{", "type", ":", "\"w\"", "}", ",", "{", "type", ":", "\"e\"", "}", "]", ":", "[", "{", "type", ":", "\"n\"", "}", ",", "{", "type", ":", "\"s\"", "}", "]", ";", "const", "handlePath", "=", "this", ".", "svgBrush", ".", "selectAll", "(", "\".handle--custom\"", ")", ".", "data", "(", "handleTypes", ")", ";", "handlePath", ".", "enter", "(", ")", ".", "append", "(", "\"path\"", ")", ".", "attr", "(", "\"class\"", ",", "\"handle--custom\"", ")", ".", "merge", "(", "handlePath", ")", ".", "attr", "(", "\"cursor\"", ",", "isHorizontal", "?", "\"ew-resize\"", ":", "\"ns-resize\"", ")", ".", "attr", "(", "\"d\"", ",", "(", "d", ")", "=>", "this", ".", "resizeBrushHandle", "(", "d", ",", "width", ",", "height", ")", ")", ";", "if", "(", "this", ".", "selectionMode", "(", ")", ")", "{", "if", "(", "this", ".", "_prevXAxisType", "!==", "this", ".", "xAxisType", "(", ")", ")", "{", "this", ".", "_prevXAxisType", "=", "this", ".", "xAxisType", "(", ")", ";", "this", ".", "_prevBrush", "=", "null", ";", "}", "if", "(", "this", ".", "_prevBrush", ")", "{", "if", "(", "prevBrushSel", ")", "{", "if", "(", "this", ".", "_prevBrush", ".", "orientation", "!==", "this", ".", "orientation", "(", ")", ")", "{", "const", "tmp", "=", "prevBrushSel", "[", "0", "]", ";", "prevBrushSel", "[", "0", "]", "=", "this", ".", "_prevBrush", ".", "maxCurrExtent", "-", "prevBrushSel", "[", "1", "]", ";", "prevBrushSel", "[", "1", "]", "=", "this", ".", "_prevBrush", ".", "maxCurrExtent", "-", "tmp", ";", "}", "const", "ratio", "=", "maxCurrExtent", "/", "this", ".", "_prevBrush", ".", "maxCurrExtent", ";", "if", "(", "ratio", "!==", "1", ")", "{", "this", ".", "svgBrush", ".", "transition", "(", ")", ".", "on", "(", "\"start\"", ",", "function", "(", ")", "{", "currBrush", ".", "on", "(", "\"end\"", ",", "null", ")", ";", "}", ")", ".", "call", "(", "currBrush", ".", "move", ",", "[", "prevBrushSel", "[", "0", "]", "*", "ratio", ",", "prevBrushSel", "[", "1", "]", "*", "ratio", "]", ")", ".", "on", "(", "\"end\"", ",", "(", ")", "=>", "{", "currBrush", ".", "on", "(", "\"end\"", ",", "(", ")", "=>", "{", "return", "this", ".", "brushMoved", "(", ")", ";", "}", ")", ";", "}", ")", ";", "}", "}", "}", "else", "{", "this", ".", "svgBrush", ".", "call", "(", "currBrush", ".", "move", ",", "[", "0", ",", "maxCurrExtent", "]", ")", ";", "}", "this", ".", "_prevBrush", "=", "{", "orientation", ":", "this", ".", "orientation", "(", ")", ",", "maxCurrExtent", "}", ";", "}", "}", "updateFocusChart", "(", "domNode", ",", "element", ",", "margin", ",", "width", ",", "height", ",", "isHorizontal", ")", "{", "const", "context", "=", "this", ";", "const", "focusChart", "=", "this", ".", "svgFocus", ".", "selectAll", "(", "\"#\"", "+", "this", ".", "id", "(", ")", "+", "\"_focusChart\"", ")", ".", "data", "(", "this", ".", "xAxisFocus", "(", ")", "?", "[", "true", "]", ":", "[", "]", ")", ";", "focusChart", ".", "enter", "(", ")", ".", "append", "(", "\"g\"", ")", ".", "attr", "(", "\"id\"", ",", "this", ".", "id", "(", ")", "+", "\"_focusChart\"", ")", ".", "attr", "(", "\"class\"", ",", "\"focus\"", ")", ".", "each", "(", "function", "(", ")", "{", "context", ".", "focusChart", "=", "new", "(", "context", ".", "constructor", "as", "any", ")", "(", ")", ".", "target", "(", "this", ")", ";", "context", ".", "focusChart", ".", "xBrush", ".", "on", "(", "\"brush.focus\"", ",", "function", "(", ")", "{", "context", ".", "syncAxis", "(", "width", ")", ";", "context", ".", "chartsUpdate", "(", "width", ",", "height", ",", "0", ")", ";", "}", ")", ";", "context", ".", "focusChart", ".", "layers", "(", "context", ".", "layers", "(", ")", ".", "map", "(", "(", "w", ")", "=>", "new", "w", ".", "constructor", "(", ")", ")", ")", ";", "}", ")", ".", "merge", "(", "focusChart", ")", ".", "each", "(", "function", "(", "this", ")", "{", "context", ".", "copyPropsTo", "(", "context", ".", "focusChart", ",", "[", "\"layers\"", "]", ")", ";", "let", "layerIdx", "=", "0", ";", "for", "(", "const", "layer", "of", "context", ".", "layers", "(", ")", ")", "{", "layer", ".", "copyPropsTo", "(", "context", ".", "focusChart", ".", "layers", "(", ")", "[", "layerIdx", "]", ")", ";", "layerIdx", "++", ";", "}", "context", ".", "focusChart", ".", "xAxisFocus", "(", "false", ")", ".", "selectionMode", "(", "true", ")", ".", "skipSelection", "(", "true", ")", ".", "orientation", "(", "\"horizontal\"", ")", ".", "xAxisGuideLines", "(", "false", ")", ".", "xAxisDomainLow", "(", "null", ")", ".", "xAxisDomainHigh", "(", "null", ")", ".", "yAxisGuideLines", "(", "false", ")", ".", "x", "(", "context", ".", "width", "(", ")", "/", "2", ")", ".", "y", "(", "context", ".", "height", "(", ")", "-", "context", ".", "xAxisFocusHeight", "(", ")", "/", "2", ")", ".", "width", "(", "context", ".", "width", "(", ")", ")", ".", "height", "(", "context", ".", "xAxisFocusHeight", "(", ")", ")", ".", "columns", "(", "context", ".", "columns", "(", ")", ")", ".", "data", "(", "context", ".", "data", "(", ")", ")", ".", "render", "(", ")", ";", "context", ".", "syncAxis", "(", "width", ")", ";", "}", ")", ";", "focusChart", ".", "exit", "(", ")", ".", "each", "(", "function", "(", ")", "{", "if", "(", "context", ".", "focusChart", ")", "{", "context", ".", "focusChart", ".", "target", "(", "null", ")", ";", "delete", "context", ".", "focusChart", ";", "}", "}", ")", ".", "remove", "(", ")", ";", "}", "syncAxis", "(", "width", ")", "{", "const", "currSel", "=", "d3BrushSelection", "(", "this", ".", "focusChart", ".", "svgBrush", ".", "node", "(", ")", ")", "as", "[", "number", ",", "number", "]", ";", "if", "(", "currSel", ")", "{", "if", "(", "this", ".", "focusChart", ".", "xAxisType", "(", ")", "!==", "\"ordinal\"", ")", "{", "console", ".", "log", "(", "JSON", ".", "stringify", "(", "[", "this", ".", "focusChart", ".", "xAxis", ".", "invert", "(", "currSel", "[", "0", "]", ")", ",", "this", ".", "focusChart", ".", "xAxis", ".", "invert", "(", "currSel", "[", "1", "]", ")", "]", ")", ")", ";", "this", ".", "xAxis", ".", "domain", "(", "[", "this", ".", "focusChart", ".", "xAxis", ".", "invert", "(", "currSel", "[", "0", "]", ")", ",", "this", ".", "focusChart", ".", "xAxis", ".", "invert", "(", "currSel", "[", "1", "]", ")", "]", ")", ";", "}", "else", "{", "const", "brushWidth", "=", "currSel", "[", "1", "]", "-", "currSel", "[", "0", "]", ";", "const", "scale", "=", "brushWidth", "/", "width", ";", "this", ".", "xAxis", ".", "range", "(", "[", "-", "currSel", "[", "0", "]", "/", "scale", ",", "(", "width", "-", "currSel", "[", "0", "]", ")", "/", "scale", "]", ")", ";", "}", "this", ".", "xAxis", ".", "rerender", "(", ")", ";", "}", "}", "layerColumns", "(", "host", ")", "{", "const", "masterColumns", "=", "host", ".", "columns", "(", ")", ";", "const", "retVal", "=", "super", ".", "columns", "(", ")", ".", "filter", "(", "col", "=>", "col", "!==", "masterColumns", "[", "0", "]", ")", ";", "if", "(", "!", "retVal", ".", "length", ")", "{", "return", "masterColumns", ";", "}", "return", "[", "masterColumns", "[", "0", "]", ",", "...", "retVal", "]", ";", "}", "layerColumnIndices", "(", "host", ")", "{", "const", "masterColumns", "=", "host", ".", "columns", "(", ")", ";", "const", "layerColumns", "=", "this", ".", "layerColumns", "(", "host", ")", ";", "return", "layerColumns", ".", "map", "(", "col", "=>", "masterColumns", ".", "indexOf", "(", "col", ")", ")", ";", "}", "layerColumnIndex", "(", "host", ",", "column", ")", "{", "const", "masterColumns", "=", "host", ".", "columns", "(", ")", ";", "return", "masterColumns", ".", "indexOf", "(", "column", ")", ";", "}", "layerData", "(", "host", ")", "{", "if", "(", "arguments", ".", "length", "===", "1", ")", "{", "const", "indices", "=", "this", ".", "layerColumnIndices", "(", "host", ")", ";", "return", "host", ".", "data", "(", ")", ".", "map", "(", "row", "=>", "{", "const", "retVal", "=", "indices", ".", "map", "(", "idx", "=>", "row", "[", "idx", "]", ")", ";", "(", "retVal", "as", "any", ")", ".", "__hpcc_origRow", "=", "row", ";", "return", "retVal", ";", "}", ")", ";", "}", "throw", "new", "Error", "(", "\"Setting data on XYAxisLayer is not supported.\"", ")", ";", "}", "layerEnter", "(", "host", ",", "element", ",", "duration", "=", "250", ")", "{", "}", "layerUpdate", "(", "host", ",", "element", ",", "duration", "=", "250", ")", "{", "}", "layerExit", "(", "host", ",", "element", ",", "duration", "=", "250", ")", "{", "}", "chartsEnter", "(", "host", ",", "element", ",", "duration", "=", "250", ")", "{", "this", ".", "layerEnter", "(", "this", ",", "element", ",", "duration", ")", ";", "for", "(", "const", "w", "of", "this", ".", "layers", "(", ")", ")", "{", "w", "[", "\"__xyAxisElement\"", "]", "=", "element", ".", "append", "(", "\"g\"", ")", ".", "attr", "(", "\"class\"", ",", "w", ".", "class", "(", ")", ")", ";", "w", ".", "target", "(", "w", "[", "\"__xyAxisElement\"", "]", ".", "node", "(", ")", "as", "SVGElement", ")", ".", "layerEnter", "(", "this", ",", "element", ",", "duration", ")", ";", "}", "}", "chartsUpdate", "(", "width", ",", "height", ",", "duration", ")", "{", "this", ".", "layerUpdate", "(", "this", ",", "this", ".", "svgData", ",", "duration", ")", ";", "for", "(", "const", "w", "of", "this", ".", "layers", "(", ")", ")", "{", "w", ".", "resize", "(", "{", "width", ",", "height", "}", ")", ".", "layerUpdate", "(", "this", ",", "w", "[", "\"__xyAxisElement\"", "]", ",", "duration", ")", ";", "}", "}", "exit", "(", "domNode", ",", "element", ")", "{", "this", ".", "valueAxis", ".", "target", "(", "null", ")", ";", "this", ".", "domainAxis", ".", "target", "(", "null", ")", ";", "super", ".", "exit", "(", "domNode", ",", "element", ")", ";", "}", "selection", "(", "_selected", ")", "{", "const", "context", "=", "this", ";", "this", ".", "_selection", ".", "widgetElement", "(", ")", ".", "selectAll", "(", "\".selected,.deselected\"", ")", ".", "each", "(", "function", "(", "d", ")", "{", "const", "selected", "=", "_selected", ".", "indexOf", "(", "d", ".", "origRow", ")", ">=", "0", ";", "d3Select", "(", "this", ")", ".", "classed", "(", "\"selected\"", ",", "selected", ")", ".", "classed", "(", "\"deselected\"", ",", "!", "selected", ")", ".", "attr", "(", "\"filter\"", ",", "context", ".", "_selection", ".", "svgGlowID", "(", ")", "&&", "selected", "?", "`url(#${", "context", ".", "_selection", ".", "svgGlowID", "(", ")", "})`", ":", "null", ")", ";", "}", ")", ";", "const", "selRows", "=", "_selected", ".", "map", "(", "d", "=>", "{", "return", "this", ".", "rowToObj", "(", "d", ")", ";", "}", ")", ";", "setTimeout", "(", "(", ")", "=>", "{", "this", ".", "click", "(", "selRows", ",", "\"\"", ",", "true", ")", ";", "}", ",", "0", ")", ";", "}", "xAxisOrdinalMapping", "(", "origRow", ",", "lparam", ")", "{", "return", "origRow", "[", "0", "]", ";", "}", "click", "(", "row", ",", "column", ",", "selected", ")", "{", "console", ".", "log", "(", "\"Click: \"", "+", "JSON", ".", "stringify", "(", "row", ")", "+", "\", \"", "+", "column", "+", "\", \"", "+", "selected", ")", ";", "}", "_selection", ":", "Utility", ".", "SimpleSelection", ";", "}", "XYAxis", ".", "prototype", ".", "_class", "+=", "\" chart_XYAxis\"", ";", "XYAxis", ".", "prototype", ".", "mixin", "(", "Utility", ".", "SimpleSelectionMixin", ")", ";", "export", "interface", "XYAxis", "{", "orientation", "(", ")", ":", "\"horizontal\"", "|", "\"vertical\"", ";", "orientation", "(", "_", ")", ":", "this", ";", "orientation_default", "(", "_", ")", ";", "pointSizeColumn", "(", ")", ":", "string", ";", "pointSizeColumn", "(", "_", ")", ":", "this", ";", "pointSizeColumn_exists", "(", ")", ":", "boolean", ";", "minPointSize", "(", ")", ":", "number", ";", "minPointSize", "(", "_", ")", ":", "this", ";", "maxPointSize", "(", ")", ":", "number", ";", "maxPointSize", "(", "_", ")", ":", "this", ";", "use2dSelection", "(", ")", ":", "boolean", ";", "use2dSelection", "(", "_", ")", ":", "this", ";", "selectionMode", "(", ")", ":", "boolean", ";", "selectionMode", "(", "_", ")", ":", "this", ";", "xAxisTitle", "(", ")", ":", "string", ";", "xAxisTitle", "(", "_", ")", ":", "this", ";", "xAxisTitle_exists", "(", ")", ":", "boolean", ";", "xAxisTickCount", "(", ")", ":", "number", ";", "xAxisTickCount", "(", "_", ")", ":", "this", ";", "xAxisTickFormat", "(", ")", ":", "string", ";", "xAxisTickFormat", "(", "_", ")", ":", "this", ";", "xAxisTicks", "(", ")", ":", "Array", "<", "{", "value", ":", "string", ";", "label", ":", "string", ";", "}", ">", ";", "xAxisTicks", "(", "_", ")", ":", "this", ";", "xAxisType", "(", ")", ":", "\"none\"", "|", "\"ordinal\"", "|", "\"linear\"", "|", "\"pow\"", "|", "\"log\"", "|", "\"time\"", ";", "xAxisType", "(", "_", ")", ":", "this", ";", "xAxisType_default", "(", "_", ")", ";", "xAxisTypeTimePattern", "(", ")", ":", "string", ";", "xAxisTypeTimePattern", "(", "_", ")", ":", "this", ";", "xAxisDomainLow", "(", ")", ":", "number", "|", "string", ";", "xAxisDomainLow", "(", "_", ")", ":", "this", ";", "xAxisDomainHigh", "(", ")", ":", "number", "|", "string", ";", "xAxisDomainHigh", "(", "_", ")", ":", "this", ";", "xAxisFontSize", "(", ")", ":", "number", "|", "string", ";", "xAxisFontSize", "(", "_", ")", ":", "this", ";", "xAxisFontFamily", "(", ")", ":", "string", ";", "xAxisFontFamily", "(", "_", ")", ":", "this", ";", "xAxisOrdinalPaddingInner", "(", ")", ":", "number", ";", "xAxisOrdinalPaddingInner", "(", "_", ")", ":", "this", ";", "xAxisOrdinalPaddingOuter", "(", ")", ":", "number", ";", "xAxisOrdinalPaddingOuter", "(", "_", ")", ":", "this", ";", "xAxisOverlapMode", "(", ")", ":", "\"none\"", "|", "\"stagger\"", "|", "\"hide\"", "|", "\"rotate\"", "|", "\"linebreak\"", "|", "\"wrap\"", ";", "xAxisOverlapMode", "(", "_", ")", ":", "this", ";", "xAxisLabelRotation", "(", ")", ":", "number", ";", "xAxisLabelRotation", "(", "_", ")", ":", "this", ";", "xAxisDomainPadding", "(", ")", ":", "number", ";", "xAxisDomainPadding", "(", "_", ")", ":", "this", ";", "xAxisGuideLines", "(", ")", ":", "boolean", ";", "xAxisGuideLines", "(", "_", ")", ":", "this", ";", "xAxisGuideLines_default", "(", "_", ")", ";", "xAxisFocus", "(", ")", ":", "boolean", ";", "xAxisFocus", "(", "_", ")", ":", "this", ";", "xAxisFocusHeight", "(", ")", ":", "number", ";", "xAxisFocusHeight", "(", "_", ")", ":", "this", ";", "xAxisHidden", "(", ")", ":", "boolean", ";", "xAxisHidden", "(", "_", ")", ":", "this", ";", "xAxisHidden_default", "(", "_", ")", ";", "yAxisTitle", "(", ")", ":", "string", ";", "yAxisTitle", "(", "_", ")", ":", "this", ";", "yAxisTickCount", "(", ")", ":", "number", ";", "yAxisTickCount", "(", "_", ")", ":", "this", ";", "yAxisTickFormat", "(", ")", ":", "string", ";", "yAxisTickFormat", "(", "_", ")", ":", "this", ";", "yAxisTicks", "(", ")", ":", "Array", "<", "{", "value", ":", "string", ";", "label", ":", "string", ";", "}", ">", ";", "yAxisTicks", "(", "_", ")", ":", "this", ";", "yAxisType", "(", ")", ":", "\"none\"", "|", "\"ordinal\"", "|", "\"linear\"", "|", "\"pow\"", "|", "\"log\"", "|", "\"time\"", ";", "yAxisType", "(", "_", ")", ":", "this", ";", "yAxisType_default", "(", "_", ")", ";", "yAxisTypeTimePattern", "(", ")", ":", "string", ";", "yAxisTypeTimePattern", "(", "_", ")", ":", "this", ";", "yAxisTypePowExponent", "(", ")", ":", "number", ";", "yAxisTypePowExponent", "(", "_", ")", ":", "this", ";", "yAxisTypeLogBase", "(", ")", ":", "number", ";", "yAxisTypeLogBase", "(", "_", ")", ":", "this", ";", "yAxisStacked", "(", ")", ":", "boolean", ";", "yAxisStacked", "(", "_", ")", ":", "this", ";", "yAxisDomainLow", "(", ")", ":", "number", "|", "string", ";", "yAxisDomainLow", "(", "_", ")", ":", "this", ";", "yAxisDomainHigh", "(", ")", ":", "number", "|", "string", ";", "yAxisDomainHigh", "(", "_", ")", ":", "this", ";", "yAxisDomainPadding", "(", ")", ":", "number", ";", "yAxisDomainPadding", "(", "_", ")", ":", "this", ";", "yAxisGuideLines", "(", ")", ":", "boolean", ";", "yAxisGuideLines", "(", "_", ")", ":", "this", ";", "yAxisGuideLines_default", "(", "_", ")", ";", "yAxisHidden", "(", ")", ":", "boolean", ";", "yAxisHidden", "(", "_", ")", ":", "this", ";", "yAxisHidden_default", "(", "_", ")", ";", "regions", "(", ")", ":", "object", "[", "]", ";", "regions", "(", "_", ")", ":", "this", ";", "layers", "(", ")", ":", "XYAxis", "[", "]", ";", "layers", "(", "_", ")", ":", "this", ";", "}", "XYAxis", ".", "prototype", ".", "publish", "(", "\"orientation\"", ",", "\"horizontal\"", ",", "\"set\"", ",", "\"Selects orientation for the axis\"", ",", "[", "\"horizontal\"", ",", "\"vertical\"", "]", ")", ";", "XYAxis", ".", "prototype", ".", "publish", "(", "\"pointSizeColumn\"", ",", "null", ",", "\"string\"", ",", "\"pointSizeColumn\"", ",", "null", ",", "{", "optional", ":", "true", "}", ")", ";", "XYAxis", ".", "prototype", ".", "publish", "(", "\"minPointSize\"", ",", "6", ",", "\"number\"", ",", "\"minPointSize\"", ")", ";", "XYAxis", ".", "prototype", ".", "publish", "(", "\"maxPointSize\"", ",", "26", ",", "\"number\"", ",", "\"maxPointSize\"", ")", ";", "XYAxis", ".", "prototype", ".", "publish", "(", "\"use2dSelection\"", ",", "false", ",", "\"boolean\"", ",", "\"2D Range Selector\"", ")", ";", "XYAxis", ".", "prototype", ".", "publish", "(", "\"selectionMode\"", ",", "false", ",", "\"boolean\"", ",", "\"Range Selector\"", ")", ";", "XYAxis", ".", "prototype", ".", "publishProxy", "(", "\"xAxisTitle\"", ",", "\"domainAxis\"", ",", "\"title\"", ")", ";", "XYAxis", ".", "prototype", ".", "publishProxy", "(", "\"xAxisTickCount\"", ",", "\"domainAxis\"", ",", "\"tickCount\"", ")", ";", "XYAxis", ".", "prototype", ".", "publishProxy", "(", "\"xAxisTickFormat\"", ",", "\"domainAxis\"", ",", "\"tickFormat\"", ")", ";", "XYAxis", ".", "prototype", ".", "publishProxy", "(", "\"xAxisTicks\"", ",", "\"domainAxis\"", ",", "\"ticks\"", ")", ";", "XYAxis", ".", "prototype", ".", "publishProxy", "(", "\"xAxisType\"", ",", "\"domainAxis\"", ",", "\"type\"", ")", ";", "XYAxis", ".", "prototype", ".", "publishProxy", "(", "\"xAxisTypeTimePattern\"", ",", "\"domainAxis\"", ",", "\"timePattern\"", ")", ";", "XYAxis", ".", "prototype", ".", "publish", "(", "\"xAxisDomainLow\"", ",", "null", ",", "\"string\"", ",", "\"X-Axis Low\"", ",", "null", ",", "{", "optional", ":", "true", ",", "disable", ":", "(", "w", ")", "=>", "w", ".", "xAxisType", "(", ")", "===", "\"ordinal\"", "}", ")", ";", "XYAxis", ".", "prototype", ".", "publish", "(", "\"xAxisDomainHigh\"", ",", "null", ",", "\"string\"", ",", "\"X-Axis High\"", ",", "null", ",", "{", "optional", ":", "true", ",", "disable", ":", "(", "w", ")", "=>", "w", ".", "xAxisType", "(", ")", "===", "\"ordinal\"", "}", ")", ";", "XYAxis", ".", "prototype", ".", "publishProxy", "(", "\"xAxisFontSize\"", ",", "\"domainAxis\"", ",", "\"fontSize\"", ")", ";", "XYAxis", ".", "prototype", ".", "publishProxy", "(", "\"xAxisFontFamily\"", ",", "\"domainAxis\"", ",", "\"fontFamily\"", ")", ";", "XYAxis", ".", "prototype", ".", "publishProxy", "(", "\"xAxisOrdinalPaddingInner\"", ",", "\"domainAxis\"", ",", "\"ordinalPaddingInner\"", ")", ";", "XYAxis", ".", "prototype", ".", "publishProxy", "(", "\"xAxisOrdinalPaddingOuter\"", ",", "\"domainAxis\"", ",", "\"ordinalPaddingOuter\"", ")", ";", "XYAxis", ".", "prototype", ".", "publishProxy", "(", "\"xAxisOverlapMode\"", ",", "\"domainAxis\"", ",", "\"overlapMode\"", ")", ";", "XYAxis", ".", "prototype", ".", "publishProxy", "(", "\"xAxisLabelRotation\"", ",", "\"domainAxis\"", ",", "\"labelRotation\"", ")", ";", "XYAxis", ".", "prototype", ".", "publishProxy", "(", "\"xAxisDomainPadding\"", ",", "\"domainAxis\"", ",", "\"extend\"", ")", ";", "XYAxis", ".", "prototype", ".", "publish", "(", "\"xAxisGuideLines\"", ",", "false", ",", "\"boolean\"", ",", "\"Y-Axis Guide Lines\"", ")", ";", "XYAxis", ".", "prototype", ".", "publish", "(", "\"xAxisFocus\"", ",", "false", ",", "\"boolean\"", ",", "\"X-Axis Focus\"", ",", "null", ",", "{", "disable", ":", "(", "w", ")", "=>", "w", ".", "orientation", "(", ")", "!==", "\"horizontal\"", "}", ")", ";", "XYAxis", ".", "prototype", ".", "publish", "(", "\"xAxisFocusHeight\"", ",", "80", ",", "\"number\"", ",", "\"X-Axis Focus Height\"", ",", "null", ",", "{", "disable", ":", "(", "w", ")", "=>", "!", "w", ".", "xAxisFocus", "(", ")", "}", ")", ";", "XYAxis", ".", "prototype", ".", "publishProxy", "(", "\"xAxisHidden\"", ",", "\"domainAxis\"", ",", "\"hidden\"", ")", ";", "XYAxis", ".", "prototype", ".", "publishProxy", "(", "\"yAxisFontSize\"", ",", "\"valueAxis\"", ",", "\"fontSize\"", ")", ";", "XYAxis", ".", "prototype", ".", "publishProxy", "(", "\"yAxisFontFamily\"", ",", "\"valueAxis\"", ",", "\"fontFamily\"", ")", ";", "XYAxis", ".", "prototype", ".", "publishProxy", "(", "\"yAxisTitle\"", ",", "\"valueAxis\"", ",", "\"title\"", ")", ";", "XYAxis", ".", "prototype", ".", "publishProxy", "(", "\"yAxisTickCount\"", ",", "\"valueAxis\"", ",", "\"tickCount\"", ")", ";", "XYAxis", ".", "prototype", ".", "publishProxy", "(", "\"yAxisTickFormat\"", ",", "\"valueAxis\"", ",", "\"tickFormat\"", ")", ";", "XYAxis", ".", "prototype", ".", "publishProxy", "(", "\"yAxisTicks\"", ",", "\"valueAxis\"", ",", "\"ticks\"", ")", ";", "XYAxis", ".", "prototype", ".", "publishProxy", "(", "\"yAxisType\"", ",", "\"valueAxis\"", ",", "\"type\"", ")", ";", "XYAxis", ".", "prototype", ".", "publishProxy", "(", "\"yAxisTypeTimePattern\"", ",", "\"valueAxis\"", ",", "\"timePattern\"", ")", ";", "XYAxis", ".", "prototype", ".", "publishProxy", "(", "\"yAxisTypePowExponent\"", ",", "\"valueAxis\"", ",", "\"powExponent\"", ")", ";", "XYAxis", ".", "prototype", ".", "publishProxy", "(", "\"yAxisTypeLogBase\"", ",", "\"valueAxis\"", ",", "\"logBase\"", ")", ";", "XYAxis", ".", "prototype", ".", "publish", "(", "\"yAxisStacked\"", ",", "false", ",", "\"boolean\"", ",", "\"Stacked Chart\"", ",", "null", ",", "{", "tags", ":", "[", "\"Basic\"", "]", ",", "disable", ":", "(", "w", ")", "=>", "w", ".", "xAxisType", "(", ")", "!==", "\"ordinal\"", "||", "w", ".", "_class", ".", "indexOf", "(", "\"chart_Column\"", ")", "<", "0", "}", ")", ";", "XYAxis", ".", "prototype", ".", "publish", "(", "\"yAxisDomainLow\"", ",", "null", ",", "\"string\"", ",", "\"Y-Axis Low\"", ",", "null", ",", "{", "optional", ":", "true", ",", "disable", ":", "(", "w", ")", "=>", "w", ".", "yAxisType", "(", ")", "===", "\"ordinal\"", "}", ")", ";", "XYAxis", ".", "prototype", ".", "publish", "(", "\"yAxisDomainHigh\"", ",", "null", ",", "\"string\"", ",", "\"Y-Axis High\"", ",", "null", ",", "{", "optional", ":", "true", ",", "disable", ":", "(", "w", ")", "=>", "w", ".", "yAxisType", "(", ")", "===", "\"ordinal\"", "}", ")", ";", "XYAxis", ".", "prototype", ".", "publishProxy", "(", "\"yAxisDomainPadding\"", ",", "\"valueAxis\"", ",", "\"extend\"", ")", ";", "XYAxis", ".", "prototype", ".", "publish", "(", "\"yAxisGuideLines\"", ",", "true", ",", "\"boolean\"", ",", "\"Y-Axis Guide Lines\"", ")", ";", "XYAxis", ".", "prototype", ".", "publishProxy", "(", "\"yAxisHidden\"", ",", "\"valueAxis\"", ",", "\"hidden\"", ")", ";", "XYAxis", ".", "prototype", ".", "publish", "(", "\"regions\"", ",", "[", "]", ",", "\"array\"", ",", "\"Regions\"", ")", ";", "XYAxis", ".", "prototype", ".", "publish", "(", "\"layers\"", ",", "[", "]", ",", "\"widgetArray\"", ",", "\"Layers\"", ",", "null", ",", "{", "render", ":", "false", "}", ")", ";" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, 8, null, null, 8, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, 13022, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, 3, null, null, null, null, 3, null, null, null, null, 3, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 13022, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 290, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, 13022, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 3, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, 13022, null, null, null, 5, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, 13022, null, null, null, 5, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, 3, null, 13022, null, 2, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, 13022, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 13022, null, null, null, 3, null, null, null, null, null, 4, null, 13022, null, null, null, 3, null, null, null, null, null, 4, null, 13022, null, null, null, 3, null, null, null, null, null, 4, null, 13022, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 13022, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 13022, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 13, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 13, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 13022, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 13022, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1393
[ "import", "{", "INDChart", ",", "ITooltip", "}", "from", "\"@hpcc-js/api\"", ";", "import", "{", "InputField", "}", "from", "\"@hpcc-js/common\"", ";", "import", "{", "extent", "as", "d3Extent", "}", "from", "\"d3-array\"", ";", "import", "{", "scaleLinear", "as", "d3ScaleLinear", ",", "scaleLog", "as", "d3ScaleLog", ",", "scalePow", "as", "d3ScalePow", ",", "scaleSqrt", "as", "d3ScaleSqrt", "}", "from", "\"d3-scale\"", ";", "import", "{", "select", "as", "d3Select", "}", "from", "\"d3-selection\"", ";", "import", "{", "area", "as", "d3Area", ",", "curveBasis", "as", "d3CurveBasis", ",", "curveBundle", "as", "d3CurveBundle", ",", "curveCardinal", "as", "d3CurveCardinal", ",", "curveCatmullRom", "as", "d3curveCatmullRom", ",", "curveLinear", "as", "d3CurveLinear", ",", "curveMonotoneX", "as", "d3CurveMonotoneX", ",", "curveNatural", "as", "d3CurveNatural", ",", "curveStep", "as", "d3CurveStep", ",", "curveStepAfter", "as", "d3CurveStepAfter", ",", "curveStepBefore", "as", "d3CurveStepBefore", ",", "line", "as", "d3Line", "}", "from", "\"d3-shape\"", ";", "import", "{", "XYAxis", "}", "from", "\"./XYAxis\"", ";", "import", "\"../src/Scatter.css\"", ";", "export", "class", "Scatter", "extends", "XYAxis", "{", "static", "__inputs", ":", "InputField", "[", "]", "=", "[", "{", "id", ":", "\"label\"", ",", "type", ":", "\"any\"", "}", ",", "{", "id", ":", "\"values\"", ",", "type", ":", "\"number\"", ",", "multi", ":", "true", "}", "]", ";", "constructor", "(", ")", "{", "super", "(", ")", ";", "INDChart", ".", "call", "(", "this", ")", ";", "ITooltip", ".", "call", "(", "this", ")", ";", "this", ".", "xAxisGuideLines_default", "(", "true", ")", ".", "yAxisGuideLines_default", "(", "true", ")", ";", "}", "xPos", "(", "host", ",", "d", ")", "{", "return", "host", ".", "orientation", "(", ")", "===", "\"horizontal\"", "?", "host", ".", "dataPos", "(", "d", ".", "label", ")", ":", "host", ".", "valuePos", "(", "d", ".", "value", ")", ";", "}", "yPos", "(", "host", ",", "d", ")", "{", "return", "host", ".", "orientation", "(", ")", "===", "\"horizontal\"", "?", "host", ".", "valuePos", "(", "d", ".", "value", ")", ":", "host", ".", "dataPos", "(", "d", ".", "label", ")", ";", "}", "private", "curve", "(", ")", "{", "switch", "(", "this", ".", "interpolate", "(", ")", ")", "{", "case", "\"linear\"", ":", "return", "d3CurveLinear", ";", "case", "\"step\"", ":", "return", "d3CurveStep", ";", "case", "\"step-before\"", ":", "return", "d3CurveStepBefore", ";", "case", "\"step-after\"", ":", "return", "d3CurveStepAfter", ";", "case", "\"basis\"", ":", "return", "d3CurveBasis", ";", "case", "\"bundle\"", ":", "return", "d3CurveBundle", ";", "case", "\"cardinal\"", ":", "return", "d3CurveCardinal", ";", "case", "\"catmullRom\"", ":", "return", "d3curveCatmullRom", ";", "case", "\"natural\"", ":", "return", "d3CurveNatural", ";", "case", "\"monotone\"", ":", "default", ":", "return", "d3CurveMonotoneX", ";", "}", "}", "private", "getScale", "(", ")", "{", "switch", "(", "this", ".", "pointSizeScale", "(", ")", ")", "{", "case", "\"linear\"", ":", "return", "d3ScaleLinear", "(", ")", ";", "case", "\"pow\"", ":", "return", "d3ScalePow", "(", ")", ".", "exponent", "(", "2", ")", ";", "case", "\"log\"", ":", "return", "d3ScaleLog", "(", ")", ";", "case", "\"sqrt\"", ":", "return", "d3ScaleSqrt", "(", ")", ";", "}", "}", "protected", "pointColor", "(", "row", ",", "col", ",", "value", ",", "origRow", ")", "{", "if", "(", "this", ".", "interpolate", "(", ")", "&&", "this", ".", "pointDarken", "(", ")", ")", "{", "return", "this", ".", "strokeColor", "(", "row", ",", "col", ",", "value", ",", "origRow", ")", ";", "}", "return", "this", ".", "fillColor", "(", "row", ",", "col", ",", "value", ",", "origRow", ")", ";", "}", "protected", "lineColor", "(", "row", ",", "col", ",", "value", ",", "origRow", ")", "{", "if", "(", "this", ".", "interpolateFill", "(", ")", "&&", "this", ".", "interpolateDarken", "(", ")", ")", "{", "return", "this", ".", "strokeColor", "(", "row", ",", "col", ",", "value", ",", "origRow", ")", ";", "}", "return", "this", ".", "fillColor", "(", "row", ",", "col", ",", "value", ",", "origRow", ")", ";", "}", "protected", "areaColor", "(", "row", ",", "col", ",", "value", ",", "origRow", ")", "{", "return", "this", ".", "fillColor", "(", "row", ",", "col", ",", "value", ",", "origRow", ")", ";", "}", "layerEnter", "(", "host", ",", "element", ",", "duration", "=", "250", ")", "{", "super", ".", "layerEnter", "(", "host", ",", "element", ",", "duration", ")", ";", "const", "context", "=", "this", ";", "this", ".", "tooltipHTML", "(", "function", "(", "d", ")", "{", "switch", "(", "context", ".", "tooltipStyle", "(", ")", ")", "{", "case", "\"series-table\"", ":", "return", "context", ".", "tooltipFormat", "(", "{", "label", ":", "d", ".", "label", ",", "arr", ":", "context", ".", "columns", "(", ")", ".", "slice", "(", "1", ")", ".", "map", "(", "function", "(", "column", ",", "i", ")", "{", "return", "{", "label", ":", "column", ",", "color", ":", "context", ".", "_palette", "(", "column", ")", ",", "value", ":", "context", ".", "data", "(", ")", "[", "d", ".", "rowIdx", "]", "[", "i", "+", "1", "]", "}", ";", "}", ")", "}", ")", ";", "default", ":", "return", "context", ".", "tooltipFormat", "(", "{", "label", ":", "d", ".", "label", ",", "series", ":", "d", ".", "column", ",", "value", ":", "d", ".", "value", "}", ")", ";", "}", "}", ")", ";", "}", "protected", "_prevPointShape", ";", "layerUpdate", "(", "host", ",", "element", ",", "duration", "=", "250", ")", "{", "super", ".", "layerUpdate", "(", "host", ",", "element", ")", ";", "const", "isHorizontal", "=", "host", ".", "orientation", "(", ")", "===", "\"horizontal\"", ";", "const", "height", "=", "isHorizontal", "?", "this", ".", "height", "(", ")", ":", "this", ".", "width", "(", ")", ";", "const", "context", "=", "this", ";", "this", ".", "_palette", "=", "this", ".", "_palette", ".", "switch", "(", "this", ".", "paletteID", "(", ")", ")", ";", "if", "(", "this", ".", "useClonedPalette", "(", ")", ")", "{", "this", ".", "_palette", "=", "this", ".", "_palette", ".", "cloneNotExists", "(", "this", ".", "paletteID", "(", ")", "+", "\"_\"", "+", "this", ".", "id", "(", ")", ")", ";", "}", "if", "(", "this", ".", "_prevPointShape", "!==", "this", ".", "pointShape", "(", ")", ")", "{", "element", ".", "selectAll", "(", "\".data\"", ")", ".", "remove", "(", ")", ";", "this", ".", "_prevPointShape", "=", "this", ".", "pointShape", "(", ")", ";", "}", "function", "mapShape", "(", "shape", ")", "{", "switch", "(", "shape", ")", "{", "case", "\"rectangle\"", ":", "return", "\"rect\"", ";", "case", "\"circle\"", ":", "return", "\"circle\"", ";", "case", "\"cross\"", ":", "return", "\"path\"", ";", "default", ":", "}", "}", "const", "usePointSizeColumn", "=", "this", ".", "pointSizeColumn_exists", "(", ")", ";", "let", "pointSizeColumnIdx", ";", "let", "extent", ";", "let", "scale", ";", "if", "(", "usePointSizeColumn", ")", "{", "pointSizeColumnIdx", "=", "this", ".", "columns", "(", ")", ".", "indexOf", "(", "this", ".", "pointSizeColumn", "(", ")", ")", ";", "extent", "=", "d3Extent", "(", "this", ".", "data", "(", ")", ",", "d", "=>", "d", "[", "pointSizeColumnIdx", "]", ")", ";", "scale", "=", "this", ".", "getScale", "(", ")", ".", "domain", "(", "extent", ")", ";", "}", "const", "layerColumns", "=", "this", ".", "layerColumns", "(", "host", ")", ";", "const", "layerData", "=", "this", ".", "layerData", "(", "host", ")", ";", "const", "flatData", "=", "this", ".", "flattenData", "(", "layerColumns", ",", "layerData", ")", ".", "map", "(", "function", "(", "d", ")", "{", "d", ".", "shape", "=", "mapShape", "(", "context", ".", "pointShape", "(", ")", ")", ";", "d", ".", "column", "=", "layerColumns", "[", "d", ".", "colIdx", "]", ";", "d", ".", "row", "=", "layerData", "[", "d", ".", "rowIdx", "]", ";", "d", ".", "origRow", "=", "(", "layerData", "[", "d", ".", "rowIdx", "]", "as", "any", ")", ".", "__hpcc_origRow", ";", "if", "(", "extent", ")", "{", "d", ".", "size", "=", "scale", "(", "d", ".", "row", "[", "pointSizeColumnIdx", "]", ")", "*", "(", "context", ".", "maxPointSize", "(", ")", "-", "context", ".", "minPointSize", "(", ")", ")", "+", "context", ".", "minPointSize", "(", ")", ";", "return", "d", ".", "column", "===", "context", ".", "pointSizeColumn", "(", ")", "?", "false", ":", "d", ";", "}", "else", "{", "d", ".", "size", "=", "context", ".", "pointSize", "(", ")", ";", "return", "d", ";", "}", "}", ")", ".", "filter", "(", "d", "=>", "d", ")", ";", "const", "areas", "=", "element", ".", "selectAll", "(", "\".area\"", ")", ".", "data", "(", "layerColumns", ".", "filter", "(", "function", "(", "_d", ",", "idx", ")", "{", "return", "context", ".", "interpolate", "(", ")", "&&", "context", ".", "interpolateFill", "(", ")", "&&", "idx", ">", "0", ";", "}", ")", ")", ";", "const", "areasEnter", "=", "areas", ".", "enter", "(", ")", ".", "append", "(", "\"path\"", ")", ";", "const", "area", "=", "d3Area", "(", ")", ".", "curve", "(", "this", ".", "curve", "(", ")", ")", ";", "if", "(", "isHorizontal", ")", "{", "area", ".", "x", "(", "function", "(", "d", ")", "{", "return", "context", ".", "xPos", "(", "host", ",", "d", ")", ";", "}", ")", ".", "y0", "(", "Math", ".", "min", "(", "height", ",", "this", ".", "yPos", "(", "host", ",", "{", "value", ":", "0", "}", ")", ")", ")", ".", "y1", "(", "function", "(", "d", ")", "{", "return", "context", ".", "yPos", "(", "host", ",", "d", ")", ";", "}", ")", ";", "}", "else", "{", "area", ".", "y", "(", "function", "(", "d", ")", "{", "return", "context", ".", "yPos", "(", "host", ",", "d", ")", ";", "}", ")", ".", "x0", "(", "Math", ".", "max", "(", "0", ",", "this", ".", "xPos", "(", "host", ",", "{", "value", ":", "0", "}", ")", ")", ")", ".", "x1", "(", "function", "(", "d", ")", "{", "return", "context", ".", "xPos", "(", "host", ",", "d", ")", ";", "}", ")", ";", "}", "areasEnter", ".", "merge", "(", "areas", ")", ".", "attr", "(", "\"class\"", ",", "d", "=>", "\"area series series-\"", "+", "this", ".", "cssTag", "(", "d", ")", ")", ".", "each", "(", "function", "(", "_d", ",", "idx", ")", "{", "const", "element", "=", "d3Select", "(", "this", ")", ";", "element", ".", "attr", "(", "\"d\"", ",", "area", "(", "flatData", ".", "filter", "(", "function", "(", "d2", ")", "{", "return", "d2", ".", "colIdx", "===", "idx", "+", "1", ";", "}", ")", ")", ")", ".", "style", "(", "\"opacity\"", ",", "context", ".", "interpolateFillOpacity", "(", ")", ")", ".", "style", "(", "\"stroke\"", ",", "\"none\"", ")", ".", "style", "(", "\"fill\"", ",", "context", ".", "areaColor", "(", "[", "]", ",", "_d", ",", "undefined", ",", "[", "]", ")", ")", ";", "}", ")", ";", "areas", ".", "exit", "(", ")", ".", "remove", "(", ")", ";", "const", "lines", "=", "element", ".", "selectAll", "(", "\".line\"", ")", ".", "data", "(", "layerColumns", ".", "filter", "(", "function", "(", "_d", ",", "idx", ")", "{", "return", "context", ".", "interpolate", "(", ")", "&&", "idx", ">", "0", ";", "}", ")", ")", ";", "const", "linesEnter", "=", "lines", ".", "enter", "(", ")", ".", "append", "(", "\"path\"", ")", ";", "const", "line", "=", "d3Line", "(", ")", ".", "x", "(", "function", "(", "d", ")", "{", "return", "context", ".", "xPos", "(", "host", ",", "d", ")", ";", "}", ")", ".", "y", "(", "function", "(", "d", ")", "{", "return", "context", ".", "yPos", "(", "host", ",", "d", ")", ";", "}", ")", ".", "curve", "(", "this", ".", "curve", "(", ")", ")", ";", "linesEnter", ".", "merge", "(", "lines", ")", ".", "attr", "(", "\"class\"", ",", "d", "=>", "\"line series series-\"", "+", "this", ".", "cssTag", "(", "d", ")", ")", ".", "each", "(", "function", "(", "_d", ",", "idx", ")", "{", "const", "element", "=", "d3Select", "(", "this", ")", ";", "const", "data2", "=", "flatData", ".", "filter", "(", "function", "(", "d2", ")", "{", "return", "d2", ".", "colIdx", "===", "idx", "+", "1", ";", "}", ")", ";", "element", ".", "attr", "(", "\"d\"", ",", "line", "(", "data2", ")", ")", ".", "style", "(", "\"stroke\"", ",", "context", ".", "lineColor", "(", "[", "]", ",", "_d", ",", "undefined", ",", "[", "]", ")", ")", ".", "style", "(", "\"fill\"", ",", "\"none\"", ")", ";", "}", ")", ";", "lines", ".", "exit", "(", ")", ".", "remove", "(", ")", ";", "const", "points", "=", "element", ".", "selectAll", "(", "\".point\"", ")", ".", "data", "(", "flatData", ",", "function", "(", "d", ",", "idx", ")", "{", "return", "d", ".", "shape", "+", "\"_\"", "+", "idx", ";", "}", ")", ";", "points", ".", "enter", "(", ")", ".", "append", "(", "\"g\"", ")", ".", "each", "(", "function", "(", "this", ",", "d2", ")", "{", "const", "element", "=", "d3Select", "(", "this", ")", ";", "element", ".", "append", "(", "d2", ".", "shape", ")", ".", "attr", "(", "\"class\"", ",", "\"pointShape\"", ")", ";", "element", ".", "append", "(", "\"text\"", ")", ".", "attr", "(", "\"class\"", ",", "\"pointValue\"", ")", ".", "style", "(", "\"display\"", ",", "\"none\"", ")", ".", "attr", "(", "\"text-anchor\"", ",", "context", ".", "valueAnchor", "(", ")", ")", ".", "attr", "(", "\"alignment-baseline\"", ",", "context", ".", "valueBaseline", "(", ")", ")", ".", "attr", "(", "\"fill\"", ",", "function", "(", "d", ",", "_idx", ")", "{", "const", "useTextColor", "=", "context", ".", "valueBaseline", "(", ")", "===", "\"middle\"", "||", "context", ".", "valueBaseline", "(", ")", "===", "\"central\"", ";", "return", "useTextColor", "?", "context", ".", "textColor", "(", "d", ".", "row", ",", "d", ".", "column", ",", "d", ".", "value", ",", "d", ".", "origRow", ")", ":", "null", ";", "}", ")", ";", "element", ".", "append", "(", "\"circle\"", ")", ".", "attr", "(", "\"class\"", ",", "\"pointSelection\"", ")", ".", "on", "(", "\"mouseout.tooltip\"", ",", "context", ".", "tooltip", ".", "hide", ")", ".", "on", "(", "\"mousemove.tooltip\"", ",", "context", ".", "tooltip", ".", "show", ")", ".", "call", "(", "host", ".", "_selection", ".", "enter", ".", "bind", "(", "host", ".", "_selection", ")", ")", ".", "on", "(", "\"click\"", ",", "function", "(", "d", ",", "_idx", ")", "{", "context", ".", "click", "(", "host", ".", "rowToObj", "(", "host", ".", "data", "(", ")", "[", "d", ".", "rowIdx", "]", ")", ",", "d", ".", "column", ",", "host", ".", "_selection", ".", "selected", "(", "this", ")", ")", ";", "}", ")", ".", "on", "(", "\"dblclick\"", ",", "function", "(", "d", ",", "_idx", ")", "{", "context", ".", "dblclick", "(", "host", ".", "rowToObj", "(", "host", ".", "data", "(", ")", "[", "d", ".", "rowIdx", "]", ")", ",", "d", ".", "column", ",", "host", ".", "_selection", ".", "selected", "(", "this", ")", ")", ";", "}", ")", ";", "}", ")", ".", "merge", "(", "points", ")", ".", "attr", "(", "\"class\"", ",", "d", "=>", "\"point series series-\"", "+", "this", ".", "cssTag", "(", "d", ".", "column", ")", ")", ".", "each", "(", "function", "(", "this", ",", "d2", ")", "{", "const", "textSelection", "=", "d3Select", "(", "this", ")", ".", "select", "(", "\".pointValue\"", ")", ";", "textSelection", ".", "attr", "(", "\"x\"", ",", "function", "(", "d", ")", "{", "return", "context", ".", "xPos", "(", "host", ",", "d", ")", ";", "}", ")", ".", "attr", "(", "\"y\"", ",", "function", "(", "d", ")", "{", "return", "context", ".", "yPos", "(", "host", ",", "d", ")", ";", "}", ")", ".", "style", "(", "\"display\"", ",", "context", ".", "showValue", "(", ")", "?", "\"block\"", ":", "\"none\"", ")", ".", "attr", "(", "\"text-anchor\"", ",", "context", ".", "valueAnchor", "(", ")", ")", ".", "attr", "(", "\"alignment-baseline\"", ",", "context", ".", "valueBaseline", "(", ")", ")", ".", "text", "(", "function", "(", "d", ")", "{", "return", "d", "[", "\"value\"", "]", ";", "}", ")", ";", "const", "elementSelection", "=", "d3Select", "(", "this", ")", ".", "select", "(", "\".pointSelection\"", ")", ";", "elementSelection", ".", "attr", "(", "\"cx\"", ",", "function", "(", "d", ")", "{", "return", "context", ".", "xPos", "(", "host", ",", "d", ")", ";", "}", ")", ".", "attr", "(", "\"cy\"", ",", "function", "(", "d", ")", "{", "return", "context", ".", "yPos", "(", "host", ",", "d", ")", ";", "}", ")", ".", "attr", "(", "\"r\"", ",", "d2", ".", "size", ")", ";", "const", "element", "=", "d3Select", "(", "this", ")", ".", "select", "(", "\".pointShape\"", ")", ";", "switch", "(", "d2", ".", "shape", ")", "{", "case", "\"rect\"", ":", "element", ".", "attr", "(", "\"x\"", ",", "function", "(", "d", ")", "{", "return", "context", ".", "xPos", "(", "host", ",", "d", ")", "-", "d2", ".", "size", "/", "2", ";", "}", ")", ".", "attr", "(", "\"y\"", ",", "function", "(", "d", ")", "{", "return", "context", ".", "yPos", "(", "host", ",", "d", ")", "-", "d2", ".", "size", "/", "2", ";", "}", ")", ".", "attr", "(", "\"width\"", ",", "d2", ".", "size", ")", ".", "attr", "(", "\"height\"", ",", "d2", ".", "size", ")", ".", "style", "(", "\"fill\"", ",", "context", ".", "pointColor", "(", "d2", ".", "row", ",", "d2", ".", "column", ",", "d2", ".", "value", ",", "d2", ".", "origRow", ")", ")", ";", "break", ";", "case", "\"circle\"", ":", "element", ".", "attr", "(", "\"cx\"", ",", "function", "(", "d", ")", "{", "return", "context", ".", "xPos", "(", "host", ",", "d", ")", ";", "}", ")", ".", "attr", "(", "\"cy\"", ",", "function", "(", "d", ")", "{", "return", "context", ".", "yPos", "(", "host", ",", "d", ")", ";", "}", ")", ".", "attr", "(", "\"r\"", ",", "d2", ".", "size", "*", "0.9", ")", ".", "style", "(", "\"fill\"", ",", "context", ".", "pointColor", "(", "d2", ".", "row", ",", "d2", ".", "column", ",", "d2", ".", "value", ",", "d2", ".", "origRow", ")", ")", ";", "break", ";", "case", "\"path\"", ":", "element", ".", "attr", "(", "\"d\"", ",", "function", "(", "d", ")", "{", "return", "\"M\"", "+", "(", "context", ".", "xPos", "(", "host", ",", "d", ")", "-", "d2", ".", "size", "/", "2", ")", "+", "\" \"", "+", "(", "context", ".", "yPos", "(", "host", ",", "d", ")", "-", "d2", ".", "size", "/", "2", ")", "+", "\" \"", "+", "\"L\"", "+", "(", "context", ".", "xPos", "(", "host", ",", "d", ")", "+", "d2", ".", "size", "/", "2", ")", "+", "\" \"", "+", "(", "context", ".", "yPos", "(", "host", ",", "d", ")", "+", "d2", ".", "size", "/", "2", ")", "+", "\" \"", "+", "\"M\"", "+", "(", "context", ".", "xPos", "(", "host", ",", "d", ")", "-", "d2", ".", "size", "/", "2", ")", "+", "\" \"", "+", "(", "context", ".", "yPos", "(", "host", ",", "d", ")", "+", "d2", ".", "size", "/", "2", ")", "+", "\" \"", "+", "\"L\"", "+", "(", "context", ".", "xPos", "(", "host", ",", "d", ")", "+", "d2", ".", "size", "/", "2", ")", "+", "\" \"", "+", "(", "context", ".", "yPos", "(", "host", ",", "d", ")", "-", "d2", ".", "size", "/", "2", ")", ";", "}", ")", ".", "style", "(", "\"stroke\"", ",", "context", ".", "pointColor", "(", "d2", ".", "row", ",", "d2", ".", "column", ",", "d2", ".", "value", ",", "d2", ".", "origRow", ")", ")", ";", "break", ";", "default", ":", "}", "}", ")", ";", "points", ".", "exit", "(", ")", ".", "remove", "(", ")", ";", "}", "exit", "(", "domNode", ",", "element", ")", "{", "super", ".", "exit", "(", "domNode", ",", "element", ")", ";", "}", "paletteID", ":", "{", "(", ")", ":", "string", ";", "(", "_", ")", ":", "Scatter", ";", "}", ";", "useClonedPalette", ":", "{", "(", ")", ":", "boolean", ";", "(", "_", ")", ":", "Scatter", ";", "}", ";", "pointSizeScale", ":", "{", "(", ")", ":", "string", ";", "(", "_", ")", ":", "Scatter", ";", "}", ";", "pointShape", ":", "{", "(", ")", ":", "string", ";", "(", "_", ")", ":", "Scatter", ";", "}", ";", "pointSize", ":", "{", "(", ")", ":", "number", ";", "(", "_", ")", ":", "Scatter", ";", "}", ";", "interpolate", ":", "{", "(", ")", ":", "string", ";", "(", "_", ")", ":", "Scatter", ";", "}", ";", "interpolate_default", ":", "{", "(", ")", ":", "string", ";", "(", "_", ")", ":", "Scatter", ";", "}", ";", "interpolateFill", ":", "{", "(", ")", ":", "boolean", ";", "(", "_", ")", ":", "Scatter", ";", "}", ";", "interpolateFill_default", ":", "{", "(", ")", ":", "boolean", ";", "(", "_", ")", ":", "Scatter", ";", "}", ";", "interpolateFillOpacity", ":", "{", "(", ")", ":", "number", ";", "(", "_", ")", ":", "Scatter", ";", "}", ";", "_palette", ";", "fillColor", ":", "(", "row", ",", "column", ",", "value", ",", "origRow", ")", "=>", "string", ";", "strokeColor", ":", "(", "row", ",", "column", ",", "value", ",", "origRow", ")", "=>", "string", ";", "textColor", ":", "(", "row", ",", "column", ",", "value", ",", "origRow", ")", "=>", "string", ";", "dblclick", ":", "(", "row", ",", "column", ",", "selected", ")", "=>", "void", ";", "tooltip", ";", "tooltipHTML", ":", "(", "_", ")", "=>", "string", ";", "tooltipFormat", ":", "(", "_", ")", "=>", "string", ";", "tooltipStyle", ":", "(", ")", "=>", "\"default\"", "|", "\"none\"", "|", "\"series-table\"", ";", "}", "Scatter", ".", "prototype", ".", "_class", "+=", "\" chart_Scatter\"", ";", "Scatter", ".", "prototype", ".", "implements", "(", "INDChart", ".", "prototype", ")", ";", "Scatter", ".", "prototype", ".", "implements", "(", "ITooltip", ".", "prototype", ")", ";", "export", "interface", "Scatter", "{", "valueAnchor", "(", ")", ":", "string", ";", "valueAnchor", "(", "_", ")", ":", "this", ";", "valueBaseline", "(", ")", ":", "string", ";", "valueBaseline", "(", "_", ")", ":", "this", ";", "showValue", "(", ")", ":", "boolean", ";", "showValue", "(", "_", ")", ":", "this", ";", "pointDarken", "(", ")", ":", "boolean", ";", "pointDarken", "(", "_", ")", ":", "this", ";", "interpolateDarken", "(", ")", ":", "boolean", ";", "interpolateDarken", "(", "_", ")", ":", "this", ";", "}", "Scatter", ".", "prototype", ".", "publish", "(", "\"paletteID\"", ",", "\"default\"", ",", "\"set\"", ",", "\"Color palette for this widget\"", ",", "Scatter", ".", "prototype", ".", "_palette", ".", "switch", "(", ")", ",", "{", "tags", ":", "[", "\"Basic\"", ",", "\"Shared\"", "]", "}", ")", ";", "Scatter", ".", "prototype", ".", "publish", "(", "\"pointSizeScale\"", ",", "\"linear\"", ",", "\"set\"", ",", "\"pointSizeScale\"", ",", "[", "\"linear\"", ",", "\"pow\"", ",", "\"log\"", ",", "\"sqrt\"", "]", ")", ";", "Scatter", ".", "prototype", ".", "publish", "(", "\"pointShape\"", ",", "\"cross\"", ",", "\"set\"", ",", "\"Shape of the data points\"", ",", "[", "\"circle\"", ",", "\"rectangle\"", ",", "\"cross\"", "]", ")", ";", "Scatter", ".", "prototype", ".", "publish", "(", "\"pointSize\"", ",", "6", ",", "\"number\"", ",", "\"Point Size\"", ",", "null", ",", "{", "range", ":", "{", "min", ":", "1", ",", "step", ":", "1", ",", "max", ":", "200", "}", "}", ")", ";", "Scatter", ".", "prototype", ".", "publish", "(", "\"interpolate\"", ",", "\"\"", ",", "\"set\"", ",", "\"Interpolate Data\"", ",", "[", "\"\"", ",", "\"linear\"", ",", "\"step\"", ",", "\"step-before\"", ",", "\"step-after\"", ",", "\"basis\"", ",", "\"bundle\"", ",", "\"cardinal\"", ",", "\"catmullRom\"", ",", "\"natural\"", ",", "\"monotone\"", "]", ")", ";", "Scatter", ".", "prototype", ".", "publish", "(", "\"pointDarken\"", ",", "true", ",", "\"boolean\"", ",", "\"If true, and interpolate is set, then points will have a slightly darker color than their assigned palette color\"", ",", "null", ",", "{", "disable", ":", "w", "=>", "!", "w", ".", "interpolate", "(", ")", "}", ")", ";", "Scatter", ".", "prototype", ".", "publish", "(", "\"interpolateDarken\"", ",", "true", ",", "\"boolean\"", ",", "\"If true, and interpolateFill is true, then lines will have a slightly darker color than their assigned palette color\"", ",", "null", ",", "{", "disable", ":", "w", "=>", "!", "w", ".", "interpolateFill", "(", ")", "}", ")", ";", "Scatter", ".", "prototype", ".", "publish", "(", "\"interpolateFill\"", ",", "false", ",", "\"boolean\"", ",", "\"If true, the area between the line and zero will be filled\"", ")", ";", "Scatter", ".", "prototype", ".", "publish", "(", "\"interpolateFillOpacity\"", ",", "0.66", ",", "\"number\"", ",", "\"Fill interpolation Opacity\"", ",", "null", ",", "{", "range", ":", "{", "min", ":", "0", ",", "step", ":", "0.01", ",", "max", ":", "1", "}", "}", ")", ";", "Scatter", ".", "prototype", ".", "publish", "(", "\"useClonedPalette\"", ",", "false", ",", "\"boolean\"", ",", "\"Enable or disable using a cloned palette\"", ",", "null", ",", "{", "tags", ":", "[", "\"Intermediate\"", ",", "\"Shared\"", "]", "}", ")", ";", "Scatter", ".", "prototype", ".", "publish", "(", "\"showValue\"", ",", "false", ",", "\"boolean\"", ")", ";", "Scatter", ".", "prototype", ".", "publish", "(", "\"valueAnchor\"", ",", "\"middle\"", ",", "\"set\"", ",", "\"text-anchor for shown value text\"", ",", "[", "\"start\"", ",", "\"middle\"", ",", "\"end\"", "]", ")", ";", "Scatter", ".", "prototype", ".", "publish", "(", "\"valueBaseline\"", ",", "\"ideographic\"", ",", "\"set\"", ",", "\"alignment-baseline for shown value text\"", ",", "[", "\"auto\"", ",", "\"baseline\"", ",", "\"before-edge\"", ",", "\"text-before-edge\"", ",", "\"middle\"", ",", "\"central\"", ",", "\"after-edge\"", ",", "\"text-after-edge\"", ",", "\"ideographic\"", ",", "\"alphabetic\"", ",", "\"hanging\"", ",", "\"mathematical\"", ",", "\"inherit\"", "]", ")", ";" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 13022, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 13022, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1655, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 13022, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 13022, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3673, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 125, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 403, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 125, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 290, null, null, null, null, null, 125, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 290, null, null, null, null, null, 125, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 125, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 125, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1394
[ "import", "{", "INDChart", ",", "ITooltip", "}", "from", "\"@hpcc-js/api\"", ";", "import", "{", "InputField", ",", "Text", "}", "from", "\"@hpcc-js/common\"", ";", "import", "{", "format", "as", "d3Format", "}", "from", "\"d3-format\"", ";", "import", "{", "scaleBand", "as", "d3ScaleBand", "}", "from", "\"d3-scale\"", ";", "import", "{", "local", "as", "d3Local", ",", "select", "as", "d3Select", "}", "from", "\"d3-selection\"", ";", "import", "{", "XYAxis", "}", "from", "\"./XYAxis\"", ";", "import", "\"../src/Column.css\"", ";", "export", "class", "Column", "extends", "XYAxis", "{", "static", "__inputs", ":", "InputField", "[", "]", "=", "[", "{", "id", ":", "\"label\"", ",", "type", ":", "\"string\"", "}", ",", "{", "id", ":", "\"values\"", ",", "type", ":", "\"number\"", ",", "multi", ":", "true", "}", "]", ";", "protected", "_linearGap", ":", "number", ";", "private", "textLocal", "=", "d3Local", "<", "Text", ">", "(", ")", ";", "private", "isHorizontal", ":", "boolean", ";", "constructor", "(", ")", "{", "super", "(", ")", ";", "INDChart", ".", "call", "(", "this", ")", ";", "ITooltip", ".", "call", "(", "this", ")", ";", "this", ".", "_selection", ".", "skipBringToTop", "(", "true", ")", ";", "this", ".", "_linearGap", "=", "25.0", ";", "}", "layerEnter", "(", "host", ",", "element", ",", "duration", "=", "250", ")", "{", "super", ".", "layerEnter", "(", "host", ",", "element", ",", "duration", ")", ";", "const", "context", "=", "this", ";", "this", ".", "tooltipHTML", "(", "function", "(", "d", ")", "{", "switch", "(", "context", ".", "tooltipStyle", "(", ")", ")", "{", "case", "\"series-table\"", ":", "return", "context", ".", "tooltipFormat", "(", "{", "label", ":", "d", ".", "row", "[", "0", "]", ",", "arr", ":", "context", ".", "columns", "(", ")", ".", "slice", "(", "1", ")", ".", "map", "(", "function", "(", "column", ",", "i", ")", "{", "return", "{", "label", ":", "column", ",", "color", ":", "context", ".", "_palette", "(", "column", ")", ",", "value", ":", "d", ".", "row", "[", "i", "+", "1", "]", "}", ";", "}", ")", "}", ")", ";", "default", ":", "let", "value", "=", "d", ".", "row", "[", "d", ".", "idx", "]", ";", "if", "(", "value", "instanceof", "Array", ")", "{", "value", "=", "value", "[", "1", "]", "-", "value", "[", "0", "]", ";", "}", "return", "context", ".", "tooltipFormat", "(", "{", "label", ":", "d", ".", "row", "[", "0", "]", ",", "series", ":", "context", ".", "layerColumns", "(", "host", ")", "[", "d", ".", "idx", "]", ",", "value", "}", ")", ";", "}", "}", ")", ";", "}", "adjustedData", "(", "host", ")", "{", "const", "retVal", "=", "this", ".", "layerData", "(", "host", ")", ".", "map", "(", "row", "=>", "{", "let", "prevValue", "=", "0", ";", "return", "row", ".", "map", "(", "(", "cell", ",", "idx", ")", "=>", "{", "if", "(", "idx", "===", "0", ")", "{", "return", "cell", ";", "}", "if", "(", "idx", ">=", "this", ".", "layerColumns", "(", "host", ")", ".", "length", ")", "{", "return", "cell", ";", "}", "const", "retVal2", "=", "host", ".", "yAxisStacked", "(", ")", "?", "[", "prevValue", ",", "prevValue", "+", "cell", "]", ":", "cell", ";", "prevValue", "+=", "cell", ";", "return", "retVal2", ";", "}", ",", "this", ")", ";", "}", ",", "this", ")", ";", "return", "retVal", ";", "}", "layerUpdate", "(", "host", ",", "element", ",", "duration", "=", "250", ")", "{", "super", ".", "layerUpdate", "(", "host", ",", "element", ",", "duration", ")", ";", "const", "isHorizontal", "=", "host", ".", "orientation", "(", ")", "===", "\"horizontal\"", ";", "this", ".", "isHorizontal", "=", "isHorizontal", ";", "const", "context", "=", "this", ";", "this", ".", "_palette", "=", "this", ".", "_palette", ".", "switch", "(", "this", ".", "paletteID", "(", ")", ")", ";", "if", "(", "this", ".", "useClonedPalette", "(", ")", ")", "{", "this", ".", "_palette", "=", "this", ".", "_palette", ".", "cloneNotExists", "(", "this", ".", "paletteID", "(", ")", "+", "\"_\"", "+", "this", ".", "id", "(", ")", ")", ";", "}", "let", "dataLen", "=", "10", ";", "let", "offset", "=", "0", ";", "switch", "(", "host", ".", "xAxisType", "(", ")", ")", "{", "case", "\"ordinal\"", ":", "dataLen", "=", "host", ".", "bandwidth", "(", ")", ";", "offset", "=", "-", "dataLen", "/", "2", ";", "break", ";", "case", "\"linear\"", ":", "case", "\"time\"", ":", "dataLen", "=", "Math", ".", "max", "(", "Math", ".", "abs", "(", "host", ".", "dataPos", "(", "2", ")", "-", "host", ".", "dataPos", "(", "1", ")", ")", "*", "(", "100", "-", "this", ".", "_linearGap", ")", "/", "100", ",", "dataLen", ")", ";", "offset", "=", "-", "dataLen", "/", "2", ";", "break", ";", "default", ":", "}", "this", ".", "tooltip", ".", "direction", "(", "isHorizontal", "?", "\"n\"", ":", "\"e\"", ")", ";", "const", "columnScale", "=", "d3ScaleBand", "(", ")", ".", "domain", "(", "context", ".", "layerColumns", "(", "host", ")", ".", "filter", "(", "function", "(", "_d", ",", "idx", ")", "{", "return", "idx", ">", "0", ";", "}", ")", ")", ".", "rangeRound", "(", "isHorizontal", "?", "[", "0", ",", "dataLen", "]", ":", "[", "dataLen", ",", "0", "]", ")", ".", "paddingInner", "(", "this", ".", "xAxisSeriesPaddingInner", "(", ")", ")", ".", "paddingOuter", "(", "0", ")", ";", "const", "rowData", "=", "this", ".", "adjustedData", "(", "host", ")", ";", "let", "domainSums", "=", "[", "]", ";", "const", "seriesSums", "=", "[", "]", ";", "const", "columnLength", "=", "this", ".", "columns", "(", ")", ".", "length", ";", "if", "(", "this", ".", "showValue", "(", ")", ")", "{", "switch", "(", "this", ".", "showValueAsPercent", "(", ")", ")", "{", "case", "\"series\"", ":", "rowData", ".", "forEach", "(", "(", "row", ")", "=>", "{", "row", ".", "filter", "(", "(", "_", ",", "idx", ")", "=>", "idx", ">", "0", "&&", "idx", "<", "columnLength", ")", ".", "forEach", "(", "(", "col", ",", "idx", ")", "=>", "{", "if", "(", "seriesSums", "[", "idx", "+", "1", "]", "===", "undefined", ")", "{", "seriesSums", "[", "idx", "+", "1", "]", "=", "0", ";", "}", "seriesSums", "[", "idx", "+", "1", "]", "+=", "col", ";", "}", ")", ";", "}", ")", ";", "break", ";", "case", "\"domain\"", ":", "domainSums", "=", "rowData", ".", "map", "(", "row", "=>", "{", "return", "row", ".", "filter", "(", "(", "cell", ",", "idx", ")", "=>", "idx", ">", "0", "&&", "idx", "<", "columnLength", ")", ".", "reduce", "(", "(", "sum", ",", "cell", ")", "=>", "{", "return", "sum", "+", "cell", ";", "}", ",", "0", ")", ";", "}", ")", ";", "break", ";", "case", "null", ":", "default", ":", "}", "}", "const", "column", "=", "element", ".", "selectAll", "(", "\".dataRow\"", ")", ".", "data", "(", "this", ".", "adjustedData", "(", "host", ")", ")", ";", "const", "hostData", "=", "host", ".", "data", "(", ")", ";", "const", "axisSize", "=", "this", ".", "getAxisSize", "(", "host", ")", ";", "column", ".", "enter", "(", ")", ".", "append", "(", "\"g\"", ")", ".", "attr", "(", "\"class\"", ",", "\"dataRow\"", ")", ".", "merge", "(", "column", ")", ".", "each", "(", "function", "(", "dataRow", ",", "dataRowIdx", ")", "{", "const", "element", "=", "d3Select", "(", "this", ")", ";", "const", "columnGRect", "=", "element", ".", "selectAll", "(", "\".dataCell\"", ")", ".", "data", "(", "dataRow", ".", "filter", "(", "function", "(", "_d", ",", "i", ")", "{", "return", "i", "<", "context", ".", "layerColumns", "(", "host", ")", ".", "length", ";", "}", ")", ".", "map", "(", "function", "(", "d", ",", "i", ")", "{", "return", "{", "column", ":", "context", ".", "layerColumns", "(", "host", ")", "[", "i", "]", ",", "row", ":", "dataRow", ",", "origRow", ":", "hostData", "[", "dataRowIdx", "]", ",", "value", ":", "d", ",", "idx", ":", "i", "}", ";", "}", ")", ".", "filter", "(", "function", "(", "d", ")", "{", "return", "d", ".", "value", "!==", "null", "&&", "d", ".", "idx", ">", "0", ";", "}", ")", ",", "(", "d", ")", "=>", "d", ".", "column", ")", ";", "const", "columnGEnter", "=", "columnGRect", ".", "enter", "(", ")", ".", "append", "(", "\"g\"", ")", ".", "attr", "(", "\"class\"", ",", "\"dataCell\"", ")", ".", "on", "(", "\"mouseout.tooltip\"", ",", "function", "(", "d", ")", "{", "if", "(", "!", "context", ".", "tooltipInnerTextEllipsedOnly", "(", ")", "||", "(", "d", ".", "innerTextObj", "&&", "d", ".", "innerTextObj", ".", "isTruncated", ")", ")", "{", "context", ".", "tooltip", ".", "hide", ".", "apply", "(", "context", ",", "arguments", ")", ";", "}", "}", ")", ".", "on", "(", "\"mousemove.tooltip\"", ",", "function", "(", "d", ")", "{", "if", "(", "!", "context", ".", "tooltipInnerTextEllipsedOnly", "(", ")", "||", "(", "d", ".", "innerTextObj", "&&", "d", ".", "innerTextObj", ".", "isTruncated", ")", ")", "{", "context", ".", "tooltip", ".", "show", ".", "apply", "(", "context", ",", "arguments", ")", ";", "}", "}", ")", ".", "call", "(", "host", ".", "_selection", ".", "enter", ".", "bind", "(", "host", ".", "_selection", ")", ")", ".", "on", "(", "\"click\"", ",", "function", "(", "d", ")", "{", "context", ".", "click", "(", "host", ".", "rowToObj", "(", "d", ".", "origRow", ")", ",", "d", ".", "column", ",", "host", ".", "_selection", ".", "selected", "(", "this", ")", ")", ";", "}", ")", ".", "on", "(", "\"dblclick\"", ",", "function", "(", "d", ")", "{", "context", ".", "dblclick", "(", "host", ".", "rowToObj", "(", "d", ".", "origRow", ")", ",", "d", ".", "column", ",", "host", ".", "_selection", ".", "selected", "(", "this", ")", ")", ";", "}", ")", ".", "style", "(", "\"opacity\"", ",", "0", ")", ".", "each", "(", "function", "(", "this", ",", "d", ")", "{", "const", "element", "=", "d3Select", "(", "this", ")", ";", "element", ".", "append", "(", "\"rect\"", ")", ".", "attr", "(", "\"class\"", ",", "\"columnRect series series-\"", "+", "context", ".", "cssTag", "(", "d", ".", "column", ")", ")", ";", "element", ".", "append", "(", "\"text\"", ")", ".", "attr", "(", "\"class\"", ",", "\"columnRectText\"", ")", ".", "style", "(", "\"stroke\"", ",", "\"transparent\"", ")", ";", "}", ")", ";", "columnGEnter", ".", "transition", "(", ")", ".", "duration", "(", "duration", ")", ".", "style", "(", "\"opacity\"", ",", "1", ")", ";", "const", "domainLength", "=", "host", ".", "yAxisStacked", "(", ")", "?", "dataLen", ":", "columnScale", ".", "bandwidth", "(", ")", ";", "columnGEnter", ".", "merge", "(", "columnGRect", "as", "any", ")", ".", "each", "(", "function", "(", "this", ",", "d", ")", "{", "const", "element", "=", "d3Select", "(", "this", ")", ";", "const", "domainPos", "=", "host", ".", "dataPos", "(", "dataRow", "[", "0", "]", ")", "+", "(", "host", ".", "yAxisStacked", "(", ")", "?", "0", ":", "columnScale", "(", "d", ".", "column", ")", ")", "+", "offset", ";", "const", "upperValue", "=", "d", ".", "value", "instanceof", "Array", "?", "d", ".", "value", "[", "1", "]", ":", "d", ".", "value", ";", "let", "valueText", "=", "d", ".", "origRow", "[", "d", ".", "idx", "]", ";", "if", "(", "context", ".", "showValue", "(", ")", ")", "{", "const", "dm", "=", "context", ".", "dataMeta", "(", ")", ";", "switch", "(", "context", ".", "showValueAsPercent", "(", ")", ")", "{", "case", "\"series\"", ":", "const", "seriesSum", "=", "typeof", "dm", ".", "sum", "!==", "\"undefined\"", "?", "dm", ".", "sum", ":", "seriesSums", "[", "d", ".", "idx", "]", ";", "valueText", "=", "d3Format", "(", "context", ".", "showValueAsPercentFormat", "(", ")", ")", "(", "valueText", "/", "seriesSum", ")", ";", "break", ";", "case", "\"domain\"", ":", "const", "domainSum", "=", "typeof", "dm", ".", "sum", "!==", "\"undefined\"", "?", "dm", ".", "sum", ":", "domainSums", "[", "d", ".", "idx", "]", ";", "valueText", "=", "d3Format", "(", "context", ".", "showValueAsPercentFormat", "(", ")", ")", "(", "valueText", "/", "domainSum", ")", ";", "break", ";", "case", "null", ":", "default", ":", "valueText", "=", "d3Format", "(", "context", ".", "showValueFormat", "(", ")", ")", "(", "valueText", ")", ";", "break", ";", "}", "}", "const", "upperValuePos", "=", "host", ".", "valuePos", "(", "upperValue", ")", ";", "const", "lowerValuePos", "=", "host", ".", "valuePos", "(", "d", ".", "value", "instanceof", "Array", "?", "d", ".", "value", "[", "0", "]", ":", "0", ")", ";", "const", "valuePos", "=", "Math", ".", "min", "(", "lowerValuePos", ",", "upperValuePos", ")", ";", "const", "valueLength", "=", "Math", ".", "abs", "(", "upperValuePos", "-", "lowerValuePos", ")", ";", "const", "innerTextHeight", "=", "context", ".", "innerTextFontSize", "(", ")", ";", "const", "innerTextPadding", "=", "context", ".", "innerTextPadding_exists", "(", ")", "?", "context", ".", "innerTextPadding", "(", ")", ":", "innerTextHeight", "/", "2.5", ";", "const", "dataRect", "=", "context", ".", "intersectRectRect", "(", "{", "x", ":", "isHorizontal", "?", "domainPos", ":", "valuePos", ",", "y", ":", "isHorizontal", "?", "valuePos", ":", "domainPos", ",", "width", ":", "isHorizontal", "?", "domainLength", ":", "valueLength", ",", "height", ":", "isHorizontal", "?", "valueLength", ":", "domainLength", "}", ",", "{", "x", ":", "0", ",", "y", ":", "0", ",", "width", ":", "axisSize", ".", "width", ",", "height", ":", "axisSize", ".", "height", "}", ")", ";", "const", "_rects", "=", "element", ".", "select", "(", "\"rect\"", ")", ".", "transition", "(", ")", ".", "duration", "(", "duration", ")", ".", "style", "(", "\"fill\"", ",", "(", "d", ")", "=>", "context", ".", "fillColor", "(", "d", ".", "row", ",", "d", ".", "column", ",", "d", ".", "value", ",", "d", ".", "origRow", ")", ")", ";", "if", "(", "isHorizontal", ")", "{", "_rects", ".", "attr", "(", "\"x\"", ",", "domainPos", ")", ".", "attr", "(", "\"y\"", ",", "valuePos", ")", ".", "attr", "(", "\"width\"", ",", "domainLength", ")", ".", "attr", "(", "\"height\"", ",", "valueLength", ")", ";", "}", "else", "{", "_rects", ".", "attr", "(", "\"y\"", ",", "domainPos", ")", ".", "attr", "(", "\"x\"", ",", "valuePos", ")", ".", "attr", "(", "\"height\"", ",", "domainLength", ")", ".", "attr", "(", "\"width\"", ",", "valueLength", ")", ";", "}", "const", "_texts", "=", "element", ".", "select", "(", "\"text\"", ")", ".", "transition", "(", ")", ".", "duration", "(", "duration", ")", ".", "style", "(", "\"font-size\"", ",", "innerTextHeight", "+", "\"px\"", ")", ".", "style", "(", "\"fill\"", ",", "(", "d", ")", "=>", "context", ".", "textColor", "(", "d", ".", "row", ",", "d", ".", "column", ",", "d", ".", "value", ",", "d", ".", "origRow", ")", ")", ";", "_texts", ".", "style", "(", "\"font-family\"", ",", "context", ".", "innerTextFontFamily_exists", "(", ")", "?", "context", ".", "innerTextFontFamily", "(", ")", ":", "null", ")", ";", "const", "padding", "=", "context", ".", "innerTextPadding_exists", "(", ")", "?", "context", ".", "innerTextPadding", "(", ")", ":", "8", ";", "const", "textHeightOffset", "=", "innerTextHeight", "/", "2.7", ";", "if", "(", "isHorizontal", ")", "{", "const", "y", "=", "dataRect", ".", "y", "+", "dataRect", ".", "height", "-", "innerTextPadding", ";", "_texts", ".", "attr", "(", "\"x\"", ",", "domainPos", "+", "(", "domainLength", "/", "2", ")", ")", ".", "attr", "(", "\"y\"", ",", "y", "+", "textHeightOffset", ")", ".", "attr", "(", "\"transform\"", ",", "`rotate(-90, ${", "domainPos", "+", "(", "domainLength", "/", "2", ")", "}, ${", "y", "})`", ")", ";", "}", "else", "{", "_texts", ".", "attr", "(", "\"x\"", ",", "dataRect", ".", "x", "+", "padding", ")", ".", "attr", "(", "\"y\"", ",", "domainPos", "+", "(", "domainLength", "/", "2", ")", "+", "textHeightOffset", ")", ";", "}", "_texts", ".", "attr", "(", "\"height\"", ",", "domainLength", ")", ".", "attr", "(", "\"width\"", ",", "valueLength", ")", ";", "if", "(", "context", ".", "showInnerText", "(", ")", ")", "{", "_texts", ".", "text", "(", "(", "d", ")", "=>", "{", "const", "innerText", "=", "context", ".", "innerText", "(", "d", ".", "origRow", ",", "d", ".", "origRow", "[", "columnLength", "]", ",", "d", ".", "idx", ")", ";", "if", "(", "innerText", ")", "{", "const", "clippedValueLength", "=", "isHorizontal", "?", "dataRect", ".", "height", ":", "dataRect", ".", "width", ";", "const", "innerTextObj", "=", "context", ".", "calcInnerText", "(", "clippedValueLength", ",", "innerText", ",", "valueText", ")", ";", "d", ".", "innerTextObj", "=", "innerTextObj", ";", "return", "innerTextObj", ".", "text", ";", "}", "return", "\"\"", ";", "}", ")", ";", "}", "const", "dataText", "=", "element", ".", "selectAll", "(", "\".dataText\"", ")", ".", "data", "(", "context", ".", "showValue", "(", ")", "?", "[", "`${", "upperValue", "}`", "]", ":", "[", "]", ")", ";", "const", "dataTextEnter", "=", "dataText", ".", "enter", "(", ")", ".", "append", "(", "\"g\"", ")", ".", "attr", "(", "\"class\"", ",", "\"dataText\"", ")", ".", "each", "(", "function", "(", "this", ",", "d", ")", "{", "context", ".", "textLocal", ".", "set", "(", "this", ",", "new", "Text", "(", ")", ".", "target", "(", "this", ")", ".", "colorStroke_default", "(", "\"transparent\"", ")", ")", ";", "}", ")", ";", "dataTextEnter", ".", "merge", "(", "dataText", "as", "any", ")", ".", "each", "(", "function", "(", "this", ")", "{", "const", "pos", "=", "{", "x", ":", "0", ",", "y", ":", "0", "}", ";", "const", "valueFontFamily", "=", "context", ".", "valueFontFamily", "(", ")", ";", "const", "valueFontSize", "=", "context", ".", "valueFontSize", "(", ")", ";", "const", "textSize", "=", "context", ".", "textSize", "(", "valueText", ",", "valueFontFamily", ",", "valueFontSize", ")", ";", "const", "isPositive", "=", "parseFloat", "(", "valueText", ")", ">=", "0", ";", "let", "valueAnchor", "=", "context", ".", "valueAnchor", "(", ")", "?", "context", ".", "valueAnchor", "(", ")", ":", "isHorizontal", "?", "\"middle\"", ":", "\"start\"", ";", "const", "leftSpace", "=", "dataRect", ".", "x", ";", "const", "rightSpace", "=", "axisSize", ".", "width", "-", "(", "dataRect", ".", "x", "+", "dataRect", ".", "width", ")", ";", "const", "topSpace", "=", "dataRect", ".", "y", ";", "const", "bottomSpace", "=", "axisSize", ".", "height", "-", "(", "dataRect", ".", "y", "+", "dataRect", ".", "height", ")", ";", "let", "noRoomInside", ";", "let", "isOutside", ";", "let", "noRoomOnExpectedSide", ";", "if", "(", "d", ".", "innerTextObj", ")", "{", "const", "{", "padding", ",", "valueTextWidth", "}", "=", "d", ".", "innerTextObj", ";", "isOutside", "=", "false", ";", "if", "(", "isHorizontal", ")", "{", "valueAnchor", "=", "\"middle\"", ";", "pos", ".", "x", "=", "domainPos", "+", "(", "domainLength", "/", "2", ")", ";", "if", "(", "d", ".", "innerTextObj", ".", "category", "===", "4", ")", "{", "isOutside", "=", "true", ";", "pos", ".", "y", "=", "valuePos", "-", "padding", "-", "(", "valueFontSize", "/", "2", ")", ";", "}", "else", "{", "pos", ".", "y", "=", "valuePos", "+", "padding", "+", "(", "valueFontSize", "/", "2", ")", ";", "}", "}", "else", "{", "valueAnchor", "=", "\"start\"", ";", "if", "(", "d", ".", "innerTextObj", ".", "category", "===", "4", ")", "{", "isOutside", "=", "true", ";", "pos", ".", "x", "=", "(", "valueLength", "+", "valuePos", ")", "+", "padding", ";", "}", "else", "{", "pos", ".", "x", "=", "(", "valueLength", "+", "valuePos", ")", "-", "valueTextWidth", "-", "padding", ";", "}", "pos", ".", "y", "=", "domainPos", "+", "(", "domainLength", "/", "2", ")", ";", "}", "}", "else", "{", "if", "(", "isHorizontal", ")", "{", "noRoomInside", "=", "dataRect", ".", "height", "<", "textSize", ".", "height", ";", "isOutside", "=", "!", "context", ".", "valueCentered", "(", ")", "||", "noRoomInside", ";", "pos", ".", "x", "=", "dataRect", ".", "x", "+", "(", "dataRect", ".", "width", "/", "2", ")", ";", "if", "(", "isOutside", ")", "{", "if", "(", "isPositive", ")", "{", "noRoomOnExpectedSide", "=", "topSpace", "<", "textSize", ".", "height", "+", "padding", ";", "if", "(", "noRoomOnExpectedSide", ")", "{", "if", "(", "!", "noRoomInside", ")", "{", "isOutside", "=", "false", ";", "pos", ".", "y", "=", "dataRect", ".", "y", "+", "(", "dataRect", ".", "height", "/", "2", ")", ";", "}", "else", "{", "pos", ".", "y", "=", "dataRect", ".", "y", "+", "dataRect", ".", "height", "+", "textSize", ".", "height", ";", "}", "}", "else", "{", "pos", ".", "y", "=", "dataRect", ".", "y", "-", "(", "textSize", ".", "height", "/", "2", ")", "-", "padding", ";", "}", "}", "else", "{", "noRoomOnExpectedSide", "=", "bottomSpace", "<", "textSize", ".", "height", ";", "if", "(", "noRoomOnExpectedSide", ")", "{", "if", "(", "!", "noRoomInside", ")", "{", "isOutside", "=", "false", ";", "pos", ".", "y", "=", "dataRect", ".", "y", "+", "(", "dataRect", ".", "height", "/", "2", ")", ";", "}", "else", "{", "pos", ".", "y", "=", "dataRect", ".", "y", "-", "(", "textSize", ".", "height", "/", "2", ")", "-", "padding", ";", "}", "}", "else", "{", "pos", ".", "y", "=", "dataRect", ".", "y", "+", "textSize", ".", "height", "+", "padding", ";", "}", "}", "}", "else", "{", "pos", ".", "y", "=", "dataRect", ".", "y", "+", "(", "dataRect", ".", "height", "/", "2", ")", ";", "}", "}", "else", "{", "noRoomInside", "=", "dataRect", ".", "width", "<", "textSize", ".", "width", ";", "isOutside", "=", "!", "context", ".", "valueCentered", "(", ")", "||", "noRoomInside", ";", "pos", ".", "y", "=", "dataRect", ".", "y", "+", "(", "dataRect", ".", "height", "/", "2", ")", ";", "if", "(", "isOutside", ")", "{", "if", "(", "isPositive", ")", "{", "noRoomOnExpectedSide", "=", "rightSpace", "<", "textSize", ".", "width", "+", "padding", ";", "if", "(", "noRoomOnExpectedSide", ")", "{", "if", "(", "context", ".", "showInnerText", "(", ")", "||", "!", "noRoomInside", ")", "{", "isOutside", "=", "false", ";", "pos", ".", "x", "=", "dataRect", ".", "x", "+", "(", "dataRect", ".", "width", "/", "2", ")", ";", "}", "else", "{", "pos", ".", "x", "=", "dataRect", ".", "x", "-", "(", "textSize", ".", "width", "-", "padding", ")", ";", "}", "}", "else", "{", "pos", ".", "x", "=", "dataRect", ".", "x", "+", "dataRect", ".", "width", "+", "(", "textSize", ".", "width", "/", "2", ")", "+", "padding", ";", "}", "}", "else", "{", "noRoomOnExpectedSide", "=", "leftSpace", "<", "textSize", ".", "width", ";", "if", "(", "noRoomOnExpectedSide", ")", "{", "if", "(", "context", ".", "showInnerText", "(", ")", "||", "!", "noRoomInside", ")", "{", "isOutside", "=", "false", ";", "pos", ".", "x", "=", "dataRect", ".", "x", "+", "(", "dataRect", ".", "width", "/", "2", ")", ";", "}", "else", "{", "pos", ".", "x", "=", "dataRect", ".", "x", "+", "dataRect", ".", "width", "+", "(", "textSize", ".", "width", "-", "padding", ")", ";", "}", "}", "else", "{", "pos", ".", "x", "=", "dataRect", ".", "x", "-", "(", "textSize", ".", "width", "-", "padding", ")", ";", "}", "}", "}", "else", "{", "pos", ".", "x", "=", "dataRect", ".", "x", "+", "(", "dataRect", ".", "width", "/", "2", ")", ";", "}", "}", "}", "const", "textColor", "=", "isOutside", "?", "null", ":", "context", ".", "textColor", "(", "d", ".", "row", ",", "d", ".", "column", ",", "d", ".", "value", ",", "d", ".", "origRow", ")", ";", "context", ".", "textLocal", ".", "get", "(", "this", ")", ".", "pos", "(", "pos", ")", ".", "anchor", "(", "valueAnchor", ")", ".", "fontFamily", "(", "valueFontFamily", ")", ".", "fontSize", "(", "valueFontSize", ")", ".", "text", "(", "`${", "valueText", "}`", ")", ".", "colorFill", "(", "textColor", ")", ".", "visible", "(", "context", ".", "showValue", "(", ")", ")", ".", "render", "(", ")", ";", "}", ")", ";", "dataText", ".", "exit", "(", ")", ".", "each", "(", "function", "(", "this", ",", "d", ")", "{", "context", ".", "textLocal", ".", "get", "(", "this", ")", ".", "target", "(", "null", ")", ";", "}", ")", ".", "remove", "(", ")", ";", "}", ")", ";", "columnGRect", ".", "exit", "(", ")", ".", "transition", "(", ")", ".", "duration", "(", "duration", ")", ".", "style", "(", "\"opacity\"", ",", "0", ")", ".", "remove", "(", ")", ";", "}", ")", ";", "column", ".", "exit", "(", ")", ".", "transition", "(", ")", ".", "duration", "(", "duration", ")", ".", "remove", "(", ")", ";", "}", "calcInnerText", "(", "offset", ",", "innerText", ",", "valueText", ")", "{", "const", "fontFamily", "=", "this", ".", "innerTextFontFamily_exists", "(", ")", "?", "this", ".", "innerTextFontFamily", "(", ")", ":", "\"Verdana\"", ";", "const", "fontSize", "=", "this", ".", "innerTextFontSize", "(", ")", ";", "const", "valueFontFamily", "=", "this", ".", "valueFontFamily_exists", "(", ")", "?", "this", ".", "valueFontFamily", "(", ")", ":", "\"Verdana\"", ";", "const", "valueFontSize", "=", "this", ".", "valueFontSize", "(", ")", ";", "const", "padding", "=", "this", ".", "innerTextPadding_exists", "(", ")", "?", "this", ".", "innerTextPadding", "(", ")", ":", "fontSize", "/", "2.5", ";", "const", "valueTextWidth", "=", "this", ".", "isHorizontal", "?", "valueFontSize", ":", "this", ".", "textSize", "(", "valueText", ",", "valueFontFamily", ",", "valueFontSize", ")", ".", "width", ";", "const", "ellipsisWidth", "=", "this", ".", "textSize", "(", "\"...\"", ",", "fontFamily", ",", "fontSize", ")", ".", "width", ";", "const", "innerTextWidth", "=", "this", ".", "textSize", "(", "innerText", ",", "fontFamily", ",", "fontSize", ")", ".", "width", ";", "const", "origInnerText", "=", "innerText", ";", "const", "fullWidth", "=", "(", "padding", "*", "3", ")", "+", "innerTextWidth", "+", "valueTextWidth", ";", "const", "fullWidth2", "=", "(", "padding", "*", "3", ")", "+", "ellipsisWidth", "+", "valueTextWidth", ";", "const", "fullWidth3", "=", "(", "padding", "*", "1", ")", "+", "valueTextWidth", ";", "let", "category", "=", "4", ";", "if", "(", "fullWidth", "<", "offset", ")", "{", "category", "=", "1", ";", "}", "else", "if", "(", "fullWidth2", "<", "offset", ")", "{", "const", "excessWidth", "=", "offset", "-", "fullWidth2", ";", "let", "_text", "=", "\"\"", ";", "for", "(", "const", "letter", "of", "innerText", ")", "{", "if", "(", "this", ".", "textSize", "(", "_text", "+", "letter", ",", "fontFamily", ",", "fontSize", ")", ".", "width", ">", "excessWidth", ")", "{", "innerText", "=", "_text", "+", "\"...\"", ";", "break", ";", "}", "else", "{", "_text", "+=", "letter", ";", "}", "}", "category", "=", "2", ";", "}", "else", "if", "(", "fullWidth3", "<", "offset", ")", "{", "innerText", "=", "\"\"", ";", "category", "=", "3", ";", "}", "else", "{", "innerText", "=", "\"\"", ";", "}", "return", "{", "text", ":", "innerText", ",", "isTruncated", ":", "origInnerText", "!==", "innerText", ",", "padding", ",", "category", ",", "valueTextWidth", "}", ";", "}", "innerText", "(", "origRow", ",", "lparam", ",", "idx", ")", "{", "return", "origRow", "[", "0", "]", ";", "}", "_palette", ";", "fillColor", ":", "(", "row", ",", "column", ",", "value", ",", "origRow", ")", "=>", "string", ";", "textColor", ":", "(", "row", ",", "column", ",", "value", ",", "origRow", ")", "=>", "string", ";", "dblclick", ":", "(", "row", ",", "column", ",", "selected", ")", "=>", "void", ";", "tooltip", ";", "tooltipHTML", ":", "(", "_", ")", "=>", "string", ";", "tooltipFormat", ":", "(", "_", ")", "=>", "string", ";", "tooltipStyle", ":", "(", ")", "=>", "\"default\"", "|", "\"none\"", "|", "\"series-table\"", ";", "}", "Column", ".", "prototype", ".", "_class", "+=", "\" chart_Column\"", ";", "Column", ".", "prototype", ".", "implements", "(", "INDChart", ".", "prototype", ")", ";", "Column", ".", "prototype", ".", "implements", "(", "ITooltip", ".", "prototype", ")", ";", "export", "interface", "Column", "{", "paletteID", "(", ")", ":", "string", ";", "paletteID", "(", "_", ")", ":", "this", ";", "useClonedPalette", "(", ")", ":", "boolean", ";", "useClonedPalette", "(", "_", ")", ":", "this", ";", "showValue", "(", ")", ":", "boolean", ";", "showValue", "(", "_", ")", ":", "this", ";", "showInnerText", "(", ")", ":", "boolean", ";", "showInnerText", "(", "_", ")", ":", "this", ";", "showValueFormat", "(", ")", ":", "string", ";", "showValueFormat", "(", "_", ")", ":", "this", ";", "showValueAsPercent", "(", ")", ":", "null", "|", "\"series\"", "|", "\"domain\"", ";", "showValueAsPercent", "(", "_", ")", ":", "this", ";", "showValueAsPercentFormat", "(", ")", ":", "string", ";", "showValueAsPercentFormat", "(", "_", ")", ":", "this", ";", "valueCentered", "(", ")", ":", "boolean", ";", "valueCentered", "(", "_", ")", ":", "this", ";", "valueAnchor", "(", ")", ":", "\"start\"", "|", "\"middle\"", "|", "\"end\"", ";", "valueAnchor", "(", "_", ")", ":", "this", ";", "valueFontFamily", "(", ")", ":", "string", ";", "valueFontFamily", "(", "_", ")", ":", "this", ";", "valueFontFamily_exists", "(", ")", ":", "boolean", ";", "valueFontSize", "(", ")", ":", "number", ";", "valueFontSize", "(", "_", ")", ":", "this", ";", "xAxisSeriesPaddingInner", "(", ")", ":", "number", ";", "xAxisSeriesPaddingInner", "(", "_", ")", ":", "this", ";", "innerTextFontFamily", "(", ")", ":", "string", ";", "innerTextFontFamily", "(", "_", ")", ":", "this", ";", "innerTextFontFamily_exists", "(", ")", ":", "boolean", ";", "innerTextFontSize", "(", ")", ":", "number", ";", "innerTextFontSize", "(", "_", ")", ":", "this", ";", "innerTextPadding", "(", ")", ":", "number", ";", "innerTextPadding", "(", "_", ")", ":", "this", ";", "innerTextPadding_exists", "(", ")", ":", "boolean", ";", "tooltipInnerTextEllipsedOnly", "(", ")", ":", "boolean", ";", "tooltipInnerTextEllipsedOnly", "(", "_", ")", ":", "this", ";", "}", "Column", ".", "prototype", ".", "publish", "(", "\"valueFontFamily\"", ",", "null", ",", "\"string\"", ",", "\"Font family of value text\"", ",", "null", ",", "{", "optional", ":", "true", "}", ")", ";", "Column", ".", "prototype", ".", "publish", "(", "\"valueFontSize\"", ",", "12", ",", "\"number\"", ",", "\"Height of value text (pixels)\"", ")", ";", "Column", ".", "prototype", ".", "publish", "(", "\"innerTextFontFamily\"", ",", "null", ",", "\"string\"", ",", "\"Font family of inner text\"", ",", "null", ",", "{", "optional", ":", "true", "}", ")", ";", "Column", ".", "prototype", ".", "publish", "(", "\"innerTextPadding\"", ",", "8", ",", "\"number\"", ",", "\"Offset of inner text (pixels)\"", ",", "null", ",", "{", "optional", ":", "true", "}", ")", ";", "Column", ".", "prototype", ".", "publish", "(", "\"innerTextFontSize\"", ",", "12", ",", "\"number\"", ",", "\"Height of inner text (pixels)\"", ")", ";", "Column", ".", "prototype", ".", "publish", "(", "\"paletteID\"", ",", "\"default\"", ",", "\"set\"", ",", "\"Color palette for this widget\"", ",", "(", ")", "=>", "Column", ".", "prototype", ".", "_palette", ".", "switch", "(", ")", ",", "{", "tags", ":", "[", "\"Basic\"", ",", "\"Shared\"", "]", "}", ")", ";", "Column", ".", "prototype", ".", "publish", "(", "\"useClonedPalette\"", ",", "false", ",", "\"boolean\"", ",", "\"Enable or disable using a cloned palette\"", ",", "null", ",", "{", "tags", ":", "[", "\"Intermediate\"", ",", "\"Shared\"", "]", "}", ")", ";", "Column", ".", "prototype", ".", "publish", "(", "\"showValue\"", ",", "false", ",", "\"boolean\"", ",", "\"Show Value in column\"", ")", ";", "Column", ".", "prototype", ".", "publish", "(", "\"showInnerText\"", ",", "false", ",", "\"boolean\"", ",", "\"Show Label in column\"", ")", ";", "Column", ".", "prototype", ".", "publish", "(", "\"showValueFormat\"", ",", "\".2s\"", ",", "\"string\"", ",", "\"D3 Format for Value\"", ",", "null", ",", "{", "disable", ":", "(", "w", ")", "=>", "!", "w", ".", "showValue", "(", ")", "||", "!", "!", "w", ".", "showValueAsPercent", "(", ")", "}", ")", ";", "Column", ".", "prototype", ".", "publish", "(", "\"showValueAsPercent\"", ",", "null", ",", "\"set\"", ",", "\"If showValue is true, optionally show value as a percentage by Series or Domain\"", ",", "[", "null", ",", "\"series\"", ",", "\"domain\"", "]", ",", "{", "disable", ":", "w", "=>", "!", "w", ".", "showValue", "(", ")", ",", "optional", ":", "true", "}", ")", ";", "Column", ".", "prototype", ".", "publish", "(", "\"showValueAsPercentFormat\"", ",", "\".0%\"", ",", "\"string\"", ",", "\"D3 Format for %\"", ",", "null", ",", "{", "disable", ":", "(", "w", ")", "=>", "!", "w", ".", "showValue", "(", ")", "||", "!", "w", ".", "showValueAsPercent", "(", ")", "}", ")", ";", "Column", ".", "prototype", ".", "publish", "(", "\"valueCentered\"", ",", "false", ",", "\"boolean\"", ",", "\"Show Value in center of column\"", ")", ";", "Column", ".", "prototype", ".", "publish", "(", "\"valueAnchor\"", ",", "\"middle\"", ",", "\"set\"", ",", "\"text-anchor for shown value text\"", ",", "[", "\"start\"", ",", "\"middle\"", ",", "\"end\"", "]", ")", ";", "Column", ".", "prototype", ".", "publish", "(", "\"xAxisSeriesPaddingInner\"", ",", "0", ",", "\"number\"", ",", "\"Determines the ratio of the range that is reserved for blank space between band (0->1)\"", ")", ";", "Column", ".", "prototype", ".", "publish", "(", "\"tooltipInnerTextEllipsedOnly\"", ",", "false", ",", "\"boolean\"", ",", "\"Show tooltip only when inner text is truncated with an ellipsis\"", ")", ";" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 13022, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 13022, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 13022, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5094, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, 5, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 125, null, null, null, null, null, null, null, 125, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 125, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 290, null, null, null, null, null, 125, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 290, null, null, null, null, null, 125, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 281, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 125, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 125, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 290, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 290, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, 51, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 290, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 228, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 228, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1395
[ "import", "{", "I2DChart", ",", "ITooltip", "}", "from", "\"@hpcc-js/api\"", ";", "import", "{", "FAChar", ",", "InputField", ",", "ISize", ",", "SVGWidget", ",", "Text", ",", "Utility", "}", "from", "\"@hpcc-js/common\"", ";", "import", "{", "hierarchy", "as", "d3Hierarchy", ",", "pack", "as", "d3Pack", "}", "from", "\"d3-hierarchy\"", ";", "import", "{", "select", "as", "d3Select", "}", "from", "\"d3-selection\"", ";", "import", "\"../src/Bubble.css\"", ";", "export", "class", "Bubble", "extends", "SVGWidget", "{", "static", "__inputs", ":", "InputField", "[", "]", "=", "[", "{", "id", ":", "\"label\"", ",", "type", ":", "\"string\"", "}", ",", "{", "id", ":", "\"value\"", ",", "type", ":", "\"number\"", "}", "]", ";", "labelWidgets", ";", "d3Pack", ";", "constructor", "(", ")", "{", "super", "(", ")", ";", "I2DChart", ".", "call", "(", "this", ")", ";", "ITooltip", ".", "call", "(", "this", ")", ";", "Utility", ".", "SimpleSelectionMixin", ".", "call", "(", "this", ")", ";", "this", ".", "_drawStartPos", "=", "\"origin\"", ";", "this", ".", "labelWidgets", "=", "{", "}", ";", "this", ".", "d3Pack", "=", "d3Pack", "(", ")", ".", "size", "(", "[", "this", ".", "width", "(", ")", ",", "this", ".", "height", "(", ")", "]", ")", ".", "padding", "(", "1.5", ")", ";", "}", "size", "(", ")", ";", "size", "(", "_", ")", ";", "size", "(", "_", "?", ")", "{", "const", "retVal", "=", "super", ".", "size", ".", "apply", "(", "this", ",", "arguments", ")", ";", "if", "(", "arguments", ".", "length", ")", "{", "this", ".", "d3Pack", ".", "size", "(", "[", "this", ".", "width", "(", ")", ",", "this", ".", "height", "(", ")", "]", ")", ";", "}", "return", "retVal", ";", "}", "enter", "(", "domNode", ",", "element", ")", "{", "super", ".", "enter", "(", "domNode", ",", "element", ")", ";", "this", ".", "_selection", ".", "widgetElement", "(", "element", ")", ";", "const", "context", "=", "this", ";", "this", ".", "tooltipHTML", "(", "function", "(", "d", ")", "{", "switch", "(", "context", ".", "tooltipStyle", "(", ")", ")", "{", "case", "\"series-table\"", ":", "return", "context", ".", "tooltipFormat", "(", "{", "label", ":", "d", "[", "0", "]", ",", "arr", ":", "context", ".", "columns", "(", ")", ".", "slice", "(", "1", ")", ".", "map", "(", "function", "(", "column", ",", "i", ")", "{", "return", "{", "label", ":", "column", ",", "color", ":", "context", ".", "_palette", "(", "d", "[", "0", "]", ")", ",", "value", ":", "d", "[", "1", "]", "}", ";", "}", ")", "}", ")", ";", "default", ":", "return", "context", ".", "tooltipFormat", "(", "{", "label", ":", "d", ".", "data", "[", "0", "]", ",", "value", ":", "d", ".", "data", "[", "1", "]", "}", ")", ";", "}", "}", ")", ";", "}", "update", "(", "domNode", ",", "element", ")", "{", "super", ".", "update", "(", "domNode", ",", "element", ")", ";", "const", "context", "=", "this", ";", "this", ".", "_palette", "=", "this", ".", "_palette", ".", "switch", "(", "this", ".", "paletteID", "(", ")", ")", ";", "if", "(", "this", ".", "useClonedPalette", "(", ")", ")", "{", "this", ".", "_palette", "=", "this", ".", "_palette", ".", "cloneNotExists", "(", "this", ".", "paletteID", "(", ")", "+", "\"_\"", "+", "this", ".", "id", "(", ")", ")", ";", "}", "const", "root", "=", "d3Hierarchy", "(", "{", "children", ":", "this", ".", "cloneData", "(", ")", "}", ")", ".", "sum", "(", "function", "(", "d", ")", "{", "return", "d", "[", "1", "]", ";", "}", ")", ".", "sort", "(", "function", "(", "b", ",", "a", ")", "{", "return", "a", "[", "1", "]", "<", "b", "[", "1", "]", "?", "-", "1", ":", "a", "[", "1", "]", ">", "b", "[", "1", "]", "?", "1", ":", "0", ";", "}", ")", ";", "this", ".", "d3Pack", "(", "root", ")", ";", "const", "node", "=", "element", ".", "selectAll", "(", "\".node\"", ")", ".", "data", "(", "root", ".", "children", "||", "[", "]", ",", "d", "=>", "d", ".", "data", "[", "0", "]", ")", ";", "node", ".", "enter", "(", ")", ".", "append", "(", "\"g\"", ")", ".", "attr", "(", "\"class\"", ",", "(", "d", ",", "i", ")", "=>", "\"node series series-\"", "+", "this", ".", "cssTag", "(", "d", ".", "data", "[", "0", "]", ")", ")", ".", "attr", "(", "\"opacity\"", ",", "0", ")", ".", "call", "(", "this", ".", "_selection", ".", "enter", ".", "bind", "(", "this", ".", "_selection", ")", ")", ".", "on", "(", "\"click\"", ",", "function", "(", "d", ")", "{", "context", ".", "click", "(", "context", ".", "rowToObj", "(", "d", ".", "data", ")", ",", "context", ".", "columns", "(", ")", "[", "1", "]", ",", "context", ".", "_selection", ".", "selected", "(", "this", ")", ")", ";", "}", ")", ".", "on", "(", "\"dblclick\"", ",", "function", "(", "d", ")", "{", "context", ".", "dblclick", "(", "context", ".", "rowToObj", "(", "d", ".", "data", ")", ",", "context", ".", "columns", "(", ")", "[", "1", "]", ",", "context", ".", "_selection", ".", "selected", "(", "this", ")", ")", ";", "}", ")", ".", "each", "(", "function", "(", "d", ")", "{", "const", "element2", "=", "d3Select", "(", "this", ")", ";", "const", "pos", "=", "{", "x", ":", "d", ".", "x", ",", "y", ":", "d", ".", "y", "}", ";", "element2", ".", "append", "(", "\"circle\"", ")", ".", "attr", "(", "\"transform\"", ",", "\"translate(\"", "+", "pos", ".", "x", "+", "\",\"", "+", "pos", ".", "y", "+", "\")\"", ")", ".", "attr", "(", "\"r\"", ",", "0", ")", ".", "on", "(", "\"mouseout.tooltip\"", ",", "context", ".", "tooltip", ".", "hide", ")", ".", "on", "(", "\"mousemove.tooltip\"", ",", "context", ".", "tooltip", ".", "show", ")", ";", "if", "(", "d", ".", "__viz_faChar", ")", "{", "context", ".", "labelWidgets", "[", "d", ".", "data", "[", "0", "]", "]", "=", "new", "FAChar", "(", ")", ".", "char", "(", "d", ".", "__viz_faChar", ")", ".", "target", "(", "this", ")", ".", "render", "(", ")", ";", "}", "else", "{", "context", ".", "labelWidgets", "[", "d", ".", "data", "[", "0", "]", "]", "=", "new", "Text", "(", ")", ".", "text", "(", "d", ".", "data", "[", "0", "]", ")", ".", "target", "(", "this", ")", ".", "render", "(", ")", ";", "}", "}", ")", ".", "merge", "(", "node", ")", ".", "transition", "(", ")", ".", "attr", "(", "\"opacity\"", ",", "1", ")", ".", "each", "(", "function", "(", "d", ")", "{", "const", "element2", "=", "d3Select", "(", "this", ")", ";", "const", "pos", "=", "{", "x", ":", "d", ".", "x", ",", "y", ":", "d", ".", "y", "}", ";", "element2", ".", "select", "(", "\"circle\"", ")", ".", "transition", "(", ")", ".", "attr", "(", "\"transform\"", ",", "\"translate(\"", "+", "pos", ".", "x", "+", "\",\"", "+", "pos", ".", "y", "+", "\")\"", ")", ".", "style", "(", "\"fill\"", ",", "context", ".", "fillColor", "(", "d", ".", "data", ",", "context", ".", "columns", "(", ")", "[", "1", "]", ",", "d", ".", "data", "[", "1", "]", ")", ")", ".", "attr", "(", "\"r\"", ",", "d", ".", "r", ")", ".", "select", "(", "\"title\"", ")", ".", "text", "(", "d", ".", "data", "[", "0", "]", "+", "\" (\"", "+", "d", ".", "data", "[", "1", "]", "+", "\")\"", ")", ";", "if", "(", "d", ".", "__viz_faChar", ")", "{", "context", ".", "labelWidgets", "[", "d", ".", "data", "[", "0", "]", "]", ".", "pos", "(", "pos", ")", ".", "render", "(", ")", ";", "}", "else", "{", "context", ".", "labelWidgets", "[", "d", ".", "data", "[", "0", "]", "]", ".", "pos", "(", "pos", ")", ".", "colorFill_default", "(", "context", ".", "textColor", "(", "d", ".", "data", ",", "context", ".", "columns", "(", ")", "[", "1", "]", ",", "d", ".", "data", "[", "1", "]", ")", ")", ".", "width", "(", "d", ".", "r", "*", "2", ")", ".", "text", "(", "d", ".", "data", "[", "0", "]", ")", ".", "render", "(", ")", ";", "}", "}", ")", ";", "node", ".", "exit", "(", ")", ".", "transition", "(", ")", ".", "style", "(", "\"opacity\"", ",", "0", ")", ".", "remove", "(", ")", ";", "}", "exit", "(", "domNode", ",", "element", ")", "{", "super", ".", "exit", "(", "domNode", ",", "element", ")", ";", "}", "paletteID", ":", "{", "(", ")", ":", "string", ";", "(", "_", ")", ":", "Bubble", ";", "}", ";", "useClonedPalette", ":", "{", "(", ")", ":", "boolean", ";", "(", "_", ")", ":", "Bubble", ";", "}", ";", "_palette", ";", "fillColor", ":", "(", "row", ":", "any", "[", "]", ",", "column", ":", "string", ",", "value", ":", "number", ")", "=>", "string", ";", "textColor", ":", "(", "row", ":", "any", "[", "]", ",", "column", ":", "string", ",", "value", ":", "number", ")", "=>", "string", ";", "click", ":", "(", "row", ",", "column", ",", "selected", ")", "=>", "void", ";", "dblclick", ":", "(", "row", ",", "column", ",", "selected", ")", "=>", "void", ";", "tooltip", ";", "tooltipHTML", ":", "(", "_", ")", "=>", "string", ";", "tooltipFormat", ":", "(", "_", ")", "=>", "string", ";", "tooltipStyle", ":", "(", ")", "=>", "\"default\"", "|", "\"none\"", "|", "\"series-table\"", ";", "_selection", ";", "}", "Bubble", ".", "prototype", ".", "_class", "+=", "\" chart_Bubble\"", ";", "Bubble", ".", "prototype", ".", "implements", "(", "I2DChart", ".", "prototype", ")", ";", "Bubble", ".", "prototype", ".", "implements", "(", "ITooltip", ".", "prototype", ")", ";", "Bubble", ".", "prototype", ".", "mixin", "(", "Utility", ".", "SimpleSelectionMixin", ")", ";", "Bubble", ".", "prototype", ".", "publish", "(", "\"paletteID\"", ",", "\"default\"", ",", "\"set\"", ",", "\"Color palette for this widget\"", ",", "Bubble", ".", "prototype", ".", "_palette", ".", "switch", "(", ")", ",", "{", "tags", ":", "[", "\"Basic\"", ",", "\"Shared\"", "]", "}", ")", ";", "Bubble", ".", "prototype", ".", "publish", "(", "\"useClonedPalette\"", ",", "false", ",", "\"boolean\"", ",", "\"Enable or disable using a cloned palette\"", ",", "null", ",", "{", "tags", ":", "[", "\"Intermediate\"", ",", "\"Shared\"", "]", "}", ")", ";" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2593, null, null, null, null, null, null, null, null, 2593, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 125, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 125, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1396
[ "import", "{", "Scatter", "}", "from", "\"./Scatter\"", ";", "export", "class", "BubbleXY", "extends", "Scatter", "{", "constructor", "(", ")", "{", "super", "(", ")", ";", "}", "enter", "(", "domNode", ",", "element", ")", "{", "if", "(", "!", "this", ".", "pointSizeColumn_exists", "(", ")", ")", "{", "this", ".", "pointSizeColumn", "(", "this", ".", "columns", "(", ")", "[", "this", ".", "columns", "(", ")", ".", "length", "-", "1", "]", ")", ";", "}", "super", ".", "enter", "(", "domNode", ",", "element", ")", ";", "}", "}", "BubbleXY", ".", "prototype", ".", "_class", "+=", "\" chart_BubbleXY\"", ";" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1397
[ "import", "{", "HTMLWidget", ",", "publish", ",", "Utility", "}", "from", "\"@hpcc-js/common\"", ";", "import", "{", "select", "as", "d3Select", "}", "from", "\"d3-selection\"", ";", "import", "{", "bullet", "as", "d3Bullet", "}", "from", "\"d3v4-bullet\"", ";", "import", "\"../src/Bullet.css\"", ";", "export", "class", "Bullet", "extends", "HTMLWidget", "{", "@", "publish", "(", "null", ",", "\"set\"", ",", "\"Title Column\"", ",", "function", "(", ")", "{", "return", "this", ".", "columns", "(", ")", ";", "}", ",", "{", "optional", ":", "true", "}", ")", "titleColumn", ":", "publish", "<", "this", ",", "string", ">", ";", "@", "publish", "(", "null", ",", "\"set\"", ",", "\"Subtitle Column\"", ",", "function", "(", ")", "{", "return", "this", ".", "columns", "(", ")", ";", "}", ",", "{", "optional", ":", "true", "}", ")", "subtitleColumn", ":", "publish", "<", "this", ",", "string", ">", ";", "@", "publish", "(", "null", ",", "\"set\"", ",", "\"Ranges Column\"", ",", "function", "(", ")", "{", "return", "this", ".", "columns", "(", ")", ";", "}", ",", "{", "optional", ":", "true", "}", ")", "rangesColumn", ":", "publish", "<", "this", ",", "string", ">", ";", "@", "publish", "(", "null", ",", "\"set\"", ",", "\"Measures Column\"", ",", "function", "(", ")", "{", "return", "this", ".", "columns", "(", ")", ";", "}", ",", "{", "optional", ":", "true", "}", ")", "measuresColumn", ":", "publish", "<", "this", ",", "string", ">", ";", "@", "publish", "(", "null", ",", "\"set\"", ",", "\"Markers Column\"", ",", "function", "(", ")", "{", "return", "this", ".", "columns", "(", ")", ";", "}", ",", "{", "optional", ":", "true", "}", ")", "markersColumn", ":", "publish", "<", "this", ",", "string", ">", ";", "private", "_hiddenColumns", "=", "{", "}", ";", "constructor", "(", ")", "{", "super", "(", ")", ";", "Utility", ".", "SimpleSelectionMixin", ".", "call", "(", "this", ",", "true", ")", ";", "}", "bulletData", "(", ")", "{", "const", "context", "=", "this", ";", "this", ".", "_hiddenColumns", "=", "{", "}", ";", "const", "columns", "=", "this", ".", "columns", "(", ")", ";", "return", "this", ".", "data", "(", ")", ".", "map", "(", "function", "(", "row", ")", "{", "return", "{", "title", ":", "valueOf", "(", "row", ",", "this", ".", "titleColumn", "(", ")", ")", ",", "subtitle", ":", "valueOf", "(", "row", ",", "this", ".", "subtitleColumn", "(", ")", ")", ",", "ranges", ":", "valueOf", "(", "row", ",", "this", ".", "rangesColumn", "(", ")", ",", "\"range\"", ")", ",", "measures", ":", "valueOf", "(", "row", ",", "this", ".", "measuresColumn", "(", ")", ",", "\"measure\"", ")", ",", "markers", ":", "valueOf", "(", "row", ",", "this", ".", "markersColumn", "(", ")", ",", "\"marker\"", ")", ",", "origRow", ":", "row", "}", ";", "}", ",", "this", ")", ";", "function", "valueOf", "(", "row", ",", "column", ",", "columnType", "?", ")", "{", "const", "colIdx", "=", "columns", ".", "indexOf", "(", "column", ")", ";", "if", "(", "colIdx", ">=", "0", ")", "{", "if", "(", "row", "[", "colIdx", "]", "instanceof", "Array", ")", "{", "return", "row", "[", "colIdx", "]", ";", "}", "return", "[", "row", "[", "colIdx", "]", "]", ";", "}", "if", "(", "columnType", ")", "{", "context", ".", "_hiddenColumns", "[", "columnType", "]", "=", "true", ";", "}", "return", "[", "0", "]", ";", "}", "}", "enter", "(", "domNode", ",", "element", ")", "{", "super", ".", "enter", "(", "domNode", ",", "element", ")", ";", "d3Select", "(", "domNode", ".", "parentNode", ")", ".", "style", "(", "\"overflow\"", ",", "\"auto\"", ")", ";", "this", ".", "_selection", ".", "widgetElement", "(", "element", ")", ";", "}", "update", "(", "_domNode", ",", "element", ")", "{", "super", ".", "update", "(", "_domNode", ",", "element", ")", ";", "const", "context", "=", "this", ";", "element", ".", "selectAll", "(", "\".axis\"", ")", ".", "style", "(", "\"display\"", ",", "\"none\"", ")", ";", "element", ".", "selectAll", "(", "\".range,.measure,.marker\"", ")", ".", "style", "(", "\"display\"", ",", "null", ")", ";", "const", "margin", "=", "{", "left", ":", "2", ",", "top", ":", "8", ",", "right", ":", "2", ",", "bottom", ":", "8", "}", ";", "const", "width", "=", "this", ".", "width", "(", ")", "-", "margin", ".", "left", "-", "margin", ".", "right", ";", "const", "height", "=", "40", "-", "margin", ".", "top", "-", "margin", ".", "bottom", ";", "const", "svg", "=", "element", ".", "selectAll", "(", "\"svg\"", ")", ".", "data", "(", "this", ".", "bulletData", "(", ")", ")", ";", "const", "svgUpdate", "=", "svg", ".", "enter", "(", ")", ".", "append", "(", "\"svg\"", ")", ".", "attr", "(", "\"class\"", ",", "\"bullet\"", ")", ".", "call", "(", "this", ".", "_selection", ".", "enter", ".", "bind", "(", "this", ".", "_selection", ")", ")", ".", "on", "(", "\"click\"", ",", "function", "(", "d", ")", "{", "context", ".", "click", "(", "context", ".", "rowToObj", "(", "d", ".", "origRow", ")", ",", "context", ".", "titleColumn", "(", ")", ",", "context", ".", "_selection", ".", "selected", "(", "this", ")", ")", ";", "}", ")", ".", "on", "(", "\"dblclick\"", ",", "function", "(", "d", ")", "{", "context", ".", "dblclick", "(", "context", ".", "rowToObj", "(", "d", ".", "origRow", ")", ",", "context", ".", "titleColumn", "(", ")", ",", "context", ".", "_selection", ".", "selected", "(", "this", ")", ")", ";", "}", ")", ".", "each", "(", "function", "(", ")", "{", "const", "element2", "=", "d3Select", "(", "this", ")", ";", "const", "bulletBar", "=", "element2", ".", "append", "(", "\"g\"", ")", ".", "attr", "(", "\"class\"", ",", "(", "d", ",", "i", ")", "=>", "\"bulletBar series series-\"", "+", "context", ".", "cssTag", "(", "context", ".", "titleColumn", "(", ")", ")", ")", ";", "const", "bulletTitle", "=", "bulletBar", ".", "append", "(", "\"g\"", ")", ".", "attr", "(", "\"class\"", ",", "\"bulletTitle\"", ")", ";", "bulletTitle", ".", "append", "(", "\"text\"", ")", ".", "attr", "(", "\"class\"", ",", "\"title\"", ")", ";", "bulletTitle", ".", "append", "(", "\"text\"", ")", ".", "attr", "(", "\"class\"", ",", "\"subtitle\"", ")", ".", "attr", "(", "\"dy\"", ",", "\"1em\"", ")", ";", "}", ")", ".", "merge", "(", "svg", ")", ";", "const", "title", "=", "svgUpdate", ".", "select", "(", "\".bulletTitle\"", ")", ".", "style", "(", "\"text-anchor\"", ",", "\"end\"", ")", ".", "attr", "(", "\"transform\"", ",", "\"translate(-6,\"", "+", "height", "/", "2", "+", "\")\"", ")", ";", "title", ".", "select", "(", "\".title\"", ")", ".", "text", "(", "function", "(", "d", ")", "{", "return", "d", ".", "title", ";", "}", ")", ";", "title", ".", "select", "(", "\".subtitle\"", ")", ".", "text", "(", "function", "(", "d", ")", "{", "return", "d", ".", "subtitle", ";", "}", ")", ";", "let", "titleWidth", "=", "0", ";", "title", ".", "each", "(", "function", "(", ")", "{", "const", "bbox", "=", "this", ".", "getBBox", "(", ")", ";", "if", "(", "bbox", ".", "width", ">", "titleWidth", ")", "{", "titleWidth", "=", "bbox", ".", "width", ";", "}", "}", ")", ";", "titleWidth", ";", "const", "chart", "=", "d3Bullet", "(", ")", ".", "width", "(", "width", "-", "titleWidth", "-", "6", ")", ".", "height", "(", "height", ")", ";", "svgUpdate", ".", "attr", "(", "\"width\"", ",", "width", ")", ".", "attr", "(", "\"height\"", ",", "height", "+", "margin", ".", "top", "+", "margin", ".", "bottom", ")", ".", "style", "(", "\"margin-left\"", ",", "`${", "margin", ".", "left", "}px`", ")", ";", "svgUpdate", ".", "select", "(", "\".bulletBar\"", ")", ".", "attr", "(", "\"transform\"", ",", "\"translate(\"", "+", "(", "titleWidth", "+", "6", ")", "+", "\",\"", "+", "margin", ".", "top", "+", "\")\"", ")", ".", "call", "(", "chart", ")", ";", "svg", ".", "exit", "(", ")", ".", "remove", "(", ")", ";", "if", "(", "Object", ".", "keys", "(", "this", ".", "_hiddenColumns", ")", ".", "length", ">", "0", ")", "{", "element", ".", "selectAll", "(", "`.${", "Object", ".", "keys", "(", "this", ".", "_hiddenColumns", ")", ".", "join", "(", "\",.\"", ")", "}`", ")", ".", "style", "(", "\"display\"", ",", "\"none\"", ")", ";", "}", "}", "exit", "(", "domNode", ",", "element", ")", "{", "super", ".", "exit", "(", "domNode", ",", "element", ")", ";", "}", "click", "(", "row", ",", "column", ",", "selected", ")", "{", "console", ".", "log", "(", "\"Click: \"", "+", "JSON", ".", "stringify", "(", "row", ")", "+", "\", \"", "+", "column", "+", "\",\"", "+", "selected", ")", ";", "}", "dblclick", "(", "row", ",", "column", ",", "selected", ")", "{", "console", ".", "log", "(", "\"Double click: \"", "+", "JSON", ".", "stringify", "(", "row", ")", "+", "\", \"", "+", "column", "+", "\",\"", "+", "selected", ")", ";", "}", "_selection", ";", "}", "Bullet", ".", "prototype", ".", "_class", "+=", "\" chart_Bullet\"", ";" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 125, null, null, null, null, null, null, null, 125, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 125, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1398
[ "import", "{", "I1DChart", "}", "from", "\"@hpcc-js/api\"", ";", "import", "{", "InputField", "}", "from", "\"@hpcc-js/common\"", ";", "import", "{", "contourDensity", "as", "d3ContourDensity", "}", "from", "\"d3-contour\"", ";", "import", "{", "geoPath", "}", "from", "\"d3-geo\"", ";", "import", "{", "XYAxis", "}", "from", "\"./XYAxis\"", ";", "export", "class", "Contour", "extends", "XYAxis", "{", "static", "__inputs", ":", "InputField", "[", "]", "=", "[", "{", "id", ":", "\"x\"", ",", "type", ":", "\"any\"", "}", ",", "{", "id", ":", "\"y\"", ",", "type", ":", "\"number\"", "}", "]", ";", "protected", "_dataMinWeight", ";", "protected", "_dataMaxWeight", ";", "constructor", "(", ")", "{", "super", "(", ")", ";", "this", ".", "xAxisGuideLines_default", "(", "false", ")", ".", "yAxisGuideLines_default", "(", "false", ")", ".", "xAxisType_default", "(", "\"linear\"", ")", ";", "}", "xPos", "(", "host", ",", "d", ")", "{", "return", "host", ".", "orientation", "(", ")", "===", "\"horizontal\"", "?", "host", ".", "dataPos", "(", "d", ".", "label", ")", ":", "host", ".", "valuePos", "(", "d", ".", "value", ")", ";", "}", "yPos", "(", "host", ",", "d", ")", "{", "return", "host", ".", "orientation", "(", ")", "===", "\"horizontal\"", "?", "host", ".", "valuePos", "(", "d", ".", "value", ")", ":", "host", ".", "dataPos", "(", "d", ".", "label", ")", ";", "}", "layerEnter", "(", "host", ",", "element", ",", "duration", "=", "250", ")", "{", "super", ".", "layerEnter", "(", "host", ",", "element", ",", "duration", ")", ";", "}", "layerUpdate", "(", "host", ",", "element", ",", "duration", "=", "250", ")", "{", "super", ".", "layerUpdate", "(", "host", ",", "element", ",", "duration", ")", ";", "this", ".", "_palette", "=", "this", ".", "_palette", ".", "switch", "(", "this", ".", "paletteID", "(", ")", ")", ";", "const", "data", "=", "this", ".", "flattenData", "(", "this", ".", "layerColumns", "(", "host", ")", ",", "this", ".", "layerData", "(", "host", ")", ")", ";", "const", "contourData", "=", "d3ContourDensity", "(", ")", ".", "x", "(", "d", "=>", "this", ".", "xPos", "(", "host", ",", "d", ")", ")", ".", "y", "(", "d", "=>", "this", ".", "yPos", "(", "host", ",", "d", ")", ")", ".", "size", "(", "[", "this", ".", "width", "(", ")", ",", "this", ".", "height", "(", ")", "]", ")", ".", "bandwidth", "(", "this", ".", "contourBandwidth", "(", ")", ")", "(", "data", ")", ";", "const", "_vals", "=", "contourData", ".", "map", "(", "d", "=>", "d", ".", "value", ")", ";", "const", "minValue", "=", "Math", ".", "min", ".", "apply", "(", "this", ",", "_vals", ")", ";", "const", "maxValue", "=", "Math", ".", "max", ".", "apply", "(", "this", ",", "_vals", ")", ";", "this", ".", "_dataMinWeight", "=", "minValue", ";", "this", ".", "_dataMaxWeight", "=", "maxValue", ";", "const", "lines", "=", "element", ".", "selectAll", "(", "\"path\"", ")", ".", "data", "(", "contourData", ")", ";", "lines", ".", "enter", "(", ")", ".", "append", "(", "\"path\"", ")", ".", "merge", "(", "lines", ")", ".", "attr", "(", "\"d\"", ",", "geoPath", "(", ")", ")", ".", "attr", "(", "\"fill\"", ",", "d", "=>", "this", ".", "showContourFill", "(", ")", "?", "this", ".", "_palette", "(", "d", ".", "value", ",", "minValue", ",", "maxValue", ")", ":", "\"none\"", ")", ".", "attr", "(", "\"stroke\"", ",", "this", ".", "contourStrokeColor", "(", ")", ")", ".", "attr", "(", "\"stroke-linejoin\"", ",", "\"round\"", ")", ".", "attr", "(", "\"stroke-width\"", ",", "this", ".", "contourStrokeWidth", "(", ")", ")", ";", "lines", ".", "exit", "(", ")", ".", "remove", "(", ")", ";", "}", "exit", "(", "_domNode", ",", "_element", ")", "{", "super", ".", "exit", "(", "_domNode", ",", "_element", ")", ";", "}", "}", "Contour", ".", "prototype", ".", "_class", "+=", "\" chart_Contour\"", ";", "Contour", ".", "prototype", ".", "implements", "(", "I1DChart", ".", "prototype", ")", ";", "export", "interface", "Contour", "{", "paletteID", "(", ")", ":", "string", ";", "paletteID", "(", "_", ")", ":", "this", ";", "useClonedPalette", "(", ")", ":", "boolean", ";", "useClonedPalette", "(", "_", ")", ":", "this", ";", "showContourFill", "(", ")", ":", "boolean", ";", "showContourFill", "(", "_", ")", ":", "this", ";", "showContour", "(", ")", ":", "boolean", ";", "showContour", "(", "_", ")", ":", "this", ";", "contourBandwidth", "(", ")", ":", "number", ";", "contourBandwidth", "(", "_", ")", ":", "this", ";", "contourStrokeColor", "(", ")", ":", "string", ";", "contourStrokeColor", "(", "_", ")", ":", "this", ";", "contourStrokeWidth", "(", ")", ":", "number", ";", "contourStrokeWidth", "(", "_", ")", ":", "this", ";", "}", "Contour", ".", "prototype", ".", "publish", "(", "\"paletteID\"", ",", "\"YlGnBu\"", ",", "\"string\"", ",", "\"Color palette for this widget\"", ")", ";", "Contour", ".", "prototype", ".", "publish", "(", "\"useClonedPalette\"", ",", "true", ",", "\"boolean\"", ",", "\"Enable or disable using a cloned palette\"", ")", ";", "Contour", ".", "prototype", ".", "publish", "(", "\"showContourFill\"", ",", "true", ",", "\"boolean\"", ",", "\"Show/hide the contour background colors\"", ")", ";", "Contour", ".", "prototype", ".", "publish", "(", "\"showContour\"", ",", "true", ",", "\"boolean\"", ",", "\"Show/hide the contour border lines\"", ")", ";", "Contour", ".", "prototype", ".", "publish", "(", "\"contourBandwidth\"", ",", "40", ",", "\"number\"", ",", "\"Controls the sensitivity of the contour grouping algorithm\"", ")", ";", "Contour", ".", "prototype", ".", "publish", "(", "\"contourStrokeColor\"", ",", "\"#2C3A47\"", ",", "\"html-color\"", ",", "\"Color of the contour border lines\"", ")", ";", "Contour", ".", "prototype", ".", "publish", "(", "\"contourStrokeWidth\"", ",", "1", ",", "\"number\"", ",", "\"Width of the contour border lines\"", ")", ";" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 13022, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 13022, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 13022, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 13022, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1399
[ "import", "{", "dispatch", "}", "from", "\"d3-dispatch\"", ";", "const", "cloudRadians", "=", "Math", ".", "PI", "/", "180", ";", "const", "cw", "=", "1", "<<", "11", ">>", "5", ";", "const", "ch", "=", "1", "<<", "11", ";", "export", "function", "d3Cloud", "(", ")", "{", "const", "event", "=", "dispatch", "(", "\"word\"", ",", "\"end\"", ")", ";", "const", "cloud", "=", "{", "}", ";", "let", "size", "=", "[", "256", ",", "256", "]", ";", "let", "text", "=", "cloudText", ";", "let", "font", "=", "cloudFont", ";", "let", "fontSize", "=", "cloudFontSize", ";", "let", "fontStyle", "=", "cloudFontNormal", ";", "let", "fontWeight", "=", "cloudFontNormal", ";", "let", "rotate", "=", "cloudRotate", ";", "let", "padding", "=", "cloudPadding", ";", "let", "words", "=", "[", "]", ";", "let", "spiral", "=", "archimedeanSpiral", ";", "let", "timeInterval", "=", "Infinity", ";", "let", "timer", "=", "null", ";", "let", "random", "=", "Math", ".", "random", ";", "let", "canvas", "=", "cloudCanvas", ";", "cloud", ".", "canvas", "=", "function", "(", "_", ")", "{", "return", "arguments", ".", "length", "?", "(", "canvas", "=", "functor", "(", "_", ")", ",", "cloud", ")", ":", "canvas", ";", "}", ";", "cloud", ".", "start", "=", "function", "(", ")", "{", "const", "contextAndRatio", "=", "getContext", "(", "canvas", "(", ")", ")", ";", "const", "board", "=", "zeroArray", "(", "(", "size", "[", "0", "]", ">>", "5", ")", "*", "size", "[", "1", "]", ")", ";", "let", "bounds", "=", "null", ";", "const", "n", "=", "words", ".", "length", ";", "let", "i", "=", "-", "1", ";", "const", "tags", "=", "[", "]", ";", "const", "data", "=", "words", ".", "map", "(", "function", "(", "d", ",", "i", ")", "{", "d", ".", "text", "=", "text", ".", "call", "(", "this", ",", "d", ",", "i", ")", ";", "d", ".", "font", "=", "font", ".", "call", "(", "this", ",", "d", ",", "i", ")", ";", "d", ".", "style", "=", "fontStyle", ".", "call", "(", "this", ",", "d", ",", "i", ")", ";", "d", ".", "weight", "=", "fontWeight", ".", "call", "(", "this", ",", "d", ",", "i", ")", ";", "d", ".", "rotate", "=", "rotate", ".", "call", "(", "this", ",", "d", ",", "i", ")", ";", "d", ".", "size", "=", "~", "~", "fontSize", ".", "call", "(", "this", ",", "d", ",", "i", ")", ";", "d", ".", "padding", "=", "padding", ".", "call", "(", "this", ",", "d", ",", "i", ")", ";", "return", "d", ";", "}", ")", ".", "sort", "(", "function", "(", "a", ",", "b", ")", "{", "return", "b", ".", "size", "-", "a", ".", "size", ";", "}", ")", ";", "if", "(", "timer", ")", "clearInterval", "(", "timer", ")", ";", "timer", "=", "setInterval", "(", "step", ",", "0", ")", ";", "step", "(", ")", ";", "return", "cloud", ";", "function", "step", "(", ")", "{", "const", "start", "=", "Date", ".", "now", "(", ")", ";", "while", "(", "Date", ".", "now", "(", ")", "-", "start", "<", "timeInterval", "&&", "++", "i", "<", "n", "&&", "timer", ")", "{", "const", "d", "=", "data", "[", "i", "]", ";", "d", ".", "x", "=", "(", "size", "[", "0", "]", "*", "(", "random", "(", ")", "+", ".5", ")", ")", ">>", "1", ";", "d", ".", "y", "=", "(", "size", "[", "1", "]", "*", "(", "random", "(", ")", "+", ".5", ")", ")", ">>", "1", ";", "cloudSprite", "(", "contextAndRatio", ",", "d", ",", "data", ",", "i", ")", ";", "if", "(", "d", ".", "hasText", "&&", "place", "(", "board", ",", "d", ",", "bounds", ")", ")", "{", "tags", ".", "push", "(", "d", ")", ";", "event", ".", "call", "(", "\"word\"", ",", "cloud", ",", "d", ")", ";", "if", "(", "bounds", ")", "cloudBounds", "(", "bounds", ",", "d", ")", ";", "else", "bounds", "=", "[", "{", "x", ":", "d", ".", "x", "+", "d", ".", "x0", ",", "y", ":", "d", ".", "y", "+", "d", ".", "y0", "}", ",", "{", "x", ":", "d", ".", "x", "+", "d", ".", "x1", ",", "y", ":", "d", ".", "y", "+", "d", ".", "y1", "}", "]", ";", "d", ".", "x", "-=", "size", "[", "0", "]", ">>", "1", ";", "d", ".", "y", "-=", "size", "[", "1", "]", ">>", "1", ";", "}", "}", "if", "(", "i", ">=", "n", ")", "{", "cloud", ".", "stop", "(", ")", ";", "event", ".", "call", "(", "\"end\"", ",", "cloud", ",", "tags", ",", "bounds", ")", ";", "}", "}", "}", ";", "cloud", ".", "stop", "=", "function", "(", ")", "{", "if", "(", "timer", ")", "{", "clearInterval", "(", "timer", ")", ";", "timer", "=", "null", ";", "}", "return", "cloud", ";", "}", ";", "function", "getContext", "(", "canvas", ")", "{", "canvas", ".", "width", "=", "canvas", ".", "height", "=", "1", ";", "const", "ratio", "=", "Math", ".", "sqrt", "(", "canvas", ".", "getContext", "(", "\"2d\"", ")", ".", "getImageData", "(", "0", ",", "0", ",", "1", ",", "1", ")", ".", "data", ".", "length", ">>", "2", ")", ";", "canvas", ".", "width", "=", "(", "cw", "<<", "5", ")", "/", "ratio", ";", "canvas", ".", "height", "=", "ch", "/", "ratio", ";", "const", "context", "=", "canvas", ".", "getContext", "(", "\"2d\"", ")", ";", "context", ".", "fillStyle", "=", "context", ".", "strokeStyle", "=", "\"red\"", ";", "context", ".", "textAlign", "=", "\"center\"", ";", "return", "{", "context", ",", "ratio", "}", ";", "}", "function", "place", "(", "board", ",", "tag", ",", "bounds", ")", "{", "const", "startX", "=", "tag", ".", "x", ";", "const", "startY", "=", "tag", ".", "y", ";", "const", "maxDelta", "=", "Math", ".", "sqrt", "(", "size", "[", "0", "]", "*", "size", "[", "0", "]", "+", "size", "[", "1", "]", "*", "size", "[", "1", "]", ")", ";", "const", "s", "=", "spiral", "(", "size", ")", ";", "const", "dt", "=", "random", "(", ")", "<", ".5", "?", "1", ":", "-", "1", ";", "let", "t", "=", "-", "dt", ";", "let", "dxdy", ";", "let", "dx", ";", "let", "dy", ";", "while", "(", "dxdy", "=", "s", "(", "t", "+=", "dt", ")", ")", "{", "dx", "=", "~", "~", "dxdy", "[", "0", "]", ";", "dy", "=", "~", "~", "dxdy", "[", "1", "]", ";", "if", "(", "Math", ".", "min", "(", "Math", ".", "abs", "(", "dx", ")", ",", "Math", ".", "abs", "(", "dy", ")", ")", ">=", "maxDelta", ")", "break", ";", "tag", ".", "x", "=", "startX", "+", "dx", ";", "tag", ".", "y", "=", "startY", "+", "dy", ";", "if", "(", "tag", ".", "x", "+", "tag", ".", "x0", "<", "0", "||", "tag", ".", "y", "+", "tag", ".", "y0", "<", "0", "||", "tag", ".", "x", "+", "tag", ".", "x1", ">", "size", "[", "0", "]", "||", "tag", ".", "y", "+", "tag", ".", "y1", ">", "size", "[", "1", "]", ")", "continue", ";", "if", "(", "!", "bounds", "||", "!", "cloudCollide", "(", "tag", ",", "board", ",", "size", "[", "0", "]", ")", ")", "{", "if", "(", "!", "bounds", "||", "collideRects", "(", "tag", ",", "bounds", ")", ")", "{", "const", "sprite", "=", "tag", ".", "sprite", ";", "const", "w", "=", "tag", ".", "width", ">>", "5", ";", "const", "sw", "=", "size", "[", "0", "]", ">>", "5", ";", "const", "lx", "=", "tag", ".", "x", "-", "(", "w", "<<", "4", ")", ";", "const", "sx", "=", "lx", "&", "0x7f", ";", "const", "msx", "=", "32", "-", "sx", ";", "const", "h", "=", "tag", ".", "y1", "-", "tag", ".", "y0", ";", "let", "x", "=", "(", "tag", ".", "y", "+", "tag", ".", "y0", ")", "*", "sw", "+", "(", "lx", ">>", "5", ")", ";", "let", "last", ";", "for", "(", "let", "j", "=", "0", ";", "j", "<", "h", ";", "j", "++", ")", "{", "last", "=", "0", ";", "for", "(", "let", "i", "=", "0", ";", "i", "<=", "w", ";", "i", "++", ")", "{", "board", "[", "x", "+", "i", "]", "|=", "(", "last", "<<", "msx", ")", "|", "(", "i", "<", "w", "?", "(", "last", "=", "sprite", "[", "j", "*", "w", "+", "i", "]", ")", ">>>", "sx", ":", "0", ")", ";", "}", "x", "+=", "sw", ";", "}", "delete", "tag", ".", "sprite", ";", "return", "true", ";", "}", "}", "}", "return", "false", ";", "}", "cloud", ".", "timeInterval", "=", "function", "(", "_", ")", "{", "return", "arguments", ".", "length", "?", "(", "timeInterval", "=", "_", "==", "null", "?", "Infinity", ":", "_", ",", "cloud", ")", ":", "timeInterval", ";", "}", ";", "cloud", ".", "words", "=", "function", "(", "_", ")", "{", "return", "arguments", ".", "length", "?", "(", "words", "=", "_", ",", "cloud", ")", ":", "words", ";", "}", ";", "cloud", ".", "size", "=", "function", "(", "_", ")", "{", "return", "arguments", ".", "length", "?", "(", "size", "=", "[", "+", "_", "[", "0", "]", ",", "+", "_", "[", "1", "]", "]", ",", "cloud", ")", ":", "size", ";", "}", ";", "cloud", ".", "font", "=", "function", "(", "_", ")", "{", "return", "arguments", ".", "length", "?", "(", "font", "=", "functor", "(", "_", ")", ",", "cloud", ")", ":", "font", ";", "}", ";", "cloud", ".", "fontStyle", "=", "function", "(", "_", ")", "{", "return", "arguments", ".", "length", "?", "(", "fontStyle", "=", "functor", "(", "_", ")", ",", "cloud", ")", ":", "fontStyle", ";", "}", ";", "cloud", ".", "fontWeight", "=", "function", "(", "_", ")", "{", "return", "arguments", ".", "length", "?", "(", "fontWeight", "=", "functor", "(", "_", ")", ",", "cloud", ")", ":", "fontWeight", ";", "}", ";", "cloud", ".", "rotate", "=", "function", "(", "_", ")", "{", "return", "arguments", ".", "length", "?", "(", "rotate", "=", "functor", "(", "_", ")", ",", "cloud", ")", ":", "rotate", ";", "}", ";", "cloud", ".", "text", "=", "function", "(", "_", ")", "{", "return", "arguments", ".", "length", "?", "(", "text", "=", "functor", "(", "_", ")", ",", "cloud", ")", ":", "text", ";", "}", ";", "cloud", ".", "spiral", "=", "function", "(", "_", ")", "{", "return", "arguments", ".", "length", "?", "(", "spiral", "=", "spirals", "[", "_", "]", "||", "_", ",", "cloud", ")", ":", "spiral", ";", "}", ";", "cloud", ".", "fontSize", "=", "function", "(", "_", ")", "{", "return", "arguments", ".", "length", "?", "(", "fontSize", "=", "functor", "(", "_", ")", ",", "cloud", ")", ":", "fontSize", ";", "}", ";", "cloud", ".", "padding", "=", "function", "(", "_", ")", "{", "return", "arguments", ".", "length", "?", "(", "padding", "=", "functor", "(", "_", ")", ",", "cloud", ")", ":", "padding", ";", "}", ";", "cloud", ".", "random", "=", "function", "(", "_", ")", "{", "return", "arguments", ".", "length", "?", "(", "random", "=", "_", ",", "cloud", ")", ":", "random", ";", "}", ";", "cloud", ".", "on", "=", "function", "(", ")", "{", "const", "value", "=", "event", ".", "on", ".", "apply", "(", "event", ",", "arguments", ")", ";", "return", "value", "===", "event", "?", "cloud", ":", "value", ";", "}", ";", "return", "cloud", ";", "}", "function", "cloudText", "(", "d", ")", "{", "return", "d", ".", "text", ";", "}", "function", "cloudFont", "(", ")", "{", "return", "\"serif\"", ";", "}", "function", "cloudFontNormal", "(", ")", "{", "return", "\"normal\"", ";", "}", "function", "cloudFontSize", "(", "d", ")", "{", "return", "Math", ".", "sqrt", "(", "d", ".", "value", ")", ";", "}", "function", "cloudRotate", "(", ")", "{", "return", "(", "~", "~", "(", "Math", ".", "random", "(", ")", "*", "6", ")", "-", "3", ")", "*", "30", ";", "}", "function", "cloudPadding", "(", ")", "{", "return", "1", ";", "}", "function", "cloudSprite", "(", "contextAndRatio", ",", "d", ",", "data", ",", "di", ")", "{", "if", "(", "d", ".", "sprite", ")", "return", ";", "const", "c", "=", "contextAndRatio", ".", "context", ";", "const", "ratio", "=", "contextAndRatio", ".", "ratio", ";", "c", ".", "clearRect", "(", "0", ",", "0", ",", "(", "cw", "<<", "5", ")", "/", "ratio", ",", "ch", "/", "ratio", ")", ";", "let", "x", "=", "0", ";", "let", "y", "=", "0", ";", "let", "maxh", "=", "0", ";", "const", "n", "=", "data", ".", "length", ";", "--", "di", ";", "while", "(", "++", "di", "<", "n", ")", "{", "d", "=", "data", "[", "di", "]", ";", "c", ".", "save", "(", ")", ";", "c", ".", "font", "=", "d", ".", "style", "+", "\" \"", "+", "d", ".", "weight", "+", "\" \"", "+", "~", "~", "(", "(", "d", ".", "size", "+", "1", ")", "/", "ratio", ")", "+", "\"px \"", "+", "d", ".", "font", ";", "let", "w", "=", "c", ".", "measureText", "(", "d", ".", "text", "+", "\"m\"", ")", ".", "width", "*", "ratio", ";", "let", "h", "=", "d", ".", "size", "<<", "1", ";", "if", "(", "d", ".", "rotate", ")", "{", "const", "sr", "=", "Math", ".", "sin", "(", "d", ".", "rotate", "*", "cloudRadians", ")", ";", "const", "cr", "=", "Math", ".", "cos", "(", "d", ".", "rotate", "*", "cloudRadians", ")", ";", "const", "wcr", "=", "w", "*", "cr", ";", "const", "wsr", "=", "w", "*", "sr", ";", "const", "hcr", "=", "h", "*", "cr", ";", "const", "hsr", "=", "h", "*", "sr", ";", "w", "=", "(", "Math", ".", "max", "(", "Math", ".", "abs", "(", "wcr", "+", "hsr", ")", ",", "Math", ".", "abs", "(", "wcr", "-", "hsr", ")", ")", "+", "0x1f", ")", ">>", "5", "<<", "5", ";", "h", "=", "~", "~", "Math", ".", "max", "(", "Math", ".", "abs", "(", "wsr", "+", "hcr", ")", ",", "Math", ".", "abs", "(", "wsr", "-", "hcr", ")", ")", ";", "}", "else", "{", "w", "=", "(", "w", "+", "0x1f", ")", ">>", "5", "<<", "5", ";", "}", "if", "(", "h", ">", "maxh", ")", "maxh", "=", "h", ";", "if", "(", "x", "+", "w", ">=", "(", "cw", "<<", "5", ")", ")", "{", "x", "=", "0", ";", "y", "+=", "maxh", ";", "maxh", "=", "0", ";", "}", "if", "(", "y", "+", "h", ">=", "ch", ")", "break", ";", "c", ".", "translate", "(", "(", "x", "+", "(", "w", ">>", "1", ")", ")", "/", "ratio", ",", "(", "y", "+", "(", "h", ">>", "1", ")", ")", "/", "ratio", ")", ";", "if", "(", "d", ".", "rotate", ")", "c", ".", "rotate", "(", "d", ".", "rotate", "*", "cloudRadians", ")", ";", "c", ".", "fillText", "(", "d", ".", "text", ",", "0", ",", "0", ")", ";", "if", "(", "d", ".", "padding", ")", "c", ".", "lineWidth", "=", "2", "*", "d", ".", "padding", ",", "c", ".", "strokeText", "(", "d", ".", "text", ",", "0", ",", "0", ")", ";", "c", ".", "restore", "(", ")", ";", "d", ".", "width", "=", "w", ";", "d", ".", "height", "=", "h", ";", "d", ".", "xoff", "=", "x", ";", "d", ".", "yoff", "=", "y", ";", "d", ".", "x1", "=", "w", ">>", "1", ";", "d", ".", "y1", "=", "h", ">>", "1", ";", "d", ".", "x0", "=", "-", "d", ".", "x1", ";", "d", ".", "y0", "=", "-", "d", ".", "y1", ";", "d", ".", "hasText", "=", "true", ";", "x", "+=", "w", ";", "}", "const", "pixels", "=", "c", ".", "getImageData", "(", "0", ",", "0", ",", "(", "cw", "<<", "5", ")", "/", "ratio", ",", "ch", "/", "ratio", ")", ".", "data", ";", "const", "sprite", "=", "[", "]", ";", "while", "(", "--", "di", ">=", "0", ")", "{", "d", "=", "data", "[", "di", "]", ";", "if", "(", "!", "d", ".", "hasText", ")", "continue", ";", "const", "w", "=", "d", ".", "width", ";", "const", "w32", "=", "w", ">>", "5", ";", "let", "h", "=", "d", ".", "y1", "-", "d", ".", "y0", ";", "for", "(", "let", "i", "=", "0", ";", "i", "<", "h", "*", "w32", ";", "i", "++", ")", "sprite", "[", "i", "]", "=", "0", ";", "x", "=", "d", ".", "xoff", ";", "if", "(", "x", "==", "null", ")", "return", ";", "y", "=", "d", ".", "yoff", ";", "let", "seen", "=", "0", ";", "let", "seenRow", "=", "-", "1", ";", "for", "(", "let", "j", "=", "0", ";", "j", "<", "h", ";", "j", "++", ")", "{", "for", "(", "let", "i", "=", "0", ";", "i", "<", "w", ";", "i", "++", ")", "{", "const", "k", "=", "w32", "*", "j", "+", "(", "i", ">>", "5", ")", ";", "const", "m", "=", "pixels", "[", "(", "(", "y", "+", "j", ")", "*", "(", "cw", "<<", "5", ")", "+", "(", "x", "+", "i", ")", ")", "<<", "2", "]", "?", "1", "<<", "(", "31", "-", "(", "i", "%", "32", ")", ")", ":", "0", ";", "sprite", "[", "k", "]", "|=", "m", ";", "seen", "|=", "m", ";", "}", "if", "(", "seen", ")", "seenRow", "=", "j", ";", "else", "{", "d", ".", "y0", "++", ";", "h", "--", ";", "j", "--", ";", "y", "++", ";", "}", "}", "d", ".", "y1", "=", "d", ".", "y0", "+", "seenRow", ";", "d", ".", "sprite", "=", "sprite", ".", "slice", "(", "0", ",", "(", "d", ".", "y1", "-", "d", ".", "y0", ")", "*", "w32", ")", ";", "}", "}", "function", "cloudCollide", "(", "tag", ",", "board", ",", "sw", ")", "{", "sw", ">>=", "5", ";", "const", "sprite", "=", "tag", ".", "sprite", ";", "const", "w", "=", "tag", ".", "width", ">>", "5", ";", "const", "lx", "=", "tag", ".", "x", "-", "(", "w", "<<", "4", ")", ";", "const", "sx", "=", "lx", "&", "0x7f", ";", "const", "msx", "=", "32", "-", "sx", ";", "const", "h", "=", "tag", ".", "y1", "-", "tag", ".", "y0", ";", "let", "x", "=", "(", "tag", ".", "y", "+", "tag", ".", "y0", ")", "*", "sw", "+", "(", "lx", ">>", "5", ")", ";", "let", "last", ";", "for", "(", "let", "j", "=", "0", ";", "j", "<", "h", ";", "j", "++", ")", "{", "last", "=", "0", ";", "for", "(", "let", "i", "=", "0", ";", "i", "<=", "w", ";", "i", "++", ")", "{", "if", "(", "(", "(", "last", "<<", "msx", ")", "|", "(", "i", "<", "w", "?", "(", "last", "=", "sprite", "[", "j", "*", "w", "+", "i", "]", ")", ">>>", "sx", ":", "0", ")", ")", "&", "board", "[", "x", "+", "i", "]", ")", "return", "true", ";", "}", "x", "+=", "sw", ";", "}", "return", "false", ";", "}", "function", "cloudBounds", "(", "bounds", ",", "d", ")", "{", "const", "b0", "=", "bounds", "[", "0", "]", ";", "const", "b1", "=", "bounds", "[", "1", "]", ";", "if", "(", "d", ".", "x", "+", "d", ".", "x0", "<", "b0", ".", "x", ")", "b0", ".", "x", "=", "d", ".", "x", "+", "d", ".", "x0", ";", "if", "(", "d", ".", "y", "+", "d", ".", "y0", "<", "b0", ".", "y", ")", "b0", ".", "y", "=", "d", ".", "y", "+", "d", ".", "y0", ";", "if", "(", "d", ".", "x", "+", "d", ".", "x1", ">", "b1", ".", "x", ")", "b1", ".", "x", "=", "d", ".", "x", "+", "d", ".", "x1", ";", "if", "(", "d", ".", "y", "+", "d", ".", "y1", ">", "b1", ".", "y", ")", "b1", ".", "y", "=", "d", ".", "y", "+", "d", ".", "y1", ";", "}", "function", "collideRects", "(", "a", ",", "b", ")", "{", "return", "a", ".", "x", "+", "a", ".", "x1", ">", "b", "[", "0", "]", ".", "x", "&&", "a", ".", "x", "+", "a", ".", "x0", "<", "b", "[", "1", "]", ".", "x", "&&", "a", ".", "y", "+", "a", ".", "y1", ">", "b", "[", "0", "]", ".", "y", "&&", "a", ".", "y", "+", "a", ".", "y0", "<", "b", "[", "1", "]", ".", "y", ";", "}", "function", "archimedeanSpiral", "(", "size", ")", "{", "const", "e", "=", "size", "[", "0", "]", "/", "size", "[", "1", "]", ";", "return", "function", "(", "t", ")", "{", "return", "[", "e", "*", "(", "t", "*=", ".1", ")", "*", "Math", ".", "cos", "(", "t", ")", ",", "t", "*", "Math", ".", "sin", "(", "t", ")", "]", ";", "}", ";", "}", "function", "rectangularSpiral", "(", "size", ")", "{", "const", "dy", "=", "4", ";", "const", "dx", "=", "dy", "*", "size", "[", "0", "]", "/", "size", "[", "1", "]", ";", "let", "x", "=", "0", ";", "let", "y", "=", "0", ";", "return", "function", "(", "t", ")", "{", "const", "sign", "=", "t", "<", "0", "?", "-", "1", ":", "1", ";", "switch", "(", "(", "Math", ".", "sqrt", "(", "1", "+", "4", "*", "sign", "*", "t", ")", "-", "sign", ")", "&", "3", ")", "{", "case", "0", ":", "x", "+=", "dx", ";", "break", ";", "case", "1", ":", "y", "+=", "dy", ";", "break", ";", "case", "2", ":", "x", "-=", "dx", ";", "break", ";", "default", ":", "y", "-=", "dy", ";", "break", ";", "}", "return", "[", "x", ",", "y", "]", ";", "}", ";", "}", "function", "zeroArray", "(", "n", ")", "{", "const", "a", "=", "[", "]", ";", "let", "i", "=", "-", "1", ";", "while", "(", "++", "i", "<", "n", ")", "a", "[", "i", "]", "=", "0", ";", "return", "a", ";", "}", "function", "cloudCanvas", "(", ")", "{", "return", "document", ".", "createElement", "(", "\"canvas\"", ")", ";", "}", "function", "functor", "(", "d", ")", "{", "return", "typeof", "d", "===", "\"function\"", "?", "d", ":", "function", "(", ")", "{", "return", "d", ";", "}", ";", "}", "const", "spirals", "=", "{", "archimedean", ":", "archimedeanSpiral", ",", "rectangular", ":", "rectangularSpiral", "}", ";" ]
[ null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, 119, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, 3, null, null, null, null, 2, null, null, null, null, 2, null, null, null, null, 3, null, null, null, null, 3, null, null, null, null, 5, null, null, null, null, null, 5, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, 139, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, 3, null, null, null, null, null, 5, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, 3, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, 4, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, 3, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, 3, null, null, null, null, null, null, 3, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, 3, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, 3, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, 3, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, 5, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 139, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null ]