Merge pull request #3135 from SillyTavern/staging Staging
Signed| @@ -19,6 +19,10 @@ module.exports = { | |||
| 19 | parserOptions: { | 19 | parserOptions: { |
| 20 | sourceType: 'module', | 20 | sourceType: 'module', |
| 21 | }, | 21 | }, |
| 22 | globals: { | ||
| 23 | globalThis: 'readonly', | ||
| 24 | Deno: 'readonly', | ||
| 25 | }, | ||
| 22 | }, | 26 | }, |
| 23 | { | 27 | { |
| 24 | files: ['*.cjs'], | 28 | files: ['*.cjs'], |
| @@ -50,23 +54,9 @@ module.exports = { | |||
| 50 | }, | 54 | }, |
| 51 | // These scripts are loaded in HTML; tell ESLint not to complain about them being undefined | 55 | // These scripts are loaded in HTML; tell ESLint not to complain about them being undefined |
| 52 | globals: { | 56 | globals: { |
| 53 | DOMPurify: 'readonly', | 57 | ePub: 'readonly', |
| 54 | droll: 'readonly', | ||
| 55 | Fuse: 'readonly', | ||
| 56 | Handlebars: 'readonly', | ||
| 57 | hljs: 'readonly', | ||
| 58 | localforage: 'readonly', | ||
| 59 | moment: 'readonly', | ||
| 60 | pdfjsLib: 'readonly', | 58 | pdfjsLib: 'readonly', |
| 61 | Popper: 'readonly', | ||
| 62 | showdown: 'readonly', | ||
| 63 | showdownKatex: 'readonly', | ||
| 64 | SVGInject: 'readonly', | ||
| 65 | toastr: 'readonly', | 59 | toastr: 'readonly', |
| 66 | Readability: 'readonly', | ||
| 67 | isProbablyReaderable: 'readonly', | ||
| 68 | ePub: 'readonly', | ||
| 69 | diff_match_patch: 'readonly', | ||
| 70 | SillyTavern: 'readonly', | 60 | SillyTavern: 'readonly', |
| 71 | }, | 61 | }, |
| 72 | }, | 62 | }, |
| @@ -168,5 +168,13 @@ claude: | |||
| 168 | # (e.g {{random}} macro or lorebooks not as in-chat injections). | 168 | # (e.g {{random}} macro or lorebooks not as in-chat injections). |
| 169 | # Otherwise, you'll just waste money on cache misses. | 169 | # Otherwise, you'll just waste money on cache misses. |
| 170 | enableSystemPromptCache: false | 170 | enableSystemPromptCache: false |
| 171 | # Enables caching of the message history at depth (if supported). | ||
| 172 | # https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching | ||
| 173 | # -- IMPORTANT! -- | ||
| 174 | # Use with caution. Behavior may be unpredictable and no guarantees can or will be made. | ||
| 175 | # Set to an integer to specify the desired depth. 0 (which does NOT include the prefill) | ||
| 176 | # should be ideal for most use cases. | ||
| 177 | # Any value other than a non-negative integer will be ignored and caching at depth will not be enabled. | ||
| 178 | cachingAtDepth: -1 | ||
| 171 | # -- SERVER PLUGIN CONFIGURATION -- | 179 | # -- SERVER PLUGIN CONFIGURATION -- |
| 172 | enableServerPlugins: false | 180 | enableServerPlugins: false |
| @@ -0,0 +1,137 @@ | |||
| 1 | { | ||
| 2 | "3": { | ||
| 3 | "inputs": { | ||
| 4 | "seed": "%seed%", | ||
| 5 | "steps": "%steps%", | ||
| 6 | "cfg": "%scale%", | ||
| 7 | "sampler_name": "%sampler%", | ||
| 8 | "scheduler": "%scheduler%", | ||
| 9 | "denoise": "%denoise%", | ||
| 10 | "model": [ | ||
| 11 | "4", | ||
| 12 | 0 | ||
| 13 | ], | ||
| 14 | "positive": [ | ||
| 15 | "6", | ||
| 16 | 0 | ||
| 17 | ], | ||
| 18 | "negative": [ | ||
| 19 | "7", | ||
| 20 | 0 | ||
| 21 | ], | ||
| 22 | "latent_image": [ | ||
| 23 | "12", | ||
| 24 | 0 | ||
| 25 | ] | ||
| 26 | }, | ||
| 27 | "class_type": "KSampler", | ||
| 28 | "_meta": { | ||
| 29 | "title": "KSampler" | ||
| 30 | } | ||
| 31 | }, | ||
| 32 | "4": { | ||
| 33 | "inputs": { | ||
| 34 | "ckpt_name": "%model%" | ||
| 35 | }, | ||
| 36 | "class_type": "CheckpointLoaderSimple", | ||
| 37 | "_meta": { | ||
| 38 | "title": "Load Checkpoint" | ||
| 39 | } | ||
| 40 | }, | ||
| 41 | "6": { | ||
| 42 | "inputs": { | ||
| 43 | "text": "%prompt%", | ||
| 44 | "clip": [ | ||
| 45 | "4", | ||
| 46 | 1 | ||
| 47 | ] | ||
| 48 | }, | ||
| 49 | "class_type": "CLIPTextEncode", | ||
| 50 | "_meta": { | ||
| 51 | "title": "CLIP Text Encode (Prompt)" | ||
| 52 | } | ||
| 53 | }, | ||
| 54 | "7": { | ||
| 55 | "inputs": { | ||
| 56 | "text": "%negative_prompt%", | ||
| 57 | "clip": [ | ||
| 58 | "4", | ||
| 59 | 1 | ||
| 60 | ] | ||
| 61 | }, | ||
| 62 | "class_type": "CLIPTextEncode", | ||
| 63 | "_meta": { | ||
| 64 | "title": "CLIP Text Encode (Negative Prompt)" | ||
| 65 | } | ||
| 66 | }, | ||
| 67 | "8": { | ||
| 68 | "inputs": { | ||
| 69 | "samples": [ | ||
| 70 | "3", | ||
| 71 | 0 | ||
| 72 | ], | ||
| 73 | "vae": [ | ||
| 74 | "4", | ||
| 75 | 2 | ||
| 76 | ] | ||
| 77 | }, | ||
| 78 | "class_type": "VAEDecode", | ||
| 79 | "_meta": { | ||
| 80 | "title": "VAE Decode" | ||
| 81 | } | ||
| 82 | }, | ||
| 83 | "9": { | ||
| 84 | "inputs": { | ||
| 85 | "filename_prefix": "SillyTavern", | ||
| 86 | "images": [ | ||
| 87 | "8", | ||
| 88 | 0 | ||
| 89 | ] | ||
| 90 | }, | ||
| 91 | "class_type": "SaveImage", | ||
| 92 | "_meta": { | ||
| 93 | "title": "Save Image" | ||
| 94 | } | ||
| 95 | }, | ||
| 96 | "10": { | ||
| 97 | "inputs": { | ||
| 98 | "image": "%char_avatar%" | ||
| 99 | }, | ||
| 100 | "class_type": "ETN_LoadImageBase64", | ||
| 101 | "_meta": { | ||
| 102 | "title": "Load Image (Base64) [https://github.com/Acly/comfyui-tooling-nodes]" | ||
| 103 | } | ||
| 104 | }, | ||
| 105 | "12": { | ||
| 106 | "inputs": { | ||
| 107 | "pixels": [ | ||
| 108 | "13", | ||
| 109 | 0 | ||
| 110 | ], | ||
| 111 | "vae": [ | ||
| 112 | "4", | ||
| 113 | 2 | ||
| 114 | ] | ||
| 115 | }, | ||
| 116 | "class_type": "VAEEncode", | ||
| 117 | "_meta": { | ||
| 118 | "title": "VAE Encode" | ||
| 119 | } | ||
| 120 | }, | ||
| 121 | "13": { | ||
| 122 | "inputs": { | ||
| 123 | "upscale_method": "bicubic", | ||
| 124 | "width": "%width%", | ||
| 125 | "height": "%height%", | ||
| 126 | "crop": "center", | ||
| 127 | "image": [ | ||
| 128 | "10", | ||
| 129 | 0 | ||
| 130 | ] | ||
| 131 | }, | ||
| 132 | "class_type": "ImageScale", | ||
| 133 | "_meta": { | ||
| 134 | "title": "Upscale Image" | ||
| 135 | } | ||
| 136 | } | ||
| 137 | } | ||
| @@ -136,6 +136,10 @@ | |||
| 136 | "type": "workflow" | 136 | "type": "workflow" |
| 137 | }, | 137 | }, |
| 138 | { | 138 | { |
| 139 | "filename": "Char_Avatar_Comfy_Workflow.json", | ||
| 140 | "type": "workflow" | ||
| 141 | }, | ||
| 142 | { | ||
| 139 | "filename": "presets/kobold/Ace of Spades.json", | 143 | "filename": "presets/kobold/Ace of Spades.json", |
| 140 | "type": "kobold_preset" | 144 | "type": "kobold_preset" |
| 141 | }, | 145 | }, |
| @@ -624,6 +628,14 @@ | |||
| 624 | "type": "instruct" | 628 | "type": "instruct" |
| 625 | }, | 629 | }, |
| 626 | { | 630 | { |
| 631 | "filename": "presets/instruct/Tulu.json", | ||
| 632 | "type": "instruct" | ||
| 633 | }, | ||
| 634 | { | ||
| 635 | "filename": "presets/context/Tulu.json", | ||
| 636 | "type": "context" | ||
| 637 | }, | ||
| 638 | { | ||
| 627 | "filename": "presets/instruct/Vicuna 1.0.json", | 639 | "filename": "presets/instruct/Vicuna 1.0.json", |
| 628 | "type": "instruct" | 640 | "type": "instruct" |
| 629 | }, | 641 | }, |
| @@ -762,5 +774,13 @@ | |||
| 762 | { | 774 | { |
| 763 | "filename": "presets/context/Mistral V3-Tekken.json", | 775 | "filename": "presets/context/Mistral V3-Tekken.json", |
| 764 | "type": "context" | 776 | "type": "context" |
| 777 | }, | ||
| 778 | { | ||
| 779 | "filename": "presets/instruct/Mistral V7.json", | ||
| 780 | "type": "instruct" | ||
| 781 | }, | ||
| 782 | { | ||
| 783 | "filename": "presets/context/Mistral V7.json", | ||
| 784 | "type": "context" | ||
| 765 | } | 785 | } |
| 766 | ] | 786 | ] |
| @@ -0,0 +1,11 @@ | |||
| 1 | { | ||
| 2 | "story_string": "[SYSTEM_PROMPT] {{#if system}}{{system}}\n{{/if}}{{#if wiBefore}}{{wiBefore}}\n{{/if}}{{#if description}}{{description}}\n{{/if}}{{#if personality}}{{personality}}\n{{/if}}{{#if scenario}}{{scenario}}\n{{/if}}{{#if wiAfter}}{{wiAfter}}\n{{/if}}{{#if persona}}{{persona}}\n{{/if}}{{trim}}[/SYSTEM_PROMPT]", | ||
| 3 | "example_separator": "", | ||
| 4 | "chat_start": "", | ||
| 5 | "use_stop_strings": false, | ||
| 6 | "allow_jailbreak": false, | ||
| 7 | "always_force_name2": true, | ||
| 8 | "trim_sentences": false, | ||
| 9 | "single_line": false, | ||
| 10 | "name": "Mistral V7" | ||
| 11 | } | ||
| @@ -0,0 +1,11 @@ | |||
| 1 | { | ||
| 2 | "story_string": "<|system|>\n{{#if system}}{{system}}\n{{/if}}{{#if wiBefore}}{{wiBefore}}\n{{/if}}{{#if description}}{{description}}\n{{/if}}{{#if personality}}{{char}}'s personality: {{personality}}\n{{/if}}{{#if scenario}}Scenario: {{scenario}}\n{{/if}}{{#if wiAfter}}{{wiAfter}}\n{{/if}}{{#if persona}}{{persona}}\n{{/if}}{{trim}}\n", | ||
| 3 | "example_separator": "", | ||
| 4 | "chat_start": "", | ||
| 5 | "use_stop_strings": false, | ||
| 6 | "allow_jailbreak": false, | ||
| 7 | "always_force_name2": true, | ||
| 8 | "trim_sentences": false, | ||
| 9 | "single_line": false, | ||
| 10 | "name": "Tulu" | ||
| 11 | } | ||
| @@ -0,0 +1,22 @@ | |||
| 1 | { | ||
| 2 | "input_sequence": "[INST] ", | ||
| 3 | "output_sequence": " ", | ||
| 4 | "last_output_sequence": "", | ||
| 5 | "system_sequence": "[SYSTEM_PROMPT] ", | ||
| 6 | "stop_sequence": "</s>", | ||
| 7 | "wrap": false, | ||
| 8 | "macro": true, | ||
| 9 | "names_behavior": "always", | ||
| 10 | "activation_regex": "", | ||
| 11 | "system_sequence_prefix": "", | ||
| 12 | "system_sequence_suffix": "", | ||
| 13 | "first_output_sequence": "", | ||
| 14 | "skip_examples": false, | ||
| 15 | "output_suffix": "</s>", | ||
| 16 | "input_suffix": "[/INST]", | ||
| 17 | "system_suffix": "[/SYSTEM_PROMPT]", | ||
| 18 | "user_alignment_message": "", | ||
| 19 | "system_same_as_user": false, | ||
| 20 | "last_system_sequence": "", | ||
| 21 | "name": "Mistral V7" | ||
| 22 | } | ||
| @@ -0,0 +1,22 @@ | |||
| 1 | { | ||
| 2 | "input_sequence": "<|user|>\n", | ||
| 3 | "output_sequence": "<|assistant|>\n", | ||
| 4 | "first_output_sequence": "", | ||
| 5 | "last_output_sequence": "", | ||
| 6 | "system_sequence_prefix": "", | ||
| 7 | "system_sequence_suffix": "", | ||
| 8 | "stop_sequence": "<|end_of_text|>", | ||
| 9 | "wrap": false, | ||
| 10 | "macro": true, | ||
| 11 | "names_behavior": "always", | ||
| 12 | "activation_regex": "", | ||
| 13 | "skip_examples": false, | ||
| 14 | "output_suffix": "<|end_of_text|>\n", | ||
| 15 | "input_suffix": "\n", | ||
| 16 | "system_sequence": "<|system|>\n", | ||
| 17 | "system_suffix": "\n", | ||
| 18 | "user_alignment_message": "", | ||
| 19 | "last_system_sequence": "", | ||
| 20 | "system_same_as_user": false, | ||
| 21 | "name": "Tulu" | ||
| 22 | } | ||
| @@ -230,7 +230,6 @@ | |||
| 230 | "show_external_models": false, | 230 | "show_external_models": false, |
| 231 | "assistant_prefill": "", | 231 | "assistant_prefill": "", |
| 232 | "assistant_impersonation": "", | 232 | "assistant_impersonation": "", |
| 233 | "human_sysprompt_message": "Let's get started. Please generate your response based on the information and instructions provided above.", | ||
| 234 | "claude_use_sysprompt": false, | 233 | "claude_use_sysprompt": false, |
| 235 | "use_alt_scale": false, | 234 | "use_alt_scale": false, |
| 236 | "squash_system_messages": false, | 235 | "squash_system_messages": false, |
| @@ -133,7 +133,6 @@ | |||
| 133 | "auto_fix_generated_markdown": false, | 133 | "auto_fix_generated_markdown": false, |
| 134 | "send_on_enter": 0, | 134 | "send_on_enter": 0, |
| 135 | "console_log_prompts": false, | 135 | "console_log_prompts": false, |
| 136 | "render_formulas": false, | ||
| 137 | "allow_name1_display": false, | 136 | "allow_name1_display": false, |
| 138 | "allow_name2_display": false, | 137 | "allow_name2_display": false, |
| 139 | "hotswap_enabled": true, | 138 | "hotswap_enabled": true, |
| @@ -1,39 +1,53 @@ | |||
| 1 | { | 1 | { |
| 2 | "name": "sillytavern", | 2 | "name": "sillytavern", |
| 3 | "version": "1.12.7", | 3 | "version": "1.12.8", |
| 4 | "lockfileVersion": 3, | 4 | "lockfileVersion": 3, |
| 5 | "requires": true, | 5 | "requires": true, |
| 6 | "packages": { | 6 | "packages": { |
| 7 | "": { | 7 | "": { |
| 8 | "name": "sillytavern", | 8 | "name": "sillytavern", |
| 9 | "version": "1.12.7", | 9 | "version": "1.12.8", |
| 10 | "hasInstallScript": true, | 10 | "hasInstallScript": true, |
| 11 | "license": "AGPL-3.0", | 11 | "license": "AGPL-3.0", |
| 12 | "dependencies": { | 12 | "dependencies": { |
| 13 | "@adobe/css-tools": "^4.4.0", | ||
| 13 | "@agnai/sentencepiece-js": "^1.1.1", | 14 | "@agnai/sentencepiece-js": "^1.1.1", |
| 14 | "@agnai/web-tokenizers": "^0.1.3", | 15 | "@agnai/web-tokenizers": "^0.1.3", |
| 16 | "@iconfu/svg-inject": "^1.2.3", | ||
| 17 | "@mozilla/readability": "^0.5.0", | ||
| 18 | "@popperjs/core": "^2.11.8", | ||
| 15 | "@zeldafan0225/ai_horde": "^5.1.0", | 19 | "@zeldafan0225/ai_horde": "^5.1.0", |
| 16 | "archiver": "^7.0.1", | 20 | "archiver": "^7.0.1", |
| 17 | "bing-translate-api": "^2.9.1", | 21 | "bing-translate-api": "^2.9.1", |
| 18 | "body-parser": "^1.20.2", | 22 | "body-parser": "^1.20.2", |
| 23 | "bowser": "^2.11.0", | ||
| 19 | "command-exists": "^1.2.9", | 24 | "command-exists": "^1.2.9", |
| 20 | "compression": "^1", | 25 | "compression": "^1", |
| 21 | "cookie-parser": "^1.4.6", | 26 | "cookie-parser": "^1.4.6", |
| 22 | "cookie-session": "^2.1.0", | 27 | "cookie-session": "^2.1.0", |
| 23 | "cors": "^2.8.5", | 28 | "cors": "^2.8.5", |
| 24 | "csrf-csrf": "^2.2.3", | 29 | "csrf-csrf": "^2.2.3", |
| 30 | "diff-match-patch": "^1.0.5", | ||
| 31 | "dompurify": "^3.1.7", | ||
| 32 | "droll": "^0.2.1", | ||
| 25 | "express": "^4.21.0", | 33 | "express": "^4.21.0", |
| 26 | "form-data": "^4.0.0", | 34 | "form-data": "^4.0.0", |
| 35 | "fuse.js": "^7.0.0", | ||
| 27 | "google-translate-api-browser": "^3.0.1", | 36 | "google-translate-api-browser": "^3.0.1", |
| 28 | "google-translate-api-x": "^10.7.1", | 37 | "google-translate-api-x": "^10.7.1", |
| 38 | "handlebars": "^4.7.8", | ||
| 29 | "helmet": "^7.1.0", | 39 | "helmet": "^7.1.0", |
| 40 | "highlight.js": "^11.10.0", | ||
| 30 | "html-entities": "^2.5.2", | 41 | "html-entities": "^2.5.2", |
| 31 | "iconv-lite": "^0.6.3", | 42 | "iconv-lite": "^0.6.3", |
| 32 | "ip-matching": "^2.1.2", | 43 | "ip-matching": "^2.1.2", |
| 33 | "ipaddr.js": "^2.0.1", | 44 | "ipaddr.js": "^2.0.1", |
| 34 | "jimp": "^0.22.10", | 45 | "jimp": "^0.22.10", |
| 46 | "localforage": "^1.10.0", | ||
| 35 | "lodash": "^4.17.21", | 47 | "lodash": "^4.17.21", |
| 36 | "mime-types": "^2.1.35", | 48 | "mime-types": "^2.1.35", |
| 49 | "moment": "^2.30.1", | ||
| 50 | "morphdom": "^2.7.4", | ||
| 37 | "multer": "^1.4.5-lts.1", | 51 | "multer": "^1.4.5-lts.1", |
| 38 | "node-fetch": "^3.3.2", | 52 | "node-fetch": "^3.3.2", |
| 39 | "node-persist": "^4.0.1", | 53 | "node-persist": "^4.0.1", |
| @@ -45,11 +59,14 @@ | |||
| 45 | "rate-limiter-flexible": "^5.0.0", | 59 | "rate-limiter-flexible": "^5.0.0", |
| 46 | "response-time": "^2.3.2", | 60 | "response-time": "^2.3.2", |
| 47 | "sanitize-filename": "^1.6.3", | 61 | "sanitize-filename": "^1.6.3", |
| 62 | "seedrandom": "^3.0.5", | ||
| 63 | "showdown": "^2.1.0", | ||
| 48 | "sillytavern-transformers": "2.14.6", | 64 | "sillytavern-transformers": "2.14.6", |
| 49 | "simple-git": "^3.19.1", | 65 | "simple-git": "^3.19.1", |
| 50 | "tiktoken": "^1.0.16", | 66 | "tiktoken": "^1.0.16", |
| 51 | "vectra": "^0.2.2", | 67 | "vectra": "^0.2.2", |
| 52 | "wavefile": "^11.0.0", | 68 | "wavefile": "^11.0.0", |
| 69 | "webpack": "^5.95.0", | ||
| 53 | "write-file-atomic": "^5.0.1", | 70 | "write-file-atomic": "^5.0.1", |
| 54 | "ws": "^8.17.1", | 71 | "ws": "^8.17.1", |
| 55 | "yaml": "^2.3.4", | 72 | "yaml": "^2.3.4", |
| @@ -66,7 +83,7 @@ | |||
| 66 | "@types/cookie-parser": "^1.4.7", | 83 | "@types/cookie-parser": "^1.4.7", |
| 67 | "@types/cookie-session": "^2.0.49", | 84 | "@types/cookie-session": "^2.0.49", |
| 68 | "@types/cors": "^2.8.17", | 85 | "@types/cors": "^2.8.17", |
| 69 | "@types/dompurify": "^3.0.5", | 86 | "@types/deno": "^2.0.0", |
| 70 | "@types/express": "^4.17.21", | 87 | "@types/express": "^4.17.21", |
| 71 | "@types/jquery": "^3.5.29", | 88 | "@types/jquery": "^3.5.29", |
| 72 | "@types/lodash": "^4.17.10", | 89 | "@types/lodash": "^4.17.10", |
| @@ -98,6 +115,12 @@ | |||
| 98 | "node": ">=0.10.0" | 115 | "node": ">=0.10.0" |
| 99 | } | 116 | } |
| 100 | }, | 117 | }, |
| 118 | "node_modules/@adobe/css-tools": { | ||
| 119 | "version": "4.4.0", | ||
| 120 | "resolved": "https://registry.npmjs.org/@adobe/css-tools/-/css-tools-4.4.0.tgz", | ||
| 121 | "integrity": "sha512-Ff9+ksdQQB3rMncgqDK78uLznstjyfIf2Arnh22pW8kBpLs6rpKDwgnZT46hin5Hl1WzazzK64DOrhSwYpS7bQ==", | ||
| 122 | "license": "MIT" | ||
| 123 | }, | ||
| 101 | "node_modules/@agnai/sentencepiece-js": { | 124 | "node_modules/@agnai/sentencepiece-js": { |
| 102 | "version": "1.1.1", | 125 | "version": "1.1.1", |
| 103 | "resolved": "https://registry.npmjs.org/@agnai/sentencepiece-js/-/sentencepiece-js-1.1.1.tgz", | 126 | "resolved": "https://registry.npmjs.org/@agnai/sentencepiece-js/-/sentencepiece-js-1.1.1.tgz", |
| @@ -270,6 +293,12 @@ | |||
| 270 | "dev": true, | 293 | "dev": true, |
| 271 | "license": "BSD-3-Clause" | 294 | "license": "BSD-3-Clause" |
| 272 | }, | 295 | }, |
| 296 | "node_modules/@iconfu/svg-inject": { | ||
| 297 | "version": "1.2.3", | ||
| 298 | "resolved": "https://registry.npmjs.org/@iconfu/svg-inject/-/svg-inject-1.2.3.tgz", | ||
| 299 | "integrity": "sha512-3v1MUAJqmJS4jmhHoCkSxt+EdJrjPHlLXrWocCT25kCxnxJto8028Z6CC406EL11KA53SDZgI/QQA5GEJAoiRw==", | ||
| 300 | "license": "MIT" | ||
| 301 | }, | ||
| 273 | "node_modules/@isaacs/cliui": { | 302 | "node_modules/@isaacs/cliui": { |
| 274 | "version": "8.0.2", | 303 | "version": "8.0.2", |
| 275 | "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", | 304 | "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", |
| @@ -778,6 +807,64 @@ | |||
| 778 | "regenerator-runtime": "^0.13.3" | 807 | "regenerator-runtime": "^0.13.3" |
| 779 | } | 808 | } |
| 780 | }, | 809 | }, |
| 810 | "node_modules/@jridgewell/gen-mapping": { | ||
| 811 | "version": "0.3.5", | ||
| 812 | "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.5.tgz", | ||
| 813 | "integrity": "sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg==", | ||
| 814 | "license": "MIT", | ||
| 815 | "dependencies": { | ||
| 816 | "@jridgewell/set-array": "^1.2.1", | ||
| 817 | "@jridgewell/sourcemap-codec": "^1.4.10", | ||
| 818 | "@jridgewell/trace-mapping": "^0.3.24" | ||
| 819 | }, | ||
| 820 | "engines": { | ||
| 821 | "node": ">=6.0.0" | ||
| 822 | } | ||
| 823 | }, | ||
| 824 | "node_modules/@jridgewell/resolve-uri": { | ||
| 825 | "version": "3.1.2", | ||
| 826 | "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", | ||
| 827 | "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", | ||
| 828 | "license": "MIT", | ||
| 829 | "engines": { | ||
| 830 | "node": ">=6.0.0" | ||
| 831 | } | ||
| 832 | }, | ||
| 833 | "node_modules/@jridgewell/set-array": { | ||
| 834 | "version": "1.2.1", | ||
| 835 | "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.2.1.tgz", | ||
| 836 | "integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==", | ||
| 837 | "license": "MIT", | ||
| 838 | "engines": { | ||
| 839 | "node": ">=6.0.0" | ||
| 840 | } | ||
| 841 | }, | ||
| 842 | "node_modules/@jridgewell/source-map": { | ||
| 843 | "version": "0.3.6", | ||
| 844 | "resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.6.tgz", | ||
| 845 | "integrity": "sha512-1ZJTZebgqllO79ue2bm3rIGud/bOe0pP5BjSRCRxxYkEZS8STV7zN84UBbiYu7jy+eCKSnVIUgoWWE/tt+shMQ==", | ||
| 846 | "license": "MIT", | ||
| 847 | "dependencies": { | ||
| 848 | "@jridgewell/gen-mapping": "^0.3.5", | ||
| 849 | "@jridgewell/trace-mapping": "^0.3.25" | ||
| 850 | } | ||
| 851 | }, | ||
| 852 | "node_modules/@jridgewell/sourcemap-codec": { | ||
| 853 | "version": "1.5.0", | ||
| 854 | "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz", | ||
| 855 | "integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==", | ||
| 856 | "license": "MIT" | ||
| 857 | }, | ||
| 858 | "node_modules/@jridgewell/trace-mapping": { | ||
| 859 | "version": "0.3.25", | ||
| 860 | "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz", | ||
| 861 | "integrity": "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==", | ||
| 862 | "license": "MIT", | ||
| 863 | "dependencies": { | ||
| 864 | "@jridgewell/resolve-uri": "^3.1.0", | ||
| 865 | "@jridgewell/sourcemap-codec": "^1.4.14" | ||
| 866 | } | ||
| 867 | }, | ||
| 781 | "node_modules/@kwsites/file-exists": { | 868 | "node_modules/@kwsites/file-exists": { |
| 782 | "version": "1.1.1", | 869 | "version": "1.1.1", |
| 783 | "resolved": "https://registry.npmjs.org/@kwsites/file-exists/-/file-exists-1.1.1.tgz", | 870 | "resolved": "https://registry.npmjs.org/@kwsites/file-exists/-/file-exists-1.1.1.tgz", |
| @@ -816,6 +903,15 @@ | |||
| 816 | "integrity": "sha512-GaHYm+c0O9MjZRu0ongGBRbinu8gVAMd2UZjji6jVmqKtZluZnptXGWhz1E8j8D2HJ3f/yMxKAUC0b+57wncIw==", | 903 | "integrity": "sha512-GaHYm+c0O9MjZRu0ongGBRbinu8gVAMd2UZjji6jVmqKtZluZnptXGWhz1E8j8D2HJ3f/yMxKAUC0b+57wncIw==", |
| 817 | "license": "MIT" | 904 | "license": "MIT" |
| 818 | }, | 905 | }, |
| 906 | "node_modules/@mozilla/readability": { | ||
| 907 | "version": "0.5.0", | ||
| 908 | "resolved": "https://registry.npmjs.org/@mozilla/readability/-/readability-0.5.0.tgz", | ||
| 909 | "integrity": "sha512-Z+CZ3QaosfFaTqvhQsIktyGrjFjSC0Fa4EMph4mqKnWhmyoGICsV/8QK+8HpXut6zV7zwfWwqDmEjtk1Qf6EgQ==", | ||
| 910 | "license": "Apache-2.0", | ||
| 911 | "engines": { | ||
| 912 | "node": ">=14.0.0" | ||
| 913 | } | ||
| 914 | }, | ||
| 819 | "node_modules/@nodelib/fs.scandir": { | 915 | "node_modules/@nodelib/fs.scandir": { |
| 820 | "version": "2.1.5", | 916 | "version": "2.1.5", |
| 821 | "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", | 917 | "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", |
| @@ -863,6 +959,16 @@ | |||
| 863 | "node": ">=14" | 959 | "node": ">=14" |
| 864 | } | 960 | } |
| 865 | }, | 961 | }, |
| 962 | "node_modules/@popperjs/core": { | ||
| 963 | "version": "2.11.8", | ||
| 964 | "resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.8.tgz", | ||
| 965 | "integrity": "sha512-P1st0aksCrn9sGZhp8GMYwBnQsbvAWsZAX44oXNNvLHGqAOcoVxmjZiohstwQ7SqKnbR47akdNi+uleWD8+g6A==", | ||
| 966 | "license": "MIT", | ||
| 967 | "funding": { | ||
| 968 | "type": "opencollective", | ||
| 969 | "url": "https://opencollective.com/popperjs" | ||
| 970 | } | ||
| 971 | }, | ||
| 866 | "node_modules/@protobufjs/aspromise": { | 972 | "node_modules/@protobufjs/aspromise": { |
| 867 | "version": "1.1.2", | 973 | "version": "1.1.2", |
| 868 | "resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz", | 974 | "resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz", |
| @@ -1060,15 +1166,18 @@ | |||
| 1060 | "@types/node": "*" | 1166 | "@types/node": "*" |
| 1061 | } | 1167 | } |
| 1062 | }, | 1168 | }, |
| 1063 | "node_modules/@types/dompurify": { | 1169 | "node_modules/@types/deno": { |
| 1064 | "version": "3.0.5", | 1170 | "version": "2.0.0", |
| 1065 | "resolved": "https://registry.npmjs.org/@types/dompurify/-/dompurify-3.0.5.tgz", | 1171 | "resolved": "https://registry.npmjs.org/@types/deno/-/deno-2.0.0.tgz", |
| 1066 | "integrity": "sha512-1Wg0g3BtQF7sSb27fJQAKck1HECM6zV1EB66j8JH9i3LCjYabJa0FSdiSgsD5K/RbrsR0SiraKacLB+T8ZVYAg==", | 1172 | "integrity": "sha512-O9/jRVlq93kqfkl4sYR5N7+Pz4ukzXVIbMnE/VgvpauNHsvjQ9iBVnJ3X0gAvMa2khcoFD8DSO7mQVCuiuDMPg==", |
| 1067 | "dev": true, | 1173 | "dev": true, |
| 1068 | "license": "MIT", | 1174 | "license": "MIT" |
| 1069 | "dependencies": { | 1175 | }, |
| 1070 | "@types/trusted-types": "*" | 1176 | "node_modules/@types/estree": { |
| 1071 | } | 1177 | "version": "1.0.6", |
| 1178 | "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.6.tgz", | ||
| 1179 | "integrity": "sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==", | ||
| 1180 | "license": "MIT" | ||
| 1072 | }, | 1181 | }, |
| 1073 | "node_modules/@types/express": { | 1182 | "node_modules/@types/express": { |
| 1074 | "version": "4.17.21", | 1183 | "version": "4.17.21", |
| @@ -1117,6 +1226,12 @@ | |||
| 1117 | "@types/sizzle": "*" | 1226 | "@types/sizzle": "*" |
| 1118 | } | 1227 | } |
| 1119 | }, | 1228 | }, |
| 1229 | "node_modules/@types/json-schema": { | ||
| 1230 | "version": "7.0.15", | ||
| 1231 | "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", | ||
| 1232 | "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", | ||
| 1233 | "license": "MIT" | ||
| 1234 | }, | ||
| 1120 | "node_modules/@types/keygrip": { | 1235 | "node_modules/@types/keygrip": { |
| 1121 | "version": "1.0.6", | 1236 | "version": "1.0.6", |
| 1122 | "resolved": "https://registry.npmjs.org/@types/keygrip/-/keygrip-1.0.6.tgz", | 1237 | "resolved": "https://registry.npmjs.org/@types/keygrip/-/keygrip-1.0.6.tgz", |
| @@ -1301,13 +1416,6 @@ | |||
| 1301 | "@types/jquery": "*" | 1416 | "@types/jquery": "*" |
| 1302 | } | 1417 | } |
| 1303 | }, | 1418 | }, |
| 1304 | "node_modules/@types/trusted-types": { | ||
| 1305 | "version": "2.0.7", | ||
| 1306 | "resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.7.tgz", | ||
| 1307 | "integrity": "sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==", | ||
| 1308 | "dev": true, | ||
| 1309 | "license": "MIT" | ||
| 1310 | }, | ||
| 1311 | "node_modules/@types/write-file-atomic": { | 1419 | "node_modules/@types/write-file-atomic": { |
| 1312 | "version": "4.0.3", | 1420 | "version": "4.0.3", |
| 1313 | "resolved": "https://registry.npmjs.org/@types/write-file-atomic/-/write-file-atomic-4.0.3.tgz", | 1421 | "resolved": "https://registry.npmjs.org/@types/write-file-atomic/-/write-file-atomic-4.0.3.tgz", |
| @@ -1352,6 +1460,164 @@ | |||
| 1352 | "dev": true, | 1460 | "dev": true, |
| 1353 | "license": "ISC" | 1461 | "license": "ISC" |
| 1354 | }, | 1462 | }, |
| 1463 | "node_modules/@webassemblyjs/ast": { | ||
| 1464 | "version": "1.12.1", | ||
| 1465 | "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.12.1.tgz", | ||
| 1466 | "integrity": "sha512-EKfMUOPRRUTy5UII4qJDGPpqfwjOmZ5jeGFwid9mnoqIFK+e0vqoi1qH56JpmZSzEL53jKnNzScdmftJyG5xWg==", | ||
| 1467 | "license": "MIT", | ||
| 1468 | "dependencies": { | ||
| 1469 | "@webassemblyjs/helper-numbers": "1.11.6", | ||
| 1470 | "@webassemblyjs/helper-wasm-bytecode": "1.11.6" | ||
| 1471 | } | ||
| 1472 | }, | ||
| 1473 | "node_modules/@webassemblyjs/floating-point-hex-parser": { | ||
| 1474 | "version": "1.11.6", | ||
| 1475 | "resolved": "https://registry.npmjs.org/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.11.6.tgz", | ||
| 1476 | "integrity": "sha512-ejAj9hfRJ2XMsNHk/v6Fu2dGS+i4UaXBXGemOfQ/JfQ6mdQg/WXtwleQRLLS4OvfDhv8rYnVwH27YJLMyYsxhw==", | ||
| 1477 | "license": "MIT" | ||
| 1478 | }, | ||
| 1479 | "node_modules/@webassemblyjs/helper-api-error": { | ||
| 1480 | "version": "1.11.6", | ||
| 1481 | "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-api-error/-/helper-api-error-1.11.6.tgz", | ||
| 1482 | "integrity": "sha512-o0YkoP4pVu4rN8aTJgAyj9hC2Sv5UlkzCHhxqWj8butaLvnpdc2jOwh4ewE6CX0txSfLn/UYaV/pheS2Txg//Q==", | ||
| 1483 | "license": "MIT" | ||
| 1484 | }, | ||
| 1485 | "node_modules/@webassemblyjs/helper-buffer": { | ||
| 1486 | "version": "1.12.1", | ||
| 1487 | "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-buffer/-/helper-buffer-1.12.1.tgz", | ||
| 1488 | "integrity": "sha512-nzJwQw99DNDKr9BVCOZcLuJJUlqkJh+kVzVl6Fmq/tI5ZtEyWT1KZMyOXltXLZJmDtvLCDgwsyrkohEtopTXCw==", | ||
| 1489 | "license": "MIT" | ||
| 1490 | }, | ||
| 1491 | "node_modules/@webassemblyjs/helper-numbers": { | ||
| 1492 | "version": "1.11.6", | ||
| 1493 | "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-numbers/-/helper-numbers-1.11.6.tgz", | ||
| 1494 | "integrity": "sha512-vUIhZ8LZoIWHBohiEObxVm6hwP034jwmc9kuq5GdHZH0wiLVLIPcMCdpJzG4C11cHoQ25TFIQj9kaVADVX7N3g==", | ||
| 1495 | "license": "MIT", | ||
| 1496 | "dependencies": { | ||
| 1497 | "@webassemblyjs/floating-point-hex-parser": "1.11.6", | ||
| 1498 | "@webassemblyjs/helper-api-error": "1.11.6", | ||
| 1499 | "@xtuc/long": "4.2.2" | ||
| 1500 | } | ||
| 1501 | }, | ||
| 1502 | "node_modules/@webassemblyjs/helper-wasm-bytecode": { | ||
| 1503 | "version": "1.11.6", | ||
| 1504 | "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.11.6.tgz", | ||
| 1505 | "integrity": "sha512-sFFHKwcmBprO9e7Icf0+gddyWYDViL8bpPjJJl0WHxCdETktXdmtWLGVzoHbqUcY4Be1LkNfwTmXOJUFZYSJdA==", | ||
| 1506 | "license": "MIT" | ||
| 1507 | }, | ||
| 1508 | "node_modules/@webassemblyjs/helper-wasm-section": { | ||
| 1509 | "version": "1.12.1", | ||
| 1510 | "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.12.1.tgz", | ||
| 1511 | "integrity": "sha512-Jif4vfB6FJlUlSbgEMHUyk1j234GTNG9dBJ4XJdOySoj518Xj0oGsNi59cUQF4RRMS9ouBUxDDdyBVfPTypa5g==", | ||
| 1512 | "license": "MIT", | ||
| 1513 | "dependencies": { | ||
| 1514 | "@webassemblyjs/ast": "1.12.1", | ||
| 1515 | "@webassemblyjs/helper-buffer": "1.12.1", | ||
| 1516 | "@webassemblyjs/helper-wasm-bytecode": "1.11.6", | ||
| 1517 | "@webassemblyjs/wasm-gen": "1.12.1" | ||
| 1518 | } | ||
| 1519 | }, | ||
| 1520 | "node_modules/@webassemblyjs/ieee754": { | ||
| 1521 | "version": "1.11.6", | ||
| 1522 | "resolved": "https://registry.npmjs.org/@webassemblyjs/ieee754/-/ieee754-1.11.6.tgz", | ||
| 1523 | "integrity": "sha512-LM4p2csPNvbij6U1f19v6WR56QZ8JcHg3QIJTlSwzFcmx6WSORicYj6I63f9yU1kEUtrpG+kjkiIAkevHpDXrg==", | ||
| 1524 | "license": "MIT", | ||
| 1525 | "dependencies": { | ||
| 1526 | "@xtuc/ieee754": "^1.2.0" | ||
| 1527 | } | ||
| 1528 | }, | ||
| 1529 | "node_modules/@webassemblyjs/leb128": { | ||
| 1530 | "version": "1.11.6", | ||
| 1531 | "resolved": "https://registry.npmjs.org/@webassemblyjs/leb128/-/leb128-1.11.6.tgz", | ||
| 1532 | "integrity": "sha512-m7a0FhE67DQXgouf1tbN5XQcdWoNgaAuoULHIfGFIEVKA6tu/edls6XnIlkmS6FrXAquJRPni3ZZKjw6FSPjPQ==", | ||
| 1533 | "license": "Apache-2.0", | ||
| 1534 | "dependencies": { | ||
| 1535 | "@xtuc/long": "4.2.2" | ||
| 1536 | } | ||
| 1537 | }, | ||
| 1538 | "node_modules/@webassemblyjs/utf8": { | ||
| 1539 | "version": "1.11.6", | ||
| 1540 | "resolved": "https://registry.npmjs.org/@webassemblyjs/utf8/-/utf8-1.11.6.tgz", | ||
| 1541 | "integrity": "sha512-vtXf2wTQ3+up9Zsg8sa2yWiQpzSsMyXj0qViVP6xKGCUT8p8YJ6HqI7l5eCnWx1T/FYdsv07HQs2wTFbbof/RA==", | ||
| 1542 | "license": "MIT" | ||
| 1543 | }, | ||
| 1544 | "node_modules/@webassemblyjs/wasm-edit": { | ||
| 1545 | "version": "1.12.1", | ||
| 1546 | "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-edit/-/wasm-edit-1.12.1.tgz", | ||
| 1547 | "integrity": "sha512-1DuwbVvADvS5mGnXbE+c9NfA8QRcZ6iKquqjjmR10k6o+zzsRVesil54DKexiowcFCPdr/Q0qaMgB01+SQ1u6g==", | ||
| 1548 | "license": "MIT", | ||
| 1549 | "dependencies": { | ||
| 1550 | "@webassemblyjs/ast": "1.12.1", | ||
| 1551 | "@webassemblyjs/helper-buffer": "1.12.1", | ||
| 1552 | "@webassemblyjs/helper-wasm-bytecode": "1.11.6", | ||
| 1553 | "@webassemblyjs/helper-wasm-section": "1.12.1", | ||
| 1554 | "@webassemblyjs/wasm-gen": "1.12.1", | ||
| 1555 | "@webassemblyjs/wasm-opt": "1.12.1", | ||
| 1556 | "@webassemblyjs/wasm-parser": "1.12.1", | ||
| 1557 | "@webassemblyjs/wast-printer": "1.12.1" | ||
| 1558 | } | ||
| 1559 | }, | ||
| 1560 | "node_modules/@webassemblyjs/wasm-gen": { | ||
| 1561 | "version": "1.12.1", | ||
| 1562 | "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-gen/-/wasm-gen-1.12.1.tgz", | ||
| 1563 | "integrity": "sha512-TDq4Ojh9fcohAw6OIMXqiIcTq5KUXTGRkVxbSo1hQnSy6lAM5GSdfwWeSxpAo0YzgsgF182E/U0mDNhuA0tW7w==", | ||
| 1564 | "license": "MIT", | ||
| 1565 | "dependencies": { | ||
| 1566 | "@webassemblyjs/ast": "1.12.1", | ||
| 1567 | "@webassemblyjs/helper-wasm-bytecode": "1.11.6", | ||
| 1568 | "@webassemblyjs/ieee754": "1.11.6", | ||
| 1569 | "@webassemblyjs/leb128": "1.11.6", | ||
| 1570 | "@webassemblyjs/utf8": "1.11.6" | ||
| 1571 | } | ||
| 1572 | }, | ||
| 1573 | "node_modules/@webassemblyjs/wasm-opt": { | ||
| 1574 | "version": "1.12.1", | ||
| 1575 | "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-opt/-/wasm-opt-1.12.1.tgz", | ||
| 1576 | "integrity": "sha512-Jg99j/2gG2iaz3hijw857AVYekZe2SAskcqlWIZXjji5WStnOpVoat3gQfT/Q5tb2djnCjBtMocY/Su1GfxPBg==", | ||
| 1577 | "license": "MIT", | ||
| 1578 | "dependencies": { | ||
| 1579 | "@webassemblyjs/ast": "1.12.1", | ||
| 1580 | "@webassemblyjs/helper-buffer": "1.12.1", | ||
| 1581 | "@webassemblyjs/wasm-gen": "1.12.1", | ||
| 1582 | "@webassemblyjs/wasm-parser": "1.12.1" | ||
| 1583 | } | ||
| 1584 | }, | ||
| 1585 | "node_modules/@webassemblyjs/wasm-parser": { | ||
| 1586 | "version": "1.12.1", | ||
| 1587 | "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-parser/-/wasm-parser-1.12.1.tgz", | ||
| 1588 | "integrity": "sha512-xikIi7c2FHXysxXe3COrVUPSheuBtpcfhbpFj4gmu7KRLYOzANztwUU0IbsqvMqzuNK2+glRGWCEqZo1WCLyAQ==", | ||
| 1589 | "license": "MIT", | ||
| 1590 | "dependencies": { | ||
| 1591 | "@webassemblyjs/ast": "1.12.1", | ||
| 1592 | "@webassemblyjs/helper-api-error": "1.11.6", | ||
| 1593 | "@webassemblyjs/helper-wasm-bytecode": "1.11.6", | ||
| 1594 | "@webassemblyjs/ieee754": "1.11.6", | ||
| 1595 | "@webassemblyjs/leb128": "1.11.6", | ||
| 1596 | "@webassemblyjs/utf8": "1.11.6" | ||
| 1597 | } | ||
| 1598 | }, | ||
| 1599 | "node_modules/@webassemblyjs/wast-printer": { | ||
| 1600 | "version": "1.12.1", | ||
| 1601 | "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-printer/-/wast-printer-1.12.1.tgz", | ||
| 1602 | "integrity": "sha512-+X4WAlOisVWQMikjbcvY2e0rwPsKQ9F688lksZhBcPycBBuii3O7m8FACbDMWDojpAqvjIncrG8J0XHKyQfVeA==", | ||
| 1603 | "license": "MIT", | ||
| 1604 | "dependencies": { | ||
| 1605 | "@webassemblyjs/ast": "1.12.1", | ||
| 1606 | "@xtuc/long": "4.2.2" | ||
| 1607 | } | ||
| 1608 | }, | ||
| 1609 | "node_modules/@xtuc/ieee754": { | ||
| 1610 | "version": "1.2.0", | ||
| 1611 | "resolved": "https://registry.npmjs.org/@xtuc/ieee754/-/ieee754-1.2.0.tgz", | ||
| 1612 | "integrity": "sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA==", | ||
| 1613 | "license": "BSD-3-Clause" | ||
| 1614 | }, | ||
| 1615 | "node_modules/@xtuc/long": { | ||
| 1616 | "version": "4.2.2", | ||
| 1617 | "resolved": "https://registry.npmjs.org/@xtuc/long/-/long-4.2.2.tgz", | ||
| 1618 | "integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==", | ||
| 1619 | "license": "Apache-2.0" | ||
| 1620 | }, | ||
| 1355 | "node_modules/@zeldafan0225/ai_horde": { | 1621 | "node_modules/@zeldafan0225/ai_horde": { |
| 1356 | "version": "5.1.0", | 1622 | "version": "5.1.0", |
| 1357 | "resolved": "https://registry.npmjs.org/@zeldafan0225/ai_horde/-/ai_horde-5.1.0.tgz", | 1623 | "resolved": "https://registry.npmjs.org/@zeldafan0225/ai_horde/-/ai_horde-5.1.0.tgz", |
| @@ -1392,7 +1658,6 @@ | |||
| 1392 | "version": "8.11.2", | 1658 | "version": "8.11.2", |
| 1393 | "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.2.tgz", | 1659 | "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.2.tgz", |
| 1394 | "integrity": "sha512-nc0Axzp/0FILLEVsm4fNwLCwMttvhEI263QtVPQcbpfZZ3ts0hLsZGOpE6czNlid7CJ9MlyH8reXkpsf3YUY4w==", | 1660 | "integrity": "sha512-nc0Axzp/0FILLEVsm4fNwLCwMttvhEI263QtVPQcbpfZZ3ts0hLsZGOpE6czNlid7CJ9MlyH8reXkpsf3YUY4w==", |
| 1395 | "dev": true, | ||
| 1396 | "license": "MIT", | 1661 | "license": "MIT", |
| 1397 | "bin": { | 1662 | "bin": { |
| 1398 | "acorn": "bin/acorn" | 1663 | "acorn": "bin/acorn" |
| @@ -1401,6 +1666,15 @@ | |||
| 1401 | "node": ">=0.4.0" | 1666 | "node": ">=0.4.0" |
| 1402 | } | 1667 | } |
| 1403 | }, | 1668 | }, |
| 1669 | "node_modules/acorn-import-attributes": { | ||
| 1670 | "version": "1.9.5", | ||
| 1671 | "resolved": "https://registry.npmjs.org/acorn-import-attributes/-/acorn-import-attributes-1.9.5.tgz", | ||
| 1672 | "integrity": "sha512-n02Vykv5uA3eHGM/Z2dQrcD56kL8TyDb2p1+0P83PClMnC/nc+anbQRhIOWnSq4Ke/KvDPrY3C9hDtC/A3eHnQ==", | ||
| 1673 | "license": "MIT", | ||
| 1674 | "peerDependencies": { | ||
| 1675 | "acorn": "^8" | ||
| 1676 | } | ||
| 1677 | }, | ||
| 1404 | "node_modules/acorn-jsx": { | 1678 | "node_modules/acorn-jsx": { |
| 1405 | "version": "5.3.2", | 1679 | "version": "5.3.2", |
| 1406 | "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", | 1680 | "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", |
| @@ -1462,7 +1736,6 @@ | |||
| 1462 | "version": "6.12.6", | 1736 | "version": "6.12.6", |
| 1463 | "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", | 1737 | "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", |
| 1464 | "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", | 1738 | "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", |
| 1465 | "dev": true, | ||
| 1466 | "license": "MIT", | 1739 | "license": "MIT", |
| 1467 | "dependencies": { | 1740 | "dependencies": { |
| 1468 | "fast-deep-equal": "^3.1.1", | 1741 | "fast-deep-equal": "^3.1.1", |
| @@ -1475,6 +1748,15 @@ | |||
| 1475 | "url": "https://github.com/sponsors/epoberezkin" | 1748 | "url": "https://github.com/sponsors/epoberezkin" |
| 1476 | } | 1749 | } |
| 1477 | }, | 1750 | }, |
| 1751 | "node_modules/ajv-keywords": { | ||
| 1752 | "version": "3.5.2", | ||
| 1753 | "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz", | ||
| 1754 | "integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==", | ||
| 1755 | "license": "MIT", | ||
| 1756 | "peerDependencies": { | ||
| 1757 | "ajv": "^6.9.1" | ||
| 1758 | } | ||
| 1759 | }, | ||
| 1478 | "node_modules/ansi-regex": { | 1760 | "node_modules/ansi-regex": { |
| 1479 | "version": "5.0.1", | 1761 | "version": "5.0.1", |
| 1480 | "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", | 1762 | "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", |
| @@ -1898,6 +2180,12 @@ | |||
| 1898 | "integrity": "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==", | 2180 | "integrity": "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==", |
| 1899 | "license": "ISC" | 2181 | "license": "ISC" |
| 1900 | }, | 2182 | }, |
| 2183 | "node_modules/bowser": { | ||
| 2184 | "version": "2.11.0", | ||
| 2185 | "resolved": "https://registry.npmjs.org/bowser/-/bowser-2.11.0.tgz", | ||
| 2186 | "integrity": "sha512-AlcaJBi/pqqJBIQ8U9Mcpc9i8Aqxn88Skv5d+xBX006BY5u8N3mGLHa5Lgppa7L/HfwgwLgZ6NYs+Ag6uUmJRA==", | ||
| 2187 | "license": "MIT" | ||
| 2188 | }, | ||
| 1901 | "node_modules/brace-expansion": { | 2189 | "node_modules/brace-expansion": { |
| 1902 | "version": "1.1.11", | 2190 | "version": "1.1.11", |
| 1903 | "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", | 2191 | "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", |
| @@ -1909,6 +2197,38 @@ | |||
| 1909 | "concat-map": "0.0.1" | 2197 | "concat-map": "0.0.1" |
| 1910 | } | 2198 | } |
| 1911 | }, | 2199 | }, |
| 2200 | "node_modules/browserslist": { | ||
| 2201 | "version": "4.24.0", | ||
| 2202 | "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.24.0.tgz", | ||
| 2203 | "integrity": "sha512-Rmb62sR1Zpjql25eSanFGEhAxcFwfA1K0GuQcLoaJBAcENegrQut3hYdhXFF1obQfiDyqIW/cLM5HSJ/9k884A==", | ||
| 2204 | "funding": [ | ||
| 2205 | { | ||
| 2206 | "type": "opencollective", | ||
| 2207 | "url": "https://opencollective.com/browserslist" | ||
| 2208 | }, | ||
| 2209 | { | ||
| 2210 | "type": "tidelift", | ||
| 2211 | "url": "https://tidelift.com/funding/github/npm/browserslist" | ||
| 2212 | }, | ||
| 2213 | { | ||
| 2214 | "type": "github", | ||
| 2215 | "url": "https://github.com/sponsors/ai" | ||
| 2216 | } | ||
| 2217 | ], | ||
| 2218 | "license": "MIT", | ||
| 2219 | "dependencies": { | ||
| 2220 | "caniuse-lite": "^1.0.30001663", | ||
| 2221 | "electron-to-chromium": "^1.5.28", | ||
| 2222 | "node-releases": "^2.0.18", | ||
| 2223 | "update-browserslist-db": "^1.1.0" | ||
| 2224 | }, | ||
| 2225 | "bin": { | ||
| 2226 | "browserslist": "cli.js" | ||
| 2227 | }, | ||
| 2228 | "engines": { | ||
| 2229 | "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" | ||
| 2230 | } | ||
| 2231 | }, | ||
| 1912 | "node_modules/buffer": { | 2232 | "node_modules/buffer": { |
| 1913 | "version": "5.7.1", | 2233 | "version": "5.7.1", |
| 1914 | "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", | 2234 | "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", |
| @@ -2033,6 +2353,26 @@ | |||
| 2033 | "node": ">=6" | 2353 | "node": ">=6" |
| 2034 | } | 2354 | } |
| 2035 | }, | 2355 | }, |
| 2356 | "node_modules/caniuse-lite": { | ||
| 2357 | "version": "1.0.30001669", | ||
| 2358 | "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001669.tgz", | ||
| 2359 | "integrity": "sha512-DlWzFDJqstqtIVx1zeSpIMLjunf5SmwOw0N2Ck/QSQdS8PLS4+9HrLaYei4w8BIAL7IB/UEDu889d8vhCTPA0w==", | ||
| 2360 | "funding": [ | ||
| 2361 | { | ||
| 2362 | "type": "opencollective", | ||
| 2363 | "url": "https://opencollective.com/browserslist" | ||
| 2364 | }, | ||
| 2365 | { | ||
| 2366 | "type": "tidelift", | ||
| 2367 | "url": "https://tidelift.com/funding/github/npm/caniuse-lite" | ||
| 2368 | }, | ||
| 2369 | { | ||
| 2370 | "type": "github", | ||
| 2371 | "url": "https://github.com/sponsors/ai" | ||
| 2372 | } | ||
| 2373 | ], | ||
| 2374 | "license": "CC-BY-4.0" | ||
| 2375 | }, | ||
| 2036 | "node_modules/centra": { | 2376 | "node_modules/centra": { |
| 2037 | "version": "2.7.0", | 2377 | "version": "2.7.0", |
| 2038 | "resolved": "https://registry.npmjs.org/centra/-/centra-2.7.0.tgz", | 2378 | "resolved": "https://registry.npmjs.org/centra/-/centra-2.7.0.tgz", |
| @@ -2106,6 +2446,15 @@ | |||
| 2106 | "url": "https://github.com/sponsors/fb55" | 2446 | "url": "https://github.com/sponsors/fb55" |
| 2107 | } | 2447 | } |
| 2108 | }, | 2448 | }, |
| 2449 | "node_modules/chrome-trace-event": { | ||
| 2450 | "version": "1.0.4", | ||
| 2451 | "resolved": "https://registry.npmjs.org/chrome-trace-event/-/chrome-trace-event-1.0.4.tgz", | ||
| 2452 | "integrity": "sha512-rNjApaLzuwaOTjCiT8lSDdGN1APCiqkChLMJxJPWLunPAt5fy8xgU9/jNOchV84wfIxrA0lRQB7oCT8jrn/wrQ==", | ||
| 2453 | "license": "MIT", | ||
| 2454 | "engines": { | ||
| 2455 | "node": ">=6.0" | ||
| 2456 | } | ||
| 2457 | }, | ||
| 2109 | "node_modules/cliui": { | 2458 | "node_modules/cliui": { |
| 2110 | "version": "8.0.1", | 2459 | "version": "8.0.1", |
| 2111 | "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", | 2460 | "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", |
| @@ -2177,6 +2526,12 @@ | |||
| 2177 | "integrity": "sha512-LTQ/SGc+s0Xc0Fu5WaKnR0YiygZkm9eKFvyS+fRsU7/ZWFF8ykFM6Pc9aCVf1+xasOOZpO3BAVgVrKvsqKHV7w==", | 2526 | "integrity": "sha512-LTQ/SGc+s0Xc0Fu5WaKnR0YiygZkm9eKFvyS+fRsU7/ZWFF8ykFM6Pc9aCVf1+xasOOZpO3BAVgVrKvsqKHV7w==", |
| 2178 | "license": "MIT" | 2527 | "license": "MIT" |
| 2179 | }, | 2528 | }, |
| 2529 | "node_modules/commander": { | ||
| 2530 | "version": "2.20.3", | ||
| 2531 | "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", | ||
| 2532 | "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", | ||
| 2533 | "license": "MIT" | ||
| 2534 | }, | ||
| 2180 | "node_modules/compress-commons": { | 2535 | "node_modules/compress-commons": { |
| 2181 | "version": "6.0.2", | 2536 | "version": "6.0.2", |
| 2182 | "resolved": "https://registry.npmjs.org/compress-commons/-/compress-commons-6.0.2.tgz", | 2537 | "resolved": "https://registry.npmjs.org/compress-commons/-/compress-commons-6.0.2.tgz", |
| @@ -2740,6 +3095,12 @@ | |||
| 2740 | "npm": "1.2.8000 || >= 1.4.16" | 3095 | "npm": "1.2.8000 || >= 1.4.16" |
| 2741 | } | 3096 | } |
| 2742 | }, | 3097 | }, |
| 3098 | "node_modules/diff-match-patch": { | ||
| 3099 | "version": "1.0.5", | ||
| 3100 | "resolved": "https://registry.npmjs.org/diff-match-patch/-/diff-match-patch-1.0.5.tgz", | ||
| 3101 | "integrity": "sha512-IayShXAgj/QMXgB0IWmKx+rOPuGMhqm5w6jvFxmVenXKIzRqTAAsbBPT3kWQeGANj3jGgvcvv4yK6SxqYmikgw==", | ||
| 3102 | "license": "Apache-2.0" | ||
| 3103 | }, | ||
| 2743 | "node_modules/digest-fetch": { | 3104 | "node_modules/digest-fetch": { |
| 2744 | "version": "1.3.0", | 3105 | "version": "1.3.0", |
| 2745 | "resolved": "https://registry.npmjs.org/digest-fetch/-/digest-fetch-1.3.0.tgz", | 3106 | "resolved": "https://registry.npmjs.org/digest-fetch/-/digest-fetch-1.3.0.tgz", |
| @@ -2809,6 +3170,12 @@ | |||
| 2809 | "url": "https://github.com/fb55/domhandler?sponsor=1" | 3170 | "url": "https://github.com/fb55/domhandler?sponsor=1" |
| 2810 | } | 3171 | } |
| 2811 | }, | 3172 | }, |
| 3173 | "node_modules/dompurify": { | ||
| 3174 | "version": "3.1.7", | ||
| 3175 | "resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.1.7.tgz", | ||
| 3176 | "integrity": "sha512-VaTstWtsneJY8xzy7DekmYWEOZcmzIe3Qb3zPd4STve1OBTa+e+WmS1ITQec1fZYXI3HCsOZZiSMpG6oxoWMWQ==", | ||
| 3177 | "license": "(MPL-2.0 OR Apache-2.0)" | ||
| 3178 | }, | ||
| 2812 | "node_modules/domutils": { | 3179 | "node_modules/domutils": { |
| 2813 | "version": "3.1.0", | 3180 | "version": "3.1.0", |
| 2814 | "resolved": "https://registry.npmjs.org/domutils/-/domutils-3.1.0.tgz", | 3181 | "resolved": "https://registry.npmjs.org/domutils/-/domutils-3.1.0.tgz", |
| @@ -2832,6 +3199,17 @@ | |||
| 2832 | "node": ">=10" | 3199 | "node": ">=10" |
| 2833 | } | 3200 | } |
| 2834 | }, | 3201 | }, |
| 3202 | "node_modules/droll": { | ||
| 3203 | "version": "0.2.1", | ||
| 3204 | "resolved": "https://registry.npmjs.org/droll/-/droll-0.2.1.tgz", | ||
| 3205 | "integrity": "sha512-fXxtxZSwGK6afeG18Vk6q/8LQDAnIylsvk/2tQhHwDOJmdB/x+YL9GLoSZUZXJkQ8LrBcyU/1EoIL1eSlpDMsg==", | ||
| 3206 | "bin": { | ||
| 3207 | "droll": "bin/droll-cli.js" | ||
| 3208 | }, | ||
| 3209 | "engines": { | ||
| 3210 | "node": ">=0.8.0" | ||
| 3211 | } | ||
| 3212 | }, | ||
| 2835 | "node_modules/eastasianwidth": { | 3213 | "node_modules/eastasianwidth": { |
| 2836 | "version": "0.2.0", | 3214 | "version": "0.2.0", |
| 2837 | "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", | 3215 | "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", |
| @@ -2843,6 +3221,12 @@ | |||
| 2843 | "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==", | 3221 | "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==", |
| 2844 | "license": "MIT" | 3222 | "license": "MIT" |
| 2845 | }, | 3223 | }, |
| 3224 | "node_modules/electron-to-chromium": { | ||
| 3225 | "version": "1.5.39", | ||
| 3226 | "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.39.tgz", | ||
| 3227 | "integrity": "sha512-4xkpSR6CjuiaNyvwiWDI85N9AxsvbPawB8xc7yzLPonYTuP19BVgYweKyUMFtHEZgIcHWMt1ks5Cqx2m+6/Grg==", | ||
| 3228 | "license": "ISC" | ||
| 3229 | }, | ||
| 2846 | "node_modules/emoji-regex": { | 3230 | "node_modules/emoji-regex": { |
| 2847 | "version": "8.0.0", | 3231 | "version": "8.0.0", |
| 2848 | "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", | 3232 | "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", |
| @@ -2867,6 +3251,19 @@ | |||
| 2867 | "once": "^1.4.0" | 3251 | "once": "^1.4.0" |
| 2868 | } | 3252 | } |
| 2869 | }, | 3253 | }, |
| 3254 | "node_modules/enhanced-resolve": { | ||
| 3255 | "version": "5.17.1", | ||
| 3256 | "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.17.1.tgz", | ||
| 3257 | "integrity": "sha512-LMHl3dXhTcfv8gM4kEzIUeTQ+7fpdA0l2tUf34BddXPkz2A5xJ5L/Pchd5BL6rdccM9QGvu0sWZzK1Z1t4wwyg==", | ||
| 3258 | "license": "MIT", | ||
| 3259 | "dependencies": { | ||
| 3260 | "graceful-fs": "^4.2.4", | ||
| 3261 | "tapable": "^2.2.0" | ||
| 3262 | }, | ||
| 3263 | "engines": { | ||
| 3264 | "node": ">=10.13.0" | ||
| 3265 | } | ||
| 3266 | }, | ||
| 2870 | "node_modules/entities": { | 3267 | "node_modules/entities": { |
| 2871 | "version": "4.5.0", | 3268 | "version": "4.5.0", |
| 2872 | "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", | 3269 | "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", |
| @@ -2900,10 +3297,16 @@ | |||
| 2900 | "node": ">= 0.4" | 3297 | "node": ">= 0.4" |
| 2901 | } | 3298 | } |
| 2902 | }, | 3299 | }, |
| 3300 | "node_modules/es-module-lexer": { | ||
| 3301 | "version": "1.5.4", | ||
| 3302 | "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.5.4.tgz", | ||
| 3303 | "integrity": "sha512-MVNK56NiMrOwitFB7cqDwq0CQutbw+0BvLshJSse0MUNU+y1FC3bUS/AQg7oUng+/wKrrki7JfmwtVHkVfPLlw==", | ||
| 3304 | "license": "MIT" | ||
| 3305 | }, | ||
| 2903 | "node_modules/escalade": { | 3306 | "node_modules/escalade": { |
| 2904 | "version": "3.1.2", | 3307 | "version": "3.2.0", |
| 2905 | "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.2.tgz", | 3308 | "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", |
| 2906 | "integrity": "sha512-ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA==", | 3309 | "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", |
| 2907 | "license": "MIT", | 3310 | "license": "MIT", |
| 2908 | "engines": { | 3311 | "engines": { |
| 2909 | "node": ">=6" | 3312 | "node": ">=6" |
| @@ -3130,7 +3533,6 @@ | |||
| 3130 | "version": "4.3.0", | 3533 | "version": "4.3.0", |
| 3131 | "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", | 3534 | "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", |
| 3132 | "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", | 3535 | "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", |
| 3133 | "dev": true, | ||
| 3134 | "license": "BSD-2-Clause", | 3536 | "license": "BSD-2-Clause", |
| 3135 | "dependencies": { | 3537 | "dependencies": { |
| 3136 | "estraverse": "^5.2.0" | 3538 | "estraverse": "^5.2.0" |
| @@ -3263,7 +3665,6 @@ | |||
| 3263 | "version": "3.1.3", | 3665 | "version": "3.1.3", |
| 3264 | "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", | 3666 | "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", |
| 3265 | "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", | 3667 | "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", |
| 3266 | "dev": true, | ||
| 3267 | "license": "MIT" | 3668 | "license": "MIT" |
| 3268 | }, | 3669 | }, |
| 3269 | "node_modules/fast-fifo": { | 3670 | "node_modules/fast-fifo": { |
| @@ -3275,7 +3676,6 @@ | |||
| 3275 | "version": "2.1.0", | 3676 | "version": "2.1.0", |
| 3276 | "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", | 3677 | "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", |
| 3277 | "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", | 3678 | "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", |
| 3278 | "dev": true, | ||
| 3279 | "license": "MIT" | 3679 | "license": "MIT" |
| 3280 | }, | 3680 | }, |
| 3281 | "node_modules/fast-levenshtein": { | 3681 | "node_modules/fast-levenshtein": { |
| @@ -3556,6 +3956,15 @@ | |||
| 3556 | "url": "https://github.com/sponsors/ljharb" | 3956 | "url": "https://github.com/sponsors/ljharb" |
| 3557 | } | 3957 | } |
| 3558 | }, | 3958 | }, |
| 3959 | "node_modules/fuse.js": { | ||
| 3960 | "version": "7.0.0", | ||
| 3961 | "resolved": "https://registry.npmjs.org/fuse.js/-/fuse.js-7.0.0.tgz", | ||
| 3962 | "integrity": "sha512-14F4hBIxqKvD4Zz/XjDc3y94mNZN6pRv3U13Udo0lNLCWRBUsrMv2xwcF/y/Z5sV6+FQW+/ow68cHpm4sunt8Q==", | ||
| 3963 | "license": "Apache-2.0", | ||
| 3964 | "engines": { | ||
| 3965 | "node": ">=10" | ||
| 3966 | } | ||
| 3967 | }, | ||
| 3559 | "node_modules/get-caller-file": { | 3968 | "node_modules/get-caller-file": { |
| 3560 | "version": "2.0.5", | 3969 | "version": "2.0.5", |
| 3561 | "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", | 3970 | "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", |
| @@ -3668,6 +4077,12 @@ | |||
| 3668 | "url": "https://github.com/sponsors/isaacs" | 4077 | "url": "https://github.com/sponsors/isaacs" |
| 3669 | } | 4078 | } |
| 3670 | }, | 4079 | }, |
| 4080 | "node_modules/glob-to-regexp": { | ||
| 4081 | "version": "0.4.1", | ||
| 4082 | "resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz", | ||
| 4083 | "integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==", | ||
| 4084 | "license": "BSD-2-Clause" | ||
| 4085 | }, | ||
| 3671 | "node_modules/global": { | 4086 | "node_modules/global": { |
| 3672 | "version": "4.4.0", | 4087 | "version": "4.4.0", |
| 3673 | "resolved": "https://registry.npmjs.org/global/-/global-4.4.0.tgz", | 4088 | "resolved": "https://registry.npmjs.org/global/-/global-4.4.0.tgz", |
| @@ -3774,11 +4189,31 @@ | |||
| 3774 | "integrity": "sha512-Y8T4vYhEfwJOTbouREvG+3XDsjr8E3kIr7uf+JZ0BYloFsttiHU0WfvANVsR7TxNUJa/WpCnw/Ino/p+DeBhBQ==", | 4189 | "integrity": "sha512-Y8T4vYhEfwJOTbouREvG+3XDsjr8E3kIr7uf+JZ0BYloFsttiHU0WfvANVsR7TxNUJa/WpCnw/Ino/p+DeBhBQ==", |
| 3775 | "license": "ISC" | 4190 | "license": "ISC" |
| 3776 | }, | 4191 | }, |
| 4192 | "node_modules/handlebars": { | ||
| 4193 | "version": "4.7.8", | ||
| 4194 | "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.8.tgz", | ||
| 4195 | "integrity": "sha512-vafaFqs8MZkRrSX7sFVUdo3ap/eNiLnb4IakshzvP56X5Nr1iGKAIqdX6tMlm6HcNRIkr6AxO5jFEoJzzpT8aQ==", | ||
| 4196 | "license": "MIT", | ||
| 4197 | "dependencies": { | ||
| 4198 | "minimist": "^1.2.5", | ||
| 4199 | "neo-async": "^2.6.2", | ||
| 4200 | "source-map": "^0.6.1", | ||
| 4201 | "wordwrap": "^1.0.0" | ||
| 4202 | }, | ||
| 4203 | "bin": { | ||
| 4204 | "handlebars": "bin/handlebars" | ||
| 4205 | }, | ||
| 4206 | "engines": { | ||
| 4207 | "node": ">=0.4.7" | ||
| 4208 | }, | ||
| 4209 | "optionalDependencies": { | ||
| 4210 | "uglify-js": "^3.1.4" | ||
| 4211 | } | ||
| 4212 | }, | ||
| 3777 | "node_modules/has-flag": { | 4213 | "node_modules/has-flag": { |
| 3778 | "version": "4.0.0", | 4214 | "version": "4.0.0", |
| 3779 | "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", | 4215 | "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", |
| 3780 | "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", | 4216 | "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", |
| 3781 | "dev": true, | ||
| 3782 | "license": "MIT", | 4217 | "license": "MIT", |
| 3783 | "engines": { | 4218 | "engines": { |
| 3784 | "node": ">=8" | 4219 | "node": ">=8" |
| @@ -3840,6 +4275,15 @@ | |||
| 3840 | "node": ">=16.0.0" | 4275 | "node": ">=16.0.0" |
| 3841 | } | 4276 | } |
| 3842 | }, | 4277 | }, |
| 4278 | "node_modules/highlight.js": { | ||
| 4279 | "version": "11.10.0", | ||
| 4280 | "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-11.10.0.tgz", | ||
| 4281 | "integrity": "sha512-SYVnVFswQER+zu1laSya563s+F8VDGt7o35d4utbamowvUNLLMovFqwCLSocpZTz3MgaSRA1IbqRWZv97dtErQ==", | ||
| 4282 | "license": "BSD-3-Clause", | ||
| 4283 | "engines": { | ||
| 4284 | "node": ">=12.0.0" | ||
| 4285 | } | ||
| 4286 | }, | ||
| 3843 | "node_modules/html-entities": { | 4287 | "node_modules/html-entities": { |
| 3844 | "version": "2.5.2", | 4288 | "version": "2.5.2", |
| 3845 | "resolved": "https://registry.npmjs.org/html-entities/-/html-entities-2.5.2.tgz", | 4289 | "resolved": "https://registry.npmjs.org/html-entities/-/html-entities-2.5.2.tgz", |
| @@ -4048,6 +4492,12 @@ | |||
| 4048 | "integrity": "sha512-QpLcX9ZSsq3YYUUnD3nFDY8H7wctAhQj/TFKL8Ya8v5fMm3CFXxo8zStsLAl780ltoYoo1WvKUVGBQK+1ifr7g==", | 4492 | "integrity": "sha512-QpLcX9ZSsq3YYUUnD3nFDY8H7wctAhQj/TFKL8Ya8v5fMm3CFXxo8zStsLAl780ltoYoo1WvKUVGBQK+1ifr7g==", |
| 4049 | "license": "MIT" | 4493 | "license": "MIT" |
| 4050 | }, | 4494 | }, |
| 4495 | "node_modules/immediate": { | ||
| 4496 | "version": "3.0.6", | ||
| 4497 | "resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz", | ||
| 4498 | "integrity": "sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ==", | ||
| 4499 | "license": "MIT" | ||
| 4500 | }, | ||
| 4051 | "node_modules/import-fresh": { | 4501 | "node_modules/import-fresh": { |
| 4052 | "version": "3.3.0", | 4502 | "version": "3.3.0", |
| 4053 | "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", | 4503 | "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", |
| @@ -4270,6 +4720,35 @@ | |||
| 4270 | "@pkgjs/parseargs": "^0.11.0" | 4720 | "@pkgjs/parseargs": "^0.11.0" |
| 4271 | } | 4721 | } |
| 4272 | }, | 4722 | }, |
| 4723 | "node_modules/jest-worker": { | ||
| 4724 | "version": "27.5.1", | ||
| 4725 | "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-27.5.1.tgz", | ||
| 4726 | "integrity": "sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg==", | ||
| 4727 | "license": "MIT", | ||
| 4728 | "dependencies": { | ||
| 4729 | "@types/node": "*", | ||
| 4730 | "merge-stream": "^2.0.0", | ||
| 4731 | "supports-color": "^8.0.0" | ||
| 4732 | }, | ||
| 4733 | "engines": { | ||
| 4734 | "node": ">= 10.13.0" | ||
| 4735 | } | ||
| 4736 | }, | ||
| 4737 | "node_modules/jest-worker/node_modules/supports-color": { | ||
| 4738 | "version": "8.1.1", | ||
| 4739 | "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", | ||
| 4740 | "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", | ||
| 4741 | "license": "MIT", | ||
| 4742 | "dependencies": { | ||
| 4743 | "has-flag": "^4.0.0" | ||
| 4744 | }, | ||
| 4745 | "engines": { | ||
| 4746 | "node": ">=10" | ||
| 4747 | }, | ||
| 4748 | "funding": { | ||
| 4749 | "url": "https://github.com/chalk/supports-color?sponsor=1" | ||
| 4750 | } | ||
| 4751 | }, | ||
| 4273 | "node_modules/jimp": { | 4752 | "node_modules/jimp": { |
| 4274 | "version": "0.22.12", | 4753 | "version": "0.22.12", |
| 4275 | "resolved": "https://registry.npmjs.org/jimp/-/jimp-0.22.12.tgz", | 4754 | "resolved": "https://registry.npmjs.org/jimp/-/jimp-0.22.12.tgz", |
| @@ -4385,11 +4864,16 @@ | |||
| 4385 | "node": ">=4" | 4864 | "node": ">=4" |
| 4386 | } | 4865 | } |
| 4387 | }, | 4866 | }, |
| 4867 | "node_modules/json-parse-even-better-errors": { | ||
| 4868 | "version": "2.3.1", | ||
| 4869 | "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", | ||
| 4870 | "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", | ||
| 4871 | "license": "MIT" | ||
| 4872 | }, | ||
| 4388 | "node_modules/json-schema-traverse": { | 4873 | "node_modules/json-schema-traverse": { |
| 4389 | "version": "0.4.1", | 4874 | "version": "0.4.1", |
| 4390 | "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", | 4875 | "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", |
| 4391 | "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", | 4876 | "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", |
| 4392 | "dev": true, | ||
| 4393 | "license": "MIT" | 4877 | "license": "MIT" |
| 4394 | }, | 4878 | }, |
| 4395 | "node_modules/json-stable-stringify-without-jsonify": { | 4879 | "node_modules/json-stable-stringify-without-jsonify": { |
| @@ -4456,6 +4940,15 @@ | |||
| 4456 | "node": ">= 0.8.0" | 4940 | "node": ">= 0.8.0" |
| 4457 | } | 4941 | } |
| 4458 | }, | 4942 | }, |
| 4943 | "node_modules/lie": { | ||
| 4944 | "version": "3.1.1", | ||
| 4945 | "resolved": "https://registry.npmjs.org/lie/-/lie-3.1.1.tgz", | ||
| 4946 | "integrity": "sha512-RiNhHysUjhrDQntfYSfY4MU24coXXdEOgw9WGcKHNeEwffDYbF//u87M1EWaMGzuFoSbqW0C9C6lEEhDOAswfw==", | ||
| 4947 | "license": "MIT", | ||
| 4948 | "dependencies": { | ||
| 4949 | "immediate": "~3.0.5" | ||
| 4950 | } | ||
| 4951 | }, | ||
| 4459 | "node_modules/load-bmfont": { | 4952 | "node_modules/load-bmfont": { |
| 4460 | "version": "1.4.2", | 4953 | "version": "1.4.2", |
| 4461 | "resolved": "https://registry.npmjs.org/load-bmfont/-/load-bmfont-1.4.2.tgz", | 4954 | "resolved": "https://registry.npmjs.org/load-bmfont/-/load-bmfont-1.4.2.tgz", |
| @@ -4472,6 +4965,24 @@ | |||
| 4472 | "xtend": "^4.0.0" | 4965 | "xtend": "^4.0.0" |
| 4473 | } | 4966 | } |
| 4474 | }, | 4967 | }, |
| 4968 | "node_modules/loader-runner": { | ||
| 4969 | "version": "4.3.0", | ||
| 4970 | "resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-4.3.0.tgz", | ||
| 4971 | "integrity": "sha512-3R/1M+yS3j5ou80Me59j7F9IMs4PXs3VqRrm0TU3AbKPxlmpoY1TNscJV/oGJXo8qCatFGTfDbY6W6ipGOYXfg==", | ||
| 4972 | "license": "MIT", | ||
| 4973 | "engines": { | ||
| 4974 | "node": ">=6.11.5" | ||
| 4975 | } | ||
| 4976 | }, | ||
| 4977 | "node_modules/localforage": { | ||
| 4978 | "version": "1.10.0", | ||
| 4979 | "resolved": "https://registry.npmjs.org/localforage/-/localforage-1.10.0.tgz", | ||
| 4980 | "integrity": "sha512-14/H1aX7hzBBmmh7sGPd+AOMkkIrHM3Z1PAyGgZigA1H1p5O5ANnMyWzvpAETtG68/dC4pC0ncy3+PPGzXZHPg==", | ||
| 4981 | "license": "Apache-2.0", | ||
| 4982 | "dependencies": { | ||
| 4983 | "lie": "3.1.1" | ||
| 4984 | } | ||
| 4985 | }, | ||
| 4475 | "node_modules/locate-path": { | 4986 | "node_modules/locate-path": { |
| 4476 | "version": "6.0.0", | 4987 | "version": "6.0.0", |
| 4477 | "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", | 4988 | "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", |
| @@ -4559,6 +5070,12 @@ | |||
| 4559 | "url": "https://github.com/sponsors/sindresorhus" | 5070 | "url": "https://github.com/sponsors/sindresorhus" |
| 4560 | } | 5071 | } |
| 4561 | }, | 5072 | }, |
| 5073 | "node_modules/merge-stream": { | ||
| 5074 | "version": "2.0.0", | ||
| 5075 | "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", | ||
| 5076 | "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", | ||
| 5077 | "license": "MIT" | ||
| 5078 | }, | ||
| 4562 | "node_modules/methods": { | 5079 | "node_modules/methods": { |
| 4563 | "version": "1.1.2", | 5080 | "version": "1.1.2", |
| 4564 | "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", | 5081 | "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", |
| @@ -4651,6 +5168,21 @@ | |||
| 4651 | "node": ">=16 || 14 >=14.17" | 5168 | "node": ">=16 || 14 >=14.17" |
| 4652 | } | 5169 | } |
| 4653 | }, | 5170 | }, |
| 5171 | "node_modules/moment": { | ||
| 5172 | "version": "2.30.1", | ||
| 5173 | "resolved": "https://registry.npmjs.org/moment/-/moment-2.30.1.tgz", | ||
| 5174 | "integrity": "sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how==", | ||
| 5175 | "license": "MIT", | ||
| 5176 | "engines": { | ||
| 5177 | "node": "*" | ||
| 5178 | } | ||
| 5179 | }, | ||
| 5180 | "node_modules/morphdom": { | ||
| 5181 | "version": "2.7.4", | ||
| 5182 | "resolved": "https://registry.npmjs.org/morphdom/-/morphdom-2.7.4.tgz", | ||
| 5183 | "integrity": "sha512-ATTbWMgGa+FaMU3FhnFYB6WgulCqwf6opOll4CBzmVDTLvPMmUPrEv8CudmLPK0MESa64+6B89fWOxP3+YIlxQ==", | ||
| 5184 | "license": "MIT" | ||
| 5185 | }, | ||
| 4654 | "node_modules/ms": { | 5186 | "node_modules/ms": { |
| 4655 | "version": "2.0.0", | 5187 | "version": "2.0.0", |
| 4656 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", | 5188 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", |
| @@ -4703,6 +5235,12 @@ | |||
| 4703 | "node": ">= 0.6" | 5235 | "node": ">= 0.6" |
| 4704 | } | 5236 | } |
| 4705 | }, | 5237 | }, |
| 5238 | "node_modules/neo-async": { | ||
| 5239 | "version": "2.6.2", | ||
| 5240 | "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", | ||
| 5241 | "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", | ||
| 5242 | "license": "MIT" | ||
| 5243 | }, | ||
| 4706 | "node_modules/netmask": { | 5244 | "node_modules/netmask": { |
| 4707 | "version": "2.0.2", | 5245 | "version": "2.0.2", |
| 4708 | "resolved": "https://registry.npmjs.org/netmask/-/netmask-2.0.2.tgz", | 5246 | "resolved": "https://registry.npmjs.org/netmask/-/netmask-2.0.2.tgz", |
| @@ -4766,6 +5304,12 @@ | |||
| 4766 | "node": ">=10.12.0" | 5304 | "node": ">=10.12.0" |
| 4767 | } | 5305 | } |
| 4768 | }, | 5306 | }, |
| 5307 | "node_modules/node-releases": { | ||
| 5308 | "version": "2.0.18", | ||
| 5309 | "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.18.tgz", | ||
| 5310 | "integrity": "sha512-d9VeXT4SJ7ZeOqGX6R5EM022wpL+eWPooLI+5UpWn2jCT1aosUQEhQP214x33Wkwx3JQMvIm+tIoVOdodFS40g==", | ||
| 5311 | "license": "MIT" | ||
| 5312 | }, | ||
| 4769 | "node_modules/normalize-path": { | 5313 | "node_modules/normalize-path": { |
| 4770 | "version": "3.0.0", | 5314 | "version": "3.0.0", |
| 4771 | "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", | 5315 | "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", |
| @@ -5217,6 +5761,12 @@ | |||
| 5217 | "node": ">= 8" | 5761 | "node": ">= 8" |
| 5218 | } | 5762 | } |
| 5219 | }, | 5763 | }, |
| 5764 | "node_modules/picocolors": { | ||
| 5765 | "version": "1.1.0", | ||
| 5766 | "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.0.tgz", | ||
| 5767 | "integrity": "sha512-TQ92mBOW0l3LeMeyLV6mzy/kWr8lkd/hp3mTg7wYK7zJhuBStmGMBG0BdeDZS/dZx1IukaX6Bk11zcln25o1Aw==", | ||
| 5768 | "license": "ISC" | ||
| 5769 | }, | ||
| 5220 | "node_modules/pixelmatch": { | 5770 | "node_modules/pixelmatch": { |
| 5221 | "version": "4.0.2", | 5771 | "version": "4.0.2", |
| 5222 | "resolved": "https://registry.npmjs.org/pixelmatch/-/pixelmatch-4.0.2.tgz", | 5772 | "resolved": "https://registry.npmjs.org/pixelmatch/-/pixelmatch-4.0.2.tgz", |
| @@ -5480,6 +6030,15 @@ | |||
| 5480 | "url": "https://github.com/sponsors/sindresorhus" | 6030 | "url": "https://github.com/sponsors/sindresorhus" |
| 5481 | } | 6031 | } |
| 5482 | }, | 6032 | }, |
| 6033 | "node_modules/randombytes": { | ||
| 6034 | "version": "2.1.0", | ||
| 6035 | "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", | ||
| 6036 | "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", | ||
| 6037 | "license": "MIT", | ||
| 6038 | "dependencies": { | ||
| 6039 | "safe-buffer": "^5.1.0" | ||
| 6040 | } | ||
| 6041 | }, | ||
| 5483 | "node_modules/range-parser": { | 6042 | "node_modules/range-parser": { |
| 5484 | "version": "1.2.1", | 6043 | "version": "1.2.1", |
| 5485 | "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", | 6044 | "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", |
| @@ -5745,6 +6304,12 @@ | |||
| 5745 | "integrity": "sha512-+aWOz7yVScEGoKNd4PA10LZ8sk0A/z5+nXQG5giUO5rprX9jgYsTdov9qCchZiPIZezbZH+jRut8nPodFAX4Jg==", | 6304 | "integrity": "sha512-+aWOz7yVScEGoKNd4PA10LZ8sk0A/z5+nXQG5giUO5rprX9jgYsTdov9qCchZiPIZezbZH+jRut8nPodFAX4Jg==", |
| 5746 | "license": "ISC" | 6305 | "license": "ISC" |
| 5747 | }, | 6306 | }, |
| 6307 | "node_modules/seedrandom": { | ||
| 6308 | "version": "3.0.5", | ||
| 6309 | "resolved": "https://registry.npmjs.org/seedrandom/-/seedrandom-3.0.5.tgz", | ||
| 6310 | "integrity": "sha512-8OwmbklUNzwezjGInmZ+2clQmExQPvomqjL7LFqOYqtmuxRgQYqOD3mHaU+MvZn5FLUeVxVfQjwLZW/n/JFuqg==", | ||
| 6311 | "license": "MIT" | ||
| 6312 | }, | ||
| 5748 | "node_modules/send": { | 6313 | "node_modules/send": { |
| 5749 | "version": "0.19.0", | 6314 | "version": "0.19.0", |
| 5750 | "resolved": "https://registry.npmjs.org/send/-/send-0.19.0.tgz", | 6315 | "resolved": "https://registry.npmjs.org/send/-/send-0.19.0.tgz", |
| @@ -5784,6 +6349,15 @@ | |||
| 5784 | "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", | 6349 | "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", |
| 5785 | "license": "MIT" | 6350 | "license": "MIT" |
| 5786 | }, | 6351 | }, |
| 6352 | "node_modules/serialize-javascript": { | ||
| 6353 | "version": "6.0.2", | ||
| 6354 | "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.2.tgz", | ||
| 6355 | "integrity": "sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==", | ||
| 6356 | "license": "BSD-3-Clause", | ||
| 6357 | "dependencies": { | ||
| 6358 | "randombytes": "^2.1.0" | ||
| 6359 | } | ||
| 6360 | }, | ||
| 5787 | "node_modules/serve-static": { | 6361 | "node_modules/serve-static": { |
| 5788 | "version": "1.16.2", | 6362 | "version": "1.16.2", |
| 5789 | "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.16.2.tgz", | 6363 | "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.16.2.tgz", |
| @@ -5843,6 +6417,31 @@ | |||
| 5843 | "node": ">=8" | 6417 | "node": ">=8" |
| 5844 | } | 6418 | } |
| 5845 | }, | 6419 | }, |
| 6420 | "node_modules/showdown": { | ||
| 6421 | "version": "2.1.0", | ||
| 6422 | "resolved": "https://registry.npmjs.org/showdown/-/showdown-2.1.0.tgz", | ||
| 6423 | "integrity": "sha512-/6NVYu4U819R2pUIk79n67SYgJHWCce0a5xTP979WbNp0FL9MN1I1QK662IDU1b6JzKTvmhgI7T7JYIxBi3kMQ==", | ||
| 6424 | "license": "MIT", | ||
| 6425 | "dependencies": { | ||
| 6426 | "commander": "^9.0.0" | ||
| 6427 | }, | ||
| 6428 | "bin": { | ||
| 6429 | "showdown": "bin/showdown.js" | ||
| 6430 | }, | ||
| 6431 | "funding": { | ||
| 6432 | "type": "individual", | ||
| 6433 | "url": "https://www.paypal.me/tiviesantos" | ||
| 6434 | } | ||
| 6435 | }, | ||
| 6436 | "node_modules/showdown/node_modules/commander": { | ||
| 6437 | "version": "9.5.0", | ||
| 6438 | "resolved": "https://registry.npmjs.org/commander/-/commander-9.5.0.tgz", | ||
| 6439 | "integrity": "sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ==", | ||
| 6440 | "license": "MIT", | ||
| 6441 | "engines": { | ||
| 6442 | "node": "^12.20.0 || >=14" | ||
| 6443 | } | ||
| 6444 | }, | ||
| 5846 | "node_modules/side-channel": { | 6445 | "node_modules/side-channel": { |
| 5847 | "version": "1.0.6", | 6446 | "version": "1.0.6", |
| 5848 | "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.6.tgz", | 6447 | "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.6.tgz", |
| @@ -5994,11 +6593,20 @@ | |||
| 5994 | "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", | 6593 | "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", |
| 5995 | "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", | 6594 | "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", |
| 5996 | "license": "BSD-3-Clause", | 6595 | "license": "BSD-3-Clause", |
| 5997 | "optional": true, | ||
| 5998 | "engines": { | 6596 | "engines": { |
| 5999 | "node": ">=0.10.0" | 6597 | "node": ">=0.10.0" |
| 6000 | } | 6598 | } |
| 6001 | }, | 6599 | }, |
| 6600 | "node_modules/source-map-support": { | ||
| 6601 | "version": "0.5.21", | ||
| 6602 | "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", | ||
| 6603 | "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", | ||
| 6604 | "license": "MIT", | ||
| 6605 | "dependencies": { | ||
| 6606 | "buffer-from": "^1.0.0", | ||
| 6607 | "source-map": "^0.6.0" | ||
| 6608 | } | ||
| 6609 | }, | ||
| 6002 | "node_modules/sprintf-js": { | 6610 | "node_modules/sprintf-js": { |
| 6003 | "version": "1.1.3", | 6611 | "version": "1.1.3", |
| 6004 | "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.3.tgz", | 6612 | "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.3.tgz", |
| @@ -6138,6 +6746,15 @@ | |||
| 6138 | "node": ">=8" | 6746 | "node": ">=8" |
| 6139 | } | 6747 | } |
| 6140 | }, | 6748 | }, |
| 6749 | "node_modules/tapable": { | ||
| 6750 | "version": "2.2.1", | ||
| 6751 | "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.1.tgz", | ||
| 6752 | "integrity": "sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==", | ||
| 6753 | "license": "MIT", | ||
| 6754 | "engines": { | ||
| 6755 | "node": ">=6" | ||
| 6756 | } | ||
| 6757 | }, | ||
| 6141 | "node_modules/tar-stream": { | 6758 | "node_modules/tar-stream": { |
| 6142 | "version": "3.1.7", | 6759 | "version": "3.1.7", |
| 6143 | "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-3.1.7.tgz", | 6760 | "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-3.1.7.tgz", |
| @@ -6148,6 +6765,76 @@ | |||
| 6148 | "streamx": "^2.15.0" | 6765 | "streamx": "^2.15.0" |
| 6149 | } | 6766 | } |
| 6150 | }, | 6767 | }, |
| 6768 | "node_modules/terser": { | ||
| 6769 | "version": "5.36.0", | ||
| 6770 | "resolved": "https://registry.npmjs.org/terser/-/terser-5.36.0.tgz", | ||
| 6771 | "integrity": "sha512-IYV9eNMuFAV4THUspIRXkLakHnV6XO7FEdtKjf/mDyrnqUg9LnlOn6/RwRvM9SZjR4GUq8Nk8zj67FzVARr74w==", | ||
| 6772 | "license": "BSD-2-Clause", | ||
| 6773 | "dependencies": { | ||
| 6774 | "@jridgewell/source-map": "^0.3.3", | ||
| 6775 | "acorn": "^8.8.2", | ||
| 6776 | "commander": "^2.20.0", | ||
| 6777 | "source-map-support": "~0.5.20" | ||
| 6778 | }, | ||
| 6779 | "bin": { | ||
| 6780 | "terser": "bin/terser" | ||
| 6781 | }, | ||
| 6782 | "engines": { | ||
| 6783 | "node": ">=10" | ||
| 6784 | } | ||
| 6785 | }, | ||
| 6786 | "node_modules/terser-webpack-plugin": { | ||
| 6787 | "version": "5.3.10", | ||
| 6788 | "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.3.10.tgz", | ||
| 6789 | "integrity": "sha512-BKFPWlPDndPs+NGGCr1U59t0XScL5317Y0UReNrHaw9/FwhPENlq6bfgs+4yPfyP51vqC1bQ4rp1EfXW5ZSH9w==", | ||
| 6790 | "license": "MIT", | ||
| 6791 | "dependencies": { | ||
| 6792 | "@jridgewell/trace-mapping": "^0.3.20", | ||
| 6793 | "jest-worker": "^27.4.5", | ||
| 6794 | "schema-utils": "^3.1.1", | ||
| 6795 | "serialize-javascript": "^6.0.1", | ||
| 6796 | "terser": "^5.26.0" | ||
| 6797 | }, | ||
| 6798 | "engines": { | ||
| 6799 | "node": ">= 10.13.0" | ||
| 6800 | }, | ||
| 6801 | "funding": { | ||
| 6802 | "type": "opencollective", | ||
| 6803 | "url": "https://opencollective.com/webpack" | ||
| 6804 | }, | ||
| 6805 | "peerDependencies": { | ||
| 6806 | "webpack": "^5.1.0" | ||
| 6807 | }, | ||
| 6808 | "peerDependenciesMeta": { | ||
| 6809 | "@swc/core": { | ||
| 6810 | "optional": true | ||
| 6811 | }, | ||
| 6812 | "esbuild": { | ||
| 6813 | "optional": true | ||
| 6814 | }, | ||
| 6815 | "uglify-js": { | ||
| 6816 | "optional": true | ||
| 6817 | } | ||
| 6818 | } | ||
| 6819 | }, | ||
| 6820 | "node_modules/terser-webpack-plugin/node_modules/schema-utils": { | ||
| 6821 | "version": "3.3.0", | ||
| 6822 | "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.3.0.tgz", | ||
| 6823 | "integrity": "sha512-pN/yOAvcC+5rQ5nERGuwrjLlYvLTbCibnZ1I7B1LaiAz9BRBlE9GMgE/eqV30P7aJQUf7Ddimy/RsbYO/GrVGg==", | ||
| 6824 | "license": "MIT", | ||
| 6825 | "dependencies": { | ||
| 6826 | "@types/json-schema": "^7.0.8", | ||
| 6827 | "ajv": "^6.12.5", | ||
| 6828 | "ajv-keywords": "^3.5.2" | ||
| 6829 | }, | ||
| 6830 | "engines": { | ||
| 6831 | "node": ">= 10.13.0" | ||
| 6832 | }, | ||
| 6833 | "funding": { | ||
| 6834 | "type": "opencollective", | ||
| 6835 | "url": "https://opencollective.com/webpack" | ||
| 6836 | } | ||
| 6837 | }, | ||
| 6151 | "node_modules/text-table": { | 6838 | "node_modules/text-table": { |
| 6152 | "version": "0.2.0", | 6839 | "version": "0.2.0", |
| 6153 | "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", | 6840 | "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", |
| @@ -6279,6 +6966,19 @@ | |||
| 6279 | "integrity": "sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==", | 6966 | "integrity": "sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==", |
| 6280 | "license": "MIT" | 6967 | "license": "MIT" |
| 6281 | }, | 6968 | }, |
| 6969 | "node_modules/uglify-js": { | ||
| 6970 | "version": "3.19.3", | ||
| 6971 | "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.19.3.tgz", | ||
| 6972 | "integrity": "sha512-v3Xu+yuwBXisp6QYTcH4UbH+xYJXqnq2m/LtQVWKWzYc1iehYnLixoQDN9FH6/j9/oybfd6W9Ghwkl8+UMKTKQ==", | ||
| 6973 | "license": "BSD-2-Clause", | ||
| 6974 | "optional": true, | ||
| 6975 | "bin": { | ||
| 6976 | "uglifyjs": "bin/uglifyjs" | ||
| 6977 | }, | ||
| 6978 | "engines": { | ||
| 6979 | "node": ">=0.8.0" | ||
| 6980 | } | ||
| 6981 | }, | ||
| 6282 | "node_modules/undici-types": { | 6982 | "node_modules/undici-types": { |
| 6283 | "version": "5.26.5", | 6983 | "version": "5.26.5", |
| 6284 | "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", | 6984 | "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", |
| @@ -6303,11 +7003,40 @@ | |||
| 6303 | "node": ">= 0.8" | 7003 | "node": ">= 0.8" |
| 6304 | } | 7004 | } |
| 6305 | }, | 7005 | }, |
| 7006 | "node_modules/update-browserslist-db": { | ||
| 7007 | "version": "1.1.1", | ||
| 7008 | "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.1.tgz", | ||
| 7009 | "integrity": "sha512-R8UzCaa9Az+38REPiJ1tXlImTJXlVfgHZsglwBD/k6nj76ctsH1E3q4doGrukiLQd3sGQYu56r5+lo5r94l29A==", | ||
| 7010 | "funding": [ | ||
| 7011 | { | ||
| 7012 | "type": "opencollective", | ||
| 7013 | "url": "https://opencollective.com/browserslist" | ||
| 7014 | }, | ||
| 7015 | { | ||
| 7016 | "type": "tidelift", | ||
| 7017 | "url": "https://tidelift.com/funding/github/npm/browserslist" | ||
| 7018 | }, | ||
| 7019 | { | ||
| 7020 | "type": "github", | ||
| 7021 | "url": "https://github.com/sponsors/ai" | ||
| 7022 | } | ||
| 7023 | ], | ||
| 7024 | "license": "MIT", | ||
| 7025 | "dependencies": { | ||
| 7026 | "escalade": "^3.2.0", | ||
| 7027 | "picocolors": "^1.1.0" | ||
| 7028 | }, | ||
| 7029 | "bin": { | ||
| 7030 | "update-browserslist-db": "cli.js" | ||
| 7031 | }, | ||
| 7032 | "peerDependencies": { | ||
| 7033 | "browserslist": ">= 4.21.0" | ||
| 7034 | } | ||
| 7035 | }, | ||
| 6306 | "node_modules/uri-js": { | 7036 | "node_modules/uri-js": { |
| 6307 | "version": "4.4.1", | 7037 | "version": "4.4.1", |
| 6308 | "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", | 7038 | "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", |
| 6309 | "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", | 7039 | "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", |
| 6310 | "dev": true, | ||
| 6311 | "license": "BSD-2-Clause", | 7040 | "license": "BSD-2-Clause", |
| 6312 | "dependencies": { | 7041 | "dependencies": { |
| 6313 | "punycode": "^2.1.0" | 7042 | "punycode": "^2.1.0" |
| @@ -6383,6 +7112,19 @@ | |||
| 6383 | "vectra": "bin/vectra.js" | 7112 | "vectra": "bin/vectra.js" |
| 6384 | } | 7113 | } |
| 6385 | }, | 7114 | }, |
| 7115 | "node_modules/watchpack": { | ||
| 7116 | "version": "2.4.2", | ||
| 7117 | "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.2.tgz", | ||
| 7118 | "integrity": "sha512-TnbFSbcOCcDgjZ4piURLCbJ3nJhznVh9kw6F6iokjiFPl8ONxe9A6nMDVXDiNbrSfLILs6vB07F7wLBrwPYzJw==", | ||
| 7119 | "license": "MIT", | ||
| 7120 | "dependencies": { | ||
| 7121 | "glob-to-regexp": "^0.4.1", | ||
| 7122 | "graceful-fs": "^4.1.2" | ||
| 7123 | }, | ||
| 7124 | "engines": { | ||
| 7125 | "node": ">=10.13.0" | ||
| 7126 | } | ||
| 7127 | }, | ||
| 6386 | "node_modules/wavefile": { | 7128 | "node_modules/wavefile": { |
| 6387 | "version": "11.0.0", | 7129 | "version": "11.0.0", |
| 6388 | "resolved": "https://registry.npmjs.org/wavefile/-/wavefile-11.0.0.tgz", | 7130 | "resolved": "https://registry.npmjs.org/wavefile/-/wavefile-11.0.0.tgz", |
| @@ -6413,6 +7155,101 @@ | |||
| 6413 | "node": ">=12" | 7155 | "node": ">=12" |
| 6414 | } | 7156 | } |
| 6415 | }, | 7157 | }, |
| 7158 | "node_modules/webpack": { | ||
| 7159 | "version": "5.95.0", | ||
| 7160 | "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.95.0.tgz", | ||
| 7161 | "integrity": "sha512-2t3XstrKULz41MNMBF+cJ97TyHdyQ8HCt//pqErqDvNjU9YQBnZxIHa11VXsi7F3mb5/aO2tuDxdeTPdU7xu9Q==", | ||
| 7162 | "license": "MIT", | ||
| 7163 | "dependencies": { | ||
| 7164 | "@types/estree": "^1.0.5", | ||
| 7165 | "@webassemblyjs/ast": "^1.12.1", | ||
| 7166 | "@webassemblyjs/wasm-edit": "^1.12.1", | ||
| 7167 | "@webassemblyjs/wasm-parser": "^1.12.1", | ||
| 7168 | "acorn": "^8.7.1", | ||
| 7169 | "acorn-import-attributes": "^1.9.5", | ||
| 7170 | "browserslist": "^4.21.10", | ||
| 7171 | "chrome-trace-event": "^1.0.2", | ||
| 7172 | "enhanced-resolve": "^5.17.1", | ||
| 7173 | "es-module-lexer": "^1.2.1", | ||
| 7174 | "eslint-scope": "5.1.1", | ||
| 7175 | "events": "^3.2.0", | ||
| 7176 | "glob-to-regexp": "^0.4.1", | ||
| 7177 | "graceful-fs": "^4.2.11", | ||
| 7178 | "json-parse-even-better-errors": "^2.3.1", | ||
| 7179 | "loader-runner": "^4.2.0", | ||
| 7180 | "mime-types": "^2.1.27", | ||
| 7181 | "neo-async": "^2.6.2", | ||
| 7182 | "schema-utils": "^3.2.0", | ||
| 7183 | "tapable": "^2.1.1", | ||
| 7184 | "terser-webpack-plugin": "^5.3.10", | ||
| 7185 | "watchpack": "^2.4.1", | ||
| 7186 | "webpack-sources": "^3.2.3" | ||
| 7187 | }, | ||
| 7188 | "bin": { | ||
| 7189 | "webpack": "bin/webpack.js" | ||
| 7190 | }, | ||
| 7191 | "engines": { | ||
| 7192 | "node": ">=10.13.0" | ||
| 7193 | }, | ||
| 7194 | "funding": { | ||
| 7195 | "type": "opencollective", | ||
| 7196 | "url": "https://opencollective.com/webpack" | ||
| 7197 | }, | ||
| 7198 | "peerDependenciesMeta": { | ||
| 7199 | "webpack-cli": { | ||
| 7200 | "optional": true | ||
| 7201 | } | ||
| 7202 | } | ||
| 7203 | }, | ||
| 7204 | "node_modules/webpack-sources": { | ||
| 7205 | "version": "3.2.3", | ||
| 7206 | "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.2.3.tgz", | ||
| 7207 | "integrity": "sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w==", | ||
| 7208 | "license": "MIT", | ||
| 7209 | "engines": { | ||
| 7210 | "node": ">=10.13.0" | ||
| 7211 | } | ||
| 7212 | }, | ||
| 7213 | "node_modules/webpack/node_modules/eslint-scope": { | ||
| 7214 | "version": "5.1.1", | ||
| 7215 | "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", | ||
| 7216 | "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", | ||
| 7217 | "license": "BSD-2-Clause", | ||
| 7218 | "dependencies": { | ||
| 7219 | "esrecurse": "^4.3.0", | ||
| 7220 | "estraverse": "^4.1.1" | ||
| 7221 | }, | ||
| 7222 | "engines": { | ||
| 7223 | "node": ">=8.0.0" | ||
| 7224 | } | ||
| 7225 | }, | ||
| 7226 | "node_modules/webpack/node_modules/estraverse": { | ||
| 7227 | "version": "4.3.0", | ||
| 7228 | "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", | ||
| 7229 | "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", | ||
| 7230 | "license": "BSD-2-Clause", | ||
| 7231 | "engines": { | ||
| 7232 | "node": ">=4.0" | ||
| 7233 | } | ||
| 7234 | }, | ||
| 7235 | "node_modules/webpack/node_modules/schema-utils": { | ||
| 7236 | "version": "3.3.0", | ||
| 7237 | "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.3.0.tgz", | ||
| 7238 | "integrity": "sha512-pN/yOAvcC+5rQ5nERGuwrjLlYvLTbCibnZ1I7B1LaiAz9BRBlE9GMgE/eqV30P7aJQUf7Ddimy/RsbYO/GrVGg==", | ||
| 7239 | "license": "MIT", | ||
| 7240 | "dependencies": { | ||
| 7241 | "@types/json-schema": "^7.0.8", | ||
| 7242 | "ajv": "^6.12.5", | ||
| 7243 | "ajv-keywords": "^3.5.2" | ||
| 7244 | }, | ||
| 7245 | "engines": { | ||
| 7246 | "node": ">= 10.13.0" | ||
| 7247 | }, | ||
| 7248 | "funding": { | ||
| 7249 | "type": "opencollective", | ||
| 7250 | "url": "https://opencollective.com/webpack" | ||
| 7251 | } | ||
| 7252 | }, | ||
| 6416 | "node_modules/whatwg-fetch": { | 7253 | "node_modules/whatwg-fetch": { |
| 6417 | "version": "3.6.20", | 7254 | "version": "3.6.20", |
| 6418 | "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-3.6.20.tgz", | 7255 | "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-3.6.20.tgz", |
| @@ -6447,6 +7284,12 @@ | |||
| 6447 | "node": ">= 8" | 7284 | "node": ">= 8" |
| 6448 | } | 7285 | } |
| 6449 | }, | 7286 | }, |
| 7287 | "node_modules/wordwrap": { | ||
| 7288 | "version": "1.0.0", | ||
| 7289 | "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", | ||
| 7290 | "integrity": "sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q==", | ||
| 7291 | "license": "MIT" | ||
| 7292 | }, | ||
| 6450 | "node_modules/wrap-ansi": { | 7293 | "node_modules/wrap-ansi": { |
| 6451 | "version": "7.0.0", | 7294 | "version": "7.0.0", |
| 6452 | "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", | 7295 | "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", |
| @@ -1,29 +1,43 @@ | |||
| 1 | { | 1 | { |
| 2 | "dependencies": { | 2 | "dependencies": { |
| 3 | "@adobe/css-tools": "^4.4.0", | ||
| 3 | "@agnai/sentencepiece-js": "^1.1.1", | 4 | "@agnai/sentencepiece-js": "^1.1.1", |
| 4 | "@agnai/web-tokenizers": "^0.1.3", | 5 | "@agnai/web-tokenizers": "^0.1.3", |
| 6 | "@iconfu/svg-inject": "^1.2.3", | ||
| 7 | "@mozilla/readability": "^0.5.0", | ||
| 8 | "@popperjs/core": "^2.11.8", | ||
| 5 | "@zeldafan0225/ai_horde": "^5.1.0", | 9 | "@zeldafan0225/ai_horde": "^5.1.0", |
| 6 | "archiver": "^7.0.1", | 10 | "archiver": "^7.0.1", |
| 7 | "bing-translate-api": "^2.9.1", | 11 | "bing-translate-api": "^2.9.1", |
| 8 | "body-parser": "^1.20.2", | 12 | "body-parser": "^1.20.2", |
| 13 | "bowser": "^2.11.0", | ||
| 9 | "command-exists": "^1.2.9", | 14 | "command-exists": "^1.2.9", |
| 10 | "compression": "^1", | 15 | "compression": "^1", |
| 11 | "cookie-parser": "^1.4.6", | 16 | "cookie-parser": "^1.4.6", |
| 12 | "cookie-session": "^2.1.0", | 17 | "cookie-session": "^2.1.0", |
| 13 | "cors": "^2.8.5", | 18 | "cors": "^2.8.5", |
| 14 | "csrf-csrf": "^2.2.3", | 19 | "csrf-csrf": "^2.2.3", |
| 20 | "diff-match-patch": "^1.0.5", | ||
| 21 | "dompurify": "^3.1.7", | ||
| 22 | "droll": "^0.2.1", | ||
| 15 | "express": "^4.21.0", | 23 | "express": "^4.21.0", |
| 16 | "form-data": "^4.0.0", | 24 | "form-data": "^4.0.0", |
| 25 | "fuse.js": "^7.0.0", | ||
| 17 | "google-translate-api-browser": "^3.0.1", | 26 | "google-translate-api-browser": "^3.0.1", |
| 18 | "google-translate-api-x": "^10.7.1", | 27 | "google-translate-api-x": "^10.7.1", |
| 28 | "handlebars": "^4.7.8", | ||
| 19 | "helmet": "^7.1.0", | 29 | "helmet": "^7.1.0", |
| 30 | "highlight.js": "^11.10.0", | ||
| 20 | "html-entities": "^2.5.2", | 31 | "html-entities": "^2.5.2", |
| 21 | "iconv-lite": "^0.6.3", | 32 | "iconv-lite": "^0.6.3", |
| 22 | "ip-matching": "^2.1.2", | 33 | "ip-matching": "^2.1.2", |
| 23 | "ipaddr.js": "^2.0.1", | 34 | "ipaddr.js": "^2.0.1", |
| 24 | "jimp": "^0.22.10", | 35 | "jimp": "^0.22.10", |
| 36 | "localforage": "^1.10.0", | ||
| 25 | "lodash": "^4.17.21", | 37 | "lodash": "^4.17.21", |
| 26 | "mime-types": "^2.1.35", | 38 | "mime-types": "^2.1.35", |
| 39 | "moment": "^2.30.1", | ||
| 40 | "morphdom": "^2.7.4", | ||
| 27 | "multer": "^1.4.5-lts.1", | 41 | "multer": "^1.4.5-lts.1", |
| 28 | "node-fetch": "^3.3.2", | 42 | "node-fetch": "^3.3.2", |
| 29 | "node-persist": "^4.0.1", | 43 | "node-persist": "^4.0.1", |
| @@ -35,11 +49,14 @@ | |||
| 35 | "rate-limiter-flexible": "^5.0.0", | 49 | "rate-limiter-flexible": "^5.0.0", |
| 36 | "response-time": "^2.3.2", | 50 | "response-time": "^2.3.2", |
| 37 | "sanitize-filename": "^1.6.3", | 51 | "sanitize-filename": "^1.6.3", |
| 52 | "seedrandom": "^3.0.5", | ||
| 53 | "showdown": "^2.1.0", | ||
| 38 | "sillytavern-transformers": "2.14.6", | 54 | "sillytavern-transformers": "2.14.6", |
| 39 | "simple-git": "^3.19.1", | 55 | "simple-git": "^3.19.1", |
| 40 | "tiktoken": "^1.0.16", | 56 | "tiktoken": "^1.0.16", |
| 41 | "vectra": "^0.2.2", | 57 | "vectra": "^0.2.2", |
| 42 | "wavefile": "^11.0.0", | 58 | "wavefile": "^11.0.0", |
| 59 | "webpack": "^5.95.0", | ||
| 43 | "write-file-atomic": "^5.0.1", | 60 | "write-file-atomic": "^5.0.1", |
| 44 | "ws": "^8.17.1", | 61 | "ws": "^8.17.1", |
| 45 | "yaml": "^2.3.4", | 62 | "yaml": "^2.3.4", |
| @@ -67,9 +84,11 @@ | |||
| 67 | "type": "git", | 84 | "type": "git", |
| 68 | "url": "https://github.com/SillyTavern/SillyTavern.git" | 85 | "url": "https://github.com/SillyTavern/SillyTavern.git" |
| 69 | }, | 86 | }, |
| 70 | "version": "1.12.7", | 87 | "version": "1.12.8", |
| 71 | "scripts": { | 88 | "scripts": { |
| 72 | "start": "node server.js", | 89 | "start": "node server.js", |
| 90 | "start:deno": "deno run --allow-run --allow-net --allow-read --allow-write --allow-sys --allow-env server.js", | ||
| 91 | "start:bun": "bun server.js", | ||
| 73 | "start:no-csrf": "node server.js --disableCsrf", | 92 | "start:no-csrf": "node server.js --disableCsrf", |
| 74 | "postinstall": "node post-install.js", | 93 | "postinstall": "node post-install.js", |
| 75 | "lint": "eslint \"src/**/*.js\" \"public/**/*.js\" ./*.js", | 94 | "lint": "eslint \"src/**/*.js\" \"public/**/*.js\" ./*.js", |
| @@ -92,7 +111,7 @@ | |||
| 92 | "@types/cookie-parser": "^1.4.7", | 111 | "@types/cookie-parser": "^1.4.7", |
| 93 | "@types/cookie-session": "^2.0.49", | 112 | "@types/cookie-session": "^2.0.49", |
| 94 | "@types/cors": "^2.8.17", | 113 | "@types/cors": "^2.8.17", |
| 95 | "@types/dompurify": "^3.0.5", | 114 | "@types/deno": "^2.0.0", |
| 96 | "@types/express": "^4.17.21", | 115 | "@types/express": "^4.17.21", |
| 97 | "@types/jquery": "^3.5.29", | 116 | "@types/jquery": "^3.5.29", |
| 98 | "@types/lodash": "^4.17.10", | 117 | "@types/lodash": "^4.17.10", |
| @@ -42,3 +42,9 @@ body.login .userSelect .userHandle { | |||
| 42 | body.login .userSelect:hover { | 42 | body.login .userSelect:hover { |
| 43 | background-color: var(--black30a); | 43 | background-color: var(--black30a); |
| 44 | } | 44 | } |
| 45 | |||
| 46 | body.login #handleEntryBlock, | ||
| 47 | body.login #passwordEntryBlock, | ||
| 48 | body.login #passwordRecoveryBlock { | ||
| 49 | margin: 2px; | ||
| 50 | } | ||
| @@ -72,6 +72,14 @@ | |||
| 72 | opacity: 0.5; | 72 | opacity: 0.5; |
| 73 | } | 73 | } |
| 74 | 74 | ||
| 75 | .logprobs_output_prefix:hover { | ||
| 76 | background-color: rgba(255, 0, 50, 0.4); | ||
| 77 | } | ||
| 78 | |||
| 79 | .logprobs_output_prefix:hover ~ .logprobs_output_prefix { | ||
| 80 | background-color: rgba(255, 0, 50, 0.4); | ||
| 81 | } | ||
| 82 | |||
| 75 | .logprobs_candidate_list { | 83 | .logprobs_candidate_list { |
| 76 | grid-row-start: 3; | 84 | grid-row-start: 3; |
| 77 | grid-row-end: 4; | 85 | grid-row-end: 4; |
| @@ -333,7 +333,7 @@ | |||
| 333 | } | 333 | } |
| 334 | 334 | ||
| 335 | .completion_prompt_manager_popup_entry_form_control:has(#completion_prompt_manager_popup_entry_form_prompt:disabled)>div:first-child::after { | 335 | .completion_prompt_manager_popup_entry_form_control:has(#completion_prompt_manager_popup_entry_form_prompt:disabled)>div:first-child::after { |
| 336 | content: 'The content of this prompt is pulled from elsewhere and cannot be edited here.'; | 336 | content: attr(external_piece_text); |
| 337 | display: block; | 337 | display: block; |
| 338 | width: 100%; | 338 | width: 100%; |
| 339 | font-weight: 600; | 339 | font-weight: 600; |
| @@ -0,0 +1,19 @@ | |||
| 1 | .scrollable-buttons-container { | ||
| 2 | max-height: 50vh; /* Use viewport height instead of fixed pixels */ | ||
| 3 | overflow-y: auto; | ||
| 4 | -webkit-overflow-scrolling: touch; /* Momentum scrolling on iOS */ | ||
| 5 | margin-top: 1rem; /* m-t-1 is equivalent to margin-top: 1rem; */ | ||
| 6 | flex-shrink: 1; | ||
| 7 | min-height: 0; | ||
| 8 | scrollbar-width: thin; | ||
| 9 | scrollbar-color: rgba(255, 255, 255, 0.3) transparent; | ||
| 10 | } | ||
| 11 | |||
| 12 | .scrollable-buttons-container::-webkit-scrollbar { | ||
| 13 | width: 6px; | ||
| 14 | } | ||
| 15 | |||
| 16 | .scrollable-buttons-container::-webkit-scrollbar-thumb { | ||
| 17 | background-color: rgba(255, 255, 255, 0.3); | ||
| 18 | border-radius: 3px; | ||
| 19 | } | ||
| @@ -479,11 +479,6 @@ | |||
| 479 | line-height: 1.2; | 479 | line-height: 1.2; |
| 480 | } | 480 | } |
| 481 | 481 | ||
| 482 | .custom-katex-html, | ||
| 483 | .katex-html { | ||
| 484 | display: none; | ||
| 485 | } | ||
| 486 | |||
| 487 | .hoverglow { | 482 | .hoverglow { |
| 488 | transition: opacity 200ms; | 483 | transition: opacity 200ms; |
| 489 | } | 484 | } |
| @@ -474,6 +474,8 @@ label[for="trim_spaces"]:has(input:checked) i.warning { | |||
| 474 | 474 | ||
| 475 | #claude_function_prefill_warning { | 475 | #claude_function_prefill_warning { |
| 476 | display: none; | 476 | display: none; |
| 477 | color: red; | ||
| 478 | font-weight: bold; | ||
| 477 | } | 479 | } |
| 478 | 480 | ||
| 479 | #openai_settings:has(#openai_function_calling:checked):has(#claude_assistant_prefill:not(:placeholder-shown), #claude_assistant_impersonation:not(:placeholder-shown)) #claude_function_prefill_warning { | 481 | #openai_settings:has(#openai_function_calling:checked):has(#claude_assistant_prefill:not(:placeholder-shown), #claude_assistant_impersonation:not(:placeholder-shown)) #claude_function_prefill_warning { |
| @@ -1,23 +1,17 @@ | |||
| 1 | import libs from './lib'; | ||
| 2 | |||
| 1 | // Global namespace modules | 3 | // Global namespace modules |
| 2 | declare var droll; | 4 | declare var ai; |
| 3 | declare var Handlebars; | ||
| 4 | declare var hljs; | ||
| 5 | declare var localforage; | ||
| 6 | declare var pdfjsLib; | 5 | declare var pdfjsLib; |
| 7 | declare var Popper; | ||
| 8 | declare var showdown; | ||
| 9 | declare var showdownKatex; | ||
| 10 | declare var SVGInject; | ||
| 11 | declare var Readability; | ||
| 12 | declare var isProbablyReaderable; | ||
| 13 | declare var ePub; | 6 | declare var ePub; |
| 14 | declare var ai; | ||
| 15 | 7 | ||
| 16 | declare var SillyTavern: { | 8 | declare var SillyTavern: { |
| 17 | getContext(): any; | 9 | getContext(): any; |
| 18 | llm: any; | 10 | llm: any; |
| 11 | libs: typeof libs; | ||
| 19 | }; | 12 | }; |
| 20 | 13 | ||
| 14 | declare global { | ||
| 21 | // Jquery plugins | 15 | // Jquery plugins |
| 22 | interface JQuery { | 16 | interface JQuery { |
| 23 | nanogallery2(options?: any): JQuery; | 17 | nanogallery2(options?: any): JQuery; |
| @@ -116,161 +110,8 @@ interface JQuery { | |||
| 116 | 110 | ||
| 117 | //#endregion | 111 | //#endregion |
| 118 | } | 112 | } |
| 119 | |||
| 120 | //#region Fuse | ||
| 121 | |||
| 122 | /** | ||
| 123 | * Fuse.js provides fast and flexible fuzzy searching | ||
| 124 | * @constructor | ||
| 125 | * @param list - The list of items to search through | ||
| 126 | * @param options - Configuration options for the search algorithm | ||
| 127 | */ | ||
| 128 | declare var Fuse: { | ||
| 129 | new(list: any[], options?: FuseOptions): FuseInstance; | ||
| 130 | }; | ||
| 131 | |||
| 132 | /** Instead of providing a (nested) key as a string, an object can be defined that can specify weight and a custom get function */ | ||
| 133 | interface FuseKey { | ||
| 134 | /** | ||
| 135 | * The name of they key. Supports nested paths. | ||
| 136 | */ | ||
| 137 | name: string; | ||
| 138 | /** | ||
| 139 | * You can allocate a weight to keys to give them higher (or lower) values in search results. The weight value has to be greater than 0. When a weight isn't provided, it will default to 1. | ||
| 140 | * @default 1 | ||
| 141 | */ | ||
| 142 | weight?: number; | ||
| 143 | /** | ||
| 144 | * Function to retrieve an object's value at the specified path. The default searches nested paths. | ||
| 145 | * @default (obj: T, path: string | string[]) => string | string[] | ||
| 146 | */ | ||
| 147 | getFn?: (any) => string; | ||
| 148 | } | 113 | } |
| 149 | 114 | ||
| 150 | /** Configuration options for the Fuse search algorithm */ | ||
| 151 | interface FuseOptions { | ||
| 152 | /** | ||
| 153 | * List of keys that will be searched. Supports nested paths, weighted search, and searching in arrays of strings and objects. | ||
| 154 | * @default [] | ||
| 155 | */ | ||
| 156 | keys?: string[] | FuseKey[]; | ||
| 157 | |||
| 158 | /** | ||
| 159 | * How much distance one character can be from another to be considered a match. | ||
| 160 | * @default 100 | ||
| 161 | */ | ||
| 162 | distance?: number; | ||
| 163 | |||
| 164 | /** | ||
| 165 | * At what point the match algorithm gives up. A threshold of 0.0 requires a perfect match, while 1.0 matches everything. | ||
| 166 | * @default 0.6 | ||
| 167 | */ | ||
| 168 | threshold?: number; | ||
| 169 | |||
| 170 | /** | ||
| 171 | * Whether the score should be included in the result set. A score of 0 indicates a perfect match, while a score of 1 indicates a complete mismatch. | ||
| 172 | * @default false | ||
| 173 | */ | ||
| 174 | includeScore?: boolean; | ||
| 175 | |||
| 176 | /** | ||
| 177 | * Indicates whether comparisons should be case-sensitive. | ||
| 178 | * @default false | ||
| 179 | */ | ||
| 180 | isCaseSensitive?: boolean; | ||
| 181 | |||
| 182 | /** | ||
| 183 | * Whether the matches should be included in the result set. When true, each record in the result set will include the indices of matched characters. | ||
| 184 | * @default false | ||
| 185 | */ | ||
| 186 | includeMatches?: boolean; | ||
| 187 | |||
| 188 | /** | ||
| 189 | * Only matches whose length exceeds this value will be returned. | ||
| 190 | * @default 1 | ||
| 191 | */ | ||
| 192 | minMatchCharLength?: number; | ||
| 193 | |||
| 194 | /** | ||
| 195 | * Whether to sort the result list by score. | ||
| 196 | * @default true | ||
| 197 | */ | ||
| 198 | shouldSort?: boolean; | ||
| 199 | |||
| 200 | /** | ||
| 201 | * When true, the matching function will continue to the end of a search pattern even if a perfect match has already been found. | ||
| 202 | * @default false | ||
| 203 | */ | ||
| 204 | findAllMatches?: boolean; | ||
| 205 | |||
| 206 | /** | ||
| 207 | * Determines approximately where in the text the pattern is expected to be found. | ||
| 208 | * @default 0 | ||
| 209 | */ | ||
| 210 | location?: number; | ||
| 211 | |||
| 212 | /** | ||
| 213 | * When true, search will ignore location and distance, so it won't matter where in the string the pattern appears. | ||
| 214 | * @default false | ||
| 215 | */ | ||
| 216 | ignoreLocation?: boolean; | ||
| 217 | |||
| 218 | /** | ||
| 219 | * When true, it enables the use of Unix-like search commands. | ||
| 220 | * @default false | ||
| 221 | */ | ||
| 222 | useExtendedSearch?: boolean; | ||
| 223 | |||
| 224 | /** | ||
| 225 | * Function to retrieve an object's value at the specified path. The default searches nested paths. | ||
| 226 | * @default (obj: T, path: string | string[]) => string | string[] | ||
| 227 | */ | ||
| 228 | getFn?: (obj: any, path: string | string[]) => string | string[]; | ||
| 229 | |||
| 230 | /** | ||
| 231 | * Function to sort the results. The default sorts by ascending relevance score. | ||
| 232 | * @default (a, b) => number | ||
| 233 | */ | ||
| 234 | sortFn?: (a: any, b: any) => number; | ||
| 235 | |||
| 236 | /** | ||
| 237 | * When true, the calculation for the relevance score will ignore the field-length norm. | ||
| 238 | * @default false | ||
| 239 | */ | ||
| 240 | ignoreFieldNorm?: boolean; | ||
| 241 | |||
| 242 | /** | ||
| 243 | * Determines how much the field-length norm affects scoring. 0 is equivalent to ignoring the field-length norm, while higher values increase the effect. | ||
| 244 | * @default 1 | ||
| 245 | */ | ||
| 246 | fieldNormWeight?: number; | ||
| 247 | } | ||
| 248 | |||
| 249 | |||
| 250 | /** Represents an individual Fuse search result */ | ||
| 251 | interface FuseResult { | ||
| 252 | /** The original item that was matched */ | ||
| 253 | item: any; | ||
| 254 | /** The index of the item from the original input collection that was searched */ | ||
| 255 | refIndex: number; | ||
| 256 | /** The search score, where 0 is a perfect match and 1 is the worst */ | ||
| 257 | score?: number; | ||
| 258 | /** Optional list of matched search keys */ | ||
| 259 | matches?: Array<{ key: string; indices: [number, number][] }>; | ||
| 260 | } | ||
| 261 | |||
| 262 | /** Represents a Fuse instance, used for performing searches */ | ||
| 263 | interface FuseInstance { | ||
| 264 | /** | ||
| 265 | * Searches through the list using the specified query. | ||
| 266 | * @param query - The search term or phrase to use | ||
| 267 | * @returns An array of search results matching the query | ||
| 268 | */ | ||
| 269 | search(query: string): FuseResult[]; | ||
| 270 | } | ||
| 271 | |||
| 272 | //#endregion | ||
| 273 | |||
| 274 | //#region select2 | 115 | //#region select2 |
| 275 | 116 | ||
| 276 | /** Options for configuring a select2 instance */ | 117 | /** Options for configuring a select2 instance */ |
| @@ -575,792 +416,3 @@ interface SortableUI { | |||
| 575 | } | 416 | } |
| 576 | 417 | ||
| 577 | //#endregion | 418 | //#endregion |
| 578 | |||
| 579 | // MIT Licence. Copied from: | ||
| 580 | // https://github.com/moment/moment/blob/develop/ts3.1-typings/moment.d.ts | ||
| 581 | /** | ||
| 582 | * @param strict Strict parsing disables the deprecated fallback to the native Date constructor when | ||
| 583 | * parsing a string. | ||
| 584 | */ | ||
| 585 | declare function moment(inp?: moment.MomentInput, strict?: boolean): moment.Moment; | ||
| 586 | /** | ||
| 587 | * @param strict Strict parsing requires that the format and input match exactly, including delimiters. | ||
| 588 | * Strict parsing is frequently the best parsing option. For more information about choosing strict vs | ||
| 589 | * forgiving parsing, see the [parsing guide](https://momentjs.com/guides/#/parsing/). | ||
| 590 | */ | ||
| 591 | declare function moment(inp?: moment.MomentInput, format?: moment.MomentFormatSpecification, strict?: boolean): moment.Moment; | ||
| 592 | /** | ||
| 593 | * @param strict Strict parsing requires that the format and input match exactly, including delimiters. | ||
| 594 | * Strict parsing is frequently the best parsing option. For more information about choosing strict vs | ||
| 595 | * forgiving parsing, see the [parsing guide](https://momentjs.com/guides/#/parsing/). | ||
| 596 | */ | ||
| 597 | declare function moment(inp?: moment.MomentInput, format?: moment.MomentFormatSpecification, language?: string, strict?: boolean): moment.Moment; | ||
| 598 | |||
| 599 | declare namespace moment { | ||
| 600 | type RelativeTimeKey = 's' | 'ss' | 'm' | 'mm' | 'h' | 'hh' | 'd' | 'dd' | 'w' | 'ww' | 'M' | 'MM' | 'y' | 'yy'; | ||
| 601 | type CalendarKey = 'sameDay' | 'nextDay' | 'lastDay' | 'nextWeek' | 'lastWeek' | 'sameElse' | string; | ||
| 602 | type LongDateFormatKey = 'LTS' | 'LT' | 'L' | 'LL' | 'LLL' | 'LLLL' | 'lts' | 'lt' | 'l' | 'll' | 'lll' | 'llll'; | ||
| 603 | |||
| 604 | interface Locale { | ||
| 605 | calendar(key?: CalendarKey, m?: Moment, now?: Moment): string; | ||
| 606 | |||
| 607 | longDateFormat(key: LongDateFormatKey): string; | ||
| 608 | invalidDate(): string; | ||
| 609 | ordinal(n: number): string; | ||
| 610 | |||
| 611 | preparse(inp: string): string; | ||
| 612 | postformat(inp: string): string; | ||
| 613 | relativeTime(n: number, withoutSuffix: boolean, | ||
| 614 | key: RelativeTimeKey, isFuture: boolean): string; | ||
| 615 | pastFuture(diff: number, absRelTime: string): string; | ||
| 616 | set(config: Object): void; | ||
| 617 | |||
| 618 | months(): string[]; | ||
| 619 | months(m: Moment, format?: string): string; | ||
| 620 | monthsShort(): string[]; | ||
| 621 | monthsShort(m: Moment, format?: string): string; | ||
| 622 | monthsParse(monthName: string, format: string, strict: boolean): number; | ||
| 623 | monthsRegex(strict: boolean): RegExp; | ||
| 624 | monthsShortRegex(strict: boolean): RegExp; | ||
| 625 | |||
| 626 | week(m: Moment): number; | ||
| 627 | firstDayOfYear(): number; | ||
| 628 | firstDayOfWeek(): number; | ||
| 629 | |||
| 630 | weekdays(): string[]; | ||
| 631 | weekdays(m: Moment, format?: string): string; | ||
| 632 | weekdaysMin(): string[]; | ||
| 633 | weekdaysMin(m: Moment): string; | ||
| 634 | weekdaysShort(): string[]; | ||
| 635 | weekdaysShort(m: Moment): string; | ||
| 636 | weekdaysParse(weekdayName: string, format: string, strict: boolean): number; | ||
| 637 | weekdaysRegex(strict: boolean): RegExp; | ||
| 638 | weekdaysShortRegex(strict: boolean): RegExp; | ||
| 639 | weekdaysMinRegex(strict: boolean): RegExp; | ||
| 640 | |||
| 641 | isPM(input: string): boolean; | ||
| 642 | meridiem(hour: number, minute: number, isLower: boolean): string; | ||
| 643 | } | ||
| 644 | |||
| 645 | interface StandaloneFormatSpec { | ||
| 646 | format: string[]; | ||
| 647 | standalone: string[]; | ||
| 648 | isFormat?: RegExp; | ||
| 649 | } | ||
| 650 | |||
| 651 | interface WeekSpec { | ||
| 652 | dow: number; | ||
| 653 | doy?: number; | ||
| 654 | } | ||
| 655 | |||
| 656 | type CalendarSpecVal = string | ((m?: MomentInput, now?: Moment) => string); | ||
| 657 | interface CalendarSpec { | ||
| 658 | sameDay?: CalendarSpecVal; | ||
| 659 | nextDay?: CalendarSpecVal; | ||
| 660 | lastDay?: CalendarSpecVal; | ||
| 661 | nextWeek?: CalendarSpecVal; | ||
| 662 | lastWeek?: CalendarSpecVal; | ||
| 663 | sameElse?: CalendarSpecVal; | ||
| 664 | |||
| 665 | // any additional properties might be used with moment.calendarFormat | ||
| 666 | [x: string]: CalendarSpecVal | undefined; | ||
| 667 | } | ||
| 668 | |||
| 669 | type RelativeTimeSpecVal = ( | ||
| 670 | string | | ||
| 671 | ((n: number, withoutSuffix: boolean, | ||
| 672 | key: RelativeTimeKey, isFuture: boolean) => string) | ||
| 673 | ); | ||
| 674 | type RelativeTimeFuturePastVal = string | ((relTime: string) => string); | ||
| 675 | |||
| 676 | interface RelativeTimeSpec { | ||
| 677 | future?: RelativeTimeFuturePastVal; | ||
| 678 | past?: RelativeTimeFuturePastVal; | ||
| 679 | s?: RelativeTimeSpecVal; | ||
| 680 | ss?: RelativeTimeSpecVal; | ||
| 681 | m?: RelativeTimeSpecVal; | ||
| 682 | mm?: RelativeTimeSpecVal; | ||
| 683 | h?: RelativeTimeSpecVal; | ||
| 684 | hh?: RelativeTimeSpecVal; | ||
| 685 | d?: RelativeTimeSpecVal; | ||
| 686 | dd?: RelativeTimeSpecVal; | ||
| 687 | w?: RelativeTimeSpecVal; | ||
| 688 | ww?: RelativeTimeSpecVal; | ||
| 689 | M?: RelativeTimeSpecVal; | ||
| 690 | MM?: RelativeTimeSpecVal; | ||
| 691 | y?: RelativeTimeSpecVal; | ||
| 692 | yy?: RelativeTimeSpecVal; | ||
| 693 | } | ||
| 694 | |||
| 695 | interface LongDateFormatSpec { | ||
| 696 | LTS: string; | ||
| 697 | LT: string; | ||
| 698 | L: string; | ||
| 699 | LL: string; | ||
| 700 | LLL: string; | ||
| 701 | LLLL: string; | ||
| 702 | |||
| 703 | // lets forget for a sec that any upper/lower permutation will also work | ||
| 704 | lts?: string; | ||
| 705 | lt?: string; | ||
| 706 | l?: string; | ||
| 707 | ll?: string; | ||
| 708 | lll?: string; | ||
| 709 | llll?: string; | ||
| 710 | } | ||
| 711 | |||
| 712 | type MonthWeekdayFn = (momentToFormat: Moment, format?: string) => string; | ||
| 713 | type WeekdaySimpleFn = (momentToFormat: Moment) => string; | ||
| 714 | |||
| 715 | interface LocaleSpecification { | ||
| 716 | months?: string[] | StandaloneFormatSpec | MonthWeekdayFn; | ||
| 717 | monthsShort?: string[] | StandaloneFormatSpec | MonthWeekdayFn; | ||
| 718 | |||
| 719 | weekdays?: string[] | StandaloneFormatSpec | MonthWeekdayFn; | ||
| 720 | weekdaysShort?: string[] | StandaloneFormatSpec | WeekdaySimpleFn; | ||
| 721 | weekdaysMin?: string[] | StandaloneFormatSpec | WeekdaySimpleFn; | ||
| 722 | |||
| 723 | meridiemParse?: RegExp; | ||
| 724 | meridiem?: (hour: number, minute:number, isLower: boolean) => string; | ||
| 725 | |||
| 726 | isPM?: (input: string) => boolean; | ||
| 727 | |||
| 728 | longDateFormat?: LongDateFormatSpec; | ||
| 729 | calendar?: CalendarSpec; | ||
| 730 | relativeTime?: RelativeTimeSpec; | ||
| 731 | invalidDate?: string; | ||
| 732 | ordinal?: (n: number) => string; | ||
| 733 | ordinalParse?: RegExp; | ||
| 734 | |||
| 735 | week?: WeekSpec; | ||
| 736 | |||
| 737 | // Allow anything: in general any property that is passed as locale spec is | ||
| 738 | // put in the locale object so it can be used by locale functions | ||
| 739 | [x: string]: any; | ||
| 740 | } | ||
| 741 | |||
| 742 | interface MomentObjectOutput { | ||
| 743 | years: number; | ||
| 744 | /* One digit */ | ||
| 745 | months: number; | ||
| 746 | /* Day of the month */ | ||
| 747 | date: number; | ||
| 748 | hours: number; | ||
| 749 | minutes: number; | ||
| 750 | seconds: number; | ||
| 751 | milliseconds: number; | ||
| 752 | } | ||
| 753 | interface argThresholdOpts { | ||
| 754 | ss?: number; | ||
| 755 | s?: number; | ||
| 756 | m?: number; | ||
| 757 | h?: number; | ||
| 758 | d?: number; | ||
| 759 | w?: number | null; | ||
| 760 | M?: number; | ||
| 761 | } | ||
| 762 | |||
| 763 | interface Duration { | ||
| 764 | clone(): Duration; | ||
| 765 | |||
| 766 | humanize(argWithSuffix?: boolean, argThresholds?: argThresholdOpts): string; | ||
| 767 | |||
| 768 | humanize(argThresholds?: argThresholdOpts): string; | ||
| 769 | |||
| 770 | abs(): Duration; | ||
| 771 | |||
| 772 | as(units: unitOfTime.Base): number; | ||
| 773 | get(units: unitOfTime.Base): number; | ||
| 774 | |||
| 775 | milliseconds(): number; | ||
| 776 | asMilliseconds(): number; | ||
| 777 | |||
| 778 | seconds(): number; | ||
| 779 | asSeconds(): number; | ||
| 780 | |||
| 781 | minutes(): number; | ||
| 782 | asMinutes(): number; | ||
| 783 | |||
| 784 | hours(): number; | ||
| 785 | asHours(): number; | ||
| 786 | |||
| 787 | days(): number; | ||
| 788 | asDays(): number; | ||
| 789 | |||
| 790 | weeks(): number; | ||
| 791 | asWeeks(): number; | ||
| 792 | |||
| 793 | months(): number; | ||
| 794 | asMonths(): number; | ||
| 795 | |||
| 796 | years(): number; | ||
| 797 | asYears(): number; | ||
| 798 | |||
| 799 | add(inp?: DurationInputArg1, unit?: DurationInputArg2): Duration; | ||
| 800 | subtract(inp?: DurationInputArg1, unit?: DurationInputArg2): Duration; | ||
| 801 | |||
| 802 | locale(): string; | ||
| 803 | locale(locale: LocaleSpecifier): Duration; | ||
| 804 | localeData(): Locale; | ||
| 805 | |||
| 806 | toISOString(): string; | ||
| 807 | toJSON(): string; | ||
| 808 | |||
| 809 | isValid(): boolean; | ||
| 810 | |||
| 811 | /** | ||
| 812 | * @deprecated since version 2.8.0 | ||
| 813 | */ | ||
| 814 | lang(locale: LocaleSpecifier): Moment; | ||
| 815 | /** | ||
| 816 | * @deprecated since version 2.8.0 | ||
| 817 | */ | ||
| 818 | lang(): Locale; | ||
| 819 | /** | ||
| 820 | * @deprecated | ||
| 821 | */ | ||
| 822 | toIsoString(): string; | ||
| 823 | } | ||
| 824 | |||
| 825 | interface MomentRelativeTime { | ||
| 826 | future: any; | ||
| 827 | past: any; | ||
| 828 | s: any; | ||
| 829 | ss: any; | ||
| 830 | m: any; | ||
| 831 | mm: any; | ||
| 832 | h: any; | ||
| 833 | hh: any; | ||
| 834 | d: any; | ||
| 835 | dd: any; | ||
| 836 | M: any; | ||
| 837 | MM: any; | ||
| 838 | y: any; | ||
| 839 | yy: any; | ||
| 840 | } | ||
| 841 | |||
| 842 | interface MomentLongDateFormat { | ||
| 843 | L: string; | ||
| 844 | LL: string; | ||
| 845 | LLL: string; | ||
| 846 | LLLL: string; | ||
| 847 | LT: string; | ||
| 848 | LTS: string; | ||
| 849 | |||
| 850 | l?: string; | ||
| 851 | ll?: string; | ||
| 852 | lll?: string; | ||
| 853 | llll?: string; | ||
| 854 | lt?: string; | ||
| 855 | lts?: string; | ||
| 856 | } | ||
| 857 | |||
| 858 | interface MomentParsingFlags { | ||
| 859 | empty: boolean; | ||
| 860 | unusedTokens: string[]; | ||
| 861 | unusedInput: string[]; | ||
| 862 | overflow: number; | ||
| 863 | charsLeftOver: number; | ||
| 864 | nullInput: boolean; | ||
| 865 | invalidMonth: string | null; | ||
| 866 | invalidFormat: boolean; | ||
| 867 | userInvalidated: boolean; | ||
| 868 | iso: boolean; | ||
| 869 | parsedDateParts: any[]; | ||
| 870 | meridiem: string | null; | ||
| 871 | } | ||
| 872 | |||
| 873 | interface MomentParsingFlagsOpt { | ||
| 874 | empty?: boolean; | ||
| 875 | unusedTokens?: string[]; | ||
| 876 | unusedInput?: string[]; | ||
| 877 | overflow?: number; | ||
| 878 | charsLeftOver?: number; | ||
| 879 | nullInput?: boolean; | ||
| 880 | invalidMonth?: string; | ||
| 881 | invalidFormat?: boolean; | ||
| 882 | userInvalidated?: boolean; | ||
| 883 | iso?: boolean; | ||
| 884 | parsedDateParts?: any[]; | ||
| 885 | meridiem?: string | null; | ||
| 886 | } | ||
| 887 | |||
| 888 | interface MomentBuiltinFormat { | ||
| 889 | __momentBuiltinFormatBrand: any; | ||
| 890 | } | ||
| 891 | |||
| 892 | type MomentFormatSpecification = string | MomentBuiltinFormat | (string | MomentBuiltinFormat)[]; | ||
| 893 | |||
| 894 | namespace unitOfTime { | ||
| 895 | type Base = ( | ||
| 896 | "year" | "years" | "y" | | ||
| 897 | "month" | "months" | "M" | | ||
| 898 | "week" | "weeks" | "w" | | ||
| 899 | "day" | "days" | "d" | | ||
| 900 | "hour" | "hours" | "h" | | ||
| 901 | "minute" | "minutes" | "m" | | ||
| 902 | "second" | "seconds" | "s" | | ||
| 903 | "millisecond" | "milliseconds" | "ms" | ||
| 904 | ); | ||
| 905 | |||
| 906 | type _quarter = "quarter" | "quarters" | "Q"; | ||
| 907 | type _isoWeek = "isoWeek" | "isoWeeks" | "W"; | ||
| 908 | type _date = "date" | "dates" | "D"; | ||
| 909 | type DurationConstructor = Base | _quarter; | ||
| 910 | |||
| 911 | type DurationAs = Base; | ||
| 912 | |||
| 913 | type StartOf = Base | _quarter | _isoWeek | _date | null; | ||
| 914 | |||
| 915 | type Diff = Base | _quarter; | ||
| 916 | |||
| 917 | type MomentConstructor = Base | _date; | ||
| 918 | |||
| 919 | type All = Base | _quarter | _isoWeek | _date | | ||
| 920 | "weekYear" | "weekYears" | "gg" | | ||
| 921 | "isoWeekYear" | "isoWeekYears" | "GG" | | ||
| 922 | "dayOfYear" | "dayOfYears" | "DDD" | | ||
| 923 | "weekday" | "weekdays" | "e" | | ||
| 924 | "isoWeekday" | "isoWeekdays" | "E"; | ||
| 925 | } | ||
| 926 | |||
| 927 | interface MomentInputObject { | ||
| 928 | years?: number; | ||
| 929 | year?: number; | ||
| 930 | y?: number; | ||
| 931 | |||
| 932 | months?: number; | ||
| 933 | month?: number; | ||
| 934 | M?: number; | ||
| 935 | |||
| 936 | days?: number; | ||
| 937 | day?: number; | ||
| 938 | d?: number; | ||
| 939 | |||
| 940 | dates?: number; | ||
| 941 | date?: number; | ||
| 942 | D?: number; | ||
| 943 | |||
| 944 | hours?: number; | ||
| 945 | hour?: number; | ||
| 946 | h?: number; | ||
| 947 | |||
| 948 | minutes?: number; | ||
| 949 | minute?: number; | ||
| 950 | m?: number; | ||
| 951 | |||
| 952 | seconds?: number; | ||
| 953 | second?: number; | ||
| 954 | s?: number; | ||
| 955 | |||
| 956 | milliseconds?: number; | ||
| 957 | millisecond?: number; | ||
| 958 | ms?: number; | ||
| 959 | } | ||
| 960 | |||
| 961 | interface DurationInputObject extends MomentInputObject { | ||
| 962 | quarters?: number; | ||
| 963 | quarter?: number; | ||
| 964 | Q?: number; | ||
| 965 | |||
| 966 | weeks?: number; | ||
| 967 | week?: number; | ||
| 968 | w?: number; | ||
| 969 | } | ||
| 970 | |||
| 971 | interface MomentSetObject extends MomentInputObject { | ||
| 972 | weekYears?: number; | ||
| 973 | weekYear?: number; | ||
| 974 | gg?: number; | ||
| 975 | |||
| 976 | isoWeekYears?: number; | ||
| 977 | isoWeekYear?: number; | ||
| 978 | GG?: number; | ||
| 979 | |||
| 980 | quarters?: number; | ||
| 981 | quarter?: number; | ||
| 982 | Q?: number; | ||
| 983 | |||
| 984 | weeks?: number; | ||
| 985 | week?: number; | ||
| 986 | w?: number; | ||
| 987 | |||
| 988 | isoWeeks?: number; | ||
| 989 | isoWeek?: number; | ||
| 990 | W?: number; | ||
| 991 | |||
| 992 | dayOfYears?: number; | ||
| 993 | dayOfYear?: number; | ||
| 994 | DDD?: number; | ||
| 995 | |||
| 996 | weekdays?: number; | ||
| 997 | weekday?: number; | ||
| 998 | e?: number; | ||
| 999 | |||
| 1000 | isoWeekdays?: number; | ||
| 1001 | isoWeekday?: number; | ||
| 1002 | E?: number; | ||
| 1003 | } | ||
| 1004 | |||
| 1005 | interface FromTo { | ||
| 1006 | from: MomentInput; | ||
| 1007 | to: MomentInput; | ||
| 1008 | } | ||
| 1009 | |||
| 1010 | type MomentInput = Moment | Date | string | number | (number | string)[] | MomentInputObject | null | undefined; | ||
| 1011 | type DurationInputArg1 = Duration | number | string | FromTo | DurationInputObject | null | undefined; | ||
| 1012 | type DurationInputArg2 = unitOfTime.DurationConstructor; | ||
| 1013 | type LocaleSpecifier = string | Moment | Duration | string[] | boolean; | ||
| 1014 | |||
| 1015 | interface MomentCreationData { | ||
| 1016 | input: MomentInput; | ||
| 1017 | format?: MomentFormatSpecification; | ||
| 1018 | locale: Locale; | ||
| 1019 | isUTC: boolean; | ||
| 1020 | strict?: boolean; | ||
| 1021 | } | ||
| 1022 | |||
| 1023 | interface Moment extends Object { | ||
| 1024 | format(format?: string): string; | ||
| 1025 | |||
| 1026 | startOf(unitOfTime: unitOfTime.StartOf): Moment; | ||
| 1027 | endOf(unitOfTime: unitOfTime.StartOf): Moment; | ||
| 1028 | |||
| 1029 | add(amount?: DurationInputArg1, unit?: DurationInputArg2): Moment; | ||
| 1030 | /** | ||
| 1031 | * @deprecated reverse syntax | ||
| 1032 | */ | ||
| 1033 | add(unit: unitOfTime.DurationConstructor, amount: number|string): Moment; | ||
| 1034 | |||
| 1035 | subtract(amount?: DurationInputArg1, unit?: DurationInputArg2): Moment; | ||
| 1036 | /** | ||
| 1037 | * @deprecated reverse syntax | ||
| 1038 | */ | ||
| 1039 | subtract(unit: unitOfTime.DurationConstructor, amount: number|string): Moment; | ||
| 1040 | |||
| 1041 | calendar(): string; | ||
| 1042 | calendar(formats: CalendarSpec): string; | ||
| 1043 | calendar(time?: MomentInput, formats?: CalendarSpec): string; | ||
| 1044 | |||
| 1045 | clone(): Moment; | ||
| 1046 | |||
| 1047 | /** | ||
| 1048 | * @return Unix timestamp in milliseconds | ||
| 1049 | */ | ||
| 1050 | valueOf(): number; | ||
| 1051 | |||
| 1052 | // current date/time in local mode | ||
| 1053 | local(keepLocalTime?: boolean): Moment; | ||
| 1054 | isLocal(): boolean; | ||
| 1055 | |||
| 1056 | // current date/time in UTC mode | ||
| 1057 | utc(keepLocalTime?: boolean): Moment; | ||
| 1058 | isUTC(): boolean; | ||
| 1059 | /** | ||
| 1060 | * @deprecated use isUTC | ||
| 1061 | */ | ||
| 1062 | isUtc(): boolean; | ||
| 1063 | |||
| 1064 | parseZone(): Moment; | ||
| 1065 | isValid(): boolean; | ||
| 1066 | invalidAt(): number; | ||
| 1067 | |||
| 1068 | hasAlignedHourOffset(other?: MomentInput): boolean; | ||
| 1069 | |||
| 1070 | creationData(): MomentCreationData; | ||
| 1071 | parsingFlags(): MomentParsingFlags; | ||
| 1072 | |||
| 1073 | year(y: number): Moment; | ||
| 1074 | year(): number; | ||
| 1075 | /** | ||
| 1076 | * @deprecated use year(y) | ||
| 1077 | */ | ||
| 1078 | years(y: number): Moment; | ||
| 1079 | /** | ||
| 1080 | * @deprecated use year() | ||
| 1081 | */ | ||
| 1082 | years(): number; | ||
| 1083 | quarter(): number; | ||
| 1084 | quarter(q: number): Moment; | ||
| 1085 | quarters(): number; | ||
| 1086 | quarters(q: number): Moment; | ||
| 1087 | month(M: number|string): Moment; | ||
| 1088 | month(): number; | ||
| 1089 | /** | ||
| 1090 | * @deprecated use month(M) | ||
| 1091 | */ | ||
| 1092 | months(M: number|string): Moment; | ||
| 1093 | /** | ||
| 1094 | * @deprecated use month() | ||
| 1095 | */ | ||
| 1096 | months(): number; | ||
| 1097 | day(d: number|string): Moment; | ||
| 1098 | day(): number; | ||
| 1099 | days(d: number|string): Moment; | ||
| 1100 | days(): number; | ||
| 1101 | date(d: number): Moment; | ||
| 1102 | date(): number; | ||
| 1103 | /** | ||
| 1104 | * @deprecated use date(d) | ||
| 1105 | */ | ||
| 1106 | dates(d: number): Moment; | ||
| 1107 | /** | ||
| 1108 | * @deprecated use date() | ||
| 1109 | */ | ||
| 1110 | dates(): number; | ||
| 1111 | hour(h: number): Moment; | ||
| 1112 | hour(): number; | ||
| 1113 | hours(h: number): Moment; | ||
| 1114 | hours(): number; | ||
| 1115 | minute(m: number): Moment; | ||
| 1116 | minute(): number; | ||
| 1117 | minutes(m: number): Moment; | ||
| 1118 | minutes(): number; | ||
| 1119 | second(s: number): Moment; | ||
| 1120 | second(): number; | ||
| 1121 | seconds(s: number): Moment; | ||
| 1122 | seconds(): number; | ||
| 1123 | millisecond(ms: number): Moment; | ||
| 1124 | millisecond(): number; | ||
| 1125 | milliseconds(ms: number): Moment; | ||
| 1126 | milliseconds(): number; | ||
| 1127 | weekday(): number; | ||
| 1128 | weekday(d: number): Moment; | ||
| 1129 | isoWeekday(): number; | ||
| 1130 | isoWeekday(d: number|string): Moment; | ||
| 1131 | weekYear(): number; | ||
| 1132 | weekYear(d: number): Moment; | ||
| 1133 | isoWeekYear(): number; | ||
| 1134 | isoWeekYear(d: number): Moment; | ||
| 1135 | week(): number; | ||
| 1136 | week(d: number): Moment; | ||
| 1137 | weeks(): number; | ||
| 1138 | weeks(d: number): Moment; | ||
| 1139 | isoWeek(): number; | ||
| 1140 | isoWeek(d: number): Moment; | ||
| 1141 | isoWeeks(): number; | ||
| 1142 | isoWeeks(d: number): Moment; | ||
| 1143 | weeksInYear(): number; | ||
| 1144 | isoWeeksInYear(): number; | ||
| 1145 | isoWeeksInISOWeekYear(): number; | ||
| 1146 | dayOfYear(): number; | ||
| 1147 | dayOfYear(d: number): Moment; | ||
| 1148 | |||
| 1149 | from(inp: MomentInput, suffix?: boolean): string; | ||
| 1150 | to(inp: MomentInput, suffix?: boolean): string; | ||
| 1151 | fromNow(withoutSuffix?: boolean): string; | ||
| 1152 | toNow(withoutPrefix?: boolean): string; | ||
| 1153 | |||
| 1154 | diff(b: MomentInput, unitOfTime?: unitOfTime.Diff, precise?: boolean): number; | ||
| 1155 | |||
| 1156 | toArray(): [number, number, number, number, number, number, number]; | ||
| 1157 | toDate(): Date; | ||
| 1158 | toISOString(keepOffset?: boolean): string; | ||
| 1159 | inspect(): string; | ||
| 1160 | toJSON(): string; | ||
| 1161 | unix(): number; | ||
| 1162 | |||
| 1163 | isLeapYear(): boolean; | ||
| 1164 | /** | ||
| 1165 | * @deprecated in favor of utcOffset | ||
| 1166 | */ | ||
| 1167 | zone(): number; | ||
| 1168 | zone(b: number|string): Moment; | ||
| 1169 | utcOffset(): number; | ||
| 1170 | utcOffset(b: number|string, keepLocalTime?: boolean): Moment; | ||
| 1171 | isUtcOffset(): boolean; | ||
| 1172 | daysInMonth(): number; | ||
| 1173 | isDST(): boolean; | ||
| 1174 | |||
| 1175 | zoneAbbr(): string; | ||
| 1176 | zoneName(): string; | ||
| 1177 | |||
| 1178 | isBefore(inp?: MomentInput, granularity?: unitOfTime.StartOf): boolean; | ||
| 1179 | isAfter(inp?: MomentInput, granularity?: unitOfTime.StartOf): boolean; | ||
| 1180 | isSame(inp?: MomentInput, granularity?: unitOfTime.StartOf): boolean; | ||
| 1181 | isSameOrAfter(inp?: MomentInput, granularity?: unitOfTime.StartOf): boolean; | ||
| 1182 | isSameOrBefore(inp?: MomentInput, granularity?: unitOfTime.StartOf): boolean; | ||
| 1183 | isBetween(a: MomentInput, b: MomentInput, granularity?: unitOfTime.StartOf, inclusivity?: "()" | "[)" | "(]" | "[]"): boolean; | ||
| 1184 | |||
| 1185 | /** | ||
| 1186 | * @deprecated as of 2.8.0, use locale | ||
| 1187 | */ | ||
| 1188 | lang(language: LocaleSpecifier): Moment; | ||
| 1189 | /** | ||
| 1190 | * @deprecated as of 2.8.0, use locale | ||
| 1191 | */ | ||
| 1192 | lang(): Locale; | ||
| 1193 | |||
| 1194 | locale(): string; | ||
| 1195 | locale(locale: LocaleSpecifier): Moment; | ||
| 1196 | |||
| 1197 | localeData(): Locale; | ||
| 1198 | |||
| 1199 | /** | ||
| 1200 | * @deprecated no reliable implementation | ||
| 1201 | */ | ||
| 1202 | isDSTShifted(): boolean; | ||
| 1203 | |||
| 1204 | // NOTE(constructor): Same as moment constructor | ||
| 1205 | /** | ||
| 1206 | * @deprecated as of 2.7.0, use moment.min/max | ||
| 1207 | */ | ||
| 1208 | max(inp?: MomentInput, format?: MomentFormatSpecification, strict?: boolean): Moment; | ||
| 1209 | /** | ||
| 1210 | * @deprecated as of 2.7.0, use moment.min/max | ||
| 1211 | */ | ||
| 1212 | max(inp?: MomentInput, format?: MomentFormatSpecification, language?: string, strict?: boolean): Moment; | ||
| 1213 | |||
| 1214 | // NOTE(constructor): Same as moment constructor | ||
| 1215 | /** | ||
| 1216 | * @deprecated as of 2.7.0, use moment.min/max | ||
| 1217 | */ | ||
| 1218 | min(inp?: MomentInput, format?: MomentFormatSpecification, strict?: boolean): Moment; | ||
| 1219 | /** | ||
| 1220 | * @deprecated as of 2.7.0, use moment.min/max | ||
| 1221 | */ | ||
| 1222 | min(inp?: MomentInput, format?: MomentFormatSpecification, language?: string, strict?: boolean): Moment; | ||
| 1223 | |||
| 1224 | get(unit: unitOfTime.All): number; | ||
| 1225 | set(unit: unitOfTime.All, value: number): Moment; | ||
| 1226 | set(objectLiteral: MomentSetObject): Moment; | ||
| 1227 | |||
| 1228 | toObject(): MomentObjectOutput; | ||
| 1229 | } | ||
| 1230 | |||
| 1231 | export var version: string; | ||
| 1232 | export var fn: Moment; | ||
| 1233 | |||
| 1234 | // NOTE(constructor): Same as moment constructor | ||
| 1235 | /** | ||
| 1236 | * @param strict Strict parsing disables the deprecated fallback to the native Date constructor when | ||
| 1237 | * parsing a string. | ||
| 1238 | */ | ||
| 1239 | export function utc(inp?: MomentInput, strict?: boolean): Moment; | ||
| 1240 | /** | ||
| 1241 | * @param strict Strict parsing requires that the format and input match exactly, including delimiters. | ||
| 1242 | * Strict parsing is frequently the best parsing option. For more information about choosing strict vs | ||
| 1243 | * forgiving parsing, see the [parsing guide](https://momentjs.com/guides/#/parsing/). | ||
| 1244 | */ | ||
| 1245 | export function utc(inp?: MomentInput, format?: MomentFormatSpecification, strict?: boolean): Moment; | ||
| 1246 | /** | ||
| 1247 | * @param strict Strict parsing requires that the format and input match exactly, including delimiters. | ||
| 1248 | * Strict parsing is frequently the best parsing option. For more information about choosing strict vs | ||
| 1249 | * forgiving parsing, see the [parsing guide](https://momentjs.com/guides/#/parsing/). | ||
| 1250 | */ | ||
| 1251 | export function utc(inp?: MomentInput, format?: MomentFormatSpecification, language?: string, strict?: boolean): Moment; | ||
| 1252 | |||
| 1253 | export function unix(timestamp: number): Moment; | ||
| 1254 | |||
| 1255 | export function invalid(flags?: MomentParsingFlagsOpt): Moment; | ||
| 1256 | export function isMoment(m: any): m is Moment; | ||
| 1257 | export function isDate(m: any): m is Date; | ||
| 1258 | export function isDuration(d: any): d is Duration; | ||
| 1259 | |||
| 1260 | /** | ||
| 1261 | * @deprecated in 2.8.0 | ||
| 1262 | */ | ||
| 1263 | export function lang(language?: string): string; | ||
| 1264 | /** | ||
| 1265 | * @deprecated in 2.8.0 | ||
| 1266 | */ | ||
| 1267 | export function lang(language?: string, definition?: Locale): string; | ||
| 1268 | |||
| 1269 | export function locale(language?: string): string; | ||
| 1270 | export function locale(language?: string[]): string; | ||
| 1271 | export function locale(language?: string, definition?: LocaleSpecification | null | undefined): string; | ||
| 1272 | |||
| 1273 | export function localeData(key?: string | string[]): Locale; | ||
| 1274 | |||
| 1275 | export function duration(inp?: DurationInputArg1, unit?: DurationInputArg2): Duration; | ||
| 1276 | |||
| 1277 | // NOTE(constructor): Same as moment constructor | ||
| 1278 | export function parseZone(inp?: MomentInput, format?: MomentFormatSpecification, strict?: boolean): Moment; | ||
| 1279 | export function parseZone(inp?: MomentInput, format?: MomentFormatSpecification, language?: string, strict?: boolean): Moment; | ||
| 1280 | |||
| 1281 | export function months(): string[]; | ||
| 1282 | export function months(index: number): string; | ||
| 1283 | export function months(format: string): string[]; | ||
| 1284 | export function months(format: string, index: number): string; | ||
| 1285 | export function monthsShort(): string[]; | ||
| 1286 | export function monthsShort(index: number): string; | ||
| 1287 | export function monthsShort(format: string): string[]; | ||
| 1288 | export function monthsShort(format: string, index: number): string; | ||
| 1289 | |||
| 1290 | export function weekdays(): string[]; | ||
| 1291 | export function weekdays(index: number): string; | ||
| 1292 | export function weekdays(format: string): string[]; | ||
| 1293 | export function weekdays(format: string, index: number): string; | ||
| 1294 | export function weekdays(localeSorted: boolean): string[]; | ||
| 1295 | export function weekdays(localeSorted: boolean, index: number): string; | ||
| 1296 | export function weekdays(localeSorted: boolean, format: string): string[]; | ||
| 1297 | export function weekdays(localeSorted: boolean, format: string, index: number): string; | ||
| 1298 | export function weekdaysShort(): string[]; | ||
| 1299 | export function weekdaysShort(index: number): string; | ||
| 1300 | export function weekdaysShort(format: string): string[]; | ||
| 1301 | export function weekdaysShort(format: string, index: number): string; | ||
| 1302 | export function weekdaysShort(localeSorted: boolean): string[]; | ||
| 1303 | export function weekdaysShort(localeSorted: boolean, index: number): string; | ||
| 1304 | export function weekdaysShort(localeSorted: boolean, format: string): string[]; | ||
| 1305 | export function weekdaysShort(localeSorted: boolean, format: string, index: number): string; | ||
| 1306 | export function weekdaysMin(): string[]; | ||
| 1307 | export function weekdaysMin(index: number): string; | ||
| 1308 | export function weekdaysMin(format: string): string[]; | ||
| 1309 | export function weekdaysMin(format: string, index: number): string; | ||
| 1310 | export function weekdaysMin(localeSorted: boolean): string[]; | ||
| 1311 | export function weekdaysMin(localeSorted: boolean, index: number): string; | ||
| 1312 | export function weekdaysMin(localeSorted: boolean, format: string): string[]; | ||
| 1313 | export function weekdaysMin(localeSorted: boolean, format: string, index: number): string; | ||
| 1314 | |||
| 1315 | export function min(moments: Moment[]): Moment; | ||
| 1316 | export function min(...moments: Moment[]): Moment; | ||
| 1317 | export function max(moments: Moment[]): Moment; | ||
| 1318 | export function max(...moments: Moment[]): Moment; | ||
| 1319 | |||
| 1320 | /** | ||
| 1321 | * Returns unix time in milliseconds. Overwrite for profit. | ||
| 1322 | */ | ||
| 1323 | export function now(): number; | ||
| 1324 | |||
| 1325 | export function defineLocale(language: string, localeSpec: LocaleSpecification | null): Locale; | ||
| 1326 | export function updateLocale(language: string, localeSpec: LocaleSpecification | null): Locale; | ||
| 1327 | |||
| 1328 | export function locales(): string[]; | ||
| 1329 | |||
| 1330 | export function normalizeUnits(unit: unitOfTime.All): string; | ||
| 1331 | export function relativeTimeThreshold(threshold: string): number | boolean; | ||
| 1332 | export function relativeTimeThreshold(threshold: string, limit: number): boolean; | ||
| 1333 | export function relativeTimeRounding(fn: (num: number) => number): boolean; | ||
| 1334 | export function relativeTimeRounding(): (num: number) => number; | ||
| 1335 | export function calendarFormat(m: Moment, now: Moment): string; | ||
| 1336 | |||
| 1337 | export function parseTwoDigitYear(input: string): number; | ||
| 1338 | /** | ||
| 1339 | * Constant used to enable explicit ISO_8601 format parsing. | ||
| 1340 | */ | ||
| 1341 | export var ISO_8601: MomentBuiltinFormat; | ||
| 1342 | export var RFC_2822: MomentBuiltinFormat; | ||
| 1343 | |||
| 1344 | export var defaultFormat: string; | ||
| 1345 | export var defaultFormatUtc: string; | ||
| 1346 | |||
| 1347 | export var suppressDeprecationWarnings: boolean; | ||
| 1348 | export var deprecationHandler: ((name: string | null, msg: string) => void) | null | undefined; | ||
| 1349 | |||
| 1350 | export var HTML5_FMT: { | ||
| 1351 | DATETIME_LOCAL: string, | ||
| 1352 | DATETIME_LOCAL_SECONDS: string, | ||
| 1353 | DATETIME_LOCAL_MS: string, | ||
| 1354 | DATE: string, | ||
| 1355 | TIME: string, | ||
| 1356 | TIME_SECONDS: string, | ||
| 1357 | TIME_MS: string, | ||
| 1358 | WEEK: string, | ||
| 1359 | MONTH: string | ||
| 1360 | }; | ||
| 1361 | |||
| 1362 | } | ||
| 1363 | |||
| 1364 | declare global { | ||
| 1365 | const moment: typeof moment; | ||
| 1366 | } | ||
| @@ -0,0 +1,43 @@ | |||
| 1 | <?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
| 2 | <!-- Created with Inkscape (http://www.inkscape.org/) --> | ||
| 3 | |||
| 4 | <svg | ||
| 5 | width="190.91216mm" | ||
| 6 | height="201.47243mm" | ||
| 7 | viewBox="0 0 190.91216 201.47243" | ||
| 8 | version="1.1" | ||
| 9 | id="svg1" | ||
| 10 | xmlns="http://www.w3.org/2000/svg" | ||
| 11 | xmlns:svg="http://www.w3.org/2000/svg"> | ||
| 12 | <defs | ||
| 13 | id="defs1" /> | ||
| 14 | <g | ||
| 15 | id="layer1" | ||
| 16 | transform="translate(-2.2086436)"> | ||
| 17 | <g | ||
| 18 | id="g8" | ||
| 19 | transform="matrix(0.99583856,0,0,1.0472862,2.2086437,-7.9847956)"> | ||
| 20 | <path | ||
| 21 | style="font-weight:bold;font-size:89.3125px;font-family:'Courier New';-inkscape-font-specification:'Courier New Bold';letter-spacing:-8.37308px;stroke-width:1.73283" | ||
| 22 | d="m 161.17775,117.85719 v 23.36554 q 0,20.76935 -10.30578,39.77331 -10.21695,19.00395 -29.31819,19.00395 -11.01653,0 -18.65701,-5.60771 -7.551611,-5.71157 -14.392485,-20.8732 -6.752041,-15.26549 -6.752041,-32.29635 v -23.36554 q 0,-20.665499 10.216893,-39.669461 10.216893,-19.107806 29.318113,-19.107806 10.92769,0 18.47935,5.607725 7.64049,5.607727 14.48139,20.873203 6.92976,15.161629 6.92976,32.296339 z m -18.30165,0 q 0,-17.3424 -8.26241,-30.32325 -4.70867,-7.165428 -13.2376,-7.165428 -8.26239,0 -13.50413,7.892355 -7.906998,11.942383 -7.906998,29.596323 v 23.36554 q 0,17.44626 8.351218,30.32326 4.61983,7.16543 13.2376,7.16543 8.17356,0 13.4153,-7.89237 7.90702,-11.94237 7.90702,-29.59632 z" | ||
| 23 | id="path8" /> | ||
| 24 | <path | ||
| 25 | style="font-weight:bold;font-size:89.3125px;font-family:'Courier New';-inkscape-font-specification:'Courier New Bold';letter-spacing:-8.37308px;stroke-width:1.67461" | ||
| 26 | d="M 54.800839,58.349248 V 166.67311 H 73.27526 q 6.604382,0 9.371083,2.79982 2.855949,2.70327 2.855949,7.14436 0,4.34453 -2.855949,7.14435 -2.766701,2.70327 -9.371083,2.70327 H 18.030494 q -6.604382,0 -9.4603308,-2.70327 -2.7667007,-2.79982 -2.7667007,-7.2409 0,-4.34454 2.7667007,-7.04781 2.8559488,-2.79982 9.4603308,-2.79982 H 36.504915 V 84.126852 l -16.332459,4.634176 q -3.926929,1.158544 -5.890395,1.158544 -3.480687,0 -6.0688915,-2.992905 -2.4989554,-2.992906 -2.4989554,-7.337446 0,-3.958358 1.8742165,-6.178902 1.8742167,-2.317087 7.8538604,-4.054903 z" | ||
| 27 | transform="matrix(0.99545738,0,0,1.0756271,-5.6882567,-3.6821097)" | ||
| 28 | id="path7" /> | ||
| 29 | </g> | ||
| 30 | <g | ||
| 31 | id="g1" | ||
| 32 | transform="matrix(0.84984007,0,0,0.87855774,28.999003,5.2337341e-7)"> | ||
| 33 | <path | ||
| 34 | style="font-weight:bold;font-size:89.3125px;font-family:'Courier New';-inkscape-font-specification:'Courier New Bold';letter-spacing:-8.37308px;stroke-width:1.73283" | ||
| 35 | d="m 184.13459,37.01017 q -3.34269,3.095908 -6.12102,4.409323 -2.77834,1.266508 -5.86056,1.266508 -7.1629,0 -12.54593,-6.191815 -5.33961,-6.191816 -5.33961,-15.385722 0,-7.176877 3.68997,-13.0403372 Q 162.99318,4.3096483e-6 172.15301,4.3096483e-6 q 6.55514,0 11.46064,4.2685995903517 4.90551,4.2216915 7.20632,12.2429061 2.30081,7.974308 2.30081,16.65223 0,14.729014 -10.549,23.641474 -8.16137,6.848524 -17.88555,6.848524 -5.38303,0 -8.33501,-2.345385 -1.99693,-1.547954 -1.99693,-4.080969 0,-2.063938 1.25893,-3.424261 1.30235,-1.407231 3.16905,-1.407231 1.04187,0 2.34422,0.703615 1.69304,0.938154 3.55974,0.938154 6.72879,0 12.4157,-4.925307 5.68691,-4.972215 7.03266,-12.102184 z m -1.25893,-15.151183 q -1.43258,-6.660892 -4.25433,-9.428446 -2.77834,-2.814461 -6.38149,-2.814461 -3.77681,0 -6.42491,3.142816 -2.6481,3.095907 -2.6481,8.255753 0,5.394384 2.6481,8.72483 2.69151,3.330446 6.12102,3.330446 6.03421,0 10.93971,-11.210938 z" | ||
| 36 | id="path6" /> | ||
| 37 | <path | ||
| 38 | style="font-weight:bold;font-size:89.3125px;font-family:'Courier New';-inkscape-font-specification:'Courier New Bold';letter-spacing:-8.37308px;stroke-width:1.51638" | ||
| 39 | d="m 142.10195,39.730816 h -22.30654 q -3.49058,0 -4.15545,-0.234538 -0.99731,-0.375262 -1.69543,-1.641769 -0.69812,-1.313415 -0.69812,-2.955185 0,-1.594861 0.69812,-2.908276 0.69812,-1.313416 1.72867,-1.641769 0.66488,-0.234539 4.12221,-0.234539 h 22.30654 q 3.49059,0 4.15545,0.234539 0.99732,0.375261 1.69543,1.688676 0.69812,1.266508 0.69812,2.861369 0,1.64177 -0.69812,2.955185 -0.69811,1.266507 -1.72867,1.641769 -0.66487,0.234538 -4.12221,0.234538 z" | ||
| 40 | id="text2" /> | ||
| 41 | </g> | ||
| 42 | </g> | ||
| 43 | </svg> | ||
| @@ -91,9 +91,6 @@ | |||
| 91 | <div class="margin0 title_restorable standoutHeader"> | 91 | <div class="margin0 title_restorable standoutHeader"> |
| 92 | <strong> | 92 | <strong> |
| 93 | <span data-i18n="kobldpresets">Kobold Presets</span> | 93 | <span data-i18n="kobldpresets">Kobold Presets</span> |
| 94 | <a href="https://docs.sillytavern.app/usage/api-connections/koboldai/" class="notes-link" target="_blank"> | ||
| 95 | <span class="fa-solid fa-circle-question note-link-span"></span> | ||
| 96 | </a> | ||
| 97 | </strong> | 94 | </strong> |
| 98 | 95 | ||
| 99 | <div class="flex-container gap3px"> | 96 | <div class="flex-container gap3px"> |
| @@ -685,7 +682,7 @@ | |||
| 685 | </div> | 682 | </div> |
| 686 | </div> | 683 | </div> |
| 687 | </div> | 684 | </div> |
| 688 | <div class="range-block" data-source="openai,openrouter,custom,cohere,perplexity,groq"> | 685 | <div class="range-block" data-source="openai,openrouter,custom,cohere,perplexity,groq,mistralai"> |
| 689 | <div class="range-block-title" data-i18n="Frequency Penalty"> | 686 | <div class="range-block-title" data-i18n="Frequency Penalty"> |
| 690 | Frequency Penalty | 687 | Frequency Penalty |
| 691 | </div> | 688 | </div> |
| @@ -698,7 +695,7 @@ | |||
| 698 | </div> | 695 | </div> |
| 699 | </div> | 696 | </div> |
| 700 | </div> | 697 | </div> |
| 701 | <div class="range-block" data-source="openai,openrouter,custom,cohere,perplexity,groq"> | 698 | <div class="range-block" data-source="openai,openrouter,custom,cohere,perplexity,groq,mistralai"> |
| 702 | <div class="range-block-title" data-i18n="Presence Penalty"> | 699 | <div class="range-block-title" data-i18n="Presence Penalty"> |
| 703 | Presence Penalty | 700 | Presence Penalty |
| 704 | </div> | 701 | </div> |
| @@ -823,8 +820,8 @@ | |||
| 823 | </div> | 820 | </div> |
| 824 | </div> | 821 | </div> |
| 825 | <div class="range-block m-t-1"> | 822 | <div class="range-block m-t-1"> |
| 826 | <div class="range-block-title openai_restorable" data-i18n="World Info Format Template"> | 823 | <div class="range-block-title openai_restorable"> |
| 827 | <span>World Info format template</span> | 824 | <span data-i18n="World Info Format Template">World Info format template</span> |
| 828 | <div id="wi_format_restore" data-i18n="[title]Restore default format" title="Restore default format" class="right_menu_button"> | 825 | <div id="wi_format_restore" data-i18n="[title]Restore default format" title="Restore default format" class="right_menu_button"> |
| 829 | <div class="fa-solid fa-clock-rotate-left"></div> | 826 | <div class="fa-solid fa-clock-rotate-left"></div> |
| 830 | </div> | 827 | </div> |
| @@ -1294,6 +1291,14 @@ | |||
| 1294 | <input class="neo-range-slider" type="range" id="epsilon_cutoff_textgenerationwebui" name="volume" min="0" max="9" step="0.01"> | 1291 | <input class="neo-range-slider" type="range" id="epsilon_cutoff_textgenerationwebui" name="volume" min="0" max="9" step="0.01"> |
| 1295 | <input class="neo-range-input" type="number" min="0" max="9" step="0.01" data-for="epsilon_cutoff_textgenerationwebui" id="epsilon_cutoff_counter_textgenerationwebui"> | 1292 | <input class="neo-range-input" type="number" min="0" max="9" step="0.01" data-for="epsilon_cutoff_textgenerationwebui" id="epsilon_cutoff_counter_textgenerationwebui"> |
| 1296 | </div> | 1293 | </div> |
| 1294 | <div data-tg-type="aphrodite" class="alignitemscenter flex-container flexFlowColumn flexBasis30p flexGrow flexShrink gap0"> | ||
| 1295 | <small> | ||
| 1296 | <span data-i18n="Top nsigma">Top nsigma</span> | ||
| 1297 | <div class="fa-solid fa-circle-info opacity50p" title="A sampling method that filters logits based on their statistical properties. It keeps tokens within n standard deviations of the maximum logit value, providing a simpler alternative to top-p/top-k sampling while maintaining sampling stability across different temperatures."></div> | ||
| 1298 | </small> | ||
| 1299 | <input class="neo-range-slider" type="range" id="nsigma_textgenerationwebui" name="volume" min="0" max="5" step="0.01"> | ||
| 1300 | <input class="neo-range-input" type="number" min="0" max="5" step="0.01" data-for="nsigma_textgenerationwebui" id="nsigma_counter_textgenerationwebui"> | ||
| 1301 | </div> | ||
| 1297 | <div data-tg-type="ooba,mancer,aphrodite" class="alignitemscenter flex-container flexFlowColumn flexBasis30p flexGrow flexShrink gap0"> | 1302 | <div data-tg-type="ooba,mancer,aphrodite" class="alignitemscenter flex-container flexFlowColumn flexBasis30p flexGrow flexShrink gap0"> |
| 1298 | <small> | 1303 | <small> |
| 1299 | <span data-i18n="Eta Cutoff">Eta Cutoff</span> | 1304 | <span data-i18n="Eta Cutoff">Eta Cutoff</span> |
| @@ -1337,12 +1342,12 @@ | |||
| 1337 | <input class="neo-range-slider" type="range" id="presence_pen_textgenerationwebui" name="volume" min="-2" max="2" step="0.01" /> | 1342 | <input class="neo-range-slider" type="range" id="presence_pen_textgenerationwebui" name="volume" min="-2" max="2" step="0.01" /> |
| 1338 | <input class="neo-range-input" type="number" min="-2" max="2" step="0.01" data-for="presence_pen_textgenerationwebui" id="presence_pen_counter_textgenerationwebui"> | 1343 | <input class="neo-range-input" type="number" min="-2" max="2" step="0.01" data-for="presence_pen_textgenerationwebui" id="presence_pen_counter_textgenerationwebui"> |
| 1339 | </div> | 1344 | </div> |
| 1340 | <div data-tg-type="ooba" class="alignitemscenter flex-container flexFlowColumn flexBasis30p flexGrow flexShrink gap0"> | 1345 | <div data-tg-type="aphrodite, ooba" class="alignitemscenter flex-container flexFlowColumn flexBasis30p flexGrow flexShrink gap0"> |
| 1341 | <small data-i18n="No Repeat Ngram Size">No Repeat Ngram Size</small> | 1346 | <small data-i18n="No Repeat Ngram Size">No Repeat Ngram Size</small> |
| 1342 | <input class="neo-range-slider" type="range" id="no_repeat_ngram_size_textgenerationwebui" name="volume" min="0" max="20" step="1"> | 1347 | <input class="neo-range-slider" type="range" id="no_repeat_ngram_size_textgenerationwebui" name="volume" min="0" max="20" step="1"> |
| 1343 | <input class="neo-range-input" type="number" min="0" max="20" step="1" data-for="no_repeat_ngram_size_textgenerationwebui" id="no_repeat_ngram_size_counter_textgenerationwebui"> | 1348 | <input class="neo-range-input" type="number" min="0" max="20" step="1" data-for="no_repeat_ngram_size_textgenerationwebui" id="no_repeat_ngram_size_counter_textgenerationwebui"> |
| 1344 | </div> | 1349 | </div> |
| 1345 | <div data-tg-type="tabby" class="alignitemscenter flex-container flexFlowColumn flexBasis30p flexGrow flexShrink gap0"> | 1350 | <div data-tg-type="tabby, aphrodite" class="alignitemscenter flex-container flexFlowColumn flexBasis30p flexGrow flexShrink gap0"> |
| 1346 | <small data-i18n="Skew">Skew</small> | 1351 | <small data-i18n="Skew">Skew</small> |
| 1347 | <input class="neo-range-slider" type="range" id="skew_textgenerationwebui" name="volume" min="-5" max="5" step="0.01" /> | 1352 | <input class="neo-range-slider" type="range" id="skew_textgenerationwebui" name="volume" min="-5" max="5" step="0.01" /> |
| 1348 | <input class="neo-range-input" type="number" min="-5" max="5" step="0.01" data-for="skew_textgenerationwebui" id="skew_counter_textgenerationwebui"> | 1353 | <input class="neo-range-input" type="number" min="-5" max="5" step="0.01" data-for="skew_textgenerationwebui" id="skew_counter_textgenerationwebui"> |
| @@ -1397,7 +1402,7 @@ | |||
| 1397 | </div> | 1402 | </div> |
| 1398 | </div> | 1403 | </div> |
| 1399 | 1404 | ||
| 1400 | <div data-tg-type="ooba, koboldcpp, tabby, llamacpp" id="dryBlock" class="wide100p"> | 1405 | <div data-tg-type="aphrodite, ooba, koboldcpp, tabby, llamacpp" id="dryBlock" class="wide100p"> |
| 1401 | <h4 class="wide100p textAlignCenter" title="DRY penalizes tokens that would extend the end of the input into a sequence that has previously occurred in the input. Set multiplier to 0 to disable." data-i18n="[title]DRY_Repetition_Penalty_desc"> | 1406 | <h4 class="wide100p textAlignCenter" title="DRY penalizes tokens that would extend the end of the input into a sequence that has previously occurred in the input. Set multiplier to 0 to disable." data-i18n="[title]DRY_Repetition_Penalty_desc"> |
| 1402 | <label data-i18n="DRY Repetition Penalty">DRY Repetition Penalty</label> | 1407 | <label data-i18n="DRY Repetition Penalty">DRY Repetition Penalty</label> |
| 1403 | <a href="https://github.com/oobabooga/text-generation-webui/pull/5677" target="_blank"> | 1408 | <a href="https://github.com/oobabooga/text-generation-webui/pull/5677" target="_blank"> |
| @@ -1519,15 +1524,15 @@ | |||
| 1519 | <div class=""> | 1524 | <div class=""> |
| 1520 | <label class="checkbox_label" for="early_stopping_textgenerationwebui"> | 1525 | <label class="checkbox_label" for="early_stopping_textgenerationwebui"> |
| 1521 | <input type="checkbox" id="early_stopping_textgenerationwebui" /> | 1526 | <input type="checkbox" id="early_stopping_textgenerationwebui" /> |
| 1522 | <small data-i18n="Early Stopping">Early Stopping | 1527 | <small data-i18n="Early Stopping">Early Stopping</small> |
| 1523 | <div class="fa-solid fa-circle-info opacity50p" data-i18n="[title]Controls the stopping condition for beam search. If checked, the generation stops as soon as there are '# of Beams' sequences. If not checked, a heuristic is applied and the generation is stopped when it's very unlikely to find better candidates." title="Controls the stopping condition for beam search. If checked, the generation stops as soon as there are '# of Beams' sequences. If not checked, a heuristic is applied and the generation is stopped when it's very unlikely to find better candidates."></div> | 1528 | <div class="fa-solid fa-circle-info opacity50p" data-i18n="[title]Controls the stopping condition for beam search. If checked, the generation stops as soon as there are '# of Beams' sequences. If not checked, a heuristic is applied and the generation is stopped when it's very unlikely to find better candidates." title="Controls the stopping condition for beam search. If checked, the generation stops as soon as there are '# of Beams' sequences. If not checked, a heuristic is applied and the generation is stopped when it's very unlikely to find better candidates."></div> |
| 1524 | </small> | ||
| 1525 | </label> | 1529 | </label> |
| 1526 | </div> | 1530 | </div> |
| 1527 | </div> | 1531 | </div> |
| 1528 | </div> | 1532 | </div> |
| 1529 | <div data-tg-type="ooba" id="contrastiveSearchBlock" name="contrastiveSearchBlock" class="alignitemscenter flex-container flexFlowColumn flexBasis48p flexGrow flexShrink gap0"> | 1533 | <div data-tg-type="ooba" id="contrastiveSearchBlock" name="contrastiveSearchBlock" class="alignitemscenter flex-container flexFlowColumn flexBasis48p flexGrow flexShrink gap0"> |
| 1530 | <h4 class="textAlignCenter" data-i18n="Contrastive search">Contrastive Search | 1534 | <h4 class="textAlignCenter"> |
| 1535 | <span data-i18n="Contrastive search">Contrastive Search</span> | ||
| 1531 | <div class=" fa-solid fa-circle-info opacity50p " data-i18n="Contrastive_search_txt" title="A sampler that encourages diversity while maintaining coherence, by exploiting the isotropicity of the representation space of most LLMs. For details, see the paper A Contrastive Framework for Neural Text Generation by Su et al. (2022)."></div> | 1536 | <div class=" fa-solid fa-circle-info opacity50p " data-i18n="Contrastive_search_txt" title="A sampler that encourages diversity while maintaining coherence, by exploiting the isotropicity of the representation space of most LLMs. For details, see the paper A Contrastive Framework for Neural Text Generation by Su et al. (2022)."></div> |
| 1532 | </h4> | 1537 | </h4> |
| 1533 | <div class="alignitemscenter flex-container flexFlowColumn wide100p gap0"> | 1538 | <div class="alignitemscenter flex-container flexFlowColumn wide100p gap0"> |
| @@ -1561,9 +1566,8 @@ | |||
| 1561 | </label> | 1566 | </label> |
| 1562 | <label data-tg-type="vllm, aphrodite, infermaticai" class="checkbox_label" for="ignore_eos_token_textgenerationwebui"> | 1567 | <label data-tg-type="vllm, aphrodite, infermaticai" class="checkbox_label" for="ignore_eos_token_textgenerationwebui"> |
| 1563 | <input type="checkbox" id="ignore_eos_token_textgenerationwebui" /> | 1568 | <input type="checkbox" id="ignore_eos_token_textgenerationwebui" /> |
| 1564 | <small data-i18n="Ignore EOS Token">Ignore EOS Token | 1569 | <small data-i18n="Ignore EOS Token">Ignore EOS Token</small> |
| 1565 | <div class="fa-solid fa-circle-info opacity50p " data-i18n="[title]Ignore the EOS Token even if it generates." title="Ignore the EOS Token even if it generates."></div> | 1570 | <div class="fa-solid fa-circle-info opacity50p " data-i18n="[title]Ignore the EOS Token even if it generates." title="Ignore the EOS Token even if it generates."></div> |
| 1566 | </small> | ||
| 1567 | </label> | 1571 | </label> |
| 1568 | <label class="checkbox_label flexGrow flexShrink" for="skip_special_tokens_textgenerationwebui"> | 1572 | <label class="checkbox_label flexGrow flexShrink" for="skip_special_tokens_textgenerationwebui"> |
| 1569 | <input type="checkbox" id="skip_special_tokens_textgenerationwebui" /> | 1573 | <input type="checkbox" id="skip_special_tokens_textgenerationwebui" /> |
| @@ -1624,7 +1628,8 @@ | |||
| 1624 | </div> | 1628 | </div> |
| 1625 | <div id="cfg_block_ooba" data-tg-type="ooba, tabby" class="wide100p"> | 1629 | <div id="cfg_block_ooba" data-tg-type="ooba, tabby" class="wide100p"> |
| 1626 | <hr class="width100p"> | 1630 | <hr class="width100p"> |
| 1627 | <h4 data-i18n="CFG" class="textAlignCenter">CFG | 1631 | <h4 class="textAlignCenter"> |
| 1632 | <span data-i18n="CFG">CFG</span> | ||
| 1628 | <div class="margin5 fa-solid fa-circle-info opacity50p " data-i18n="[title]Classifier Free Guidance. More helpful tip coming soon" title="Classifier Free Guidance. More helpful tip coming soon."></div> | 1633 | <div class="margin5 fa-solid fa-circle-info opacity50p " data-i18n="[title]Classifier Free Guidance. More helpful tip coming soon" title="Classifier Free Guidance. More helpful tip coming soon."></div> |
| 1629 | </h4> | 1634 | </h4> |
| 1630 | <div class="alignitemscenter flex-container flexFlowColumn flexShrink gap0"> | 1635 | <div class="alignitemscenter flex-container flexFlowColumn flexShrink gap0"> |
| @@ -1954,23 +1959,16 @@ | |||
| 1954 | Send the system prompt for supported models. If disabled, the user message is added to the beginning of the prompt. | 1959 | Send the system prompt for supported models. If disabled, the user message is added to the beginning of the prompt. |
| 1955 | </span> | 1960 | </span> |
| 1956 | </div> | 1961 | </div> |
| 1957 | <div id="claude_human_sysprompt_message_block" class="wide100p"> | ||
| 1958 | <div class="range-block-title openai_restorable"> | ||
| 1959 | <span data-i18n="User first message">User first message</span> | ||
| 1960 | <div id="claude_human_sysprompt_message_restore" title="Restore User first message" data-i18n="[title]Restore User first message" class="right_menu_button"> | ||
| 1961 | <div class="fa-solid fa-clock-rotate-left"></div> | ||
| 1962 | </div> | 1962 | </div> |
| 1963 | </div> | 1963 | </div> |
| 1964 | <textarea id="claude_human_sysprompt_textarea" class="text_pole textarea_compact autoSetHeight" rows="2" data-i18n="[placeholder]Human message" placeholder="Human message, instruction, etc. Adds nothing when empty, i.e. requires a new prompt with the role 'user'."></textarea> | 1964 | <div class="range-block m-t-1" data-source="openai,openrouter,scale,custom"> |
| 1965 | </div> | ||
| 1966 | </div> | ||
| 1967 | </div> | ||
| 1968 | <div class="range-block m-t-1" data-source="openai,openrouter,scale"> | ||
| 1969 | <div id="logit_bias_openai" class="range-block-title openai_restorable" data-i18n="Logit Bias"> | 1965 | <div id="logit_bias_openai" class="range-block-title openai_restorable" data-i18n="Logit Bias"> |
| 1970 | Logit Bias | 1966 | Logit Bias |
| 1971 | </div> | 1967 | </div> |
| 1972 | <div class="toggle-description justifyLeft" data-i18n="Helps to ban or reenforce the usage of certain words"> | 1968 | <div class="toggle-description justifyLeft"> |
| 1973 | Helps to ban or reinforce the usage of certain tokens. Confirm token parsing with <a target="_blank" href="https://platform.openai.com/tokenizer/">Tokenizer</a>. | 1969 | <span data-i18n="Helps to ban or reenforce the usage of certain words">Helps to ban or reinforce the usage of certain tokens.</span> |
| 1970 | <span data-i18n="Confirm token parsing with">Confirm token parsing with</span> | ||
| 1971 | <a target="_blank" href="https://platform.openai.com/tokenizer/" data-i18n="Tokenizer">Tokenizer</a>. | ||
| 1974 | </div> | 1972 | </div> |
| 1975 | <div class="openai_logit_bias_preset_form"> | 1973 | <div class="openai_logit_bias_preset_form"> |
| 1976 | <select id="openai_logit_bias_preset"> | 1974 | <select id="openai_logit_bias_preset"> |
| @@ -2271,8 +2269,8 @@ | |||
| 2271 | <div data-tg-type="mancer" class="flex-container flexFlowColumn"> | 2269 | <div data-tg-type="mancer" class="flex-container flexFlowColumn"> |
| 2272 | <div class="flex-container flexFlowColumn"> | 2270 | <div class="flex-container flexFlowColumn"> |
| 2273 | </div> | 2271 | </div> |
| 2274 | <h4 data-i18n="Mancer API key"> | 2272 | <h4> |
| 2275 | Mancer API key | 2273 | <span data-i18n="Mancer API key">Mancer API key</span> |
| 2276 | <a href="https://mancer.tech/" class="notes-link" target="_blank"> | 2274 | <a href="https://mancer.tech/" class="notes-link" target="_blank"> |
| 2277 | <span class="fa-solid fa-circle-question note-link-span"></span> | 2275 | <span class="fa-solid fa-circle-question note-link-span"></span> |
| 2278 | </a> | 2276 | </a> |
| @@ -2568,15 +2566,21 @@ | |||
| 2568 | <input id="koboldcpp_api_url_text" class="text_pole wide100p" value="" autocomplete="off" data-server-history="koboldcpp"> | 2566 | <input id="koboldcpp_api_url_text" class="text_pole wide100p" value="" autocomplete="off" data-server-history="koboldcpp"> |
| 2569 | </div> | 2567 | </div> |
| 2570 | </div> | 2568 | </div> |
| 2569 | <div class="flex-container flexFlowColumn marginTopBot5"> | ||
| 2570 | <label data-tg-type="ooba" class="checkbox_label" for="bypass_status_check_textgenerationwebui"> | ||
| 2571 | <input type="checkbox" id="bypass_status_check_textgenerationwebui" /> | ||
| 2572 | <span data-i18n="Bypass status check">Bypass status check</span> | ||
| 2573 | </label> | ||
| 2574 | <label data-tg-type="koboldcpp, llamacpp" class="checkbox_label" for="context_size_derived"> | ||
| 2575 | <input type="checkbox" id="context_size_derived" /> | ||
| 2576 | <span data-i18n="Derive context size from backend">Derive context size from backend</span> | ||
| 2577 | </label> | ||
| 2578 | </div> | ||
| 2571 | <div class="flex-container"> | 2579 | <div class="flex-container"> |
| 2572 | <div id="api_button_textgenerationwebui" class="api_button menu_button menu_button_icon" type="submit" data-i18n="Connect" data-server-connect="ooba_blocking,vllm,aphrodite,tabby,koboldcpp,ollama,llamacpp,huggingface">Connect</div> | 2580 | <div id="api_button_textgenerationwebui" class="api_button menu_button menu_button_icon" type="submit" data-i18n="Connect" data-server-connect="ooba_blocking,vllm,aphrodite,tabby,koboldcpp,ollama,llamacpp,huggingface">Connect</div> |
| 2573 | <div data-tg-type="openrouter" class="menu_button menu_button_icon openrouter_authorize" title="Get your OpenRouter API token using OAuth flow. You will be redirected to openrouter.ai" data-i18n="Authorize;[title]Get your OpenRouter API token using OAuth flow. You will be redirected to openrouter.ai">Authorize</div> | 2581 | <div data-tg-type="openrouter" class="menu_button menu_button_icon openrouter_authorize" title="Get your OpenRouter API token using OAuth flow. You will be redirected to openrouter.ai" data-i18n="Authorize;[title]Get your OpenRouter API token using OAuth flow. You will be redirected to openrouter.ai">Authorize</div> |
| 2574 | <div class="api_loading menu_button menu_button_icon" data-i18n="Cancel">Cancel</div> | 2582 | <div class="api_loading menu_button menu_button_icon" data-i18n="Cancel">Cancel</div> |
| 2575 | </div> | 2583 | </div> |
| 2576 | <label data-tg-type="ooba" class="checkbox_label margin-bot-10px" for="bypass_status_check_textgenerationwebui"> | ||
| 2577 | <input type="checkbox" id="bypass_status_check_textgenerationwebui" /> | ||
| 2578 | <span data-i18n="Bypass status check">Bypass status check</span> | ||
| 2579 | </label> | ||
| 2580 | </form> | 2584 | </form> |
| 2581 | <div class="online_status"> | 2585 | <div class="online_status"> |
| 2582 | <div class="online_status_indicator"></div> | 2586 | <div class="online_status_indicator"></div> |
| @@ -2601,6 +2605,7 @@ | |||
| 2601 | <option value="groq">Groq</option> | 2605 | <option value="groq">Groq</option> |
| 2602 | <option value="makersuite">Google AI Studio</option> | 2606 | <option value="makersuite">Google AI Studio</option> |
| 2603 | <option value="mistralai">MistralAI</option> | 2607 | <option value="mistralai">MistralAI</option> |
| 2608 | <option value="nanogpt">NanoGPT</option> | ||
| 2604 | <option value="openrouter">OpenRouter</option> | 2609 | <option value="openrouter">OpenRouter</option> |
| 2605 | <option value="perplexity">Perplexity</option> | 2610 | <option value="perplexity">Perplexity</option> |
| 2606 | <option value="scale">Scale</option> | 2611 | <option value="scale">Scale</option> |
| @@ -2618,8 +2623,9 @@ | |||
| 2618 | </div> | 2623 | </div> |
| 2619 | <div class="toggle-description justifyLeft"> | 2624 | <div class="toggle-description justifyLeft"> |
| 2620 | <span data-i18n="Saved addresses and passwords."> | 2625 | <span data-i18n="Saved addresses and passwords."> |
| 2621 | Saved addresses and passwords.<br> | 2626 | Saved addresses and passwords. |
| 2622 | </span> | 2627 | </span> |
| 2628 | <br> | ||
| 2623 | </div> | 2629 | </div> |
| 2624 | <div class="openai_logit_bias_preset_form"> | 2630 | <div class="openai_logit_bias_preset_form"> |
| 2625 | <select id="openai_proxy_preset"> | 2631 | <select id="openai_proxy_preset"> |
| @@ -2632,8 +2638,9 @@ | |||
| 2632 | </div> | 2638 | </div> |
| 2633 | <div class="toggle-description justifyLeft"> | 2639 | <div class="toggle-description justifyLeft"> |
| 2634 | <span data-i18n="This will show up as your saved preset."> | 2640 | <span data-i18n="This will show up as your saved preset."> |
| 2635 | This will show up as your saved preset.<br> | 2641 | This will show up as your saved preset. |
| 2636 | </span> | 2642 | </span> |
| 2643 | <br> | ||
| 2637 | </div> | 2644 | </div> |
| 2638 | <div class="wide100p"> | 2645 | <div class="wide100p"> |
| 2639 | <input id="openai_reverse_proxy_name" type="text" class="text_pole" placeholder="..." /> | 2646 | <input id="openai_reverse_proxy_name" type="text" class="text_pole" placeholder="..." /> |
| @@ -2643,8 +2650,9 @@ | |||
| 2643 | </div> | 2650 | </div> |
| 2644 | <div class="toggle-description justifyLeft wide100p"> | 2651 | <div class="toggle-description justifyLeft wide100p"> |
| 2645 | <span data-i18n="Alternative server URL (leave empty to use the default value)."> | 2652 | <span data-i18n="Alternative server URL (leave empty to use the default value)."> |
| 2646 | Alternative server URL (leave empty to use the default value).<br> | 2653 | Alternative server URL (leave empty to use the default value). |
| 2647 | </span> | 2654 | </span> |
| 2655 | <br> | ||
| 2648 | </div> | 2656 | </div> |
| 2649 | <div class="wide100p"> | 2657 | <div class="wide100p"> |
| 2650 | <input id="openai_reverse_proxy" type="text" class="text_pole" placeholder="https://api.openai.com/v1" /> | 2658 | <input id="openai_reverse_proxy" type="text" class="text_pole" placeholder="https://api.openai.com/v1" /> |
| @@ -2657,8 +2665,9 @@ | |||
| 2657 | </div> | 2665 | </div> |
| 2658 | <div class="toggle-description justifyLeft"> | 2666 | <div class="toggle-description justifyLeft"> |
| 2659 | <span data-i18n="Will be used as a password for the proxy instead of API key."> | 2667 | <span data-i18n="Will be used as a password for the proxy instead of API key."> |
| 2660 | Will be used as a password for the proxy instead of API key.<br> | 2668 | Will be used as a password for the proxy instead of API key. |
| 2661 | </span> | 2669 | </span> |
| 2670 | <br> | ||
| 2662 | </div> | 2671 | </div> |
| 2663 | <div class="flex-container width100p"> | 2672 | <div class="flex-container width100p"> |
| 2664 | <input id="openai_proxy_password" type="password" class="text_pole flex1" placeholder="" form="openai_form" autocomplete="off" /> | 2673 | <input id="openai_proxy_password" type="password" class="text_pole flex1" placeholder="" form="openai_form" autocomplete="off" /> |
| @@ -2739,6 +2748,7 @@ | |||
| 2739 | </optgroup> | 2748 | </optgroup> |
| 2740 | <optgroup label="GPT-4o"> | 2749 | <optgroup label="GPT-4o"> |
| 2741 | <option value="gpt-4o">gpt-4o</option> | 2750 | <option value="gpt-4o">gpt-4o</option> |
| 2751 | <option value="gpt-4o-2024-11-20">gpt-4o-2024-11-20</option> | ||
| 2742 | <option value="gpt-4o-2024-08-06">gpt-4o-2024-08-06</option> | 2752 | <option value="gpt-4o-2024-08-06">gpt-4o-2024-08-06</option> |
| 2743 | <option value="gpt-4o-2024-05-13">gpt-4o-2024-05-13</option> | 2753 | <option value="gpt-4o-2024-05-13">gpt-4o-2024-05-13</option> |
| 2744 | <option value="chatgpt-4o-latest">chatgpt-4o-latest</option> | 2754 | <option value="chatgpt-4o-latest">chatgpt-4o-latest</option> |
| @@ -2781,7 +2791,7 @@ | |||
| 2781 | </div> | 2791 | </div> |
| 2782 | </form> | 2792 | </form> |
| 2783 | <form id="claude_form" data-source="claude" action="javascript:void(null);" method="post" enctype="multipart/form-data"> | 2793 | <form id="claude_form" data-source="claude" action="javascript:void(null);" method="post" enctype="multipart/form-data"> |
| 2784 | <h4>Claude API Key</h4> | 2794 | <h4 data-i18n="Claude API Key">Claude API Key</h4> |
| 2785 | <div> | 2795 | <div> |
| 2786 | <span data-i18n="Get your key from">Get your key from </span> <a target="_blank" href="https://console.anthropic.com/account/keys" data-i18n="Anthropic's developer console">Anthropic's developer console</a>. | 2796 | <span data-i18n="Get your key from">Get your key from </span> <a target="_blank" href="https://console.anthropic.com/account/keys" data-i18n="Anthropic's developer console">Anthropic's developer console</a>. |
| 2787 | </div> | 2797 | </div> |
| @@ -2799,14 +2809,13 @@ | |||
| 2799 | <option value="claude-3-5-sonnet-latest">claude-3-5-sonnet-latest</option> | 2809 | <option value="claude-3-5-sonnet-latest">claude-3-5-sonnet-latest</option> |
| 2800 | <option value="claude-3-5-sonnet-20241022">claude-3-5-sonnet-20241022</option> | 2810 | <option value="claude-3-5-sonnet-20241022">claude-3-5-sonnet-20241022</option> |
| 2801 | <option value="claude-3-5-sonnet-20240620">claude-3-5-sonnet-20240620</option> | 2811 | <option value="claude-3-5-sonnet-20240620">claude-3-5-sonnet-20240620</option> |
| 2812 | <option value="claude-3-5-haiku-latest">claude-3-5-haiku-latest</option> | ||
| 2813 | <option value="claude-3-5-haiku-20241022">claude-3-5-haiku-20241022</option> | ||
| 2802 | <option value="claude-3-opus-20240229">claude-3-opus-20240229</option> | 2814 | <option value="claude-3-opus-20240229">claude-3-opus-20240229</option> |
| 2803 | <option value="claude-3-sonnet-20240229">claude-3-sonnet-20240229</option> | 2815 | <option value="claude-3-sonnet-20240229">claude-3-sonnet-20240229</option> |
| 2804 | <option value="claude-3-haiku-20240307">claude-3-haiku-20240307</option> | 2816 | <option value="claude-3-haiku-20240307">claude-3-haiku-20240307</option> |
| 2805 | <option value="claude-2.1">claude-2.1</option> | 2817 | <option value="claude-2.1">claude-2.1</option> |
| 2806 | <option value="claude-2.0">claude-2.0</option> | 2818 | <option value="claude-2.0">claude-2.0</option> |
| 2807 | <option value="claude-1.3">claude-1.3</option> | ||
| 2808 | <option value="claude-instant-1.2">claude-instant-1.2</option> | ||
| 2809 | <option value="claude-instant-1.1">claude-instant-1.1</option> | ||
| 2810 | </optgroup> | 2819 | </optgroup> |
| 2811 | </select> | 2820 | </select> |
| 2812 | </div> | 2821 | </div> |
| @@ -2976,6 +2985,8 @@ | |||
| 2976 | <option value="chat-bison-001">PaLM 2 Chat (Legacy)</option> | 2985 | <option value="chat-bison-001">PaLM 2 Chat (Legacy)</option> |
| 2977 | </optgroup> | 2986 | </optgroup> |
| 2978 | <optgroup label="Subversions"> | 2987 | <optgroup label="Subversions"> |
| 2988 | <option value="gemini-exp-1121">Gemini Experimental 2024-11-21</option> | ||
| 2989 | <option value="gemini-exp-1114">Gemini Experimental 2024-11-14</option> | ||
| 2979 | <option value="gemini-1.5-pro-exp-0801">Gemini 1.5 Pro Experiment 2024-08-01</option> | 2990 | <option value="gemini-1.5-pro-exp-0801">Gemini 1.5 Pro Experiment 2024-08-01</option> |
| 2980 | <option value="gemini-1.5-pro-exp-0827">Gemini 1.5 Pro Experiment 2024-08-27</option> | 2991 | <option value="gemini-1.5-pro-exp-0827">Gemini 1.5 Pro Experiment 2024-08-27</option> |
| 2981 | <option value="gemini-1.5-pro-latest">Gemini 1.5 Pro [latest]</option> | 2992 | <option value="gemini-1.5-pro-latest">Gemini 1.5 Pro [latest]</option> |
| @@ -3022,6 +3033,7 @@ | |||
| 3022 | <option value="codestral-latest">codestral-latest</option> | 3033 | <option value="codestral-latest">codestral-latest</option> |
| 3023 | <option value="codestral-mamba-latest">codestral-mamba-latest</option> | 3034 | <option value="codestral-mamba-latest">codestral-mamba-latest</option> |
| 3024 | <option value="pixtral-12b-latest">pixtral-12b-latest</option> | 3035 | <option value="pixtral-12b-latest">pixtral-12b-latest</option> |
| 3036 | <option value="pixtral-large-latest">pixtral-large-latest</option> | ||
| 3025 | </optgroup> | 3037 | </optgroup> |
| 3026 | <optgroup label="Sub-versions"> | 3038 | <optgroup label="Sub-versions"> |
| 3027 | <option value="open-mistral-nemo-2407">open-mistral-nemo-2407</option> | 3039 | <option value="open-mistral-nemo-2407">open-mistral-nemo-2407</option> |
| @@ -3036,10 +3048,12 @@ | |||
| 3036 | <option value="mistral-medium-2312">mistral-medium-2312</option> | 3048 | <option value="mistral-medium-2312">mistral-medium-2312</option> |
| 3037 | <option value="mistral-large-2402">mistral-large-2402</option> | 3049 | <option value="mistral-large-2402">mistral-large-2402</option> |
| 3038 | <option value="mistral-large-2407">mistral-large-2407</option> | 3050 | <option value="mistral-large-2407">mistral-large-2407</option> |
| 3051 | <option value="mistral-large-2411">mistral-large-2411</option> | ||
| 3039 | <option value="codestral-2405">codestral-2405</option> | 3052 | <option value="codestral-2405">codestral-2405</option> |
| 3040 | <option value="codestral-2405-blue">codestral-2405-blue</option> | 3053 | <option value="codestral-2405-blue">codestral-2405-blue</option> |
| 3041 | <option value="codestral-mamba-2407">codestral-mamba-2407</option> | 3054 | <option value="codestral-mamba-2407">codestral-mamba-2407</option> |
| 3042 | <option value="pixtral-12b-2409">pixtral-12b-2409</option> | 3055 | <option value="pixtral-12b-2409">pixtral-12b-2409</option> |
| 3056 | <option value="pixtral-large-2411">pixtral-large-2411</option> | ||
| 3043 | </optgroup> | 3057 | </optgroup> |
| 3044 | <optgroup id="mistralai_other_models" label="Other"></optgroup> | 3058 | <optgroup id="mistralai_other_models" label="Other"></optgroup> |
| 3045 | </select> | 3059 | </select> |
| @@ -3083,6 +3097,22 @@ | |||
| 3083 | </optgroup> | 3097 | </optgroup> |
| 3084 | </select> | 3098 | </select> |
| 3085 | </div> | 3099 | </div> |
| 3100 | <div id="nanogpt_form" data-source="nanogpt"> | ||
| 3101 | <h4 data-i18n="NanoGPT API Key">NanoGPT API Key</h4> | ||
| 3102 | <div class="flex-container"> | ||
| 3103 | <input id="api_key_nanogpt" name="api_key_nanogpt" class="text_pole flex1" value="" type="text" autocomplete="off"> | ||
| 3104 | <div title="Clear your API key" data-i18n="[title]Clear your API key" class="menu_button fa-solid fa-circle-xmark clear-api-key" data-key="api_key_nanogpt"></div> | ||
| 3105 | </div> | ||
| 3106 | <div data-for="api_key_nanogpt" class="neutral_warning" data-i18n="For privacy reasons, your API key will be hidden after you reload the page."> | ||
| 3107 | For privacy reasons, your API key will be hidden after you reload the page. | ||
| 3108 | </div> | ||
| 3109 | <div> | ||
| 3110 | <h4 data-i18n="NanoGPT Model">NanoGPT Model</h4> | ||
| 3111 | <select id="model_nanogpt_select"> | ||
| 3112 | <option value="" data-i18n="-- Connect to the API --">-- Connect to the API --</option> | ||
| 3113 | </select> | ||
| 3114 | </div> | ||
| 3115 | </div> | ||
| 3086 | <div id="perplexity_form" data-source="perplexity"> | 3116 | <div id="perplexity_form" data-source="perplexity"> |
| 3087 | <h4 data-i18n="Perplexity API Key">Perplexity API Key</h4> | 3117 | <h4 data-i18n="Perplexity API Key">Perplexity API Key</h4> |
| 3088 | <div class="flex-container"> | 3118 | <div class="flex-container"> |
| @@ -3136,6 +3166,8 @@ | |||
| 3136 | <h4 data-i18n="Cohere Model">Cohere Model</h4> | 3166 | <h4 data-i18n="Cohere Model">Cohere Model</h4> |
| 3137 | <select id="model_cohere_select"> | 3167 | <select id="model_cohere_select"> |
| 3138 | <optgroup label="Stable"> | 3168 | <optgroup label="Stable"> |
| 3169 | <option value="c4ai-aya-expanse-32b">c4ai-aya-expanse-32b</option> | ||
| 3170 | <option value="c4ai-aya-expanse-8b">c4ai-aya-expanse-8b</option> | ||
| 3139 | <option value="c4ai-aya-23-35b">c4ai-aya-23-35b</option> | 3171 | <option value="c4ai-aya-23-35b">c4ai-aya-23-35b</option> |
| 3140 | <option value="c4ai-aya-23-8b">c4ai-aya-23-8b</option> | 3172 | <option value="c4ai-aya-23-8b">c4ai-aya-23-8b</option> |
| 3141 | <option value="command-light">command-light</option> | 3173 | <option value="command-light">command-light</option> |
| @@ -3247,8 +3279,14 @@ | |||
| 3247 | </div> | 3279 | </div> |
| 3248 | <div id="AdvancedFormatting" class="drawer-content"> | 3280 | <div id="AdvancedFormatting" class="drawer-content"> |
| 3249 | <div class="flex-container alignItemsBaseline"> | 3281 | <div class="flex-container alignItemsBaseline"> |
| 3250 | <h3 class="margin0 flex1" data-i18n="Advanced Formatting"> | 3282 | <h3 class="margin0 flex1 flex-container alignItemsBaseline"> |
| 3283 | <span data-i18n="Advanced Formatting"> | ||
| 3251 | Advanced Formatting | 3284 | Advanced Formatting |
| 3285 | </span> | ||
| 3286 | |||
| 3287 | <a href="https://docs.sillytavern.app/usage/core-concepts/advancedformatting/" class="notes-link" target="_blank"> | ||
| 3288 | <span class="fa-solid fa-circle-question note-link-span"></span> | ||
| 3289 | </a> | ||
| 3252 | </h3> | 3290 | </h3> |
| 3253 | <div class="flex-container"> | 3291 | <div class="flex-container"> |
| 3254 | <input id="af_master_import_file" type="file" hidden accept=".json" class="displayNone"> | 3292 | <input id="af_master_import_file" type="file" hidden accept=".json" class="displayNone"> |
| @@ -3268,9 +3306,12 @@ | |||
| 3268 | <h4 class="standoutHeader title_restorable"> | 3306 | <h4 class="standoutHeader title_restorable"> |
| 3269 | <div> | 3307 | <div> |
| 3270 | <span data-i18n="Context Template">Context Template</span> | 3308 | <span data-i18n="Context Template">Context Template</span> |
| 3271 | <a href="https://docs.sillytavern.app/usage/core-concepts/advancedformatting/#context-template" class="notes-link" target="_blank"> | 3309 | </div> |
| 3272 | <span class="fa-solid fa-circle-question note-link-span"></span> | 3310 | <div class="flex-container"> |
| 3273 | </a> | 3311 | <label for="context_derived" class="checkbox_label flex1" title="Derive from Model Metadata, if possible." data-i18n="[title]context_derived"> |
| 3312 | <input id="context_derived" type="checkbox" style="display:none;" /> | ||
| 3313 | <small><i class="fa-solid fa-bolt menu_button margin0"></i></small> | ||
| 3314 | </label> | ||
| 3274 | </div> | 3315 | </div> |
| 3275 | </h4> | 3316 | </h4> |
| 3276 | <div class="flex-container" title="Select your current Context Template" data-i18n="[title]Select your current Context Template"> | 3317 | <div class="flex-container" title="Select your current Context Template" data-i18n="[title]Select your current Context Template"> |
| @@ -3367,11 +3408,12 @@ | |||
| 3367 | <h4 class="standoutHeader title_restorable justifySpaceBetween"> | 3408 | <h4 class="standoutHeader title_restorable justifySpaceBetween"> |
| 3368 | <div class="flex-container"> | 3409 | <div class="flex-container"> |
| 3369 | <span data-i18n="Instruct Template">Instruct Template</span> | 3410 | <span data-i18n="Instruct Template">Instruct Template</span> |
| 3370 | <a href="https://docs.sillytavern.app/usage/core-concepts/instructmode/" class="notes-link" target="_blank"> | ||
| 3371 | <span class="fa-solid fa-circle-question note-link-span"></span> | ||
| 3372 | </a> | ||
| 3373 | </div> | 3411 | </div> |
| 3374 | <div class="flex-container"> | 3412 | <div class="flex-container"> |
| 3413 | <label for="instruct_derived" class="checkbox_label flex1" title="Derive from Model Metadata, if possible." data-i18n="[title]instruct_derived"> | ||
| 3414 | <input id="instruct_derived" type="checkbox" style="display:none;" /> | ||
| 3415 | <small><i class="fa-solid fa-bolt menu_button margin0"></i></small> | ||
| 3416 | </label> | ||
| 3375 | <label for="instruct_bind_to_context" class="checkbox_label flex1" title="Bind to Context
If enabled, Context templates will be automatically selected based on selected Instruct template name or by preference." data-i18n="[title]instruct_bind_to_context"> | 3417 | <label for="instruct_bind_to_context" class="checkbox_label flex1" title="Bind to Context
If enabled, Context templates will be automatically selected based on selected Instruct template name or by preference." data-i18n="[title]instruct_bind_to_context"> |
| 3376 | <input id="instruct_bind_to_context" type="checkbox" style="display:none;" /> | 3418 | <input id="instruct_bind_to_context" type="checkbox" style="display:none;" /> |
| 3377 | <small><i class="fa-solid fa-link menu_button margin0"></i></small> | 3419 | <small><i class="fa-solid fa-link menu_button margin0"></i></small> |
| @@ -3552,9 +3594,6 @@ | |||
| 3552 | <h4 class="standoutHeader title_restorable justifySpaceBetween"> | 3594 | <h4 class="standoutHeader title_restorable justifySpaceBetween"> |
| 3553 | <div class="flex-container"> | 3595 | <div class="flex-container"> |
| 3554 | <span data-i18n="System Prompt">System Prompt</span> | 3596 | <span data-i18n="System Prompt">System Prompt</span> |
| 3555 | <a href="https://docs.sillytavern.app/usage/core-concepts/advancedformatting/#system-prompt" class="notes-link" target="_blank"> | ||
| 3556 | <span class="fa-solid fa-circle-question note-link-span"></span> | ||
| 3557 | </a> | ||
| 3558 | </div> | 3597 | </div> |
| 3559 | <div class="flex-container"> | 3598 | <div class="flex-container"> |
| 3560 | <label id="sysprompt_enabled_label" for="sysprompt_enabled" class="checkbox_label flex1" title="Enable System Prompt" data-i18n="[title]sysprompt_enabled"> | 3599 | <label id="sysprompt_enabled_label" for="sysprompt_enabled" class="checkbox_label flex1" title="Enable System Prompt" data-i18n="[title]sysprompt_enabled"> |
| @@ -3622,7 +3661,7 @@ | |||
| 3622 | <div name="tokenizerSettingsBlock"> | 3661 | <div name="tokenizerSettingsBlock"> |
| 3623 | <div name="tokenizerSelectorBlock"> | 3662 | <div name="tokenizerSelectorBlock"> |
| 3624 | <h4 class="standoutHeader"><span data-i18n="Tokenizer">Tokenizer</span> | 3663 | <h4 class="standoutHeader"><span data-i18n="Tokenizer">Tokenizer</span> |
| 3625 | <a href="https://docs.sillytavern.app/usage/core-concepts/advancedformatting/#tokenizer" class="notes-link" target="_blank"> | 3664 | <a href="https://docs.sillytavern.app/usage/prompts/tokenizer/" class="notes-link" target="_blank"> |
| 3626 | <span class="fa-solid fa-circle-question note-link-span"></span> | 3665 | <span class="fa-solid fa-circle-question note-link-span"></span> |
| 3627 | </a> | 3666 | </a> |
| 3628 | </h4> | 3667 | </h4> |
| @@ -3648,10 +3687,8 @@ | |||
| 3648 | </div> | 3687 | </div> |
| 3649 | <div class="range-block flex-container flexnowrap" name="tokenPaddingBlock"> | 3688 | <div class="range-block flex-container flexnowrap" name="tokenPaddingBlock"> |
| 3650 | <div class="range-block-title justifyLeft"> | 3689 | <div class="range-block-title justifyLeft"> |
| 3651 | <small data-i18n="Token Padding" class="flex-container">Token Padding | 3690 | <small data-i18n="Token Padding"> |
| 3652 | <a href="https://docs.sillytavern.app/usage/core-concepts/advancedformatting/#token-padding" class="notes-link" target="_blank"> | 3691 | Token Padding |
| 3653 | <span class="fa-solid fa-circle-question note-link-span"></span> | ||
| 3654 | </a> | ||
| 3655 | </small> | 3692 | </small> |
| 3656 | </div> | 3693 | </div> |
| 3657 | <input id="token_padding" class="text_pole textarea_compact" type="number" min="-2048" max="2048" /> | 3694 | <input id="token_padding" class="text_pole textarea_compact" type="number" min="-2048" max="2048" /> |
| @@ -3718,7 +3755,11 @@ | |||
| 3718 | <div id="wiTopBlock" class="flex-container"> | 3755 | <div id="wiTopBlock" class="flex-container"> |
| 3719 | <div id="WIMultiSelector" class="flex1 flex alignSelfStart range-block"> | 3756 | <div id="WIMultiSelector" class="flex1 flex alignSelfStart range-block"> |
| 3720 | <div class="range-block-title justifyLeft"> | 3757 | <div class="range-block-title justifyLeft"> |
| 3721 | <span data-i18n="Active World(s) for all chats"><small>Active World(s) for all chats</small></span> | 3758 | <span> |
| 3759 | <small data-i18n="Active World(s) for all chats"> | ||
| 3760 | Active World(s) for all chats | ||
| 3761 | </small> | ||
| 3762 | </span> | ||
| 3722 | </div> | 3763 | </div> |
| 3723 | <div class="range-block-range"> | 3764 | <div class="range-block-range"> |
| 3724 | <select id="world_info" class="select2_multi_sameline" multiple> | 3765 | <select id="world_info" class="select2_multi_sameline" multiple> |
| @@ -3903,7 +3944,13 @@ | |||
| 3903 | <div name="userSettingsRowOne" class="flex-container flexFlowRow alignitemscenter spaceBetween"> | 3944 | <div name="userSettingsRowOne" class="flex-container flexFlowRow alignitemscenter spaceBetween"> |
| 3904 | <div class="flex-container"> | 3945 | <div class="flex-container"> |
| 3905 | <div class="flex-container flexnowrap alignItemsBaseline"> | 3946 | <div class="flex-container flexnowrap alignItemsBaseline"> |
| 3906 | <h3 class="margin0"><span data-i18n="User Settings">User Settings</span></h3> | 3947 | <h3 class="margin0"> |
| 3948 | <span data-i18n="User Settings">User Settings</span> | ||
| 3949 | |||
| 3950 | <a href="https://docs.sillytavern.app/usage/user_settings/" class="notes-link" target="_blank"> | ||
| 3951 | <span class="fa-solid fa-circle-question note-link-span"></span> | ||
| 3952 | </a> | ||
| 3953 | </h3> | ||
| 3907 | </div> | 3954 | </div> |
| 3908 | </div> | 3955 | </div> |
| 3909 | <div id="UI-language-block" class="flex-container alignItemsBaseline"> | 3956 | <div id="UI-language-block" class="flex-container alignItemsBaseline"> |
| @@ -4037,7 +4084,10 @@ | |||
| 4037 | 4084 | ||
| 4038 | <div class="alignitemscenter flex-container flexFlowColumn flexBasis48p flexGrow flexShrink gap0"> | 4085 | <div class="alignitemscenter flex-container flexFlowColumn flexBasis48p flexGrow flexShrink gap0"> |
| 4039 | <small> | 4086 | <small> |
| 4040 | <span data-i18n="Chat Width">Chat Width <i class="fa-solid fa-desktop"></i></span> | 4087 | <span> |
| 4088 | <span data-i18n="Chat Width">Chat Width</span> | ||
| 4089 | <i class="fa-solid fa-desktop"></i> | ||
| 4090 | </span> | ||
| 4041 | <div class="fa-solid fa-circle-info opacity50p" data-i18n="[title]Width of the main chat window in % of screen width" title="Width of the main chat window in % of screen width"></div> | 4091 | <div class="fa-solid fa-circle-info opacity50p" data-i18n="[title]Width of the main chat window in % of screen width" title="Width of the main chat window in % of screen width"></div> |
| 4042 | </small> | 4092 | </small> |
| 4043 | <input class="neo-range-slider" type="range" id="chat_width_slider" name="chat_width_slider" min="25" max="100" step="1"> | 4093 | <input class="neo-range-slider" type="range" id="chat_width_slider" name="chat_width_slider" min="25" max="100" step="1"> |
| @@ -4209,7 +4259,7 @@ | |||
| 4209 | <div id="reload_chat" class="menu_button whitespacenowrap" data-i18n="[title]Reload and redraw the currently open chat" title="Reload and redraw the currently open chat."> | 4259 | <div id="reload_chat" class="menu_button whitespacenowrap" data-i18n="[title]Reload and redraw the currently open chat" title="Reload and redraw the currently open chat."> |
| 4210 | <small data-i18n="Reload Chat">Reload Chat</small> | 4260 | <small data-i18n="Reload Chat">Reload Chat</small> |
| 4211 | </div> | 4261 | </div> |
| 4212 | <div id="debug_menu" class="menu_button whitespacenowrap" data-i18n="Debug Menu"> | 4262 | <div id="debug_menu" class="menu_button whitespacenowrap"> |
| 4213 | <small data-i18n="Debug Menu">Debug Menu</small> | 4263 | <small data-i18n="Debug Menu">Debug Menu</small> |
| 4214 | </div> | 4264 | </div> |
| 4215 | </div> | 4265 | </div> |
| @@ -4236,9 +4286,6 @@ | |||
| 4236 | <audio id="audio_message_sound" src="sounds/message.mp3" hidden></audio> | 4286 | <audio id="audio_message_sound" src="sounds/message.mp3" hidden></audio> |
| 4237 | <span> | 4287 | <span> |
| 4238 | <small data-i18n="Message Sound">Message Sound</small> | 4288 | <small data-i18n="Message Sound">Message Sound</small> |
| 4239 | <a href="https://docs.sillytavern.app/usage/core-concepts/uicustomization/#message-sound" class="notes-link" target="_blank"> | ||
| 4240 | <span class="fa-solid fa-circle-question note-link-span"></span> | ||
| 4241 | </a> | ||
| 4242 | </span> | 4289 | </span> |
| 4243 | </label> | 4290 | </label> |
| 4244 | <label for="play_sound_unfocused" class="checkbox_label" title="Only play a sound when ST's browser tab is unfocused." data-i18n="[title]Only play a sound when ST's browser tab is unfocused"> | 4291 | <label for="play_sound_unfocused" class="checkbox_label" title="Only play a sound when ST's browser tab is unfocused." data-i18n="[title]Only play a sound when ST's browser tab is unfocused"> |
| @@ -4331,8 +4378,10 @@ | |||
| 4331 | </div> | 4378 | </div> |
| 4332 | </div> | 4379 | </div> |
| 4333 | <div id="examples-behavior-block"> | 4380 | <div id="examples-behavior-block"> |
| 4334 | <label data-i18n="Example Messages Behavior"> | 4381 | <label> |
| 4335 | <small>Example Messages Behavior:</small> | 4382 | <small data-i18n="Example Messages Behavior"> |
| 4383 | Example Messages Behavior: | ||
| 4384 | </small> | ||
| 4336 | </label> | 4385 | </label> |
| 4337 | <select id="example_messages_behavior"> | 4386 | <select id="example_messages_behavior"> |
| 4338 | <option value="normal" data-i18n="Gradual push-out">Gradual push-out</option> | 4387 | <option value="normal" data-i18n="Gradual push-out">Gradual push-out</option> |
| @@ -4399,13 +4448,6 @@ | |||
| 4399 | <input id="auto_fix_generated_markdown" type="checkbox" /> | 4448 | <input id="auto_fix_generated_markdown" type="checkbox" /> |
| 4400 | <small data-i18n="Auto-fix Markdown">Auto-fix Markdown</small> | 4449 | <small data-i18n="Auto-fix Markdown">Auto-fix Markdown</small> |
| 4401 | </label> | 4450 | </label> |
| 4402 | <label class="checkbox_label" for="render_formulas" title="Render LaTeX and AsciiMath equation notation in chat messages. Powered by KaTeX." data-i18n="[title]Render LaTeX and AsciiMath equation notation in chat messages. Powered by KaTeX"> | ||
| 4403 | <input id="render_formulas" type="checkbox" /> | ||
| 4404 | <small data-i18n="Render Formulas">Render Formulas</small> | ||
| 4405 | <a href="https://docs.sillytavern.app/usage/core-concepts/uicustomization/#formulas-rendering" class="notes-link" target="_blank"> | ||
| 4406 | <small class="fa-solid fa-circle-question note-link-small"></small> | ||
| 4407 | </a> | ||
| 4408 | </label> | ||
| 4409 | <label class="checkbox_label" for="forbid_external_media" title="Disallow embedded media from other domains in chat messages." data-i18n="[title]Disallow embedded media from other domains in chat messages"> | 4451 | <label class="checkbox_label" for="forbid_external_media" title="Disallow embedded media from other domains in chat messages." data-i18n="[title]Disallow embedded media from other domains in chat messages"> |
| 4410 | <input id="forbid_external_media" type="checkbox" /> | 4452 | <input id="forbid_external_media" type="checkbox" /> |
| 4411 | <small data-i18n="Forbid External Media">Forbid External Media</small> | 4453 | <small data-i18n="Forbid External Media">Forbid External Media</small> |
| @@ -4460,7 +4502,7 @@ | |||
| 4460 | </div> | 4502 | </div> |
| 4461 | <div nane="AutoContiueBlock" class="inline-drawer wide100p flexFlowColumn"> | 4503 | <div nane="AutoContiueBlock" class="inline-drawer wide100p flexFlowColumn"> |
| 4462 | <div class="inline-drawer-toggle inline-drawer-header userSettingsInnerExpandable" title="Automatically 'continue' a response if the model stopped before reaching a certain amount of tokens."> | 4504 | <div class="inline-drawer-toggle inline-drawer-header userSettingsInnerExpandable" title="Automatically 'continue' a response if the model stopped before reaching a certain amount of tokens."> |
| 4463 | <b><span data-i18n="Auto-swipe">Auto-Continue</span></b> | 4505 | <b><span data-i18n="Auto-Continue">Auto-Continue</span></b> |
| 4464 | <div class="fa-solid fa-circle-chevron-down inline-drawer-icon down"></div> | 4506 | <div class="fa-solid fa-circle-chevron-down inline-drawer-icon down"></div> |
| 4465 | </div> | 4507 | </div> |
| 4466 | <div class="inline-drawer-content"> | 4508 | <div class="inline-drawer-content"> |
| @@ -4490,7 +4532,7 @@ | |||
| 4490 | </div> | 4532 | </div> |
| 4491 | </div> | 4533 | </div> |
| 4492 | <div name="AutoCompleteToggle" class="inline-drawer wide100p flexFlowColumn"> | 4534 | <div name="AutoCompleteToggle" class="inline-drawer wide100p flexFlowColumn"> |
| 4493 | <div class="inline-drawer-toggle inline-drawer-header userSettingsInnerExpandable" title="Options for the various autocompelte input boxes."> | 4535 | <div class="inline-drawer-toggle inline-drawer-header userSettingsInnerExpandable" title="Options for the various autocomplete input boxes."> |
| 4494 | <b><span data-i18n="AutoComplete Settings">AutoComplete Settings</span></b> | 4536 | <b><span data-i18n="AutoComplete Settings">AutoComplete Settings</span></b> |
| 4495 | <div class="fa-solid fa-circle-chevron-down inline-drawer-icon down"></div> | 4537 | <div class="fa-solid fa-circle-chevron-down inline-drawer-icon down"></div> |
| 4496 | </div> | 4538 | </div> |
| @@ -4503,7 +4545,9 @@ | |||
| 4503 | </label> | 4545 | </label> |
| 4504 | <div class="flex-container"> | 4546 | <div class="flex-container"> |
| 4505 | <div class="flex1" title="Determines how entries are found for autocomplete." data-i18n="[title]Determines how entries are found for autocomplete."> | 4547 | <div class="flex1" title="Determines how entries are found for autocomplete." data-i18n="[title]Determines how entries are found for autocomplete."> |
| 4506 | <label for="stscript_matching" data-i18n="Autocomplete Matching"><small>Matching</small></label> | 4548 | <label for="stscript_matching"> |
| 4549 | <small data-i18n="Autocomplete Matching">Matching</small> | ||
| 4550 | </label> | ||
| 4507 | <select id="stscript_matching"> | 4551 | <select id="stscript_matching"> |
| 4508 | <option data-i18n="Starts with" value="strict">Starts with</option> | 4552 | <option data-i18n="Starts with" value="strict">Starts with</option> |
| 4509 | <option data-i18n="Includes" value="includes">Includes</option> | 4553 | <option data-i18n="Includes" value="includes">Includes</option> |
| @@ -4511,7 +4555,9 @@ | |||
| 4511 | </select> | 4555 | </select> |
| 4512 | </div> | 4556 | </div> |
| 4513 | <div class="flex1" title="Sets the style of the autocomplete." data-i18n="[title]Sets the style of the autocomplete."> | 4557 | <div class="flex1" title="Sets the style of the autocomplete." data-i18n="[title]Sets the style of the autocomplete."> |
| 4514 | <label for="stscript_autocomplete_style" data-i18n="Autocomplete Style"><small>Style</small></label> | 4558 | <label for="stscript_autocomplete_style"> |
| 4559 | <small data-i18n="Autocomplete Style">Style</small> | ||
| 4560 | </label> | ||
| 4515 | <div class="flex-container flexFlowRow alignItemsBaseline"> | 4561 | <div class="flex-container flexFlowRow alignItemsBaseline"> |
| 4516 | <select id="stscript_autocomplete_style"> | 4562 | <select id="stscript_autocomplete_style"> |
| 4517 | <option data-i18n="Follow Theme" value="theme">Follow Theme</option> | 4563 | <option data-i18n="Follow Theme" value="theme">Follow Theme</option> |
| @@ -4523,8 +4569,8 @@ | |||
| 4523 | </div> | 4569 | </div> |
| 4524 | </div> | 4570 | </div> |
| 4525 | <div title="Determines which keys select an item from the AutoComplete suggestions"> | 4571 | <div title="Determines which keys select an item from the AutoComplete suggestions"> |
| 4526 | <label data-i18n="Keyboard"> | 4572 | <label> |
| 4527 | <small>Keyboard:</small> | 4573 | <small data-i18n="Keyboard">Keyboard:</small> |
| 4528 | </label> | 4574 | </label> |
| 4529 | <select id="stscript_autocomplete_select"> | 4575 | <select id="stscript_autocomplete_select"> |
| 4530 | <option value="3" data-i18n="Select with Tab or Enter">Select with Tab or Enter</option> | 4576 | <option value="3" data-i18n="Select with Tab or Enter">Select with Tab or Enter</option> |
| @@ -4538,7 +4584,9 @@ | |||
| 4538 | <input class="neo-range-input" type="number" min="0.5" max="2" step="0.01" data-for="stscript_autocomplete_font_scale" id="stscript_autocomplete_font_scale_counter"> | 4584 | <input class="neo-range-input" type="number" min="0.5" max="2" step="0.01" data-for="stscript_autocomplete_font_scale" id="stscript_autocomplete_font_scale_counter"> |
| 4539 | </div> | 4585 | </div> |
| 4540 | <div title="Sets the width of the autocomplete." data-i18n="[title]Sets the width of the autocomplete."> | 4586 | <div title="Sets the width of the autocomplete." data-i18n="[title]Sets the width of the autocomplete."> |
| 4541 | <label for="stscript_autocomplete_width" data-i18n="Autocomplete Width"><small>Width</small></label> | 4587 | <label for="stscript_autocomplete_width"> |
| 4588 | <small data-i18n="Autocomplete Width">Width</small> | ||
| 4589 | </label> | ||
| 4542 | <div class="doubleRangeContainer"> | 4590 | <div class="doubleRangeContainer"> |
| 4543 | <div class="doubleRangeInputContainer"> | 4591 | <div class="doubleRangeInputContainer"> |
| 4544 | <input type="range" id="stscript_autocomplete_width_left" min="0" max="2" step="1"> | 4592 | <input type="range" id="stscript_autocomplete_width_left" min="0" max="2" step="1"> |
| @@ -4566,14 +4614,18 @@ | |||
| 4566 | <label><small data-i18n="Parser Flags">Parser Flags</small></label> | 4614 | <label><small data-i18n="Parser Flags">Parser Flags</small></label> |
| 4567 | <label class="checkbox_label" title="Switch to stricter escaping, allowing all delimiting characters to be escaped with a backslash, and backslashes to be escaped as well." data-i18n="[title]Switch to stricter escaping, allowing all delimiting characters to be escaped with a backslash, and backslashes to be escaped as well."> | 4615 | <label class="checkbox_label" title="Switch to stricter escaping, allowing all delimiting characters to be escaped with a backslash, and backslashes to be escaped as well." data-i18n="[title]Switch to stricter escaping, allowing all delimiting characters to be escaped with a backslash, and backslashes to be escaped as well."> |
| 4568 | <input id="stscript_parser_flag_strict_escaping" type="checkbox" /> | 4616 | <input id="stscript_parser_flag_strict_escaping" type="checkbox" /> |
| 4569 | <span data-i18n="STRICT_ESCAPING"><small>STRICT_ESCAPING</small></span> | 4617 | <span> |
| 4618 | <small data-i18n="STRICT_ESCAPING">STRICT_ESCAPING</small> | ||
| 4619 | </span> | ||
| 4570 | <a href="https://docs.sillytavern.app/usage/st-script/#strict-escaping" target="_blank" class="notes-link"> | 4620 | <a href="https://docs.sillytavern.app/usage/st-script/#strict-escaping" target="_blank" class="notes-link"> |
| 4571 | <span class="fa-solid fa-circle-question note-link-span"></span> | 4621 | <span class="fa-solid fa-circle-question note-link-span"></span> |
| 4572 | </a> | 4622 | </a> |
| 4573 | </label> | 4623 | </label> |
| 4574 | <label class="checkbox_label" title="Prevents {{getvar::}} {{getglobalvar::}} macros from having literal macro-like values auto-evaluated.
e.g. "{{newline}}" remains as literal string "{{newline}}"

(This is done by internally replacing {{getvar::}} {{getglobalvar::}} macros with scoped variables.)" data-i18n="[title]stscript_parser_flag_replace_getvar_label"> | 4624 | <label class="checkbox_label" title="Prevents {{getvar::}} {{getglobalvar::}} macros from having literal macro-like values auto-evaluated.
e.g. "{{newline}}" remains as literal string "{{newline}}"

(This is done by internally replacing {{getvar::}} {{getglobalvar::}} macros with scoped variables.)" data-i18n="[title]stscript_parser_flag_replace_getvar_label"> |
| 4575 | <input id="stscript_parser_flag_replace_getvar" type="checkbox" /> | 4625 | <input id="stscript_parser_flag_replace_getvar" type="checkbox" /> |
| 4576 | <span data-i18n="REPLACE_GETVAR"><small>REPLACE_GETVAR</small></span> | 4626 | <span> |
| 4627 | <small data-i18n="REPLACE_GETVAR">REPLACE_GETVAR</small> | ||
| 4628 | </span> | ||
| 4577 | <a href="https://docs.sillytavern.app/usage/st-script/#replace-variable-macros" target="_blank" class="notes-link"> | 4629 | <a href="https://docs.sillytavern.app/usage/st-script/#replace-variable-macros" target="_blank" class="notes-link"> |
| 4578 | <span class="fa-solid fa-circle-question note-link-span"></span> | 4630 | <span class="fa-solid fa-circle-question note-link-span"></span> |
| 4579 | </a> | 4631 | </a> |
| @@ -4704,10 +4756,12 @@ | |||
| 4704 | <div class="flex-container wide100p alignitemscenter spaceBetween flexNoGap"> | 4756 | <div class="flex-container wide100p alignitemscenter spaceBetween flexNoGap"> |
| 4705 | <div class="flex-container alignItemsBaseline wide100p"> | 4757 | <div class="flex-container alignItemsBaseline wide100p"> |
| 4706 | <div class="flex1 flex-container alignItemsBaseline"> | 4758 | <div class="flex1 flex-container alignItemsBaseline"> |
| 4707 | <h3 class="margin0" data-i18n="Persona Management">Persona Management</h3> | 4759 | <h3 class="margin0" > |
| 4708 | <a href="https://docs.sillytavern.app/usage/core-concepts/personas/" target="_blank" data-i18n="How do I use this?"> | 4760 | <span data-i18n="Persona Management">Persona Management</span> |
| 4761 | <a href="https://docs.sillytavern.app/usage/core-concepts/personas/" target="_blank"> | ||
| 4709 | <span class="fa-solid fa-circle-question note-link-span"></span> | 4762 | <span class="fa-solid fa-circle-question note-link-span"></span> |
| 4710 | </a> | 4763 | </a> |
| 4764 | </h3> | ||
| 4711 | </div> | 4765 | </div> |
| 4712 | <div class="flex-container"> | 4766 | <div class="flex-container"> |
| 4713 | <div class="menu_button menu_button_icon user_stats_button" data-i18n="[title]Click for stats!" title="Click for stats!"> | 4767 | <div class="menu_button menu_button_icon user_stats_button" data-i18n="[title]Click for stats!" title="Click for stats!"> |
| @@ -5039,6 +5093,7 @@ | |||
| 5039 | <span data-i18n="Group reply strategy">Group reply strategy</span> | 5093 | <span data-i18n="Group reply strategy">Group reply strategy</span> |
| 5040 | </label> | 5094 | </label> |
| 5041 | <select id="rm_group_activation_strategy"> | 5095 | <select id="rm_group_activation_strategy"> |
| 5096 | <option value="2" data-i18n="Manual">Manual</option> | ||
| 5042 | <option value="0" data-i18n="Natural order">Natural order</option> | 5097 | <option value="0" data-i18n="Natural order">Natural order</option> |
| 5043 | <option value="1" data-i18n="List order">List order</option> | 5098 | <option value="1" data-i18n="List order">List order</option> |
| 5044 | </select> | 5099 | </select> |
| @@ -5220,19 +5275,19 @@ | |||
| 5220 | <span class="ch_name flex1"></span> | 5275 | <span class="ch_name flex1"></span> |
| 5221 | <div class="avatar-buttons"> | 5276 | <div class="avatar-buttons"> |
| 5222 | <button class="menu_button bind_user_name" title="Bind user name to that avatar" data-i18n="[title]Bind user name to that avatar"> | 5277 | <button class="menu_button bind_user_name" title="Bind user name to that avatar" data-i18n="[title]Bind user name to that avatar"> |
| 5223 | <i class="fa-fw fa-solid fa-user-edit"></i> | 5278 | <i class="fa-fw fa-solid fa-user-edit fa-sm"></i> |
| 5224 | </button> | 5279 | </button> |
| 5225 | <button class="menu_button set_persona_image" title="Change persona image" data-i18n="[title]Change persona image"> | 5280 | <button class="menu_button set_persona_image" title="Change persona image" data-i18n="[title]Change persona image"> |
| 5226 | <i class="fa-fw fa-solid fa-image"></i> | 5281 | <i class="fa-fw fa-solid fa-image fa-sm"></i> |
| 5227 | </button> | 5282 | </button> |
| 5228 | <button class="menu_button set_default_persona" title="Select this as default persona for the new chats." data-i18n="[title]Select this as default persona for the new chats."> | 5283 | <button class="menu_button set_default_persona" title="Select this as default persona for the new chats." data-i18n="[title]Select this as default persona for the new chats."> |
| 5229 | <i class="fa-fw fa-solid fa-crown"></i> | 5284 | <i class="fa-fw fa-solid fa-crown fa-sm"></i> |
| 5230 | </button> | 5285 | </button> |
| 5231 | <button class="menu_button duplicate_persona" title="Duplicate persona" data-i18n="[title]Duplicate persona"> | 5286 | <button class="menu_button duplicate_persona" title="Duplicate persona" data-i18n="[title]Duplicate persona"> |
| 5232 | <i class="fa-fw fa-solid fa-clone"></i> | 5287 | <i class="fa-fw fa-solid fa-clone fa-sm"></i> |
| 5233 | </button> | 5288 | </button> |
| 5234 | <button class="menu_button delete_avatar" title="Delete persona" data-i18n="[title]Delete persona"> | 5289 | <button class="menu_button delete_avatar" title="Delete persona" data-i18n="[title]Delete persona"> |
| 5235 | <i class="fa-fw fa-solid fa-trash-alt"></i> | 5290 | <i class="fa-fw fa-solid fa-trash-alt fa-sm"></i> |
| 5236 | </button> | 5291 | </button> |
| 5237 | </div> | 5292 | </div> |
| 5238 | </div> | 5293 | </div> |
| @@ -5427,7 +5482,12 @@ | |||
| 5427 | <span data-i18n="Examples of dialogue" class="mdhotkey_location">Examples of dialogue</span> | 5482 | <span data-i18n="Examples of dialogue" class="mdhotkey_location">Examples of dialogue</span> |
| 5428 | <i class="editor_maximize fa-solid fa-maximize right_menu_button" data-for="mes_example_textarea" title="Expand the editor" data-i18n="[title]Expand the editor"></i> | 5483 | <i class="editor_maximize fa-solid fa-maximize right_menu_button" data-for="mes_example_textarea" title="Expand the editor" data-i18n="[title]Expand the editor"></i> |
| 5429 | </h4> | 5484 | </h4> |
| 5430 | <h5 data-i18n="Important to set the character's writing style.">Important to set the character's writing style. <a href="https://docs.sillytavern.app/usage/core-concepts/characterdesign/#examples-of-dialogue" class="notes-link" target="_blank"><span class="fa-solid fa-circle-question note-link-span"></span></a></h5> | 5485 | <h5> |
| 5486 | <span data-i18n="Important to set the character's writing style.">Important to set the character's writing style.</span> | ||
| 5487 | <a href="https://docs.sillytavern.app/usage/core-concepts/characterdesign/#examples-of-dialogue" class="notes-link" target="_blank"> | ||
| 5488 | <span class="fa-solid fa-circle-question note-link-span"></span> | ||
| 5489 | </a> | ||
| 5490 | </h5> | ||
| 5431 | </div> | 5491 | </div> |
| 5432 | <textarea id="mes_example_textarea" class="flexGrow mdHotkeys" name="mes_example" data-i18n="[placeholder](Examples of chat dialog. Begin each example with START on a new line.)" placeholder="(Examples of chat dialog. Begin each example with <START> on a new line.)" form="form_create" rows="6"></textarea> | 5492 | <textarea id="mes_example_textarea" class="flexGrow mdHotkeys" name="mes_example" data-i18n="[placeholder](Examples of chat dialog. Begin each example with START on a new line.)" placeholder="(Examples of chat dialog. Begin each example with <START> on a new line.)" form="form_create" rows="6"></textarea> |
| 5433 | <div class="extension_token_counter"> | 5493 | <div class="extension_token_counter"> |
| @@ -5451,7 +5511,7 @@ | |||
| 5451 | </div> | 5511 | </div> |
| 5452 | <div id="selectChatPopupHeaderText" class="TxtLrgBoldCenter"> | 5512 | <div id="selectChatPopupHeaderText" class="TxtLrgBoldCenter"> |
| 5453 | <span id="ChatHistoryCharName"></span><span data-i18n="Chat History">Chat History</span> | 5513 | <span id="ChatHistoryCharName"></span><span data-i18n="Chat History">Chat History</span> |
| 5454 | <a href="https://docs.sillytavern.app/usage/core-concepts/chatfilemanagement/#chat-import" class="notes-link" target="_blank"><span class="fa-solid fa-circle-question note-link-span"></span></a> | 5514 | <a href="https://docs.sillytavern.app/usage/core-concepts/chatfilemanagement/" class="notes-link" target="_blank"><span class="fa-solid fa-circle-question note-link-span"></span></a> |
| 5455 | </div> | 5515 | </div> |
| 5456 | <div id="newChatFromManageScreenButton" class="menu_button menu_button_icon"> | 5516 | <div id="newChatFromManageScreenButton" class="menu_button menu_button_icon"> |
| 5457 | <i class="fa-solid fa-plus"></i> | 5517 | <i class="fa-solid fa-plus"></i> |
| @@ -5461,13 +5521,10 @@ | |||
| 5461 | <i class="fa-solid fa-file-import"></i> | 5521 | <i class="fa-solid fa-file-import"></i> |
| 5462 | <span data-i18n="Import Chat">Import Chat</span> | 5522 | <span data-i18n="Import Chat">Import Chat</span> |
| 5463 | </div> | 5523 | </div> |
| 5464 | <input type="text" id="select_chat_search" class="text_pole flex1" data-i18n="[placeholder]Search..." placeholder="Search..." autocomplete="off"> | 5524 | <input type="search" id="select_chat_search" class="text_pole flex1" data-i18n="[placeholder]Search..." placeholder="Search..." autocomplete="off"> |
| 5465 | <div id="select_chat_cross" class="opacity50p hoverglow fa-solid fa-circle-xmark fontsize120p" alt="Close Past Chat Popup"></div> | 5525 | <div id="select_chat_cross" class="opacity50p hoverglow fa-solid fa-circle-xmark fontsize120p" alt="Close Past Chat Popup"></div> |
| 5466 | </div> | 5526 | </div> |
| 5467 | <div id="select_chat_div"></div> | 5527 | <div id="select_chat_div"></div> |
| 5468 | <div id="load_select_chat_div"> | ||
| 5469 | <div class="fa-solid fa-hourglass fa-spin"></div> | ||
| 5470 | </div> | ||
| 5471 | </div> | 5528 | </div> |
| 5472 | </div> | 5529 | </div> |
| 5473 | <div id="background_template" class="template_element"> | 5530 | <div id="background_template" class="template_element"> |
| @@ -5506,7 +5563,8 @@ | |||
| 5506 | <div class="character_world range-block flexFlowColumn flex-container"> | 5563 | <div class="character_world range-block flexFlowColumn flex-container"> |
| 5507 | <div class="range-block-title"> | 5564 | <div class="range-block-title"> |
| 5508 | <h3> | 5565 | <h3> |
| 5509 | <span data-i18n="Select a World Info file for"> Select a World Info file for <span class="character_name"></span></span>: | 5566 | <span data-i18n="Select a World Info file for">Select a World Info file for</span> |
| 5567 | <span class="character_name"></span>: | ||
| 5510 | </h3> | 5568 | </h3> |
| 5511 | </div> | 5569 | </div> |
| 5512 | <h4 data-i18n="Primary Lorebook">Primary Lorebook</h4> | 5570 | <h4 data-i18n="Primary Lorebook">Primary Lorebook</h4> |
| @@ -5540,11 +5598,11 @@ | |||
| 5540 | <div class="select_chat_block_wrapper flex-container"> | 5598 | <div class="select_chat_block_wrapper flex-container"> |
| 5541 | <div class="select_chat_block wide100p flex-container" file_name=""> | 5599 | <div class="select_chat_block wide100p flex-container" file_name=""> |
| 5542 | <div id="select_chat_name_wrapper" class="flex-container alignitemscenter justifySpaceBetween wide100p"> | 5600 | <div id="select_chat_name_wrapper" class="flex-container alignitemscenter justifySpaceBetween wide100p"> |
| 5543 | <div> | 5601 | <div class="flex-container alignItemsCenter"> |
| 5544 | <small class="select_chat_block_filename select_chat_block_filename_item"></small> | 5602 | <small class="select_chat_block_filename select_chat_block_filename_item"></small> |
| 5545 | <div title="Rename chat file" class="renameChatButton hoverglow opacity50p fa-solid fa-pencil" data-i18n="[title]Rename chat file"></div> | 5603 | <div title="Rename chat file" class="renameChatButton hoverglow opacity50p fa-solid fa-pencil fa-sm" data-i18n="[title]Rename chat file"></div> |
| 5546 | </div> | 5604 | </div> |
| 5547 | <div class="flex-container gap10px"> | 5605 | <div class="flex-container gap10px alignItemsCenter"> |
| 5548 | <div class="select_chat_info flex-container"> | 5606 | <div class="select_chat_info flex-container"> |
| 5549 | <small class="chat_messages_date select_chat_block_filename_item"></small> | 5607 | <small class="chat_messages_date select_chat_block_filename_item"></small> |
| 5550 | <small class="chat_file_size select_chat_block_filename_item"></small> | 5608 | <small class="chat_file_size select_chat_block_filename_item"></small> |
| @@ -5777,7 +5835,7 @@ | |||
| 5777 | <div class="flex-container justifySpaceBetween"> | 5835 | <div class="flex-container justifySpaceBetween"> |
| 5778 | <small for="group"> | 5836 | <small for="group"> |
| 5779 | <span data-i18n="Inclusion Group">Inclusion Group</span> | 5837 | <span data-i18n="Inclusion Group">Inclusion Group</span> |
| 5780 | <a href="https://docs.sillytavern.app/usage/core-concepts/worldinfo/#inclusion-group" class="notes-link" target="_blank" title="Inclusion Groups ensure only one entry from a group is activated at a time, if multiple are triggered. Supports multiple comma-separated groups. Documentation: World Info - Inclusion Group" data-i18n="[title]Inclusion Groups ensure only one entry from a group is activated at a time, if multiple are triggered.Documentation: World Info - Inclusion Group"> | 5838 | <a href="https://docs.sillytavern.app/usage/worldinfo/#inclusion-group" class="notes-link" target="_blank" title="Inclusion Groups ensure only one entry from a group is activated at a time, if multiple are triggered. Supports multiple comma-separated groups. Documentation: World Info - Inclusion Group" data-i18n="[title]Inclusion Groups ensure only one entry from a group is activated at a time, if multiple are triggered.Documentation: World Info - Inclusion Group"> |
| 5781 | <span class="fa-solid fa-circle-question note-link-span"></span> | 5839 | <span class="fa-solid fa-circle-question note-link-span"></span> |
| 5782 | </a> | 5840 | </a> |
| 5783 | </small> | 5841 | </small> |
| @@ -5807,7 +5865,7 @@ | |||
| 5807 | </div> | 5865 | </div> |
| 5808 | <div class="flex2 flex-container flexFlowColumn flexNoGap" data-i18n="[title]Sticky entries will stay active for N messages after being triggered." title="Sticky entries will stay active for N messages after being triggered."> | 5866 | <div class="flex2 flex-container flexFlowColumn flexNoGap" data-i18n="[title]Sticky entries will stay active for N messages after being triggered." title="Sticky entries will stay active for N messages after being triggered."> |
| 5809 | <div class="flex-container justifySpaceBetween marginBot5"> | 5867 | <div class="flex-container justifySpaceBetween marginBot5"> |
| 5810 | <small class="flex-container alignItemsBaseline" for="sticky" data-i18n="Sticky"> | 5868 | <small class="flex-container alignItemsBaseline" for="sticky"> |
| 5811 | <span data-i18n="Sticky"> | 5869 | <span data-i18n="Sticky"> |
| 5812 | Sticky | 5870 | Sticky |
| 5813 | </span> | 5871 | </span> |
| @@ -5820,7 +5878,7 @@ | |||
| 5820 | </div> | 5878 | </div> |
| 5821 | <div class="flex2 flex-container flexFlowColumn flexNoGap" data-i18n="[title]Entries with a cooldown can't be activated N messages after being triggered." title="Entries with a cooldown can't be activated N messages after being triggered."> | 5879 | <div class="flex2 flex-container flexFlowColumn flexNoGap" data-i18n="[title]Entries with a cooldown can't be activated N messages after being triggered." title="Entries with a cooldown can't be activated N messages after being triggered."> |
| 5822 | <div class="flex-container justifySpaceBetween marginBot5"> | 5880 | <div class="flex-container justifySpaceBetween marginBot5"> |
| 5823 | <small class="flex-container alignItemsBaseline" for="cooldown" data-i18n="Cooldown"> | 5881 | <small class="flex-container alignItemsBaseline" for="cooldown"> |
| 5824 | <span data-i18n="Cooldown"> | 5882 | <span data-i18n="Cooldown"> |
| 5825 | Cooldown | 5883 | Cooldown |
| 5826 | </span> | 5884 | </span> |
| @@ -5833,7 +5891,7 @@ | |||
| 5833 | </div> | 5891 | </div> |
| 5834 | <div class="flex2 flex-container flexFlowColumn flexNoGap" data-i18n="[title]Entries with a delay can't be activated until there are N messages present in the chat." title="Entries with a delay can't be activated until there are N messages present in the chat."> | 5892 | <div class="flex2 flex-container flexFlowColumn flexNoGap" data-i18n="[title]Entries with a delay can't be activated until there are N messages present in the chat." title="Entries with a delay can't be activated until there are N messages present in the chat."> |
| 5835 | <div class="flex-container justifySpaceBetween marginBot5"> | 5893 | <div class="flex-container justifySpaceBetween marginBot5"> |
| 5836 | <small class="flex-container alignItemsBaseline" for="delay" data-i18n="Delay"> | 5894 | <small class="flex-container alignItemsBaseline" for="delay"> |
| 5837 | <span data-i18n="Delay"> | 5895 | <span data-i18n="Delay"> |
| 5838 | Delay | 5896 | Delay |
| 5839 | </span> | 5897 | </span> |
| @@ -5992,7 +6050,7 @@ | |||
| 5992 | </div> | 6050 | </div> |
| 5993 | </div> | 6051 | </div> |
| 5994 | <div class="completion_prompt_manager_popup_entry_form_control"> | 6052 | <div class="completion_prompt_manager_popup_entry_form_control"> |
| 5995 | <div class="flex-container alignItemsCenter"> | 6053 | <div class="flex-container alignItemsCenter" data-i18n="[external_piece_text]The content of this prompt is pulled from elsewhere and cannot be edited here." external_piece_text="The content of this prompt is pulled from elsewhere and cannot be edited here."> |
| 5996 | <div class="flex1"> | 6054 | <div class="flex1"> |
| 5997 | <label for="completion_prompt_manager_popup_entry_form_prompt"> | 6055 | <label for="completion_prompt_manager_popup_entry_form_prompt"> |
| 5998 | <span data-i18n="Prompt">Prompt</span> | 6056 | <span data-i18n="Prompt">Prompt</span> |
| @@ -6621,8 +6679,11 @@ | |||
| 6621 | </div> | 6679 | </div> |
| 6622 | </div> | 6680 | </div> |
| 6623 | <div class="logprobs_panel_content inline-drawer-content flex-container flexFlowColumn"> | 6681 | <div class="logprobs_panel_content inline-drawer-content flex-container flexFlowColumn"> |
| 6624 | <small> | 6682 | <small class="flex-container alignItemsCenter justifySpaceBetween flexNoWrap"> |
| 6625 | <b data-i18n="Select a token to see alternatives considered by the AI.">Select a token to see alternatives considered by the AI.</b> | 6683 | <b data-i18n="Select a token to see alternatives considered by the AI.">Select a token to see alternatives considered by the AI.</b> |
| 6684 | <button id="logprobsReroll" class="menu_button margin0" title="Reroll with the entire prefix" data-i18n="[title]Reroll with the entire prefix"> | ||
| 6685 | <span class="fa-solid fa-redo logprobs_reroll"></span> | ||
| 6686 | </button> | ||
| 6626 | </small> | 6687 | </small> |
| 6627 | <hr> | 6688 | <hr> |
| 6628 | <div id="logprobs_generation_output"></div> | 6689 | <div id="logprobs_generation_output"></div> |
| @@ -6749,42 +6810,23 @@ | |||
| 6749 | 6810 | ||
| 6750 | <!-- Script includes --> | 6811 | <!-- Script includes --> |
| 6751 | <script src="lib/polyfill.js"></script> | 6812 | <script src="lib/polyfill.js"></script> |
| 6752 | <script src="lib/diff_match_patch.js"></script> | ||
| 6753 | <script src="lib/jquery-3.5.1.min.js"></script> | 6813 | <script src="lib/jquery-3.5.1.min.js"></script> |
| 6754 | <script src="lib/jquery-ui.min.js"></script> | 6814 | <script src="lib/jquery-ui.min.js"></script> |
| 6755 | <script src="lib/jquery.transit.min.js"></script> | 6815 | <script src="lib/jquery.transit.min.js"></script> |
| 6756 | <script src="lib/jquery-cookie-1.4.1.min.js"></script> | 6816 | <script src="lib/jquery-cookie-1.4.1.min.js"></script> |
| 6757 | <script src="lib/jquery.ui.touch-punch.min.js"></script> | 6817 | <script src="lib/jquery.ui.touch-punch.min.js"></script> |
| 6758 | <script src="lib/showdown.min.js"></script> | ||
| 6759 | <script src="lib/showdown-patch.js"></script> | ||
| 6760 | <script src="lib/showdown-katex.min.js"></script> | ||
| 6761 | <script src="lib/popper.js"></script> | ||
| 6762 | <script src="lib/purify.min.js"></script> | ||
| 6763 | <script src="lib/highlight.min.js"></script> | ||
| 6764 | <script src="lib/moment-with-locales.min.js"></script> | ||
| 6765 | <script src="lib/cropper.min.js"></script> | 6818 | <script src="lib/cropper.min.js"></script> |
| 6766 | <script src="lib/jquery-cropper.min.js"></script> | 6819 | <script src="lib/jquery-cropper.min.js"></script> |
| 6767 | <script src="lib/toastr.min.js"></script> | 6820 | <script src="lib/toastr.min.js"></script> |
| 6768 | <script src="lib/fuse.js"></script> | ||
| 6769 | <script src="lib/select2.min.js"></script> | 6821 | <script src="lib/select2.min.js"></script> |
| 6770 | <script src="lib/select2-search-placeholder.js"></script> | 6822 | <script src="lib/select2-search-placeholder.js"></script> |
| 6771 | <script src="lib/seedrandom.min.js"></script> | ||
| 6772 | <script src="lib/droll.js"></script> | ||
| 6773 | <script src="lib/localforage.min.js"></script> | ||
| 6774 | <script src="lib/handlebars.js"></script> | ||
| 6775 | <script src="lib/pagination.js"></script> | 6823 | <script src="lib/pagination.js"></script> |
| 6776 | <script src="lib/toolcool-color-picker.js"></script> | 6824 | <script src="lib/toolcool-color-picker.js"></script> |
| 6777 | <script src="lib/svg-inject.js"></script> | ||
| 6778 | <script src="lib/Readability.js"></script> | ||
| 6779 | <script src="lib/Readability-readerable.js"></script> | ||
| 6780 | <script src="lib/jquery.izoomify.js"></script> | 6825 | <script src="lib/jquery.izoomify.js"></script> |
| 6781 | <script type="module" src="lib/structured-clone/monkey-patch.js"></script> | 6826 | <script type="module" src="lib/structured-clone/monkey-patch.js"></script> |
| 6782 | <script type="module" src="lib/swiped-events.js"></script> | 6827 | <script type="module" src="lib/swiped-events.js"></script> |
| 6783 | <script type="module" src="lib/eventemitter.js"></script> | 6828 | <script type="module" src="lib/eventemitter.js"></script> |
| 6784 | <script type="module" src="scripts/i18n.js"></script> | 6829 | <script type="module" src="scripts/i18n.js"></script> |
| 6785 | <script type="module" src="scripts/bulk-edit.js"></script> | ||
| 6786 | <script type="module" src="scripts/setting-search.js"></script> | ||
| 6787 | <script type="module" src="scripts/server-history.js"></script> | ||
| 6788 | <script type="module" src="script.js"></script> | 6830 | <script type="module" src="script.js"></script> |
| 6789 | <script> | 6831 | <script> |
| 6790 | window.addEventListener('load', (event) => { | 6832 | window.addEventListener('load', (event) => { |
| @@ -16,17 +16,6 @@ | |||
| 16 | "scripts/extensions/quick-reply/lib/**" | 16 | "scripts/extensions/quick-reply/lib/**" |
| 17 | ], | 17 | ], |
| 18 | "typeAcquisition": { | 18 | "typeAcquisition": { |
| 19 | "include": [ | 19 | "include": [] |
| 20 | "@popperjs/core", | ||
| 21 | "showdown", | ||
| 22 | "seedrandom", | ||
| 23 | "showdown-katex", | ||
| 24 | "droll", | ||
| 25 | "handlebars", | ||
| 26 | "highlight.js", | ||
| 27 | "localforage", | ||
| 28 | "pdfjs-dist", | ||
| 29 | "@mozilla/readability" | ||
| 30 | ] | ||
| 31 | } | 20 | } |
| 32 | } | 21 | } |
| @@ -0,0 +1,118 @@ | |||
| 1 | /** | ||
| 2 | * Add all the libraries that you want to expose to the client here. | ||
| 3 | * They are bundled and exposed by Webpack in the /lib.js file. | ||
| 4 | */ | ||
| 5 | import lodash from 'lodash'; | ||
| 6 | import Fuse from 'fuse.js'; | ||
| 7 | import DOMPurify from 'dompurify'; | ||
| 8 | import hljs from 'highlight.js'; | ||
| 9 | import localforage from 'localforage'; | ||
| 10 | import Handlebars from 'handlebars'; | ||
| 11 | import css from '@adobe/css-tools'; | ||
| 12 | import Bowser from 'bowser'; | ||
| 13 | import DiffMatchPatch from 'diff-match-patch'; | ||
| 14 | import { isProbablyReaderable, Readability } from '@mozilla/readability'; | ||
| 15 | import SVGInject from '@iconfu/svg-inject'; | ||
| 16 | import showdown from 'showdown'; | ||
| 17 | import moment from 'moment'; | ||
| 18 | import seedrandom from 'seedrandom'; | ||
| 19 | import * as Popper from '@popperjs/core'; | ||
| 20 | import droll from 'droll'; | ||
| 21 | import morphdom from 'morphdom'; | ||
| 22 | |||
| 23 | /** | ||
| 24 | * Expose the libraries to the 'window' object. | ||
| 25 | * Needed for compatibility with old extensions. | ||
| 26 | * Note: New extensions are encouraged to import the libraries directly from lib.js. | ||
| 27 | */ | ||
| 28 | export function initLibraryShims() { | ||
| 29 | if (!window) { | ||
| 30 | return; | ||
| 31 | } | ||
| 32 | if (!('Fuse' in window)) { | ||
| 33 | // @ts-ignore | ||
| 34 | window.Fuse = Fuse; | ||
| 35 | } | ||
| 36 | if (!('DOMPurify' in window)) { | ||
| 37 | // @ts-ignore | ||
| 38 | window.DOMPurify = DOMPurify; | ||
| 39 | } | ||
| 40 | if (!('hljs' in window)) { | ||
| 41 | // @ts-ignore | ||
| 42 | window.hljs = hljs; | ||
| 43 | } | ||
| 44 | if (!('localforage' in window)) { | ||
| 45 | // @ts-ignore | ||
| 46 | window.localforage = localforage; | ||
| 47 | } | ||
| 48 | if (!('Handlebars' in window)) { | ||
| 49 | // @ts-ignore | ||
| 50 | window.Handlebars = Handlebars; | ||
| 51 | } | ||
| 52 | if (!('diff_match_patch' in window)) { | ||
| 53 | // @ts-ignore | ||
| 54 | window.diff_match_patch = DiffMatchPatch; | ||
| 55 | } | ||
| 56 | if (!('SVGInject' in window)) { | ||
| 57 | // @ts-ignore | ||
| 58 | window.SVGInject = SVGInject; | ||
| 59 | } | ||
| 60 | if (!('showdown' in window)) { | ||
| 61 | // @ts-ignore | ||
| 62 | window.showdown = showdown; | ||
| 63 | } | ||
| 64 | if (!('moment' in window)) { | ||
| 65 | // @ts-ignore | ||
| 66 | window.moment = moment; | ||
| 67 | } | ||
| 68 | if (!('Popper' in window)) { | ||
| 69 | // @ts-ignore | ||
| 70 | window.Popper = Popper; | ||
| 71 | } | ||
| 72 | if (!('droll' in window)) { | ||
| 73 | // @ts-ignore | ||
| 74 | window.droll = droll; | ||
| 75 | } | ||
| 76 | } | ||
| 77 | |||
| 78 | export default { | ||
| 79 | lodash, | ||
| 80 | Fuse, | ||
| 81 | DOMPurify, | ||
| 82 | hljs, | ||
| 83 | localforage, | ||
| 84 | Handlebars, | ||
| 85 | css, | ||
| 86 | Bowser, | ||
| 87 | DiffMatchPatch, | ||
| 88 | Readability, | ||
| 89 | isProbablyReaderable, | ||
| 90 | SVGInject, | ||
| 91 | showdown, | ||
| 92 | moment, | ||
| 93 | seedrandom, | ||
| 94 | Popper, | ||
| 95 | droll, | ||
| 96 | morphdom, | ||
| 97 | }; | ||
| 98 | |||
| 99 | export { | ||
| 100 | lodash, | ||
| 101 | Fuse, | ||
| 102 | DOMPurify, | ||
| 103 | hljs, | ||
| 104 | localforage, | ||
| 105 | Handlebars, | ||
| 106 | css, | ||
| 107 | Bowser, | ||
| 108 | DiffMatchPatch, | ||
| 109 | Readability, | ||
| 110 | isProbablyReaderable, | ||
| 111 | SVGInject, | ||
| 112 | showdown, | ||
| 113 | moment, | ||
| 114 | seedrandom, | ||
| 115 | Popper, | ||
| 116 | droll, | ||
| 117 | morphdom, | ||
| 118 | }; | ||
| @@ -1,108 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (c) 2010 Arc90 Inc | ||
| 3 | * | ||
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | * you may not use this file except in compliance with the License. | ||
| 6 | * You may obtain a copy of the License at | ||
| 7 | * | ||
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | * | ||
| 10 | * Unless required by applicable law or agreed to in writing, software | ||
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | * See the License for the specific language governing permissions and | ||
| 14 | * limitations under the License. | ||
| 15 | */ | ||
| 16 | |||
| 17 | /* | ||
| 18 | * This code is heavily based on Arc90's readability.js (1.7.1) script | ||
| 19 | * available at: http://code.google.com/p/arc90labs-readability | ||
| 20 | */ | ||
| 21 | |||
| 22 | var REGEXPS = { | ||
| 23 | // NOTE: These two regular expressions are duplicated in | ||
| 24 | // Readability.js. Please keep both copies in sync. | ||
| 25 | unlikelyCandidates: /-ad-|ai2html|banner|breadcrumbs|combx|comment|community|cover-wrap|disqus|extra|footer|gdpr|header|legends|menu|related|remark|replies|rss|shoutbox|sidebar|skyscraper|social|sponsor|supplemental|ad-break|agegate|pagination|pager|popup|yom-remote/i, | ||
| 26 | okMaybeItsACandidate: /and|article|body|column|content|main|shadow/i, | ||
| 27 | }; | ||
| 28 | |||
| 29 | function isNodeVisible(node) { | ||
| 30 | // Have to null-check node.style and node.className.indexOf to deal with SVG and MathML nodes. | ||
| 31 | return (!node.style || node.style.display != "none") | ||
| 32 | && !node.hasAttribute("hidden") | ||
| 33 | //check for "fallback-image" so that wikimedia math images are displayed | ||
| 34 | && (!node.hasAttribute("aria-hidden") || node.getAttribute("aria-hidden") != "true" || (node.className && node.className.indexOf && node.className.indexOf("fallback-image") !== -1)); | ||
| 35 | } | ||
| 36 | |||
| 37 | /** | ||
| 38 | * Decides whether or not the document is reader-able without parsing the whole thing. | ||
| 39 | * @param {Object} options Configuration object. | ||
| 40 | * @param {number} [options.minContentLength=140] The minimum node content length used to decide if the document is readerable. | ||
| 41 | * @param {number} [options.minScore=20] The minumum cumulated 'score' used to determine if the document is readerable. | ||
| 42 | * @param {Function} [options.visibilityChecker=isNodeVisible] The function used to determine if a node is visible. | ||
| 43 | * @return {boolean} Whether or not we suspect Readability.parse() will suceeed at returning an article object. | ||
| 44 | */ | ||
| 45 | function isProbablyReaderable(doc, options = {}) { | ||
| 46 | // For backward compatibility reasons 'options' can either be a configuration object or the function used | ||
| 47 | // to determine if a node is visible. | ||
| 48 | if (typeof options == "function") { | ||
| 49 | options = { visibilityChecker: options }; | ||
| 50 | } | ||
| 51 | |||
| 52 | var defaultOptions = { minScore: 20, minContentLength: 140, visibilityChecker: isNodeVisible }; | ||
| 53 | options = Object.assign(defaultOptions, options); | ||
| 54 | |||
| 55 | var nodes = doc.querySelectorAll("p, pre, article"); | ||
| 56 | |||
| 57 | // Get <div> nodes which have <br> node(s) and append them into the `nodes` variable. | ||
| 58 | // Some articles' DOM structures might look like | ||
| 59 | // <div> | ||
| 60 | // Sentences<br> | ||
| 61 | // <br> | ||
| 62 | // Sentences<br> | ||
| 63 | // </div> | ||
| 64 | var brNodes = doc.querySelectorAll("div > br"); | ||
| 65 | if (brNodes.length) { | ||
| 66 | var set = new Set(nodes); | ||
| 67 | [].forEach.call(brNodes, function (node) { | ||
| 68 | set.add(node.parentNode); | ||
| 69 | }); | ||
| 70 | nodes = Array.from(set); | ||
| 71 | } | ||
| 72 | |||
| 73 | var score = 0; | ||
| 74 | // This is a little cheeky, we use the accumulator 'score' to decide what to return from | ||
| 75 | // this callback: | ||
| 76 | return [].some.call(nodes, function (node) { | ||
| 77 | if (!options.visibilityChecker(node)) { | ||
| 78 | return false; | ||
| 79 | } | ||
| 80 | |||
| 81 | var matchString = node.className + " " + node.id; | ||
| 82 | if (REGEXPS.unlikelyCandidates.test(matchString) && | ||
| 83 | !REGEXPS.okMaybeItsACandidate.test(matchString)) { | ||
| 84 | return false; | ||
| 85 | } | ||
| 86 | |||
| 87 | if (node.matches("li p")) { | ||
| 88 | return false; | ||
| 89 | } | ||
| 90 | |||
| 91 | var textContentLength = node.textContent.trim().length; | ||
| 92 | if (textContentLength < options.minContentLength) { | ||
| 93 | return false; | ||
| 94 | } | ||
| 95 | |||
| 96 | score += Math.sqrt(textContentLength - options.minContentLength); | ||
| 97 | |||
| 98 | if (score > options.minScore) { | ||
| 99 | return true; | ||
| 100 | } | ||
| 101 | return false; | ||
| 102 | }); | ||
| 103 | } | ||
| 104 | |||
| 105 | if (typeof module === "object") { | ||
| 106 | /* global module */ | ||
| 107 | module.exports = isProbablyReaderable; | ||
| 108 | } | ||
| @@ -1,2314 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (c) 2010 Arc90 Inc | ||
| 3 | * | ||
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | * you may not use this file except in compliance with the License. | ||
| 6 | * You may obtain a copy of the License at | ||
| 7 | * | ||
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | * | ||
| 10 | * Unless required by applicable law or agreed to in writing, software | ||
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | * See the License for the specific language governing permissions and | ||
| 14 | * limitations under the License. | ||
| 15 | */ | ||
| 16 | |||
| 17 | /* | ||
| 18 | * This code is heavily based on Arc90's readability.js (1.7.1) script | ||
| 19 | * available at: http://code.google.com/p/arc90labs-readability | ||
| 20 | */ | ||
| 21 | |||
| 22 | /** | ||
| 23 | * Public constructor. | ||
| 24 | * @param {HTMLDocument} doc The document to parse. | ||
| 25 | * @param {Object} options The options object. | ||
| 26 | */ | ||
| 27 | function Readability(doc, options) { | ||
| 28 | // In some older versions, people passed a URI as the first argument. Cope: | ||
| 29 | if (options && options.documentElement) { | ||
| 30 | doc = options; | ||
| 31 | options = arguments[2]; | ||
| 32 | } else if (!doc || !doc.documentElement) { | ||
| 33 | throw new Error("First argument to Readability constructor should be a document object."); | ||
| 34 | } | ||
| 35 | options = options || {}; | ||
| 36 | |||
| 37 | this._doc = doc; | ||
| 38 | this._docJSDOMParser = this._doc.firstChild.__JSDOMParser__; | ||
| 39 | this._articleTitle = null; | ||
| 40 | this._articleByline = null; | ||
| 41 | this._articleDir = null; | ||
| 42 | this._articleSiteName = null; | ||
| 43 | this._attempts = []; | ||
| 44 | |||
| 45 | // Configurable options | ||
| 46 | this._debug = !!options.debug; | ||
| 47 | this._maxElemsToParse = options.maxElemsToParse || this.DEFAULT_MAX_ELEMS_TO_PARSE; | ||
| 48 | this._nbTopCandidates = options.nbTopCandidates || this.DEFAULT_N_TOP_CANDIDATES; | ||
| 49 | this._charThreshold = options.charThreshold || this.DEFAULT_CHAR_THRESHOLD; | ||
| 50 | this._classesToPreserve = this.CLASSES_TO_PRESERVE.concat(options.classesToPreserve || []); | ||
| 51 | this._keepClasses = !!options.keepClasses; | ||
| 52 | this._serializer = options.serializer || function(el) { | ||
| 53 | return el.innerHTML; | ||
| 54 | }; | ||
| 55 | this._disableJSONLD = !!options.disableJSONLD; | ||
| 56 | this._allowedVideoRegex = options.allowedVideoRegex || this.REGEXPS.videos; | ||
| 57 | |||
| 58 | // Start with all flags set | ||
| 59 | this._flags = this.FLAG_STRIP_UNLIKELYS | | ||
| 60 | this.FLAG_WEIGHT_CLASSES | | ||
| 61 | this.FLAG_CLEAN_CONDITIONALLY; | ||
| 62 | |||
| 63 | |||
| 64 | // Control whether log messages are sent to the console | ||
| 65 | if (this._debug) { | ||
| 66 | let logNode = function(node) { | ||
| 67 | if (node.nodeType == node.TEXT_NODE) { | ||
| 68 | return `${node.nodeName} ("${node.textContent}")`; | ||
| 69 | } | ||
| 70 | let attrPairs = Array.from(node.attributes || [], function(attr) { | ||
| 71 | return `${attr.name}="${attr.value}"`; | ||
| 72 | }).join(" "); | ||
| 73 | return `<${node.localName} ${attrPairs}>`; | ||
| 74 | }; | ||
| 75 | this.log = function () { | ||
| 76 | if (typeof console !== "undefined") { | ||
| 77 | let args = Array.from(arguments, arg => { | ||
| 78 | if (arg && arg.nodeType == this.ELEMENT_NODE) { | ||
| 79 | return logNode(arg); | ||
| 80 | } | ||
| 81 | return arg; | ||
| 82 | }); | ||
| 83 | args.unshift("Reader: (Readability)"); | ||
| 84 | console.log.apply(console, args); | ||
| 85 | } else if (typeof dump !== "undefined") { | ||
| 86 | /* global dump */ | ||
| 87 | var msg = Array.prototype.map.call(arguments, function(x) { | ||
| 88 | return (x && x.nodeName) ? logNode(x) : x; | ||
| 89 | }).join(" "); | ||
| 90 | dump("Reader: (Readability) " + msg + "\n"); | ||
| 91 | } | ||
| 92 | }; | ||
| 93 | } else { | ||
| 94 | this.log = function () {}; | ||
| 95 | } | ||
| 96 | } | ||
| 97 | |||
| 98 | Readability.prototype = { | ||
| 99 | FLAG_STRIP_UNLIKELYS: 0x1, | ||
| 100 | FLAG_WEIGHT_CLASSES: 0x2, | ||
| 101 | FLAG_CLEAN_CONDITIONALLY: 0x4, | ||
| 102 | |||
| 103 | // https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeType | ||
| 104 | ELEMENT_NODE: 1, | ||
| 105 | TEXT_NODE: 3, | ||
| 106 | |||
| 107 | // Max number of nodes supported by this parser. Default: 0 (no limit) | ||
| 108 | DEFAULT_MAX_ELEMS_TO_PARSE: 0, | ||
| 109 | |||
| 110 | // The number of top candidates to consider when analysing how | ||
| 111 | // tight the competition is among candidates. | ||
| 112 | DEFAULT_N_TOP_CANDIDATES: 5, | ||
| 113 | |||
| 114 | // Element tags to score by default. | ||
| 115 | DEFAULT_TAGS_TO_SCORE: "section,h2,h3,h4,h5,h6,p,td,pre".toUpperCase().split(","), | ||
| 116 | |||
| 117 | // The default number of chars an article must have in order to return a result | ||
| 118 | DEFAULT_CHAR_THRESHOLD: 500, | ||
| 119 | |||
| 120 | // All of the regular expressions in use within readability. | ||
| 121 | // Defined up here so we don't instantiate them repeatedly in loops. | ||
| 122 | REGEXPS: { | ||
| 123 | // NOTE: These two regular expressions are duplicated in | ||
| 124 | // Readability-readerable.js. Please keep both copies in sync. | ||
| 125 | unlikelyCandidates: /-ad-|ai2html|banner|breadcrumbs|combx|comment|community|cover-wrap|disqus|extra|footer|gdpr|header|legends|menu|related|remark|replies|rss|shoutbox|sidebar|skyscraper|social|sponsor|supplemental|ad-break|agegate|pagination|pager|popup|yom-remote/i, | ||
| 126 | okMaybeItsACandidate: /and|article|body|column|content|main|shadow/i, | ||
| 127 | |||
| 128 | positive: /article|body|content|entry|hentry|h-entry|main|page|pagination|post|text|blog|story/i, | ||
| 129 | negative: /-ad-|hidden|^hid$| hid$| hid |^hid |banner|combx|comment|com-|contact|foot|footer|footnote|gdpr|masthead|media|meta|outbrain|promo|related|scroll|share|shoutbox|sidebar|skyscraper|sponsor|shopping|tags|tool|widget/i, | ||
| 130 | extraneous: /print|archive|comment|discuss|e[\-]?mail|share|reply|all|login|sign|single|utility/i, | ||
| 131 | byline: /byline|author|dateline|writtenby|p-author/i, | ||
| 132 | replaceFonts: /<(\/?)font[^>]*>/gi, | ||
| 133 | normalize: /\s{2,}/g, | ||
| 134 | videos: /\/\/(www\.)?((dailymotion|youtube|youtube-nocookie|player\.vimeo|v\.qq)\.com|(archive|upload\.wikimedia)\.org|player\.twitch\.tv)/i, | ||
| 135 | shareElements: /(\b|_)(share|sharedaddy)(\b|_)/i, | ||
| 136 | nextLink: /(next|weiter|continue|>([^\|]|$)|»([^\|]|$))/i, | ||
| 137 | prevLink: /(prev|earl|old|new|<|«)/i, | ||
| 138 | tokenize: /\W+/g, | ||
| 139 | whitespace: /^\s*$/, | ||
| 140 | hasContent: /\S$/, | ||
| 141 | hashUrl: /^#.+/, | ||
| 142 | srcsetUrl: /(\S+)(\s+[\d.]+[xw])?(\s*(?:,|$))/g, | ||
| 143 | b64DataUrl: /^data:\s*([^\s;,]+)\s*;\s*base64\s*,/i, | ||
| 144 | // Commas as used in Latin, Sindhi, Chinese and various other scripts. | ||
| 145 | // see: https://en.wikipedia.org/wiki/Comma#Comma_variants | ||
| 146 | commas: /\u002C|\u060C|\uFE50|\uFE10|\uFE11|\u2E41|\u2E34|\u2E32|\uFF0C/g, | ||
| 147 | // See: https://schema.org/Article | ||
| 148 | jsonLdArticleTypes: /^Article|AdvertiserContentArticle|NewsArticle|AnalysisNewsArticle|AskPublicNewsArticle|BackgroundNewsArticle|OpinionNewsArticle|ReportageNewsArticle|ReviewNewsArticle|Report|SatiricalArticle|ScholarlyArticle|MedicalScholarlyArticle|SocialMediaPosting|BlogPosting|LiveBlogPosting|DiscussionForumPosting|TechArticle|APIReference$/ | ||
| 149 | }, | ||
| 150 | |||
| 151 | UNLIKELY_ROLES: [ "menu", "menubar", "complementary", "navigation", "alert", "alertdialog", "dialog" ], | ||
| 152 | |||
| 153 | DIV_TO_P_ELEMS: new Set([ "BLOCKQUOTE", "DL", "DIV", "IMG", "OL", "P", "PRE", "TABLE", "UL" ]), | ||
| 154 | |||
| 155 | ALTER_TO_DIV_EXCEPTIONS: ["DIV", "ARTICLE", "SECTION", "P"], | ||
| 156 | |||
| 157 | PRESENTATIONAL_ATTRIBUTES: [ "align", "background", "bgcolor", "border", "cellpadding", "cellspacing", "frame", "hspace", "rules", "style", "valign", "vspace" ], | ||
| 158 | |||
| 159 | DEPRECATED_SIZE_ATTRIBUTE_ELEMS: [ "TABLE", "TH", "TD", "HR", "PRE" ], | ||
| 160 | |||
| 161 | // The commented out elements qualify as phrasing content but tend to be | ||
| 162 | // removed by readability when put into paragraphs, so we ignore them here. | ||
| 163 | PHRASING_ELEMS: [ | ||
| 164 | // "CANVAS", "IFRAME", "SVG", "VIDEO", | ||
| 165 | "ABBR", "AUDIO", "B", "BDO", "BR", "BUTTON", "CITE", "CODE", "DATA", | ||
| 166 | "DATALIST", "DFN", "EM", "EMBED", "I", "IMG", "INPUT", "KBD", "LABEL", | ||
| 167 | "MARK", "MATH", "METER", "NOSCRIPT", "OBJECT", "OUTPUT", "PROGRESS", "Q", | ||
| 168 | "RUBY", "SAMP", "SCRIPT", "SELECT", "SMALL", "SPAN", "STRONG", "SUB", | ||
| 169 | "SUP", "TEXTAREA", "TIME", "VAR", "WBR" | ||
| 170 | ], | ||
| 171 | |||
| 172 | // These are the classes that readability sets itself. | ||
| 173 | CLASSES_TO_PRESERVE: [ "page" ], | ||
| 174 | |||
| 175 | // These are the list of HTML entities that need to be escaped. | ||
| 176 | HTML_ESCAPE_MAP: { | ||
| 177 | "lt": "<", | ||
| 178 | "gt": ">", | ||
| 179 | "amp": "&", | ||
| 180 | "quot": '"', | ||
| 181 | "apos": "'", | ||
| 182 | }, | ||
| 183 | |||
| 184 | /** | ||
| 185 | * Run any post-process modifications to article content as necessary. | ||
| 186 | * | ||
| 187 | * @param Element | ||
| 188 | * @return void | ||
| 189 | **/ | ||
| 190 | _postProcessContent: function(articleContent) { | ||
| 191 | // Readability cannot open relative uris so we convert them to absolute uris. | ||
| 192 | this._fixRelativeUris(articleContent); | ||
| 193 | |||
| 194 | this._simplifyNestedElements(articleContent); | ||
| 195 | |||
| 196 | if (!this._keepClasses) { | ||
| 197 | // Remove classes. | ||
| 198 | this._cleanClasses(articleContent); | ||
| 199 | } | ||
| 200 | }, | ||
| 201 | |||
| 202 | /** | ||
| 203 | * Iterates over a NodeList, calls `filterFn` for each node and removes node | ||
| 204 | * if function returned `true`. | ||
| 205 | * | ||
| 206 | * If function is not passed, removes all the nodes in node list. | ||
| 207 | * | ||
| 208 | * @param NodeList nodeList The nodes to operate on | ||
| 209 | * @param Function filterFn the function to use as a filter | ||
| 210 | * @return void | ||
| 211 | */ | ||
| 212 | _removeNodes: function(nodeList, filterFn) { | ||
| 213 | // Avoid ever operating on live node lists. | ||
| 214 | if (this._docJSDOMParser && nodeList._isLiveNodeList) { | ||
| 215 | throw new Error("Do not pass live node lists to _removeNodes"); | ||
| 216 | } | ||
| 217 | for (var i = nodeList.length - 1; i >= 0; i--) { | ||
| 218 | var node = nodeList[i]; | ||
| 219 | var parentNode = node.parentNode; | ||
| 220 | if (parentNode) { | ||
| 221 | if (!filterFn || filterFn.call(this, node, i, nodeList)) { | ||
| 222 | parentNode.removeChild(node); | ||
| 223 | } | ||
| 224 | } | ||
| 225 | } | ||
| 226 | }, | ||
| 227 | |||
| 228 | /** | ||
| 229 | * Iterates over a NodeList, and calls _setNodeTag for each node. | ||
| 230 | * | ||
| 231 | * @param NodeList nodeList The nodes to operate on | ||
| 232 | * @param String newTagName the new tag name to use | ||
| 233 | * @return void | ||
| 234 | */ | ||
| 235 | _replaceNodeTags: function(nodeList, newTagName) { | ||
| 236 | // Avoid ever operating on live node lists. | ||
| 237 | if (this._docJSDOMParser && nodeList._isLiveNodeList) { | ||
| 238 | throw new Error("Do not pass live node lists to _replaceNodeTags"); | ||
| 239 | } | ||
| 240 | for (const node of nodeList) { | ||
| 241 | this._setNodeTag(node, newTagName); | ||
| 242 | } | ||
| 243 | }, | ||
| 244 | |||
| 245 | /** | ||
| 246 | * Iterate over a NodeList, which doesn't natively fully implement the Array | ||
| 247 | * interface. | ||
| 248 | * | ||
| 249 | * For convenience, the current object context is applied to the provided | ||
| 250 | * iterate function. | ||
| 251 | * | ||
| 252 | * @param NodeList nodeList The NodeList. | ||
| 253 | * @param Function fn The iterate function. | ||
| 254 | * @return void | ||
| 255 | */ | ||
| 256 | _forEachNode: function(nodeList, fn) { | ||
| 257 | Array.prototype.forEach.call(nodeList, fn, this); | ||
| 258 | }, | ||
| 259 | |||
| 260 | /** | ||
| 261 | * Iterate over a NodeList, and return the first node that passes | ||
| 262 | * the supplied test function | ||
| 263 | * | ||
| 264 | * For convenience, the current object context is applied to the provided | ||
| 265 | * test function. | ||
| 266 | * | ||
| 267 | * @param NodeList nodeList The NodeList. | ||
| 268 | * @param Function fn The test function. | ||
| 269 | * @return void | ||
| 270 | */ | ||
| 271 | _findNode: function(nodeList, fn) { | ||
| 272 | return Array.prototype.find.call(nodeList, fn, this); | ||
| 273 | }, | ||
| 274 | |||
| 275 | /** | ||
| 276 | * Iterate over a NodeList, return true if any of the provided iterate | ||
| 277 | * function calls returns true, false otherwise. | ||
| 278 | * | ||
| 279 | * For convenience, the current object context is applied to the | ||
| 280 | * provided iterate function. | ||
| 281 | * | ||
| 282 | * @param NodeList nodeList The NodeList. | ||
| 283 | * @param Function fn The iterate function. | ||
| 284 | * @return Boolean | ||
| 285 | */ | ||
| 286 | _someNode: function(nodeList, fn) { | ||
| 287 | return Array.prototype.some.call(nodeList, fn, this); | ||
| 288 | }, | ||
| 289 | |||
| 290 | /** | ||
| 291 | * Iterate over a NodeList, return true if all of the provided iterate | ||
| 292 | * function calls return true, false otherwise. | ||
| 293 | * | ||
| 294 | * For convenience, the current object context is applied to the | ||
| 295 | * provided iterate function. | ||
| 296 | * | ||
| 297 | * @param NodeList nodeList The NodeList. | ||
| 298 | * @param Function fn The iterate function. | ||
| 299 | * @return Boolean | ||
| 300 | */ | ||
| 301 | _everyNode: function(nodeList, fn) { | ||
| 302 | return Array.prototype.every.call(nodeList, fn, this); | ||
| 303 | }, | ||
| 304 | |||
| 305 | /** | ||
| 306 | * Concat all nodelists passed as arguments. | ||
| 307 | * | ||
| 308 | * @return ...NodeList | ||
| 309 | * @return Array | ||
| 310 | */ | ||
| 311 | _concatNodeLists: function() { | ||
| 312 | var slice = Array.prototype.slice; | ||
| 313 | var args = slice.call(arguments); | ||
| 314 | var nodeLists = args.map(function(list) { | ||
| 315 | return slice.call(list); | ||
| 316 | }); | ||
| 317 | return Array.prototype.concat.apply([], nodeLists); | ||
| 318 | }, | ||
| 319 | |||
| 320 | _getAllNodesWithTag: function(node, tagNames) { | ||
| 321 | if (node.querySelectorAll) { | ||
| 322 | return node.querySelectorAll(tagNames.join(",")); | ||
| 323 | } | ||
| 324 | return [].concat.apply([], tagNames.map(function(tag) { | ||
| 325 | var collection = node.getElementsByTagName(tag); | ||
| 326 | return Array.isArray(collection) ? collection : Array.from(collection); | ||
| 327 | })); | ||
| 328 | }, | ||
| 329 | |||
| 330 | /** | ||
| 331 | * Removes the class="" attribute from every element in the given | ||
| 332 | * subtree, except those that match CLASSES_TO_PRESERVE and | ||
| 333 | * the classesToPreserve array from the options object. | ||
| 334 | * | ||
| 335 | * @param Element | ||
| 336 | * @return void | ||
| 337 | */ | ||
| 338 | _cleanClasses: function(node) { | ||
| 339 | var classesToPreserve = this._classesToPreserve; | ||
| 340 | var className = (node.getAttribute("class") || "") | ||
| 341 | .split(/\s+/) | ||
| 342 | .filter(function(cls) { | ||
| 343 | return classesToPreserve.indexOf(cls) != -1; | ||
| 344 | }) | ||
| 345 | .join(" "); | ||
| 346 | |||
| 347 | if (className) { | ||
| 348 | node.setAttribute("class", className); | ||
| 349 | } else { | ||
| 350 | node.removeAttribute("class"); | ||
| 351 | } | ||
| 352 | |||
| 353 | for (node = node.firstElementChild; node; node = node.nextElementSibling) { | ||
| 354 | this._cleanClasses(node); | ||
| 355 | } | ||
| 356 | }, | ||
| 357 | |||
| 358 | /** | ||
| 359 | * Converts each <a> and <img> uri in the given element to an absolute URI, | ||
| 360 | * ignoring #ref URIs. | ||
| 361 | * | ||
| 362 | * @param Element | ||
| 363 | * @return void | ||
| 364 | */ | ||
| 365 | _fixRelativeUris: function(articleContent) { | ||
| 366 | var baseURI = this._doc.baseURI; | ||
| 367 | var documentURI = this._doc.documentURI; | ||
| 368 | function toAbsoluteURI(uri) { | ||
| 369 | // Leave hash links alone if the base URI matches the document URI: | ||
| 370 | if (baseURI == documentURI && uri.charAt(0) == "#") { | ||
| 371 | return uri; | ||
| 372 | } | ||
| 373 | |||
| 374 | // Otherwise, resolve against base URI: | ||
| 375 | try { | ||
| 376 | return new URL(uri, baseURI).href; | ||
| 377 | } catch (ex) { | ||
| 378 | // Something went wrong, just return the original: | ||
| 379 | } | ||
| 380 | return uri; | ||
| 381 | } | ||
| 382 | |||
| 383 | var links = this._getAllNodesWithTag(articleContent, ["a"]); | ||
| 384 | this._forEachNode(links, function(link) { | ||
| 385 | var href = link.getAttribute("href"); | ||
| 386 | if (href) { | ||
| 387 | // Remove links with javascript: URIs, since | ||
| 388 | // they won't work after scripts have been removed from the page. | ||
| 389 | if (href.indexOf("javascript:") === 0) { | ||
| 390 | // if the link only contains simple text content, it can be converted to a text node | ||
| 391 | if (link.childNodes.length === 1 && link.childNodes[0].nodeType === this.TEXT_NODE) { | ||
| 392 | var text = this._doc.createTextNode(link.textContent); | ||
| 393 | link.parentNode.replaceChild(text, link); | ||
| 394 | } else { | ||
| 395 | // if the link has multiple children, they should all be preserved | ||
| 396 | var container = this._doc.createElement("span"); | ||
| 397 | while (link.firstChild) { | ||
| 398 | container.appendChild(link.firstChild); | ||
| 399 | } | ||
| 400 | link.parentNode.replaceChild(container, link); | ||
| 401 | } | ||
| 402 | } else { | ||
| 403 | link.setAttribute("href", toAbsoluteURI(href)); | ||
| 404 | } | ||
| 405 | } | ||
| 406 | }); | ||
| 407 | |||
| 408 | var medias = this._getAllNodesWithTag(articleContent, [ | ||
| 409 | "img", "picture", "figure", "video", "audio", "source" | ||
| 410 | ]); | ||
| 411 | |||
| 412 | this._forEachNode(medias, function(media) { | ||
| 413 | var src = media.getAttribute("src"); | ||
| 414 | var poster = media.getAttribute("poster"); | ||
| 415 | var srcset = media.getAttribute("srcset"); | ||
| 416 | |||
| 417 | if (src) { | ||
| 418 | media.setAttribute("src", toAbsoluteURI(src)); | ||
| 419 | } | ||
| 420 | |||
| 421 | if (poster) { | ||
| 422 | media.setAttribute("poster", toAbsoluteURI(poster)); | ||
| 423 | } | ||
| 424 | |||
| 425 | if (srcset) { | ||
| 426 | var newSrcset = srcset.replace(this.REGEXPS.srcsetUrl, function(_, p1, p2, p3) { | ||
| 427 | return toAbsoluteURI(p1) + (p2 || "") + p3; | ||
| 428 | }); | ||
| 429 | |||
| 430 | media.setAttribute("srcset", newSrcset); | ||
| 431 | } | ||
| 432 | }); | ||
| 433 | }, | ||
| 434 | |||
| 435 | _simplifyNestedElements: function(articleContent) { | ||
| 436 | var node = articleContent; | ||
| 437 | |||
| 438 | while (node) { | ||
| 439 | if (node.parentNode && ["DIV", "SECTION"].includes(node.tagName) && !(node.id && node.id.startsWith("readability"))) { | ||
| 440 | if (this._isElementWithoutContent(node)) { | ||
| 441 | node = this._removeAndGetNext(node); | ||
| 442 | continue; | ||
| 443 | } else if (this._hasSingleTagInsideElement(node, "DIV") || this._hasSingleTagInsideElement(node, "SECTION")) { | ||
| 444 | var child = node.children[0]; | ||
| 445 | for (var i = 0; i < node.attributes.length; i++) { | ||
| 446 | child.setAttribute(node.attributes[i].name, node.attributes[i].value); | ||
| 447 | } | ||
| 448 | node.parentNode.replaceChild(child, node); | ||
| 449 | node = child; | ||
| 450 | continue; | ||
| 451 | } | ||
| 452 | } | ||
| 453 | |||
| 454 | node = this._getNextNode(node); | ||
| 455 | } | ||
| 456 | }, | ||
| 457 | |||
| 458 | /** | ||
| 459 | * Get the article title as an H1. | ||
| 460 | * | ||
| 461 | * @return string | ||
| 462 | **/ | ||
| 463 | _getArticleTitle: function() { | ||
| 464 | var doc = this._doc; | ||
| 465 | var curTitle = ""; | ||
| 466 | var origTitle = ""; | ||
| 467 | |||
| 468 | try { | ||
| 469 | curTitle = origTitle = doc.title.trim(); | ||
| 470 | |||
| 471 | // If they had an element with id "title" in their HTML | ||
| 472 | if (typeof curTitle !== "string") | ||
| 473 | curTitle = origTitle = this._getInnerText(doc.getElementsByTagName("title")[0]); | ||
| 474 | } catch (e) {/* ignore exceptions setting the title. */} | ||
| 475 | |||
| 476 | var titleHadHierarchicalSeparators = false; | ||
| 477 | function wordCount(str) { | ||
| 478 | return str.split(/\s+/).length; | ||
| 479 | } | ||
| 480 | |||
| 481 | // If there's a separator in the title, first remove the final part | ||
| 482 | if ((/ [\|\-\\\/>»] /).test(curTitle)) { | ||
| 483 | titleHadHierarchicalSeparators = / [\\\/>»] /.test(curTitle); | ||
| 484 | curTitle = origTitle.replace(/(.*)[\|\-\\\/>»] .*/gi, "$1"); | ||
| 485 | |||
| 486 | // If the resulting title is too short (3 words or fewer), remove | ||
| 487 | // the first part instead: | ||
| 488 | if (wordCount(curTitle) < 3) | ||
| 489 | curTitle = origTitle.replace(/[^\|\-\\\/>»]*[\|\-\\\/>»](.*)/gi, "$1"); | ||
| 490 | } else if (curTitle.indexOf(": ") !== -1) { | ||
| 491 | // Check if we have an heading containing this exact string, so we | ||
| 492 | // could assume it's the full title. | ||
| 493 | var headings = this._concatNodeLists( | ||
| 494 | doc.getElementsByTagName("h1"), | ||
| 495 | doc.getElementsByTagName("h2") | ||
| 496 | ); | ||
| 497 | var trimmedTitle = curTitle.trim(); | ||
| 498 | var match = this._someNode(headings, function(heading) { | ||
| 499 | return heading.textContent.trim() === trimmedTitle; | ||
| 500 | }); | ||
| 501 | |||
| 502 | // If we don't, let's extract the title out of the original title string. | ||
| 503 | if (!match) { | ||
| 504 | curTitle = origTitle.substring(origTitle.lastIndexOf(":") + 1); | ||
| 505 | |||
| 506 | // If the title is now too short, try the first colon instead: | ||
| 507 | if (wordCount(curTitle) < 3) { | ||
| 508 | curTitle = origTitle.substring(origTitle.indexOf(":") + 1); | ||
| 509 | // But if we have too many words before the colon there's something weird | ||
| 510 | // with the titles and the H tags so let's just use the original title instead | ||
| 511 | } else if (wordCount(origTitle.substr(0, origTitle.indexOf(":"))) > 5) { | ||
| 512 | curTitle = origTitle; | ||
| 513 | } | ||
| 514 | } | ||
| 515 | } else if (curTitle.length > 150 || curTitle.length < 15) { | ||
| 516 | var hOnes = doc.getElementsByTagName("h1"); | ||
| 517 | |||
| 518 | if (hOnes.length === 1) | ||
| 519 | curTitle = this._getInnerText(hOnes[0]); | ||
| 520 | } | ||
| 521 | |||
| 522 | curTitle = curTitle.trim().replace(this.REGEXPS.normalize, " "); | ||
| 523 | // If we now have 4 words or fewer as our title, and either no | ||
| 524 | // 'hierarchical' separators (\, /, > or ») were found in the original | ||
| 525 | // title or we decreased the number of words by more than 1 word, use | ||
| 526 | // the original title. | ||
| 527 | var curTitleWordCount = wordCount(curTitle); | ||
| 528 | if (curTitleWordCount <= 4 && | ||
| 529 | (!titleHadHierarchicalSeparators || | ||
| 530 | curTitleWordCount != wordCount(origTitle.replace(/[\|\-\\\/>»]+/g, "")) - 1)) { | ||
| 531 | curTitle = origTitle; | ||
| 532 | } | ||
| 533 | |||
| 534 | return curTitle; | ||
| 535 | }, | ||
| 536 | |||
| 537 | /** | ||
| 538 | * Prepare the HTML document for readability to scrape it. | ||
| 539 | * This includes things like stripping javascript, CSS, and handling terrible markup. | ||
| 540 | * | ||
| 541 | * @return void | ||
| 542 | **/ | ||
| 543 | _prepDocument: function() { | ||
| 544 | var doc = this._doc; | ||
| 545 | |||
| 546 | // Remove all style tags in head | ||
| 547 | this._removeNodes(this._getAllNodesWithTag(doc, ["style"])); | ||
| 548 | |||
| 549 | if (doc.body) { | ||
| 550 | this._replaceBrs(doc.body); | ||
| 551 | } | ||
| 552 | |||
| 553 | this._replaceNodeTags(this._getAllNodesWithTag(doc, ["font"]), "SPAN"); | ||
| 554 | }, | ||
| 555 | |||
| 556 | /** | ||
| 557 | * Finds the next node, starting from the given node, and ignoring | ||
| 558 | * whitespace in between. If the given node is an element, the same node is | ||
| 559 | * returned. | ||
| 560 | */ | ||
| 561 | _nextNode: function (node) { | ||
| 562 | var next = node; | ||
| 563 | while (next | ||
| 564 | && (next.nodeType != this.ELEMENT_NODE) | ||
| 565 | && this.REGEXPS.whitespace.test(next.textContent)) { | ||
| 566 | next = next.nextSibling; | ||
| 567 | } | ||
| 568 | return next; | ||
| 569 | }, | ||
| 570 | |||
| 571 | /** | ||
| 572 | * Replaces 2 or more successive <br> elements with a single <p>. | ||
| 573 | * Whitespace between <br> elements are ignored. For example: | ||
| 574 | * <div>foo<br>bar<br> <br><br>abc</div> | ||
| 575 | * will become: | ||
| 576 | * <div>foo<br>bar<p>abc</p></div> | ||
| 577 | */ | ||
| 578 | _replaceBrs: function (elem) { | ||
| 579 | this._forEachNode(this._getAllNodesWithTag(elem, ["br"]), function(br) { | ||
| 580 | var next = br.nextSibling; | ||
| 581 | |||
| 582 | // Whether 2 or more <br> elements have been found and replaced with a | ||
| 583 | // <p> block. | ||
| 584 | var replaced = false; | ||
| 585 | |||
| 586 | // If we find a <br> chain, remove the <br>s until we hit another node | ||
| 587 | // or non-whitespace. This leaves behind the first <br> in the chain | ||
| 588 | // (which will be replaced with a <p> later). | ||
| 589 | while ((next = this._nextNode(next)) && (next.tagName == "BR")) { | ||
| 590 | replaced = true; | ||
| 591 | var brSibling = next.nextSibling; | ||
| 592 | next.parentNode.removeChild(next); | ||
| 593 | next = brSibling; | ||
| 594 | } | ||
| 595 | |||
| 596 | // If we removed a <br> chain, replace the remaining <br> with a <p>. Add | ||
| 597 | // all sibling nodes as children of the <p> until we hit another <br> | ||
| 598 | // chain. | ||
| 599 | if (replaced) { | ||
| 600 | var p = this._doc.createElement("p"); | ||
| 601 | br.parentNode.replaceChild(p, br); | ||
| 602 | |||
| 603 | next = p.nextSibling; | ||
| 604 | while (next) { | ||
| 605 | // If we've hit another <br><br>, we're done adding children to this <p>. | ||
| 606 | if (next.tagName == "BR") { | ||
| 607 | var nextElem = this._nextNode(next.nextSibling); | ||
| 608 | if (nextElem && nextElem.tagName == "BR") | ||
| 609 | break; | ||
| 610 | } | ||
| 611 | |||
| 612 | if (!this._isPhrasingContent(next)) | ||
| 613 | break; | ||
| 614 | |||
| 615 | // Otherwise, make this node a child of the new <p>. | ||
| 616 | var sibling = next.nextSibling; | ||
| 617 | p.appendChild(next); | ||
| 618 | next = sibling; | ||
| 619 | } | ||
| 620 | |||
| 621 | while (p.lastChild && this._isWhitespace(p.lastChild)) { | ||
| 622 | p.removeChild(p.lastChild); | ||
| 623 | } | ||
| 624 | |||
| 625 | if (p.parentNode.tagName === "P") | ||
| 626 | this._setNodeTag(p.parentNode, "DIV"); | ||
| 627 | } | ||
| 628 | }); | ||
| 629 | }, | ||
| 630 | |||
| 631 | _setNodeTag: function (node, tag) { | ||
| 632 | this.log("_setNodeTag", node, tag); | ||
| 633 | if (this._docJSDOMParser) { | ||
| 634 | node.localName = tag.toLowerCase(); | ||
| 635 | node.tagName = tag.toUpperCase(); | ||
| 636 | return node; | ||
| 637 | } | ||
| 638 | |||
| 639 | var replacement = node.ownerDocument.createElement(tag); | ||
| 640 | while (node.firstChild) { | ||
| 641 | replacement.appendChild(node.firstChild); | ||
| 642 | } | ||
| 643 | node.parentNode.replaceChild(replacement, node); | ||
| 644 | if (node.readability) | ||
| 645 | replacement.readability = node.readability; | ||
| 646 | |||
| 647 | for (var i = 0; i < node.attributes.length; i++) { | ||
| 648 | try { | ||
| 649 | replacement.setAttribute(node.attributes[i].name, node.attributes[i].value); | ||
| 650 | } catch (ex) { | ||
| 651 | /* it's possible for setAttribute() to throw if the attribute name | ||
| 652 | * isn't a valid XML Name. Such attributes can however be parsed from | ||
| 653 | * source in HTML docs, see https://github.com/whatwg/html/issues/4275, | ||
| 654 | * so we can hit them here and then throw. We don't care about such | ||
| 655 | * attributes so we ignore them. | ||
| 656 | */ | ||
| 657 | } | ||
| 658 | } | ||
| 659 | return replacement; | ||
| 660 | }, | ||
| 661 | |||
| 662 | /** | ||
| 663 | * Prepare the article node for display. Clean out any inline styles, | ||
| 664 | * iframes, forms, strip extraneous <p> tags, etc. | ||
| 665 | * | ||
| 666 | * @param Element | ||
| 667 | * @return void | ||
| 668 | **/ | ||
| 669 | _prepArticle: function(articleContent) { | ||
| 670 | this._cleanStyles(articleContent); | ||
| 671 | |||
| 672 | // Check for data tables before we continue, to avoid removing items in | ||
| 673 | // those tables, which will often be isolated even though they're | ||
| 674 | // visually linked to other content-ful elements (text, images, etc.). | ||
| 675 | this._markDataTables(articleContent); | ||
| 676 | |||
| 677 | this._fixLazyImages(articleContent); | ||
| 678 | |||
| 679 | // Clean out junk from the article content | ||
| 680 | this._cleanConditionally(articleContent, "form"); | ||
| 681 | this._cleanConditionally(articleContent, "fieldset"); | ||
| 682 | this._clean(articleContent, "object"); | ||
| 683 | this._clean(articleContent, "embed"); | ||
| 684 | this._clean(articleContent, "footer"); | ||
| 685 | this._clean(articleContent, "link"); | ||
| 686 | this._clean(articleContent, "aside"); | ||
| 687 | |||
| 688 | // Clean out elements with little content that have "share" in their id/class combinations from final top candidates, | ||
| 689 | // which means we don't remove the top candidates even they have "share". | ||
| 690 | |||
| 691 | var shareElementThreshold = this.DEFAULT_CHAR_THRESHOLD; | ||
| 692 | |||
| 693 | this._forEachNode(articleContent.children, function (topCandidate) { | ||
| 694 | this._cleanMatchedNodes(topCandidate, function (node, matchString) { | ||
| 695 | return this.REGEXPS.shareElements.test(matchString) && node.textContent.length < shareElementThreshold; | ||
| 696 | }); | ||
| 697 | }); | ||
| 698 | |||
| 699 | this._clean(articleContent, "iframe"); | ||
| 700 | this._clean(articleContent, "input"); | ||
| 701 | this._clean(articleContent, "textarea"); | ||
| 702 | this._clean(articleContent, "select"); | ||
| 703 | this._clean(articleContent, "button"); | ||
| 704 | this._cleanHeaders(articleContent); | ||
| 705 | |||
| 706 | // Do these last as the previous stuff may have removed junk | ||
| 707 | // that will affect these | ||
| 708 | this._cleanConditionally(articleContent, "table"); | ||
| 709 | this._cleanConditionally(articleContent, "ul"); | ||
| 710 | this._cleanConditionally(articleContent, "div"); | ||
| 711 | |||
| 712 | // replace H1 with H2 as H1 should be only title that is displayed separately | ||
| 713 | this._replaceNodeTags(this._getAllNodesWithTag(articleContent, ["h1"]), "h2"); | ||
| 714 | |||
| 715 | // Remove extra paragraphs | ||
| 716 | this._removeNodes(this._getAllNodesWithTag(articleContent, ["p"]), function (paragraph) { | ||
| 717 | var imgCount = paragraph.getElementsByTagName("img").length; | ||
| 718 | var embedCount = paragraph.getElementsByTagName("embed").length; | ||
| 719 | var objectCount = paragraph.getElementsByTagName("object").length; | ||
| 720 | // At this point, nasty iframes have been removed, only remain embedded video ones. | ||
| 721 | var iframeCount = paragraph.getElementsByTagName("iframe").length; | ||
| 722 | var totalCount = imgCount + embedCount + objectCount + iframeCount; | ||
| 723 | |||
| 724 | return totalCount === 0 && !this._getInnerText(paragraph, false); | ||
| 725 | }); | ||
| 726 | |||
| 727 | this._forEachNode(this._getAllNodesWithTag(articleContent, ["br"]), function(br) { | ||
| 728 | var next = this._nextNode(br.nextSibling); | ||
| 729 | if (next && next.tagName == "P") | ||
| 730 | br.parentNode.removeChild(br); | ||
| 731 | }); | ||
| 732 | |||
| 733 | // Remove single-cell tables | ||
| 734 | this._forEachNode(this._getAllNodesWithTag(articleContent, ["table"]), function(table) { | ||
| 735 | var tbody = this._hasSingleTagInsideElement(table, "TBODY") ? table.firstElementChild : table; | ||
| 736 | if (this._hasSingleTagInsideElement(tbody, "TR")) { | ||
| 737 | var row = tbody.firstElementChild; | ||
| 738 | if (this._hasSingleTagInsideElement(row, "TD")) { | ||
| 739 | var cell = row.firstElementChild; | ||
| 740 | cell = this._setNodeTag(cell, this._everyNode(cell.childNodes, this._isPhrasingContent) ? "P" : "DIV"); | ||
| 741 | table.parentNode.replaceChild(cell, table); | ||
| 742 | } | ||
| 743 | } | ||
| 744 | }); | ||
| 745 | }, | ||
| 746 | |||
| 747 | /** | ||
| 748 | * Initialize a node with the readability object. Also checks the | ||
| 749 | * className/id for special names to add to its score. | ||
| 750 | * | ||
| 751 | * @param Element | ||
| 752 | * @return void | ||
| 753 | **/ | ||
| 754 | _initializeNode: function(node) { | ||
| 755 | node.readability = {"contentScore": 0}; | ||
| 756 | |||
| 757 | switch (node.tagName) { | ||
| 758 | case "DIV": | ||
| 759 | node.readability.contentScore += 5; | ||
| 760 | break; | ||
| 761 | |||
| 762 | case "PRE": | ||
| 763 | case "TD": | ||
| 764 | case "BLOCKQUOTE": | ||
| 765 | node.readability.contentScore += 3; | ||
| 766 | break; | ||
| 767 | |||
| 768 | case "ADDRESS": | ||
| 769 | case "OL": | ||
| 770 | case "UL": | ||
| 771 | case "DL": | ||
| 772 | case "DD": | ||
| 773 | case "DT": | ||
| 774 | case "LI": | ||
| 775 | case "FORM": | ||
| 776 | node.readability.contentScore -= 3; | ||
| 777 | break; | ||
| 778 | |||
| 779 | case "H1": | ||
| 780 | case "H2": | ||
| 781 | case "H3": | ||
| 782 | case "H4": | ||
| 783 | case "H5": | ||
| 784 | case "H6": | ||
| 785 | case "TH": | ||
| 786 | node.readability.contentScore -= 5; | ||
| 787 | break; | ||
| 788 | } | ||
| 789 | |||
| 790 | node.readability.contentScore += this._getClassWeight(node); | ||
| 791 | }, | ||
| 792 | |||
| 793 | _removeAndGetNext: function(node) { | ||
| 794 | var nextNode = this._getNextNode(node, true); | ||
| 795 | node.parentNode.removeChild(node); | ||
| 796 | return nextNode; | ||
| 797 | }, | ||
| 798 | |||
| 799 | /** | ||
| 800 | * Traverse the DOM from node to node, starting at the node passed in. | ||
| 801 | * Pass true for the second parameter to indicate this node itself | ||
| 802 | * (and its kids) are going away, and we want the next node over. | ||
| 803 | * | ||
| 804 | * Calling this in a loop will traverse the DOM depth-first. | ||
| 805 | */ | ||
| 806 | _getNextNode: function(node, ignoreSelfAndKids) { | ||
| 807 | // First check for kids if those aren't being ignored | ||
| 808 | if (!ignoreSelfAndKids && node.firstElementChild) { | ||
| 809 | return node.firstElementChild; | ||
| 810 | } | ||
| 811 | // Then for siblings... | ||
| 812 | if (node.nextElementSibling) { | ||
| 813 | return node.nextElementSibling; | ||
| 814 | } | ||
| 815 | // And finally, move up the parent chain *and* find a sibling | ||
| 816 | // (because this is depth-first traversal, we will have already | ||
| 817 | // seen the parent nodes themselves). | ||
| 818 | do { | ||
| 819 | node = node.parentNode; | ||
| 820 | } while (node && !node.nextElementSibling); | ||
| 821 | return node && node.nextElementSibling; | ||
| 822 | }, | ||
| 823 | |||
| 824 | // compares second text to first one | ||
| 825 | // 1 = same text, 0 = completely different text | ||
| 826 | // works the way that it splits both texts into words and then finds words that are unique in second text | ||
| 827 | // the result is given by the lower length of unique parts | ||
| 828 | _textSimilarity: function(textA, textB) { | ||
| 829 | var tokensA = textA.toLowerCase().split(this.REGEXPS.tokenize).filter(Boolean); | ||
| 830 | var tokensB = textB.toLowerCase().split(this.REGEXPS.tokenize).filter(Boolean); | ||
| 831 | if (!tokensA.length || !tokensB.length) { | ||
| 832 | return 0; | ||
| 833 | } | ||
| 834 | var uniqTokensB = tokensB.filter(token => !tokensA.includes(token)); | ||
| 835 | var distanceB = uniqTokensB.join(" ").length / tokensB.join(" ").length; | ||
| 836 | return 1 - distanceB; | ||
| 837 | }, | ||
| 838 | |||
| 839 | _checkByline: function(node, matchString) { | ||
| 840 | if (this._articleByline) { | ||
| 841 | return false; | ||
| 842 | } | ||
| 843 | |||
| 844 | if (node.getAttribute !== undefined) { | ||
| 845 | var rel = node.getAttribute("rel"); | ||
| 846 | var itemprop = node.getAttribute("itemprop"); | ||
| 847 | } | ||
| 848 | |||
| 849 | if ((rel === "author" || (itemprop && itemprop.indexOf("author") !== -1) || this.REGEXPS.byline.test(matchString)) && this._isValidByline(node.textContent)) { | ||
| 850 | this._articleByline = node.textContent.trim(); | ||
| 851 | return true; | ||
| 852 | } | ||
| 853 | |||
| 854 | return false; | ||
| 855 | }, | ||
| 856 | |||
| 857 | _getNodeAncestors: function(node, maxDepth) { | ||
| 858 | maxDepth = maxDepth || 0; | ||
| 859 | var i = 0, ancestors = []; | ||
| 860 | while (node.parentNode) { | ||
| 861 | ancestors.push(node.parentNode); | ||
| 862 | if (maxDepth && ++i === maxDepth) | ||
| 863 | break; | ||
| 864 | node = node.parentNode; | ||
| 865 | } | ||
| 866 | return ancestors; | ||
| 867 | }, | ||
| 868 | |||
| 869 | /*** | ||
| 870 | * grabArticle - Using a variety of metrics (content score, classname, element types), find the content that is | ||
| 871 | * most likely to be the stuff a user wants to read. Then return it wrapped up in a div. | ||
| 872 | * | ||
| 873 | * @param page a document to run upon. Needs to be a full document, complete with body. | ||
| 874 | * @return Element | ||
| 875 | **/ | ||
| 876 | _grabArticle: function (page) { | ||
| 877 | this.log("**** grabArticle ****"); | ||
| 878 | var doc = this._doc; | ||
| 879 | var isPaging = page !== null; | ||
| 880 | page = page ? page : this._doc.body; | ||
| 881 | |||
| 882 | // We can't grab an article if we don't have a page! | ||
| 883 | if (!page) { | ||
| 884 | this.log("No body found in document. Abort."); | ||
| 885 | return null; | ||
| 886 | } | ||
| 887 | |||
| 888 | var pageCacheHtml = page.innerHTML; | ||
| 889 | |||
| 890 | while (true) { | ||
| 891 | this.log("Starting grabArticle loop"); | ||
| 892 | var stripUnlikelyCandidates = this._flagIsActive(this.FLAG_STRIP_UNLIKELYS); | ||
| 893 | |||
| 894 | // First, node prepping. Trash nodes that look cruddy (like ones with the | ||
| 895 | // class name "comment", etc), and turn divs into P tags where they have been | ||
| 896 | // used inappropriately (as in, where they contain no other block level elements.) | ||
| 897 | var elementsToScore = []; | ||
| 898 | var node = this._doc.documentElement; | ||
| 899 | |||
| 900 | let shouldRemoveTitleHeader = true; | ||
| 901 | |||
| 902 | while (node) { | ||
| 903 | |||
| 904 | if (node.tagName === "HTML") { | ||
| 905 | this._articleLang = node.getAttribute("lang"); | ||
| 906 | } | ||
| 907 | |||
| 908 | var matchString = node.className + " " + node.id; | ||
| 909 | |||
| 910 | if (!this._isProbablyVisible(node)) { | ||
| 911 | this.log("Removing hidden node - " + matchString); | ||
| 912 | node = this._removeAndGetNext(node); | ||
| 913 | continue; | ||
| 914 | } | ||
| 915 | |||
| 916 | // User is not able to see elements applied with both "aria-modal = true" and "role = dialog" | ||
| 917 | if (node.getAttribute("aria-modal") == "true" && node.getAttribute("role") == "dialog") { | ||
| 918 | node = this._removeAndGetNext(node); | ||
| 919 | continue; | ||
| 920 | } | ||
| 921 | |||
| 922 | // Check to see if this node is a byline, and remove it if it is. | ||
| 923 | if (this._checkByline(node, matchString)) { | ||
| 924 | node = this._removeAndGetNext(node); | ||
| 925 | continue; | ||
| 926 | } | ||
| 927 | |||
| 928 | if (shouldRemoveTitleHeader && this._headerDuplicatesTitle(node)) { | ||
| 929 | this.log("Removing header: ", node.textContent.trim(), this._articleTitle.trim()); | ||
| 930 | shouldRemoveTitleHeader = false; | ||
| 931 | node = this._removeAndGetNext(node); | ||
| 932 | continue; | ||
| 933 | } | ||
| 934 | |||
| 935 | // Remove unlikely candidates | ||
| 936 | if (stripUnlikelyCandidates) { | ||
| 937 | if (this.REGEXPS.unlikelyCandidates.test(matchString) && | ||
| 938 | !this.REGEXPS.okMaybeItsACandidate.test(matchString) && | ||
| 939 | !this._hasAncestorTag(node, "table") && | ||
| 940 | !this._hasAncestorTag(node, "code") && | ||
| 941 | node.tagName !== "BODY" && | ||
| 942 | node.tagName !== "A") { | ||
| 943 | this.log("Removing unlikely candidate - " + matchString); | ||
| 944 | node = this._removeAndGetNext(node); | ||
| 945 | continue; | ||
| 946 | } | ||
| 947 | |||
| 948 | if (this.UNLIKELY_ROLES.includes(node.getAttribute("role"))) { | ||
| 949 | this.log("Removing content with role " + node.getAttribute("role") + " - " + matchString); | ||
| 950 | node = this._removeAndGetNext(node); | ||
| 951 | continue; | ||
| 952 | } | ||
| 953 | } | ||
| 954 | |||
| 955 | // Remove DIV, SECTION, and HEADER nodes without any content(e.g. text, image, video, or iframe). | ||
| 956 | if ((node.tagName === "DIV" || node.tagName === "SECTION" || node.tagName === "HEADER" || | ||
| 957 | node.tagName === "H1" || node.tagName === "H2" || node.tagName === "H3" || | ||
| 958 | node.tagName === "H4" || node.tagName === "H5" || node.tagName === "H6") && | ||
| 959 | this._isElementWithoutContent(node)) { | ||
| 960 | node = this._removeAndGetNext(node); | ||
| 961 | continue; | ||
| 962 | } | ||
| 963 | |||
| 964 | if (this.DEFAULT_TAGS_TO_SCORE.indexOf(node.tagName) !== -1) { | ||
| 965 | elementsToScore.push(node); | ||
| 966 | } | ||
| 967 | |||
| 968 | // Turn all divs that don't have children block level elements into p's | ||
| 969 | if (node.tagName === "DIV") { | ||
| 970 | // Put phrasing content into paragraphs. | ||
| 971 | var p = null; | ||
| 972 | var childNode = node.firstChild; | ||
| 973 | while (childNode) { | ||
| 974 | var nextSibling = childNode.nextSibling; | ||
| 975 | if (this._isPhrasingContent(childNode)) { | ||
| 976 | if (p !== null) { | ||
| 977 | p.appendChild(childNode); | ||
| 978 | } else if (!this._isWhitespace(childNode)) { | ||
| 979 | p = doc.createElement("p"); | ||
| 980 | node.replaceChild(p, childNode); | ||
| 981 | p.appendChild(childNode); | ||
| 982 | } | ||
| 983 | } else if (p !== null) { | ||
| 984 | while (p.lastChild && this._isWhitespace(p.lastChild)) { | ||
| 985 | p.removeChild(p.lastChild); | ||
| 986 | } | ||
| 987 | p = null; | ||
| 988 | } | ||
| 989 | childNode = nextSibling; | ||
| 990 | } | ||
| 991 | |||
| 992 | // Sites like http://mobile.slate.com encloses each paragraph with a DIV | ||
| 993 | // element. DIVs with only a P element inside and no text content can be | ||
| 994 | // safely converted into plain P elements to avoid confusing the scoring | ||
| 995 | // algorithm with DIVs with are, in practice, paragraphs. | ||
| 996 | if (this._hasSingleTagInsideElement(node, "P") && this._getLinkDensity(node) < 0.25) { | ||
| 997 | var newNode = node.children[0]; | ||
| 998 | node.parentNode.replaceChild(newNode, node); | ||
| 999 | node = newNode; | ||
| 1000 | elementsToScore.push(node); | ||
| 1001 | } else if (!this._hasChildBlockElement(node)) { | ||
| 1002 | node = this._setNodeTag(node, "P"); | ||
| 1003 | elementsToScore.push(node); | ||
| 1004 | } | ||
| 1005 | } | ||
| 1006 | node = this._getNextNode(node); | ||
| 1007 | } | ||
| 1008 | |||
| 1009 | /** | ||
| 1010 | * Loop through all paragraphs, and assign a score to them based on how content-y they look. | ||
| 1011 | * Then add their score to their parent node. | ||
| 1012 | * | ||
| 1013 | * A score is determined by things like number of commas, class names, etc. Maybe eventually link density. | ||
| 1014 | **/ | ||
| 1015 | var candidates = []; | ||
| 1016 | this._forEachNode(elementsToScore, function(elementToScore) { | ||
| 1017 | if (!elementToScore.parentNode || typeof(elementToScore.parentNode.tagName) === "undefined") | ||
| 1018 | return; | ||
| 1019 | |||
| 1020 | // If this paragraph is less than 25 characters, don't even count it. | ||
| 1021 | var innerText = this._getInnerText(elementToScore); | ||
| 1022 | if (innerText.length < 25) | ||
| 1023 | return; | ||
| 1024 | |||
| 1025 | // Exclude nodes with no ancestor. | ||
| 1026 | var ancestors = this._getNodeAncestors(elementToScore, 5); | ||
| 1027 | if (ancestors.length === 0) | ||
| 1028 | return; | ||
| 1029 | |||
| 1030 | var contentScore = 0; | ||
| 1031 | |||
| 1032 | // Add a point for the paragraph itself as a base. | ||
| 1033 | contentScore += 1; | ||
| 1034 | |||
| 1035 | // Add points for any commas within this paragraph. | ||
| 1036 | contentScore += innerText.split(this.REGEXPS.commas).length; | ||
| 1037 | |||
| 1038 | // For every 100 characters in this paragraph, add another point. Up to 3 points. | ||
| 1039 | contentScore += Math.min(Math.floor(innerText.length / 100), 3); | ||
| 1040 | |||
| 1041 | // Initialize and score ancestors. | ||
| 1042 | this._forEachNode(ancestors, function(ancestor, level) { | ||
| 1043 | if (!ancestor.tagName || !ancestor.parentNode || typeof(ancestor.parentNode.tagName) === "undefined") | ||
| 1044 | return; | ||
| 1045 | |||
| 1046 | if (typeof(ancestor.readability) === "undefined") { | ||
| 1047 | this._initializeNode(ancestor); | ||
| 1048 | candidates.push(ancestor); | ||
| 1049 | } | ||
| 1050 | |||
| 1051 | // Node score divider: | ||
| 1052 | // - parent: 1 (no division) | ||
| 1053 | // - grandparent: 2 | ||
| 1054 | // - great grandparent+: ancestor level * 3 | ||
| 1055 | if (level === 0) | ||
| 1056 | var scoreDivider = 1; | ||
| 1057 | else if (level === 1) | ||
| 1058 | scoreDivider = 2; | ||
| 1059 | else | ||
| 1060 | scoreDivider = level * 3; | ||
| 1061 | ancestor.readability.contentScore += contentScore / scoreDivider; | ||
| 1062 | }); | ||
| 1063 | }); | ||
| 1064 | |||
| 1065 | // After we've calculated scores, loop through all of the possible | ||
| 1066 | // candidate nodes we found and find the one with the highest score. | ||
| 1067 | var topCandidates = []; | ||
| 1068 | for (var c = 0, cl = candidates.length; c < cl; c += 1) { | ||
| 1069 | var candidate = candidates[c]; | ||
| 1070 | |||
| 1071 | // Scale the final candidates score based on link density. Good content | ||
| 1072 | // should have a relatively small link density (5% or less) and be mostly | ||
| 1073 | // unaffected by this operation. | ||
| 1074 | var candidateScore = candidate.readability.contentScore * (1 - this._getLinkDensity(candidate)); | ||
| 1075 | candidate.readability.contentScore = candidateScore; | ||
| 1076 | |||
| 1077 | this.log("Candidate:", candidate, "with score " + candidateScore); | ||
| 1078 | |||
| 1079 | for (var t = 0; t < this._nbTopCandidates; t++) { | ||
| 1080 | var aTopCandidate = topCandidates[t]; | ||
| 1081 | |||
| 1082 | if (!aTopCandidate || candidateScore > aTopCandidate.readability.contentScore) { | ||
| 1083 | topCandidates.splice(t, 0, candidate); | ||
| 1084 | if (topCandidates.length > this._nbTopCandidates) | ||
| 1085 | topCandidates.pop(); | ||
| 1086 | break; | ||
| 1087 | } | ||
| 1088 | } | ||
| 1089 | } | ||
| 1090 | |||
| 1091 | var topCandidate = topCandidates[0] || null; | ||
| 1092 | var neededToCreateTopCandidate = false; | ||
| 1093 | var parentOfTopCandidate; | ||
| 1094 | |||
| 1095 | // If we still have no top candidate, just use the body as a last resort. | ||
| 1096 | // We also have to copy the body node so it is something we can modify. | ||
| 1097 | if (topCandidate === null || topCandidate.tagName === "BODY") { | ||
| 1098 | // Move all of the page's children into topCandidate | ||
| 1099 | topCandidate = doc.createElement("DIV"); | ||
| 1100 | neededToCreateTopCandidate = true; | ||
| 1101 | // Move everything (not just elements, also text nodes etc.) into the container | ||
| 1102 | // so we even include text directly in the body: | ||
| 1103 | while (page.firstChild) { | ||
| 1104 | this.log("Moving child out:", page.firstChild); | ||
| 1105 | topCandidate.appendChild(page.firstChild); | ||
| 1106 | } | ||
| 1107 | |||
| 1108 | page.appendChild(topCandidate); | ||
| 1109 | |||
| 1110 | this._initializeNode(topCandidate); | ||
| 1111 | } else if (topCandidate) { | ||
| 1112 | // Find a better top candidate node if it contains (at least three) nodes which belong to `topCandidates` array | ||
| 1113 | // and whose scores are quite closed with current `topCandidate` node. | ||
| 1114 | var alternativeCandidateAncestors = []; | ||
| 1115 | for (var i = 1; i < topCandidates.length; i++) { | ||
| 1116 | if (topCandidates[i].readability.contentScore / topCandidate.readability.contentScore >= 0.75) { | ||
| 1117 | alternativeCandidateAncestors.push(this._getNodeAncestors(topCandidates[i])); | ||
| 1118 | } | ||
| 1119 | } | ||
| 1120 | var MINIMUM_TOPCANDIDATES = 3; | ||
| 1121 | if (alternativeCandidateAncestors.length >= MINIMUM_TOPCANDIDATES) { | ||
| 1122 | parentOfTopCandidate = topCandidate.parentNode; | ||
| 1123 | while (parentOfTopCandidate.tagName !== "BODY") { | ||
| 1124 | var listsContainingThisAncestor = 0; | ||
| 1125 | for (var ancestorIndex = 0; ancestorIndex < alternativeCandidateAncestors.length && listsContainingThisAncestor < MINIMUM_TOPCANDIDATES; ancestorIndex++) { | ||
| 1126 | listsContainingThisAncestor += Number(alternativeCandidateAncestors[ancestorIndex].includes(parentOfTopCandidate)); | ||
| 1127 | } | ||
| 1128 | if (listsContainingThisAncestor >= MINIMUM_TOPCANDIDATES) { | ||
| 1129 | topCandidate = parentOfTopCandidate; | ||
| 1130 | break; | ||
| 1131 | } | ||
| 1132 | parentOfTopCandidate = parentOfTopCandidate.parentNode; | ||
| 1133 | } | ||
| 1134 | } | ||
| 1135 | if (!topCandidate.readability) { | ||
| 1136 | this._initializeNode(topCandidate); | ||
| 1137 | } | ||
| 1138 | |||
| 1139 | // Because of our bonus system, parents of candidates might have scores | ||
| 1140 | // themselves. They get half of the node. There won't be nodes with higher | ||
| 1141 | // scores than our topCandidate, but if we see the score going *up* in the first | ||
| 1142 | // few steps up the tree, that's a decent sign that there might be more content | ||
| 1143 | // lurking in other places that we want to unify in. The sibling stuff | ||
| 1144 | // below does some of that - but only if we've looked high enough up the DOM | ||
| 1145 | // tree. | ||
| 1146 | parentOfTopCandidate = topCandidate.parentNode; | ||
| 1147 | var lastScore = topCandidate.readability.contentScore; | ||
| 1148 | // The scores shouldn't get too low. | ||
| 1149 | var scoreThreshold = lastScore / 3; | ||
| 1150 | while (parentOfTopCandidate.tagName !== "BODY") { | ||
| 1151 | if (!parentOfTopCandidate.readability) { | ||
| 1152 | parentOfTopCandidate = parentOfTopCandidate.parentNode; | ||
| 1153 | continue; | ||
| 1154 | } | ||
| 1155 | var parentScore = parentOfTopCandidate.readability.contentScore; | ||
| 1156 | if (parentScore < scoreThreshold) | ||
| 1157 | break; | ||
| 1158 | if (parentScore > lastScore) { | ||
| 1159 | // Alright! We found a better parent to use. | ||
| 1160 | topCandidate = parentOfTopCandidate; | ||
| 1161 | break; | ||
| 1162 | } | ||
| 1163 | lastScore = parentOfTopCandidate.readability.contentScore; | ||
| 1164 | parentOfTopCandidate = parentOfTopCandidate.parentNode; | ||
| 1165 | } | ||
| 1166 | |||
| 1167 | // If the top candidate is the only child, use parent instead. This will help sibling | ||
| 1168 | // joining logic when adjacent content is actually located in parent's sibling node. | ||
| 1169 | parentOfTopCandidate = topCandidate.parentNode; | ||
| 1170 | while (parentOfTopCandidate.tagName != "BODY" && parentOfTopCandidate.children.length == 1) { | ||
| 1171 | topCandidate = parentOfTopCandidate; | ||
| 1172 | parentOfTopCandidate = topCandidate.parentNode; | ||
| 1173 | } | ||
| 1174 | if (!topCandidate.readability) { | ||
| 1175 | this._initializeNode(topCandidate); | ||
| 1176 | } | ||
| 1177 | } | ||
| 1178 | |||
| 1179 | // Now that we have the top candidate, look through its siblings for content | ||
| 1180 | // that might also be related. Things like preambles, content split by ads | ||
| 1181 | // that we removed, etc. | ||
| 1182 | var articleContent = doc.createElement("DIV"); | ||
| 1183 | if (isPaging) | ||
| 1184 | articleContent.id = "readability-content"; | ||
| 1185 | |||
| 1186 | var siblingScoreThreshold = Math.max(10, topCandidate.readability.contentScore * 0.2); | ||
| 1187 | // Keep potential top candidate's parent node to try to get text direction of it later. | ||
| 1188 | parentOfTopCandidate = topCandidate.parentNode; | ||
| 1189 | var siblings = parentOfTopCandidate.children; | ||
| 1190 | |||
| 1191 | for (var s = 0, sl = siblings.length; s < sl; s++) { | ||
| 1192 | var sibling = siblings[s]; | ||
| 1193 | var append = false; | ||
| 1194 | |||
| 1195 | this.log("Looking at sibling node:", sibling, sibling.readability ? ("with score " + sibling.readability.contentScore) : ""); | ||
| 1196 | this.log("Sibling has score", sibling.readability ? sibling.readability.contentScore : "Unknown"); | ||
| 1197 | |||
| 1198 | if (sibling === topCandidate) { | ||
| 1199 | append = true; | ||
| 1200 | } else { | ||
| 1201 | var contentBonus = 0; | ||
| 1202 | |||
| 1203 | // Give a bonus if sibling nodes and top candidates have the example same classname | ||
| 1204 | if (sibling.className === topCandidate.className && topCandidate.className !== "") | ||
| 1205 | contentBonus += topCandidate.readability.contentScore * 0.2; | ||
| 1206 | |||
| 1207 | if (sibling.readability && | ||
| 1208 | ((sibling.readability.contentScore + contentBonus) >= siblingScoreThreshold)) { | ||
| 1209 | append = true; | ||
| 1210 | } else if (sibling.nodeName === "P") { | ||
| 1211 | var linkDensity = this._getLinkDensity(sibling); | ||
| 1212 | var nodeContent = this._getInnerText(sibling); | ||
| 1213 | var nodeLength = nodeContent.length; | ||
| 1214 | |||
| 1215 | if (nodeLength > 80 && linkDensity < 0.25) { | ||
| 1216 | append = true; | ||
| 1217 | } else if (nodeLength < 80 && nodeLength > 0 && linkDensity === 0 && | ||
| 1218 | nodeContent.search(/\.( |$)/) !== -1) { | ||
| 1219 | append = true; | ||
| 1220 | } | ||
| 1221 | } | ||
| 1222 | } | ||
| 1223 | |||
| 1224 | if (append) { | ||
| 1225 | this.log("Appending node:", sibling); | ||
| 1226 | |||
| 1227 | if (this.ALTER_TO_DIV_EXCEPTIONS.indexOf(sibling.nodeName) === -1) { | ||
| 1228 | // We have a node that isn't a common block level element, like a form or td tag. | ||
| 1229 | // Turn it into a div so it doesn't get filtered out later by accident. | ||
| 1230 | this.log("Altering sibling:", sibling, "to div."); | ||
| 1231 | |||
| 1232 | sibling = this._setNodeTag(sibling, "DIV"); | ||
| 1233 | } | ||
| 1234 | |||
| 1235 | articleContent.appendChild(sibling); | ||
| 1236 | // Fetch children again to make it compatible | ||
| 1237 | // with DOM parsers without live collection support. | ||
| 1238 | siblings = parentOfTopCandidate.children; | ||
| 1239 | // siblings is a reference to the children array, and | ||
| 1240 | // sibling is removed from the array when we call appendChild(). | ||
| 1241 | // As a result, we must revisit this index since the nodes | ||
| 1242 | // have been shifted. | ||
| 1243 | s -= 1; | ||
| 1244 | sl -= 1; | ||
| 1245 | } | ||
| 1246 | } | ||
| 1247 | |||
| 1248 | if (this._debug) | ||
| 1249 | this.log("Article content pre-prep: " + articleContent.innerHTML); | ||
| 1250 | // So we have all of the content that we need. Now we clean it up for presentation. | ||
| 1251 | this._prepArticle(articleContent); | ||
| 1252 | if (this._debug) | ||
| 1253 | this.log("Article content post-prep: " + articleContent.innerHTML); | ||
| 1254 | |||
| 1255 | if (neededToCreateTopCandidate) { | ||
| 1256 | // We already created a fake div thing, and there wouldn't have been any siblings left | ||
| 1257 | // for the previous loop, so there's no point trying to create a new div, and then | ||
| 1258 | // move all the children over. Just assign IDs and class names here. No need to append | ||
| 1259 | // because that already happened anyway. | ||
| 1260 | topCandidate.id = "readability-page-1"; | ||
| 1261 | topCandidate.className = "page"; | ||
| 1262 | } else { | ||
| 1263 | var div = doc.createElement("DIV"); | ||
| 1264 | div.id = "readability-page-1"; | ||
| 1265 | div.className = "page"; | ||
| 1266 | while (articleContent.firstChild) { | ||
| 1267 | div.appendChild(articleContent.firstChild); | ||
| 1268 | } | ||
| 1269 | articleContent.appendChild(div); | ||
| 1270 | } | ||
| 1271 | |||
| 1272 | if (this._debug) | ||
| 1273 | this.log("Article content after paging: " + articleContent.innerHTML); | ||
| 1274 | |||
| 1275 | var parseSuccessful = true; | ||
| 1276 | |||
| 1277 | // Now that we've gone through the full algorithm, check to see if | ||
| 1278 | // we got any meaningful content. If we didn't, we may need to re-run | ||
| 1279 | // grabArticle with different flags set. This gives us a higher likelihood of | ||
| 1280 | // finding the content, and the sieve approach gives us a higher likelihood of | ||
| 1281 | // finding the -right- content. | ||
| 1282 | var textLength = this._getInnerText(articleContent, true).length; | ||
| 1283 | if (textLength < this._charThreshold) { | ||
| 1284 | parseSuccessful = false; | ||
| 1285 | page.innerHTML = pageCacheHtml; | ||
| 1286 | |||
| 1287 | if (this._flagIsActive(this.FLAG_STRIP_UNLIKELYS)) { | ||
| 1288 | this._removeFlag(this.FLAG_STRIP_UNLIKELYS); | ||
| 1289 | this._attempts.push({articleContent: articleContent, textLength: textLength}); | ||
| 1290 | } else if (this._flagIsActive(this.FLAG_WEIGHT_CLASSES)) { | ||
| 1291 | this._removeFlag(this.FLAG_WEIGHT_CLASSES); | ||
| 1292 | this._attempts.push({articleContent: articleContent, textLength: textLength}); | ||
| 1293 | } else if (this._flagIsActive(this.FLAG_CLEAN_CONDITIONALLY)) { | ||
| 1294 | this._removeFlag(this.FLAG_CLEAN_CONDITIONALLY); | ||
| 1295 | this._attempts.push({articleContent: articleContent, textLength: textLength}); | ||
| 1296 | } else { | ||
| 1297 | this._attempts.push({articleContent: articleContent, textLength: textLength}); | ||
| 1298 | // No luck after removing flags, just return the longest text we found during the different loops | ||
| 1299 | this._attempts.sort(function (a, b) { | ||
| 1300 | return b.textLength - a.textLength; | ||
| 1301 | }); | ||
| 1302 | |||
| 1303 | // But first check if we actually have something | ||
| 1304 | if (!this._attempts[0].textLength) { | ||
| 1305 | return null; | ||
| 1306 | } | ||
| 1307 | |||
| 1308 | articleContent = this._attempts[0].articleContent; | ||
| 1309 | parseSuccessful = true; | ||
| 1310 | } | ||
| 1311 | } | ||
| 1312 | |||
| 1313 | if (parseSuccessful) { | ||
| 1314 | // Find out text direction from ancestors of final top candidate. | ||
| 1315 | var ancestors = [parentOfTopCandidate, topCandidate].concat(this._getNodeAncestors(parentOfTopCandidate)); | ||
| 1316 | this._someNode(ancestors, function(ancestor) { | ||
| 1317 | if (!ancestor.tagName) | ||
| 1318 | return false; | ||
| 1319 | var articleDir = ancestor.getAttribute("dir"); | ||
| 1320 | if (articleDir) { | ||
| 1321 | this._articleDir = articleDir; | ||
| 1322 | return true; | ||
| 1323 | } | ||
| 1324 | return false; | ||
| 1325 | }); | ||
| 1326 | return articleContent; | ||
| 1327 | } | ||
| 1328 | } | ||
| 1329 | }, | ||
| 1330 | |||
| 1331 | /** | ||
| 1332 | * Check whether the input string could be a byline. | ||
| 1333 | * This verifies that the input is a string, and that the length | ||
| 1334 | * is less than 100 chars. | ||
| 1335 | * | ||
| 1336 | * @param possibleByline {string} - a string to check whether its a byline. | ||
| 1337 | * @return Boolean - whether the input string is a byline. | ||
| 1338 | */ | ||
| 1339 | _isValidByline: function(byline) { | ||
| 1340 | if (typeof byline == "string" || byline instanceof String) { | ||
| 1341 | byline = byline.trim(); | ||
| 1342 | return (byline.length > 0) && (byline.length < 100); | ||
| 1343 | } | ||
| 1344 | return false; | ||
| 1345 | }, | ||
| 1346 | |||
| 1347 | /** | ||
| 1348 | * Converts some of the common HTML entities in string to their corresponding characters. | ||
| 1349 | * | ||
| 1350 | * @param str {string} - a string to unescape. | ||
| 1351 | * @return string without HTML entity. | ||
| 1352 | */ | ||
| 1353 | _unescapeHtmlEntities: function(str) { | ||
| 1354 | if (!str) { | ||
| 1355 | return str; | ||
| 1356 | } | ||
| 1357 | |||
| 1358 | var htmlEscapeMap = this.HTML_ESCAPE_MAP; | ||
| 1359 | return str.replace(/&(quot|amp|apos|lt|gt);/g, function(_, tag) { | ||
| 1360 | return htmlEscapeMap[tag]; | ||
| 1361 | }).replace(/&#(?:x([0-9a-z]{1,4})|([0-9]{1,4}));/gi, function(_, hex, numStr) { | ||
| 1362 | var num = parseInt(hex || numStr, hex ? 16 : 10); | ||
| 1363 | return String.fromCharCode(num); | ||
| 1364 | }); | ||
| 1365 | }, | ||
| 1366 | |||
| 1367 | /** | ||
| 1368 | * Try to extract metadata from JSON-LD object. | ||
| 1369 | * For now, only Schema.org objects of type Article or its subtypes are supported. | ||
| 1370 | * @return Object with any metadata that could be extracted (possibly none) | ||
| 1371 | */ | ||
| 1372 | _getJSONLD: function (doc) { | ||
| 1373 | var scripts = this._getAllNodesWithTag(doc, ["script"]); | ||
| 1374 | |||
| 1375 | var metadata; | ||
| 1376 | |||
| 1377 | this._forEachNode(scripts, function(jsonLdElement) { | ||
| 1378 | if (!metadata && jsonLdElement.getAttribute("type") === "application/ld+json") { | ||
| 1379 | try { | ||
| 1380 | // Strip CDATA markers if present | ||
| 1381 | var content = jsonLdElement.textContent.replace(/^\s*<!\[CDATA\[|\]\]>\s*$/g, ""); | ||
| 1382 | var parsed = JSON.parse(content); | ||
| 1383 | if ( | ||
| 1384 | !parsed["@context"] || | ||
| 1385 | !parsed["@context"].match(/^https?\:\/\/schema\.org$/) | ||
| 1386 | ) { | ||
| 1387 | return; | ||
| 1388 | } | ||
| 1389 | |||
| 1390 | if (!parsed["@type"] && Array.isArray(parsed["@graph"])) { | ||
| 1391 | parsed = parsed["@graph"].find(function(it) { | ||
| 1392 | return (it["@type"] || "").match( | ||
| 1393 | this.REGEXPS.jsonLdArticleTypes | ||
| 1394 | ); | ||
| 1395 | }); | ||
| 1396 | } | ||
| 1397 | |||
| 1398 | if ( | ||
| 1399 | !parsed || | ||
| 1400 | !parsed["@type"] || | ||
| 1401 | !parsed["@type"].match(this.REGEXPS.jsonLdArticleTypes) | ||
| 1402 | ) { | ||
| 1403 | return; | ||
| 1404 | } | ||
| 1405 | |||
| 1406 | metadata = {}; | ||
| 1407 | |||
| 1408 | if (typeof parsed.name === "string" && typeof parsed.headline === "string" && parsed.name !== parsed.headline) { | ||
| 1409 | // we have both name and headline element in the JSON-LD. They should both be the same but some websites like aktualne.cz | ||
| 1410 | // put their own name into "name" and the article title to "headline" which confuses Readability. So we try to check if either | ||
| 1411 | // "name" or "headline" closely matches the html title, and if so, use that one. If not, then we use "name" by default. | ||
| 1412 | |||
| 1413 | var title = this._getArticleTitle(); | ||
| 1414 | var nameMatches = this._textSimilarity(parsed.name, title) > 0.75; | ||
| 1415 | var headlineMatches = this._textSimilarity(parsed.headline, title) > 0.75; | ||
| 1416 | |||
| 1417 | if (headlineMatches && !nameMatches) { | ||
| 1418 | metadata.title = parsed.headline; | ||
| 1419 | } else { | ||
| 1420 | metadata.title = parsed.name; | ||
| 1421 | } | ||
| 1422 | } else if (typeof parsed.name === "string") { | ||
| 1423 | metadata.title = parsed.name.trim(); | ||
| 1424 | } else if (typeof parsed.headline === "string") { | ||
| 1425 | metadata.title = parsed.headline.trim(); | ||
| 1426 | } | ||
| 1427 | if (parsed.author) { | ||
| 1428 | if (typeof parsed.author.name === "string") { | ||
| 1429 | metadata.byline = parsed.author.name.trim(); | ||
| 1430 | } else if (Array.isArray(parsed.author) && parsed.author[0] && typeof parsed.author[0].name === "string") { | ||
| 1431 | metadata.byline = parsed.author | ||
| 1432 | .filter(function(author) { | ||
| 1433 | return author && typeof author.name === "string"; | ||
| 1434 | }) | ||
| 1435 | .map(function(author) { | ||
| 1436 | return author.name.trim(); | ||
| 1437 | }) | ||
| 1438 | .join(", "); | ||
| 1439 | } | ||
| 1440 | } | ||
| 1441 | if (typeof parsed.description === "string") { | ||
| 1442 | metadata.excerpt = parsed.description.trim(); | ||
| 1443 | } | ||
| 1444 | if ( | ||
| 1445 | parsed.publisher && | ||
| 1446 | typeof parsed.publisher.name === "string" | ||
| 1447 | ) { | ||
| 1448 | metadata.siteName = parsed.publisher.name.trim(); | ||
| 1449 | } | ||
| 1450 | if (typeof parsed.datePublished === "string") { | ||
| 1451 | metadata.datePublished = parsed.datePublished.trim(); | ||
| 1452 | } | ||
| 1453 | return; | ||
| 1454 | } catch (err) { | ||
| 1455 | this.log(err.message); | ||
| 1456 | } | ||
| 1457 | } | ||
| 1458 | }); | ||
| 1459 | return metadata ? metadata : {}; | ||
| 1460 | }, | ||
| 1461 | |||
| 1462 | /** | ||
| 1463 | * Attempts to get excerpt and byline metadata for the article. | ||
| 1464 | * | ||
| 1465 | * @param {Object} jsonld — object containing any metadata that | ||
| 1466 | * could be extracted from JSON-LD object. | ||
| 1467 | * | ||
| 1468 | * @return Object with optional "excerpt" and "byline" properties | ||
| 1469 | */ | ||
| 1470 | _getArticleMetadata: function(jsonld) { | ||
| 1471 | var metadata = {}; | ||
| 1472 | var values = {}; | ||
| 1473 | var metaElements = this._doc.getElementsByTagName("meta"); | ||
| 1474 | |||
| 1475 | // property is a space-separated list of values | ||
| 1476 | var propertyPattern = /\s*(article|dc|dcterm|og|twitter)\s*:\s*(author|creator|description|published_time|title|site_name)\s*/gi; | ||
| 1477 | |||
| 1478 | // name is a single value | ||
| 1479 | var namePattern = /^\s*(?:(dc|dcterm|og|twitter|weibo:(article|webpage))\s*[\.:]\s*)?(author|creator|description|title|site_name)\s*$/i; | ||
| 1480 | |||
| 1481 | // Find description tags. | ||
| 1482 | this._forEachNode(metaElements, function(element) { | ||
| 1483 | var elementName = element.getAttribute("name"); | ||
| 1484 | var elementProperty = element.getAttribute("property"); | ||
| 1485 | var content = element.getAttribute("content"); | ||
| 1486 | if (!content) { | ||
| 1487 | return; | ||
| 1488 | } | ||
| 1489 | var matches = null; | ||
| 1490 | var name = null; | ||
| 1491 | |||
| 1492 | if (elementProperty) { | ||
| 1493 | matches = elementProperty.match(propertyPattern); | ||
| 1494 | if (matches) { | ||
| 1495 | // Convert to lowercase, and remove any whitespace | ||
| 1496 | // so we can match below. | ||
| 1497 | name = matches[0].toLowerCase().replace(/\s/g, ""); | ||
| 1498 | // multiple authors | ||
| 1499 | values[name] = content.trim(); | ||
| 1500 | } | ||
| 1501 | } | ||
| 1502 | if (!matches && elementName && namePattern.test(elementName)) { | ||
| 1503 | name = elementName; | ||
| 1504 | if (content) { | ||
| 1505 | // Convert to lowercase, remove any whitespace, and convert dots | ||
| 1506 | // to colons so we can match below. | ||
| 1507 | name = name.toLowerCase().replace(/\s/g, "").replace(/\./g, ":"); | ||
| 1508 | values[name] = content.trim(); | ||
| 1509 | } | ||
| 1510 | } | ||
| 1511 | }); | ||
| 1512 | |||
| 1513 | // get title | ||
| 1514 | metadata.title = jsonld.title || | ||
| 1515 | values["dc:title"] || | ||
| 1516 | values["dcterm:title"] || | ||
| 1517 | values["og:title"] || | ||
| 1518 | values["weibo:article:title"] || | ||
| 1519 | values["weibo:webpage:title"] || | ||
| 1520 | values["title"] || | ||
| 1521 | values["twitter:title"]; | ||
| 1522 | |||
| 1523 | if (!metadata.title) { | ||
| 1524 | metadata.title = this._getArticleTitle(); | ||
| 1525 | } | ||
| 1526 | |||
| 1527 | // get author | ||
| 1528 | metadata.byline = jsonld.byline || | ||
| 1529 | values["dc:creator"] || | ||
| 1530 | values["dcterm:creator"] || | ||
| 1531 | values["author"]; | ||
| 1532 | |||
| 1533 | // get description | ||
| 1534 | metadata.excerpt = jsonld.excerpt || | ||
| 1535 | values["dc:description"] || | ||
| 1536 | values["dcterm:description"] || | ||
| 1537 | values["og:description"] || | ||
| 1538 | values["weibo:article:description"] || | ||
| 1539 | values["weibo:webpage:description"] || | ||
| 1540 | values["description"] || | ||
| 1541 | values["twitter:description"]; | ||
| 1542 | |||
| 1543 | // get site name | ||
| 1544 | metadata.siteName = jsonld.siteName || | ||
| 1545 | values["og:site_name"]; | ||
| 1546 | |||
| 1547 | // get article published time | ||
| 1548 | metadata.publishedTime = jsonld.datePublished || | ||
| 1549 | values["article:published_time"] || null; | ||
| 1550 | |||
| 1551 | // in many sites the meta value is escaped with HTML entities, | ||
| 1552 | // so here we need to unescape it | ||
| 1553 | metadata.title = this._unescapeHtmlEntities(metadata.title); | ||
| 1554 | metadata.byline = this._unescapeHtmlEntities(metadata.byline); | ||
| 1555 | metadata.excerpt = this._unescapeHtmlEntities(metadata.excerpt); | ||
| 1556 | metadata.siteName = this._unescapeHtmlEntities(metadata.siteName); | ||
| 1557 | metadata.publishedTime = this._unescapeHtmlEntities(metadata.publishedTime); | ||
| 1558 | |||
| 1559 | return metadata; | ||
| 1560 | }, | ||
| 1561 | |||
| 1562 | /** | ||
| 1563 | * Check if node is image, or if node contains exactly only one image | ||
| 1564 | * whether as a direct child or as its descendants. | ||
| 1565 | * | ||
| 1566 | * @param Element | ||
| 1567 | **/ | ||
| 1568 | _isSingleImage: function(node) { | ||
| 1569 | if (node.tagName === "IMG") { | ||
| 1570 | return true; | ||
| 1571 | } | ||
| 1572 | |||
| 1573 | if (node.children.length !== 1 || node.textContent.trim() !== "") { | ||
| 1574 | return false; | ||
| 1575 | } | ||
| 1576 | |||
| 1577 | return this._isSingleImage(node.children[0]); | ||
| 1578 | }, | ||
| 1579 | |||
| 1580 | /** | ||
| 1581 | * Find all <noscript> that are located after <img> nodes, and which contain only one | ||
| 1582 | * <img> element. Replace the first image with the image from inside the <noscript> tag, | ||
| 1583 | * and remove the <noscript> tag. This improves the quality of the images we use on | ||
| 1584 | * some sites (e.g. Medium). | ||
| 1585 | * | ||
| 1586 | * @param Element | ||
| 1587 | **/ | ||
| 1588 | _unwrapNoscriptImages: function(doc) { | ||
| 1589 | // Find img without source or attributes that might contains image, and remove it. | ||
| 1590 | // This is done to prevent a placeholder img is replaced by img from noscript in next step. | ||
| 1591 | var imgs = Array.from(doc.getElementsByTagName("img")); | ||
| 1592 | this._forEachNode(imgs, function(img) { | ||
| 1593 | for (var i = 0; i < img.attributes.length; i++) { | ||
| 1594 | var attr = img.attributes[i]; | ||
| 1595 | switch (attr.name) { | ||
| 1596 | case "src": | ||
| 1597 | case "srcset": | ||
| 1598 | case "data-src": | ||
| 1599 | case "data-srcset": | ||
| 1600 | return; | ||
| 1601 | } | ||
| 1602 | |||
| 1603 | if (/\.(jpg|jpeg|png|webp)/i.test(attr.value)) { | ||
| 1604 | return; | ||
| 1605 | } | ||
| 1606 | } | ||
| 1607 | |||
| 1608 | img.parentNode.removeChild(img); | ||
| 1609 | }); | ||
| 1610 | |||
| 1611 | // Next find noscript and try to extract its image | ||
| 1612 | var noscripts = Array.from(doc.getElementsByTagName("noscript")); | ||
| 1613 | this._forEachNode(noscripts, function(noscript) { | ||
| 1614 | // Parse content of noscript and make sure it only contains image | ||
| 1615 | var tmp = doc.createElement("div"); | ||
| 1616 | tmp.innerHTML = noscript.innerHTML; | ||
| 1617 | if (!this._isSingleImage(tmp)) { | ||
| 1618 | return; | ||
| 1619 | } | ||
| 1620 | |||
| 1621 | // If noscript has previous sibling and it only contains image, | ||
| 1622 | // replace it with noscript content. However we also keep old | ||
| 1623 | // attributes that might contains image. | ||
| 1624 | var prevElement = noscript.previousElementSibling; | ||
| 1625 | if (prevElement && this._isSingleImage(prevElement)) { | ||
| 1626 | var prevImg = prevElement; | ||
| 1627 | if (prevImg.tagName !== "IMG") { | ||
| 1628 | prevImg = prevElement.getElementsByTagName("img")[0]; | ||
| 1629 | } | ||
| 1630 | |||
| 1631 | var newImg = tmp.getElementsByTagName("img")[0]; | ||
| 1632 | for (var i = 0; i < prevImg.attributes.length; i++) { | ||
| 1633 | var attr = prevImg.attributes[i]; | ||
| 1634 | if (attr.value === "") { | ||
| 1635 | continue; | ||
| 1636 | } | ||
| 1637 | |||
| 1638 | if (attr.name === "src" || attr.name === "srcset" || /\.(jpg|jpeg|png|webp)/i.test(attr.value)) { | ||
| 1639 | if (newImg.getAttribute(attr.name) === attr.value) { | ||
| 1640 | continue; | ||
| 1641 | } | ||
| 1642 | |||
| 1643 | var attrName = attr.name; | ||
| 1644 | if (newImg.hasAttribute(attrName)) { | ||
| 1645 | attrName = "data-old-" + attrName; | ||
| 1646 | } | ||
| 1647 | |||
| 1648 | newImg.setAttribute(attrName, attr.value); | ||
| 1649 | } | ||
| 1650 | } | ||
| 1651 | |||
| 1652 | noscript.parentNode.replaceChild(tmp.firstElementChild, prevElement); | ||
| 1653 | } | ||
| 1654 | }); | ||
| 1655 | }, | ||
| 1656 | |||
| 1657 | /** | ||
| 1658 | * Removes script tags from the document. | ||
| 1659 | * | ||
| 1660 | * @param Element | ||
| 1661 | **/ | ||
| 1662 | _removeScripts: function(doc) { | ||
| 1663 | this._removeNodes(this._getAllNodesWithTag(doc, ["script", "noscript"])); | ||
| 1664 | }, | ||
| 1665 | |||
| 1666 | /** | ||
| 1667 | * Check if this node has only whitespace and a single element with given tag | ||
| 1668 | * Returns false if the DIV node contains non-empty text nodes | ||
| 1669 | * or if it contains no element with given tag or more than 1 element. | ||
| 1670 | * | ||
| 1671 | * @param Element | ||
| 1672 | * @param string tag of child element | ||
| 1673 | **/ | ||
| 1674 | _hasSingleTagInsideElement: function(element, tag) { | ||
| 1675 | // There should be exactly 1 element child with given tag | ||
| 1676 | if (element.children.length != 1 || element.children[0].tagName !== tag) { | ||
| 1677 | return false; | ||
| 1678 | } | ||
| 1679 | |||
| 1680 | // And there should be no text nodes with real content | ||
| 1681 | return !this._someNode(element.childNodes, function(node) { | ||
| 1682 | return node.nodeType === this.TEXT_NODE && | ||
| 1683 | this.REGEXPS.hasContent.test(node.textContent); | ||
| 1684 | }); | ||
| 1685 | }, | ||
| 1686 | |||
| 1687 | _isElementWithoutContent: function(node) { | ||
| 1688 | return node.nodeType === this.ELEMENT_NODE && | ||
| 1689 | node.textContent.trim().length == 0 && | ||
| 1690 | (node.children.length == 0 || | ||
| 1691 | node.children.length == node.getElementsByTagName("br").length + node.getElementsByTagName("hr").length); | ||
| 1692 | }, | ||
| 1693 | |||
| 1694 | /** | ||
| 1695 | * Determine whether element has any children block level elements. | ||
| 1696 | * | ||
| 1697 | * @param Element | ||
| 1698 | */ | ||
| 1699 | _hasChildBlockElement: function (element) { | ||
| 1700 | return this._someNode(element.childNodes, function(node) { | ||
| 1701 | return this.DIV_TO_P_ELEMS.has(node.tagName) || | ||
| 1702 | this._hasChildBlockElement(node); | ||
| 1703 | }); | ||
| 1704 | }, | ||
| 1705 | |||
| 1706 | /*** | ||
| 1707 | * Determine if a node qualifies as phrasing content. | ||
| 1708 | * https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Content_categories#Phrasing_content | ||
| 1709 | **/ | ||
| 1710 | _isPhrasingContent: function(node) { | ||
| 1711 | return node.nodeType === this.TEXT_NODE || this.PHRASING_ELEMS.indexOf(node.tagName) !== -1 || | ||
| 1712 | ((node.tagName === "A" || node.tagName === "DEL" || node.tagName === "INS") && | ||
| 1713 | this._everyNode(node.childNodes, this._isPhrasingContent)); | ||
| 1714 | }, | ||
| 1715 | |||
| 1716 | _isWhitespace: function(node) { | ||
| 1717 | return (node.nodeType === this.TEXT_NODE && node.textContent.trim().length === 0) || | ||
| 1718 | (node.nodeType === this.ELEMENT_NODE && node.tagName === "BR"); | ||
| 1719 | }, | ||
| 1720 | |||
| 1721 | /** | ||
| 1722 | * Get the inner text of a node - cross browser compatibly. | ||
| 1723 | * This also strips out any excess whitespace to be found. | ||
| 1724 | * | ||
| 1725 | * @param Element | ||
| 1726 | * @param Boolean normalizeSpaces (default: true) | ||
| 1727 | * @return string | ||
| 1728 | **/ | ||
| 1729 | _getInnerText: function(e, normalizeSpaces) { | ||
| 1730 | normalizeSpaces = (typeof normalizeSpaces === "undefined") ? true : normalizeSpaces; | ||
| 1731 | var textContent = e.textContent.trim(); | ||
| 1732 | |||
| 1733 | if (normalizeSpaces) { | ||
| 1734 | return textContent.replace(this.REGEXPS.normalize, " "); | ||
| 1735 | } | ||
| 1736 | return textContent; | ||
| 1737 | }, | ||
| 1738 | |||
| 1739 | /** | ||
| 1740 | * Get the number of times a string s appears in the node e. | ||
| 1741 | * | ||
| 1742 | * @param Element | ||
| 1743 | * @param string - what to split on. Default is "," | ||
| 1744 | * @return number (integer) | ||
| 1745 | **/ | ||
| 1746 | _getCharCount: function(e, s) { | ||
| 1747 | s = s || ","; | ||
| 1748 | return this._getInnerText(e).split(s).length - 1; | ||
| 1749 | }, | ||
| 1750 | |||
| 1751 | /** | ||
| 1752 | * Remove the style attribute on every e and under. | ||
| 1753 | * TODO: Test if getElementsByTagName(*) is faster. | ||
| 1754 | * | ||
| 1755 | * @param Element | ||
| 1756 | * @return void | ||
| 1757 | **/ | ||
| 1758 | _cleanStyles: function(e) { | ||
| 1759 | if (!e || e.tagName.toLowerCase() === "svg") | ||
| 1760 | return; | ||
| 1761 | |||
| 1762 | // Remove `style` and deprecated presentational attributes | ||
| 1763 | for (var i = 0; i < this.PRESENTATIONAL_ATTRIBUTES.length; i++) { | ||
| 1764 | e.removeAttribute(this.PRESENTATIONAL_ATTRIBUTES[i]); | ||
| 1765 | } | ||
| 1766 | |||
| 1767 | if (this.DEPRECATED_SIZE_ATTRIBUTE_ELEMS.indexOf(e.tagName) !== -1) { | ||
| 1768 | e.removeAttribute("width"); | ||
| 1769 | e.removeAttribute("height"); | ||
| 1770 | } | ||
| 1771 | |||
| 1772 | var cur = e.firstElementChild; | ||
| 1773 | while (cur !== null) { | ||
| 1774 | this._cleanStyles(cur); | ||
| 1775 | cur = cur.nextElementSibling; | ||
| 1776 | } | ||
| 1777 | }, | ||
| 1778 | |||
| 1779 | /** | ||
| 1780 | * Get the density of links as a percentage of the content | ||
| 1781 | * This is the amount of text that is inside a link divided by the total text in the node. | ||
| 1782 | * | ||
| 1783 | * @param Element | ||
| 1784 | * @return number (float) | ||
| 1785 | **/ | ||
| 1786 | _getLinkDensity: function(element) { | ||
| 1787 | var textLength = this._getInnerText(element).length; | ||
| 1788 | if (textLength === 0) | ||
| 1789 | return 0; | ||
| 1790 | |||
| 1791 | var linkLength = 0; | ||
| 1792 | |||
| 1793 | // XXX implement _reduceNodeList? | ||
| 1794 | this._forEachNode(element.getElementsByTagName("a"), function(linkNode) { | ||
| 1795 | var href = linkNode.getAttribute("href"); | ||
| 1796 | var coefficient = href && this.REGEXPS.hashUrl.test(href) ? 0.3 : 1; | ||
| 1797 | linkLength += this._getInnerText(linkNode).length * coefficient; | ||
| 1798 | }); | ||
| 1799 | |||
| 1800 | return linkLength / textLength; | ||
| 1801 | }, | ||
| 1802 | |||
| 1803 | /** | ||
| 1804 | * Get an elements class/id weight. Uses regular expressions to tell if this | ||
| 1805 | * element looks good or bad. | ||
| 1806 | * | ||
| 1807 | * @param Element | ||
| 1808 | * @return number (Integer) | ||
| 1809 | **/ | ||
| 1810 | _getClassWeight: function(e) { | ||
| 1811 | if (!this._flagIsActive(this.FLAG_WEIGHT_CLASSES)) | ||
| 1812 | return 0; | ||
| 1813 | |||
| 1814 | var weight = 0; | ||
| 1815 | |||
| 1816 | // Look for a special classname | ||
| 1817 | if (typeof(e.className) === "string" && e.className !== "") { | ||
| 1818 | if (this.REGEXPS.negative.test(e.className)) | ||
| 1819 | weight -= 25; | ||
| 1820 | |||
| 1821 | if (this.REGEXPS.positive.test(e.className)) | ||
| 1822 | weight += 25; | ||
| 1823 | } | ||
| 1824 | |||
| 1825 | // Look for a special ID | ||
| 1826 | if (typeof(e.id) === "string" && e.id !== "") { | ||
| 1827 | if (this.REGEXPS.negative.test(e.id)) | ||
| 1828 | weight -= 25; | ||
| 1829 | |||
| 1830 | if (this.REGEXPS.positive.test(e.id)) | ||
| 1831 | weight += 25; | ||
| 1832 | } | ||
| 1833 | |||
| 1834 | return weight; | ||
| 1835 | }, | ||
| 1836 | |||
| 1837 | /** | ||
| 1838 | * Clean a node of all elements of type "tag". | ||
| 1839 | * (Unless it's a youtube/vimeo video. People love movies.) | ||
| 1840 | * | ||
| 1841 | * @param Element | ||
| 1842 | * @param string tag to clean | ||
| 1843 | * @return void | ||
| 1844 | **/ | ||
| 1845 | _clean: function(e, tag) { | ||
| 1846 | var isEmbed = ["object", "embed", "iframe"].indexOf(tag) !== -1; | ||
| 1847 | |||
| 1848 | this._removeNodes(this._getAllNodesWithTag(e, [tag]), function(element) { | ||
| 1849 | // Allow youtube and vimeo videos through as people usually want to see those. | ||
| 1850 | if (isEmbed) { | ||
| 1851 | // First, check the elements attributes to see if any of them contain youtube or vimeo | ||
| 1852 | for (var i = 0; i < element.attributes.length; i++) { | ||
| 1853 | if (this._allowedVideoRegex.test(element.attributes[i].value)) { | ||
| 1854 | return false; | ||
| 1855 | } | ||
| 1856 | } | ||
| 1857 | |||
| 1858 | // For embed with <object> tag, check inner HTML as well. | ||
| 1859 | if (element.tagName === "object" && this._allowedVideoRegex.test(element.innerHTML)) { | ||
| 1860 | return false; | ||
| 1861 | } | ||
| 1862 | } | ||
| 1863 | |||
| 1864 | return true; | ||
| 1865 | }); | ||
| 1866 | }, | ||
| 1867 | |||
| 1868 | /** | ||
| 1869 | * Check if a given node has one of its ancestor tag name matching the | ||
| 1870 | * provided one. | ||
| 1871 | * @param HTMLElement node | ||
| 1872 | * @param String tagName | ||
| 1873 | * @param Number maxDepth | ||
| 1874 | * @param Function filterFn a filter to invoke to determine whether this node 'counts' | ||
| 1875 | * @return Boolean | ||
| 1876 | */ | ||
| 1877 | _hasAncestorTag: function(node, tagName, maxDepth, filterFn) { | ||
| 1878 | maxDepth = maxDepth || 3; | ||
| 1879 | tagName = tagName.toUpperCase(); | ||
| 1880 | var depth = 0; | ||
| 1881 | while (node.parentNode) { | ||
| 1882 | if (maxDepth > 0 && depth > maxDepth) | ||
| 1883 | return false; | ||
| 1884 | if (node.parentNode.tagName === tagName && (!filterFn || filterFn(node.parentNode))) | ||
| 1885 | return true; | ||
| 1886 | node = node.parentNode; | ||
| 1887 | depth++; | ||
| 1888 | } | ||
| 1889 | return false; | ||
| 1890 | }, | ||
| 1891 | |||
| 1892 | /** | ||
| 1893 | * Return an object indicating how many rows and columns this table has. | ||
| 1894 | */ | ||
| 1895 | _getRowAndColumnCount: function(table) { | ||
| 1896 | var rows = 0; | ||
| 1897 | var columns = 0; | ||
| 1898 | var trs = table.getElementsByTagName("tr"); | ||
| 1899 | for (var i = 0; i < trs.length; i++) { | ||
| 1900 | var rowspan = trs[i].getAttribute("rowspan") || 0; | ||
| 1901 | if (rowspan) { | ||
| 1902 | rowspan = parseInt(rowspan, 10); | ||
| 1903 | } | ||
| 1904 | rows += (rowspan || 1); | ||
| 1905 | |||
| 1906 | // Now look for column-related info | ||
| 1907 | var columnsInThisRow = 0; | ||
| 1908 | var cells = trs[i].getElementsByTagName("td"); | ||
| 1909 | for (var j = 0; j < cells.length; j++) { | ||
| 1910 | var colspan = cells[j].getAttribute("colspan") || 0; | ||
| 1911 | if (colspan) { | ||
| 1912 | colspan = parseInt(colspan, 10); | ||
| 1913 | } | ||
| 1914 | columnsInThisRow += (colspan || 1); | ||
| 1915 | } | ||
| 1916 | columns = Math.max(columns, columnsInThisRow); | ||
| 1917 | } | ||
| 1918 | return {rows: rows, columns: columns}; | ||
| 1919 | }, | ||
| 1920 | |||
| 1921 | /** | ||
| 1922 | * Look for 'data' (as opposed to 'layout') tables, for which we use | ||
| 1923 | * similar checks as | ||
| 1924 | * https://searchfox.org/mozilla-central/rev/f82d5c549f046cb64ce5602bfd894b7ae807c8f8/accessible/generic/TableAccessible.cpp#19 | ||
| 1925 | */ | ||
| 1926 | _markDataTables: function(root) { | ||
| 1927 | var tables = root.getElementsByTagName("table"); | ||
| 1928 | for (var i = 0; i < tables.length; i++) { | ||
| 1929 | var table = tables[i]; | ||
| 1930 | var role = table.getAttribute("role"); | ||
| 1931 | if (role == "presentation") { | ||
| 1932 | table._readabilityDataTable = false; | ||
| 1933 | continue; | ||
| 1934 | } | ||
| 1935 | var datatable = table.getAttribute("datatable"); | ||
| 1936 | if (datatable == "0") { | ||
| 1937 | table._readabilityDataTable = false; | ||
| 1938 | continue; | ||
| 1939 | } | ||
| 1940 | var summary = table.getAttribute("summary"); | ||
| 1941 | if (summary) { | ||
| 1942 | table._readabilityDataTable = true; | ||
| 1943 | continue; | ||
| 1944 | } | ||
| 1945 | |||
| 1946 | var caption = table.getElementsByTagName("caption")[0]; | ||
| 1947 | if (caption && caption.childNodes.length > 0) { | ||
| 1948 | table._readabilityDataTable = true; | ||
| 1949 | continue; | ||
| 1950 | } | ||
| 1951 | |||
| 1952 | // If the table has a descendant with any of these tags, consider a data table: | ||
| 1953 | var dataTableDescendants = ["col", "colgroup", "tfoot", "thead", "th"]; | ||
| 1954 | var descendantExists = function(tag) { | ||
| 1955 | return !!table.getElementsByTagName(tag)[0]; | ||
| 1956 | }; | ||
| 1957 | if (dataTableDescendants.some(descendantExists)) { | ||
| 1958 | this.log("Data table because found data-y descendant"); | ||
| 1959 | table._readabilityDataTable = true; | ||
| 1960 | continue; | ||
| 1961 | } | ||
| 1962 | |||
| 1963 | // Nested tables indicate a layout table: | ||
| 1964 | if (table.getElementsByTagName("table")[0]) { | ||
| 1965 | table._readabilityDataTable = false; | ||
| 1966 | continue; | ||
| 1967 | } | ||
| 1968 | |||
| 1969 | var sizeInfo = this._getRowAndColumnCount(table); | ||
| 1970 | if (sizeInfo.rows >= 10 || sizeInfo.columns > 4) { | ||
| 1971 | table._readabilityDataTable = true; | ||
| 1972 | continue; | ||
| 1973 | } | ||
| 1974 | // Now just go by size entirely: | ||
| 1975 | table._readabilityDataTable = sizeInfo.rows * sizeInfo.columns > 10; | ||
| 1976 | } | ||
| 1977 | }, | ||
| 1978 | |||
| 1979 | /* convert images and figures that have properties like data-src into images that can be loaded without JS */ | ||
| 1980 | _fixLazyImages: function (root) { | ||
| 1981 | this._forEachNode(this._getAllNodesWithTag(root, ["img", "picture", "figure"]), function (elem) { | ||
| 1982 | // In some sites (e.g. Kotaku), they put 1px square image as base64 data uri in the src attribute. | ||
| 1983 | // So, here we check if the data uri is too short, just might as well remove it. | ||
| 1984 | if (elem.src && this.REGEXPS.b64DataUrl.test(elem.src)) { | ||
| 1985 | // Make sure it's not SVG, because SVG can have a meaningful image in under 133 bytes. | ||
| 1986 | var parts = this.REGEXPS.b64DataUrl.exec(elem.src); | ||
| 1987 | if (parts[1] === "image/svg+xml") { | ||
| 1988 | return; | ||
| 1989 | } | ||
| 1990 | |||
| 1991 | // Make sure this element has other attributes which contains image. | ||
| 1992 | // If it doesn't, then this src is important and shouldn't be removed. | ||
| 1993 | var srcCouldBeRemoved = false; | ||
| 1994 | for (var i = 0; i < elem.attributes.length; i++) { | ||
| 1995 | var attr = elem.attributes[i]; | ||
| 1996 | if (attr.name === "src") { | ||
| 1997 | continue; | ||
| 1998 | } | ||
| 1999 | |||
| 2000 | if (/\.(jpg|jpeg|png|webp)/i.test(attr.value)) { | ||
| 2001 | srcCouldBeRemoved = true; | ||
| 2002 | break; | ||
| 2003 | } | ||
| 2004 | } | ||
| 2005 | |||
| 2006 | // Here we assume if image is less than 100 bytes (or 133B after encoded to base64) | ||
| 2007 | // it will be too small, therefore it might be placeholder image. | ||
| 2008 | if (srcCouldBeRemoved) { | ||
| 2009 | var b64starts = elem.src.search(/base64\s*/i) + 7; | ||
| 2010 | var b64length = elem.src.length - b64starts; | ||
| 2011 | if (b64length < 133) { | ||
| 2012 | elem.removeAttribute("src"); | ||
| 2013 | } | ||
| 2014 | } | ||
| 2015 | } | ||
| 2016 | |||
| 2017 | // also check for "null" to work around https://github.com/jsdom/jsdom/issues/2580 | ||
| 2018 | if ((elem.src || (elem.srcset && elem.srcset != "null")) && elem.className.toLowerCase().indexOf("lazy") === -1) { | ||
| 2019 | return; | ||
| 2020 | } | ||
| 2021 | |||
| 2022 | for (var j = 0; j < elem.attributes.length; j++) { | ||
| 2023 | attr = elem.attributes[j]; | ||
| 2024 | if (attr.name === "src" || attr.name === "srcset" || attr.name === "alt") { | ||
| 2025 | continue; | ||
| 2026 | } | ||
| 2027 | var copyTo = null; | ||
| 2028 | if (/\.(jpg|jpeg|png|webp)\s+\d/.test(attr.value)) { | ||
| 2029 | copyTo = "srcset"; | ||
| 2030 | } else if (/^\s*\S+\.(jpg|jpeg|png|webp)\S*\s*$/.test(attr.value)) { | ||
| 2031 | copyTo = "src"; | ||
| 2032 | } | ||
| 2033 | if (copyTo) { | ||
| 2034 | //if this is an img or picture, set the attribute directly | ||
| 2035 | if (elem.tagName === "IMG" || elem.tagName === "PICTURE") { | ||
| 2036 | elem.setAttribute(copyTo, attr.value); | ||
| 2037 | } else if (elem.tagName === "FIGURE" && !this._getAllNodesWithTag(elem, ["img", "picture"]).length) { | ||
| 2038 | //if the item is a <figure> that does not contain an image or picture, create one and place it inside the figure | ||
| 2039 | //see the nytimes-3 testcase for an example | ||
| 2040 | var img = this._doc.createElement("img"); | ||
| 2041 | img.setAttribute(copyTo, attr.value); | ||
| 2042 | elem.appendChild(img); | ||
| 2043 | } | ||
| 2044 | } | ||
| 2045 | } | ||
| 2046 | }); | ||
| 2047 | }, | ||
| 2048 | |||
| 2049 | _getTextDensity: function(e, tags) { | ||
| 2050 | var textLength = this._getInnerText(e, true).length; | ||
| 2051 | if (textLength === 0) { | ||
| 2052 | return 0; | ||
| 2053 | } | ||
| 2054 | var childrenLength = 0; | ||
| 2055 | var children = this._getAllNodesWithTag(e, tags); | ||
| 2056 | this._forEachNode(children, (child) => childrenLength += this._getInnerText(child, true).length); | ||
| 2057 | return childrenLength / textLength; | ||
| 2058 | }, | ||
| 2059 | |||
| 2060 | /** | ||
| 2061 | * Clean an element of all tags of type "tag" if they look fishy. | ||
| 2062 | * "Fishy" is an algorithm based on content length, classnames, link density, number of images & embeds, etc. | ||
| 2063 | * | ||
| 2064 | * @return void | ||
| 2065 | **/ | ||
| 2066 | _cleanConditionally: function(e, tag) { | ||
| 2067 | if (!this._flagIsActive(this.FLAG_CLEAN_CONDITIONALLY)) | ||
| 2068 | return; | ||
| 2069 | |||
| 2070 | // Gather counts for other typical elements embedded within. | ||
| 2071 | // Traverse backwards so we can remove nodes at the same time | ||
| 2072 | // without effecting the traversal. | ||
| 2073 | // | ||
| 2074 | // TODO: Consider taking into account original contentScore here. | ||
| 2075 | this._removeNodes(this._getAllNodesWithTag(e, [tag]), function(node) { | ||
| 2076 | // First check if this node IS data table, in which case don't remove it. | ||
| 2077 | var isDataTable = function(t) { | ||
| 2078 | return t._readabilityDataTable; | ||
| 2079 | }; | ||
| 2080 | |||
| 2081 | var isList = tag === "ul" || tag === "ol"; | ||
| 2082 | if (!isList) { | ||
| 2083 | var listLength = 0; | ||
| 2084 | var listNodes = this._getAllNodesWithTag(node, ["ul", "ol"]); | ||
| 2085 | this._forEachNode(listNodes, (list) => listLength += this._getInnerText(list).length); | ||
| 2086 | isList = listLength / this._getInnerText(node).length > 0.9; | ||
| 2087 | } | ||
| 2088 | |||
| 2089 | if (tag === "table" && isDataTable(node)) { | ||
| 2090 | return false; | ||
| 2091 | } | ||
| 2092 | |||
| 2093 | // Next check if we're inside a data table, in which case don't remove it as well. | ||
| 2094 | if (this._hasAncestorTag(node, "table", -1, isDataTable)) { | ||
| 2095 | return false; | ||
| 2096 | } | ||
| 2097 | |||
| 2098 | if (this._hasAncestorTag(node, "code")) { | ||
| 2099 | return false; | ||
| 2100 | } | ||
| 2101 | |||
| 2102 | var weight = this._getClassWeight(node); | ||
| 2103 | |||
| 2104 | this.log("Cleaning Conditionally", node); | ||
| 2105 | |||
| 2106 | var contentScore = 0; | ||
| 2107 | |||
| 2108 | if (weight + contentScore < 0) { | ||
| 2109 | return true; | ||
| 2110 | } | ||
| 2111 | |||
| 2112 | if (this._getCharCount(node, ",") < 10) { | ||
| 2113 | // If there are not very many commas, and the number of | ||
| 2114 | // non-paragraph elements is more than paragraphs or other | ||
| 2115 | // ominous signs, remove the element. | ||
| 2116 | var p = node.getElementsByTagName("p").length; | ||
| 2117 | var img = node.getElementsByTagName("img").length; | ||
| 2118 | var li = node.getElementsByTagName("li").length - 100; | ||
| 2119 | var input = node.getElementsByTagName("input").length; | ||
| 2120 | var headingDensity = this._getTextDensity(node, ["h1", "h2", "h3", "h4", "h5", "h6"]); | ||
| 2121 | |||
| 2122 | var embedCount = 0; | ||
| 2123 | var embeds = this._getAllNodesWithTag(node, ["object", "embed", "iframe"]); | ||
| 2124 | |||
| 2125 | for (var i = 0; i < embeds.length; i++) { | ||
| 2126 | // If this embed has attribute that matches video regex, don't delete it. | ||
| 2127 | for (var j = 0; j < embeds[i].attributes.length; j++) { | ||
| 2128 | if (this._allowedVideoRegex.test(embeds[i].attributes[j].value)) { | ||
| 2129 | return false; | ||
| 2130 | } | ||
| 2131 | } | ||
| 2132 | |||
| 2133 | // For embed with <object> tag, check inner HTML as well. | ||
| 2134 | if (embeds[i].tagName === "object" && this._allowedVideoRegex.test(embeds[i].innerHTML)) { | ||
| 2135 | return false; | ||
| 2136 | } | ||
| 2137 | |||
| 2138 | embedCount++; | ||
| 2139 | } | ||
| 2140 | |||
| 2141 | var linkDensity = this._getLinkDensity(node); | ||
| 2142 | var contentLength = this._getInnerText(node).length; | ||
| 2143 | |||
| 2144 | var haveToRemove = | ||
| 2145 | (img > 1 && p / img < 0.5 && !this._hasAncestorTag(node, "figure")) || | ||
| 2146 | (!isList && li > p) || | ||
| 2147 | (input > Math.floor(p/3)) || | ||
| 2148 | (!isList && headingDensity < 0.9 && contentLength < 25 && (img === 0 || img > 2) && !this._hasAncestorTag(node, "figure")) || | ||
| 2149 | (!isList && weight < 25 && linkDensity > 0.2) || | ||
| 2150 | (weight >= 25 && linkDensity > 0.5) || | ||
| 2151 | ((embedCount === 1 && contentLength < 75) || embedCount > 1); | ||
| 2152 | // Allow simple lists of images to remain in pages | ||
| 2153 | if (isList && haveToRemove) { | ||
| 2154 | for (var x = 0; x < node.children.length; x++) { | ||
| 2155 | let child = node.children[x]; | ||
| 2156 | // Don't filter in lists with li's that contain more than one child | ||
| 2157 | if (child.children.length > 1) { | ||
| 2158 | return haveToRemove; | ||
| 2159 | } | ||
| 2160 | } | ||
| 2161 | let li_count = node.getElementsByTagName("li").length; | ||
| 2162 | // Only allow the list to remain if every li contains an image | ||
| 2163 | if (img == li_count) { | ||
| 2164 | return false; | ||
| 2165 | } | ||
| 2166 | } | ||
| 2167 | return haveToRemove; | ||
| 2168 | } | ||
| 2169 | return false; | ||
| 2170 | }); | ||
| 2171 | }, | ||
| 2172 | |||
| 2173 | /** | ||
| 2174 | * Clean out elements that match the specified conditions | ||
| 2175 | * | ||
| 2176 | * @param Element | ||
| 2177 | * @param Function determines whether a node should be removed | ||
| 2178 | * @return void | ||
| 2179 | **/ | ||
| 2180 | _cleanMatchedNodes: function(e, filter) { | ||
| 2181 | var endOfSearchMarkerNode = this._getNextNode(e, true); | ||
| 2182 | var next = this._getNextNode(e); | ||
| 2183 | while (next && next != endOfSearchMarkerNode) { | ||
| 2184 | if (filter.call(this, next, next.className + " " + next.id)) { | ||
| 2185 | next = this._removeAndGetNext(next); | ||
| 2186 | } else { | ||
| 2187 | next = this._getNextNode(next); | ||
| 2188 | } | ||
| 2189 | } | ||
| 2190 | }, | ||
| 2191 | |||
| 2192 | /** | ||
| 2193 | * Clean out spurious headers from an Element. | ||
| 2194 | * | ||
| 2195 | * @param Element | ||
| 2196 | * @return void | ||
| 2197 | **/ | ||
| 2198 | _cleanHeaders: function(e) { | ||
| 2199 | let headingNodes = this._getAllNodesWithTag(e, ["h1", "h2"]); | ||
| 2200 | this._removeNodes(headingNodes, function(node) { | ||
| 2201 | let shouldRemove = this._getClassWeight(node) < 0; | ||
| 2202 | if (shouldRemove) { | ||
| 2203 | this.log("Removing header with low class weight:", node); | ||
| 2204 | } | ||
| 2205 | return shouldRemove; | ||
| 2206 | }); | ||
| 2207 | }, | ||
| 2208 | |||
| 2209 | /** | ||
| 2210 | * Check if this node is an H1 or H2 element whose content is mostly | ||
| 2211 | * the same as the article title. | ||
| 2212 | * | ||
| 2213 | * @param Element the node to check. | ||
| 2214 | * @return boolean indicating whether this is a title-like header. | ||
| 2215 | */ | ||
| 2216 | _headerDuplicatesTitle: function(node) { | ||
| 2217 | if (node.tagName != "H1" && node.tagName != "H2") { | ||
| 2218 | return false; | ||
| 2219 | } | ||
| 2220 | var heading = this._getInnerText(node, false); | ||
| 2221 | this.log("Evaluating similarity of header:", heading, this._articleTitle); | ||
| 2222 | return this._textSimilarity(this._articleTitle, heading) > 0.75; | ||
| 2223 | }, | ||
| 2224 | |||
| 2225 | _flagIsActive: function(flag) { | ||
| 2226 | return (this._flags & flag) > 0; | ||
| 2227 | }, | ||
| 2228 | |||
| 2229 | _removeFlag: function(flag) { | ||
| 2230 | this._flags = this._flags & ~flag; | ||
| 2231 | }, | ||
| 2232 | |||
| 2233 | _isProbablyVisible: function(node) { | ||
| 2234 | // Have to null-check node.style and node.className.indexOf to deal with SVG and MathML nodes. | ||
| 2235 | return (!node.style || node.style.display != "none") | ||
| 2236 | && (!node.style || node.style.visibility != "hidden") | ||
| 2237 | && !node.hasAttribute("hidden") | ||
| 2238 | //check for "fallback-image" so that wikimedia math images are displayed | ||
| 2239 | && (!node.hasAttribute("aria-hidden") || node.getAttribute("aria-hidden") != "true" || (node.className && node.className.indexOf && node.className.indexOf("fallback-image") !== -1)); | ||
| 2240 | }, | ||
| 2241 | |||
| 2242 | /** | ||
| 2243 | * Runs readability. | ||
| 2244 | * | ||
| 2245 | * Workflow: | ||
| 2246 | * 1. Prep the document by removing script tags, css, etc. | ||
| 2247 | * 2. Build readability's DOM tree. | ||
| 2248 | * 3. Grab the article content from the current dom tree. | ||
| 2249 | * 4. Replace the current DOM tree with the new one. | ||
| 2250 | * 5. Read peacefully. | ||
| 2251 | * | ||
| 2252 | * @return void | ||
| 2253 | **/ | ||
| 2254 | parse: function () { | ||
| 2255 | // Avoid parsing too large documents, as per configuration option | ||
| 2256 | if (this._maxElemsToParse > 0) { | ||
| 2257 | var numTags = this._doc.getElementsByTagName("*").length; | ||
| 2258 | if (numTags > this._maxElemsToParse) { | ||
| 2259 | throw new Error("Aborting parsing document; " + numTags + " elements found"); | ||
| 2260 | } | ||
| 2261 | } | ||
| 2262 | |||
| 2263 | // Unwrap image from noscript | ||
| 2264 | this._unwrapNoscriptImages(this._doc); | ||
| 2265 | |||
| 2266 | // Extract JSON-LD metadata before removing scripts | ||
| 2267 | var jsonLd = this._disableJSONLD ? {} : this._getJSONLD(this._doc); | ||
| 2268 | |||
| 2269 | // Remove script tags from the document. | ||
| 2270 | this._removeScripts(this._doc); | ||
| 2271 | |||
| 2272 | this._prepDocument(); | ||
| 2273 | |||
| 2274 | var metadata = this._getArticleMetadata(jsonLd); | ||
| 2275 | this._articleTitle = metadata.title; | ||
| 2276 | |||
| 2277 | var articleContent = this._grabArticle(); | ||
| 2278 | if (!articleContent) | ||
| 2279 | return null; | ||
| 2280 | |||
| 2281 | this.log("Grabbed: " + articleContent.innerHTML); | ||
| 2282 | |||
| 2283 | this._postProcessContent(articleContent); | ||
| 2284 | |||
| 2285 | // If we haven't found an excerpt in the article's metadata, use the article's | ||
| 2286 | // first paragraph as the excerpt. This is used for displaying a preview of | ||
| 2287 | // the article's content. | ||
| 2288 | if (!metadata.excerpt) { | ||
| 2289 | var paragraphs = articleContent.getElementsByTagName("p"); | ||
| 2290 | if (paragraphs.length > 0) { | ||
| 2291 | metadata.excerpt = paragraphs[0].textContent.trim(); | ||
| 2292 | } | ||
| 2293 | } | ||
| 2294 | |||
| 2295 | var textContent = articleContent.textContent; | ||
| 2296 | return { | ||
| 2297 | title: this._articleTitle, | ||
| 2298 | byline: metadata.byline || this._articleByline, | ||
| 2299 | dir: this._articleDir, | ||
| 2300 | lang: this._articleLang, | ||
| 2301 | content: this._serializer(articleContent), | ||
| 2302 | textContent: textContent, | ||
| 2303 | length: textContent.length, | ||
| 2304 | excerpt: metadata.excerpt, | ||
| 2305 | siteName: metadata.siteName || this._articleSiteName, | ||
| 2306 | publishedTime: metadata.publishedTime | ||
| 2307 | }; | ||
| 2308 | } | ||
| 2309 | }; | ||
| 2310 | |||
| 2311 | if (typeof module === "object") { | ||
| 2312 | /* global module */ | ||
| 2313 | module.exports = Readability; | ||
| 2314 | } | ||
| @@ -1,14 +0,0 @@ | |||
| 1 | /** | ||
| 2 | * Bundled by jsDelivr using Rollup v2.79.1 and Terser v5.19.2. | ||
| 3 | * Original file: /npm/bowser@2.11.0/src/bowser.js | ||
| 4 | * | ||
| 5 | * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files | ||
| 6 | */ | ||
| 7 | const e={"Amazon Silk":"amazon_silk","Android Browser":"android",Bada:"bada",BlackBerry:"blackberry",Chrome:"chrome",Chromium:"chromium",Electron:"electron",Epiphany:"epiphany",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot","Internet Explorer":"ie","K-Meleon":"k_meleon",Maxthon:"maxthon","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver",Opera:"opera","Opera Coast":"opera_coast",PhantomJS:"phantomjs",Puffin:"puffin",QupZilla:"qupzilla",QQ:"qq",QQLite:"qqlite",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SeaMonkey:"seamonkey",Sleipnir:"sleipnir",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat","Yandex Browser":"yandex",Roku:"roku"},t={amazon_silk:"Amazon Silk",android:"Android Browser",bada:"Bada",blackberry:"BlackBerry",chrome:"Chrome",chromium:"Chromium",electron:"Electron",epiphany:"Epiphany",firefox:"Firefox",focus:"Focus",generic:"Generic",googlebot:"Googlebot",google_search:"Google Search",ie:"Internet Explorer",k_meleon:"K-Meleon",maxthon:"Maxthon",edge:"Microsoft Edge",mz:"MZ Browser",naver:"NAVER Whale Browser",opera:"Opera",opera_coast:"Opera Coast",phantomjs:"PhantomJS",puffin:"Puffin",qupzilla:"QupZilla",qq:"QQ Browser",qqlite:"QQ Browser Lite",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",sleipnir:"Sleipnir",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yandex:"Yandex Browser"},r={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},s={WindowsPhone:"Windows Phone",Windows:"Windows",MacOS:"macOS",iOS:"iOS",Android:"Android",WebOS:"WebOS",BlackBerry:"BlackBerry",Bada:"Bada",Tizen:"Tizen",Linux:"Linux",ChromeOS:"Chrome OS",PlayStation4:"PlayStation 4",Roku:"Roku"},i={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"};class n{static getFirstMatch(e,t){const r=t.match(e);return r&&r.length>0&&r[1]||""}static getSecondMatch(e,t){const r=t.match(e);return r&&r.length>1&&r[2]||""}static matchAndReturnConst(e,t,r){if(e.test(t))return r}static getWindowsVersionName(e){switch(e){case"NT":return"NT";case"XP":case"NT 5.1":return"XP";case"NT 5.0":return"2000";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}}static getMacOSVersionName(e){const t=e.split(".").splice(0,2).map((e=>parseInt(e,10)||0));if(t.push(0),10===t[0])switch(t[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}}static getAndroidVersionName(e){const t=e.split(".").splice(0,2).map((e=>parseInt(e,10)||0));if(t.push(0),!(1===t[0]&&t[1]<5))return 1===t[0]&&t[1]<6?"Cupcake":1===t[0]&&t[1]>=6?"Donut":2===t[0]&&t[1]<2?"Eclair":2===t[0]&&2===t[1]?"Froyo":2===t[0]&&t[1]>2?"Gingerbread":3===t[0]?"Honeycomb":4===t[0]&&t[1]<1?"Ice Cream Sandwich":4===t[0]&&t[1]<4?"Jelly Bean":4===t[0]&&t[1]>=4?"KitKat":5===t[0]?"Lollipop":6===t[0]?"Marshmallow":7===t[0]?"Nougat":8===t[0]?"Oreo":9===t[0]?"Pie":void 0}static getVersionPrecision(e){return e.split(".").length}static compareVersions(e,t,r=!1){const s=n.getVersionPrecision(e),i=n.getVersionPrecision(t);let o=Math.max(s,i),a=0;const c=n.map([e,t],(e=>{const t=o-n.getVersionPrecision(e),r=e+new Array(t+1).join(".0");return n.map(r.split("."),(e=>new Array(20-e.length).join("0")+e)).reverse()}));for(r&&(a=o-Math.min(s,i)),o-=1;o>=a;){if(c[0][o]>c[1][o])return 1;if(c[0][o]===c[1][o]){if(o===a)return 0;o-=1}else if(c[0][o]<c[1][o])return-1}}static map(e,t){const r=[];let s;if(Array.prototype.map)return Array.prototype.map.call(e,t);for(s=0;s<e.length;s+=1)r.push(t(e[s]));return r}static find(e,t){let r,s;if(Array.prototype.find)return Array.prototype.find.call(e,t);for(r=0,s=e.length;r<s;r+=1){const s=e[r];if(t(s,r))return s}}static assign(e,...t){const r=e;let s,i;if(Object.assign)return Object.assign(e,...t);for(s=0,i=t.length;s<i;s+=1){const e=t[s];if("object"==typeof e&&null!==e){Object.keys(e).forEach((t=>{r[t]=e[t]}))}}return e}static getBrowserAlias(t){return e[t]}static getBrowserTypeByAlias(e){return t[e]||""}}const o=/version\/(\d+(\.?_?\d+)+)/i,a=[{test:[/googlebot/i],describe(e){const t={name:"Googlebot"},r=n.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,e)||n.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/opera/i],describe(e){const t={name:"Opera"},r=n.getFirstMatch(o,e)||n.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/opr\/|opios/i],describe(e){const t={name:"Opera"},r=n.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,e)||n.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/SamsungBrowser/i],describe(e){const t={name:"Samsung Internet for Android"},r=n.getFirstMatch(o,e)||n.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/Whale/i],describe(e){const t={name:"NAVER Whale Browser"},r=n.getFirstMatch(o,e)||n.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/MZBrowser/i],describe(e){const t={name:"MZ Browser"},r=n.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,e)||n.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/focus/i],describe(e){const t={name:"Focus"},r=n.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,e)||n.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/swing/i],describe(e){const t={name:"Swing"},r=n.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,e)||n.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/coast/i],describe(e){const t={name:"Opera Coast"},r=n.getFirstMatch(o,e)||n.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe(e){const t={name:"Opera Touch"},r=n.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,e)||n.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/yabrowser/i],describe(e){const t={name:"Yandex Browser"},r=n.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,e)||n.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/ucbrowser/i],describe(e){const t={name:"UC Browser"},r=n.getFirstMatch(o,e)||n.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/Maxthon|mxios/i],describe(e){const t={name:"Maxthon"},r=n.getFirstMatch(o,e)||n.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/epiphany/i],describe(e){const t={name:"Epiphany"},r=n.getFirstMatch(o,e)||n.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/puffin/i],describe(e){const t={name:"Puffin"},r=n.getFirstMatch(o,e)||n.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/sleipnir/i],describe(e){const t={name:"Sleipnir"},r=n.getFirstMatch(o,e)||n.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/k-meleon/i],describe(e){const t={name:"K-Meleon"},r=n.getFirstMatch(o,e)||n.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/micromessenger/i],describe(e){const t={name:"WeChat"},r=n.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,e)||n.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/qqbrowser/i],describe(e){const t={name:/qqbrowserlite/i.test(e)?"QQ Browser Lite":"QQ Browser"},r=n.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,e)||n.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/msie|trident/i],describe(e){const t={name:"Internet Explorer"},r=n.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/\sedg\//i],describe(e){const t={name:"Microsoft Edge"},r=n.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/edg([ea]|ios)/i],describe(e){const t={name:"Microsoft Edge"},r=n.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/vivaldi/i],describe(e){const t={name:"Vivaldi"},r=n.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/seamonkey/i],describe(e){const t={name:"SeaMonkey"},r=n.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/sailfish/i],describe(e){const t={name:"Sailfish"},r=n.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,e);return r&&(t.version=r),t}},{test:[/silk/i],describe(e){const t={name:"Amazon Silk"},r=n.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/phantom/i],describe(e){const t={name:"PhantomJS"},r=n.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/slimerjs/i],describe(e){const t={name:"SlimerJS"},r=n.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(e){const t={name:"BlackBerry"},r=n.getFirstMatch(o,e)||n.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/(web|hpw)[o0]s/i],describe(e){const t={name:"WebOS Browser"},r=n.getFirstMatch(o,e)||n.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/bada/i],describe(e){const t={name:"Bada"},r=n.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/tizen/i],describe(e){const t={name:"Tizen"},r=n.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,e)||n.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/qupzilla/i],describe(e){const t={name:"QupZilla"},r=n.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,e)||n.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/firefox|iceweasel|fxios/i],describe(e){const t={name:"Firefox"},r=n.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/electron/i],describe(e){const t={name:"Electron"},r=n.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/MiuiBrowser/i],describe(e){const t={name:"Miui"},r=n.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/chromium/i],describe(e){const t={name:"Chromium"},r=n.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,e)||n.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/chrome|crios|crmo/i],describe(e){const t={name:"Chrome"},r=n.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/GSA/i],describe(e){const t={name:"Google Search"},r=n.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test(e){const t=!e.test(/like android/i),r=e.test(/android/i);return t&&r},describe(e){const t={name:"Android Browser"},r=n.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/playstation 4/i],describe(e){const t={name:"PlayStation 4"},r=n.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/safari|applewebkit/i],describe(e){const t={name:"Safari"},r=n.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/.*/i],describe(e){const t=-1!==e.search("\\(")?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:n.getFirstMatch(t,e),version:n.getSecondMatch(t,e)}}}];var c=[{test:[/Roku\/DVP/],describe(e){const t=n.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,e);return{name:s.Roku,version:t}}},{test:[/windows phone/i],describe(e){const t=n.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,e);return{name:s.WindowsPhone,version:t}}},{test:[/windows /i],describe(e){const t=n.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,e),r=n.getWindowsVersionName(t);return{name:s.Windows,version:t,versionName:r}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe(e){const t={name:s.iOS},r=n.getSecondMatch(/(Version\/)(\d[\d.]+)/,e);return r&&(t.version=r),t}},{test:[/macintosh/i],describe(e){const t=n.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,e).replace(/[_\s]/g,"."),r=n.getMacOSVersionName(t),i={name:s.MacOS,version:t};return r&&(i.versionName=r),i}},{test:[/(ipod|iphone|ipad)/i],describe(e){const t=n.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,e).replace(/[_\s]/g,".");return{name:s.iOS,version:t}}},{test(e){const t=!e.test(/like android/i),r=e.test(/android/i);return t&&r},describe(e){const t=n.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,e),r=n.getAndroidVersionName(t),i={name:s.Android,version:t};return r&&(i.versionName=r),i}},{test:[/(web|hpw)[o0]s/i],describe(e){const t=n.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,e),r={name:s.WebOS};return t&&t.length&&(r.version=t),r}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(e){const t=n.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,e)||n.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,e)||n.getFirstMatch(/\bbb(\d+)/i,e);return{name:s.BlackBerry,version:t}}},{test:[/bada/i],describe(e){const t=n.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,e);return{name:s.Bada,version:t}}},{test:[/tizen/i],describe(e){const t=n.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,e);return{name:s.Tizen,version:t}}},{test:[/linux/i],describe:()=>({name:s.Linux})},{test:[/CrOS/],describe:()=>({name:s.ChromeOS})},{test:[/PlayStation 4/],describe(e){const t=n.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,e);return{name:s.PlayStation4,version:t}}}],d=[{test:[/googlebot/i],describe:()=>({type:"bot",vendor:"Google"})},{test:[/huawei/i],describe(e){const t=n.getFirstMatch(/(can-l01)/i,e)&&"Nova",s={type:r.mobile,vendor:"Huawei"};return t&&(s.model=t),s}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:()=>({type:r.tablet,vendor:"Nexus"})},{test:[/ipad/i],describe:()=>({type:r.tablet,vendor:"Apple",model:"iPad"})},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:()=>({type:r.tablet,vendor:"Apple",model:"iPad"})},{test:[/kftt build/i],describe:()=>({type:r.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"})},{test:[/silk/i],describe:()=>({type:r.tablet,vendor:"Amazon"})},{test:[/tablet(?! pc)/i],describe:()=>({type:r.tablet})},{test(e){const t=e.test(/ipod|iphone/i),r=e.test(/like (ipod|iphone)/i);return t&&!r},describe(e){const t=n.getFirstMatch(/(ipod|iphone)/i,e);return{type:r.mobile,vendor:"Apple",model:t}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:()=>({type:r.mobile,vendor:"Nexus"})},{test:[/[^-]mobi/i],describe:()=>({type:r.mobile})},{test:e=>"blackberry"===e.getBrowserName(!0),describe:()=>({type:r.mobile,vendor:"BlackBerry"})},{test:e=>"bada"===e.getBrowserName(!0),describe:()=>({type:r.mobile})},{test:e=>"windows phone"===e.getBrowserName(),describe:()=>({type:r.mobile,vendor:"Microsoft"})},{test(e){const t=Number(String(e.getOSVersion()).split(".")[0]);return"android"===e.getOSName(!0)&&t>=3},describe:()=>({type:r.tablet})},{test:e=>"android"===e.getOSName(!0),describe:()=>({type:r.mobile})},{test:e=>"macos"===e.getOSName(!0),describe:()=>({type:r.desktop,vendor:"Apple"})},{test:e=>"windows"===e.getOSName(!0),describe:()=>({type:r.desktop})},{test:e=>"linux"===e.getOSName(!0),describe:()=>({type:r.desktop})},{test:e=>"playstation 4"===e.getOSName(!0),describe:()=>({type:r.tv})},{test:e=>"roku"===e.getOSName(!0),describe:()=>({type:r.tv})}],h=[{test:e=>"microsoft edge"===e.getBrowserName(!0),describe(e){if(/\sedg\//i.test(e))return{name:i.Blink};const t=n.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,e);return{name:i.EdgeHTML,version:t}}},{test:[/trident/i],describe(e){const t={name:i.Trident},r=n.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:e=>e.test(/presto/i),describe(e){const t={name:i.Presto},r=n.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test(e){const t=e.test(/gecko/i),r=e.test(/like gecko/i);return t&&!r},describe(e){const t={name:i.Gecko},r=n.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/(apple)?webkit\/537\.36/i],describe:()=>({name:i.Blink})},{test:[/(apple)?webkit/i],describe(e){const t={name:i.WebKit},r=n.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}}];class u{constructor(e,t=!1){if(null==e||""===e)throw new Error("UserAgent parameter can't be empty");this._ua=e,this.parsedResult={},!0!==t&&this.parse()}getUA(){return this._ua}test(e){return e.test(this._ua)}parseBrowser(){this.parsedResult.browser={};const e=n.find(a,(e=>{if("function"==typeof e.test)return e.test(this);if(e.test instanceof Array)return e.test.some((e=>this.test(e)));throw new Error("Browser's test function is not valid")}));return e&&(this.parsedResult.browser=e.describe(this.getUA())),this.parsedResult.browser}getBrowser(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()}getBrowserName(e){return e?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""}getBrowserVersion(){return this.getBrowser().version}getOS(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()}parseOS(){this.parsedResult.os={};const e=n.find(c,(e=>{if("function"==typeof e.test)return e.test(this);if(e.test instanceof Array)return e.test.some((e=>this.test(e)));throw new Error("Browser's test function is not valid")}));return e&&(this.parsedResult.os=e.describe(this.getUA())),this.parsedResult.os}getOSName(e){const{name:t}=this.getOS();return e?String(t).toLowerCase()||"":t||""}getOSVersion(){return this.getOS().version}getPlatform(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()}getPlatformType(e=!1){const{type:t}=this.getPlatform();return e?String(t).toLowerCase()||"":t||""}parsePlatform(){this.parsedResult.platform={};const e=n.find(d,(e=>{if("function"==typeof e.test)return e.test(this);if(e.test instanceof Array)return e.test.some((e=>this.test(e)));throw new Error("Browser's test function is not valid")}));return e&&(this.parsedResult.platform=e.describe(this.getUA())),this.parsedResult.platform}getEngine(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()}getEngineName(e){return e?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""}parseEngine(){this.parsedResult.engine={};const e=n.find(h,(e=>{if("function"==typeof e.test)return e.test(this);if(e.test instanceof Array)return e.test.some((e=>this.test(e)));throw new Error("Browser's test function is not valid")}));return e&&(this.parsedResult.engine=e.describe(this.getUA())),this.parsedResult.engine}parse(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this}getResult(){return n.assign({},this.parsedResult)}satisfies(e){const t={};let r=0;const s={};let i=0;if(Object.keys(e).forEach((n=>{const o=e[n];"string"==typeof o?(s[n]=o,i+=1):"object"==typeof o&&(t[n]=o,r+=1)})),r>0){const e=Object.keys(t),r=n.find(e,(e=>this.isOS(e)));if(r){const e=this.satisfies(t[r]);if(void 0!==e)return e}const s=n.find(e,(e=>this.isPlatform(e)));if(s){const e=this.satisfies(t[s]);if(void 0!==e)return e}}if(i>0){const e=Object.keys(s),t=n.find(e,(e=>this.isBrowser(e,!0)));if(void 0!==t)return this.compareVersion(s[t])}}isBrowser(e,t=!1){const r=this.getBrowserName().toLowerCase();let s=e.toLowerCase();const i=n.getBrowserTypeByAlias(s);return t&&i&&(s=i.toLowerCase()),s===r}compareVersion(e){let t=[0],r=e,s=!1;const i=this.getBrowserVersion();if("string"==typeof i)return">"===e[0]||"<"===e[0]?(r=e.substr(1),"="===e[1]?(s=!0,r=e.substr(2)):t=[],">"===e[0]?t.push(1):t.push(-1)):"="===e[0]?r=e.substr(1):"~"===e[0]&&(s=!0,r=e.substr(1)),t.indexOf(n.compareVersions(i,r,s))>-1}isOS(e){return this.getOSName(!0)===String(e).toLowerCase()}isPlatform(e){return this.getPlatformType(!0)===String(e).toLowerCase()}isEngine(e){return this.getEngineName(!0)===String(e).toLowerCase()}is(e,t=!1){return this.isBrowser(e,t)||this.isOS(e)||this.isPlatform(e)}some(e=[]){return e.some((e=>this.is(e)))}} | ||
| 8 | /*! | ||
| 9 | * Bowser - a browser detector | ||
| 10 | * https://github.com/lancedikson/bowser | ||
| 11 | * MIT License | (c) Dustin Diaz 2012-2015 | ||
| 12 | * MIT License | (c) Denis Demchenko 2015-2019 | ||
| 13 | */class l{static getParser(e,t=!1){if("string"!=typeof e)throw new Error("UserAgent should be a string");return new u(e,t)}static parse(e){return new u(e).getResult()}static get BROWSER_MAP(){return t}static get ENGINE_MAP(){return i}static get OS_MAP(){return s}static get PLATFORMS_MAP(){return r}}export{l as default}; | ||
| 14 | //# sourceMappingURL=/sm/e8a10d781424bf66d54f3662af6e3156d19b736ffcceeb58231727586e25939c.map | ||
| 14 | \ No newline at end of file | \ No newline at end of file | |
| @@ -1 +0,0 @@ | |||
| 1 | {"mappings":";;;;;;;;;;;;;AEAe,uDAA4B;IAOzC,YACE,QAAgB,EAChB,GAAW,EACX,MAAc,EACd,MAAc,EACd,GAAW,CACX;QACA,KAAK,CAAC,WAAW,MAAM,SAAS,MAAM,SAAS,OAAO;QACtD,IAAI,CAAC,MAAM,GAAG;QACd,IAAI,CAAC,QAAQ,GAAG;QAChB,IAAI,CAAC,IAAI,GAAG;QACZ,IAAI,CAAC,MAAM,GAAG;QACd,IAAI,CAAC,MAAM,GAAG;IAChB;AACF;;;;;;;;ACrBA;;CAEC,GACc;IAKb,YACE,KAAqC,EACrC,GAAmC,EACnC,MAAc,CACd;QACA,IAAI,CAAC,KAAK,GAAG;QACb,IAAI,CAAC,GAAG,GAAG;QACX,IAAI,CAAC,MAAM,GAAG;IAChB;AACF;;;;;;;UCdY;;;;;;;;;;;;;;;;;;;GAAA,8CAAA;;;AHuBZ,0CAA0C;AAC1C,yEAAyE;AACzE,gEAAgE;AAChE,+BAA+B;AAC/B,MAAM,kCAAY;AAEX,MAAM,4CAAQ,CACnB,KACA;IAEA,UAAU,WAAW,CAAC;IAEtB;;GAEC,GACD,IAAI,SAAS;IACb,IAAI,SAAS;IAEb;;GAEC,GACD,SAAS,eAAe,GAAW;QACjC,MAAM,QAAQ,IAAI,KAAK,CAAC;QACxB,IAAI,OAAO,UAAU,MAAM,MAAM;QACjC,MAAM,IAAI,IAAI,WAAW,CAAC;QAC1B,SAAS,CAAC,IAAI,IAAI,MAAM,GAAG,IAAI,SAAS,IAAI,MAAM;IACpD;IAEA;;GAEC,GACD,SAAS;QACP,MAAM,QAAQ;YAAC,MAAM;YAAQ,QAAQ;QAAM;QAC3C,OAAO,SACL,IAA0B;YAEzB,KAAY,QAAQ,GAAG,IAAI,CAAA,GAAA,wCAAO,EACjC,OACA;gBAAC,MAAM;gBAAQ,QAAQ;YAAM,GAC7B,SAAS,UAAU;YAErB;YACA,OAAO;QACT;IACF;IAEA;;GAEC,GACD,MAAM,aAAmC,EAAE;IAE3C,SAAS,MAAM,GAAW;QACxB,MAAM,MAAM,IAAI,CAAA,GAAA,wCAAY,EAC1B,SAAS,UAAU,IACnB,KACA,QACA,QACA;QAGF,IAAI,SAAS,QACX,WAAW,IAAI,CAAC;aAEhB,MAAM;IAEV;IAEA;;GAEC,GACD,SAAS;QACP,MAAM,YAAY;QAElB,MAAM,SAA2B;YAC/B,MAAM,CAAA,GAAA,yCAAO,EAAE,UAAU;YACzB,YAAY;gBACV,QAAQ,SAAS;gBACjB,OAAO;gBACP,eAAe;YACjB;QACF;QAEA,OAAO;IACT;IAEA;;GAEC,GACD,SAAS;QACP,OAAO,MAAM;IACf;IAEA;;GAEC,GACD,SAAS;QACP,OAAO,MAAM;IACf;IAEA;;GAEC,GACD,SAAS;QACP,IAAI;QACJ,MAAM,QAA0C,EAAE;QAClD;QACA,SAAS;QACT,MAAO,IAAI,MAAM,IAAI,IAAI,MAAM,CAAC,OAAO,OAAQ,CAAA,OAAO,YAAY,MAAK,EACrE,IAAI,MAAM;YACR,MAAM,IAAI,CAAC;YACX,SAAS;QACX;QAEF,OAAO;IACT;IAEA;;GAEC,GACD,SAAS,MAAM,EAAU;QACvB,MAAM,IAAI,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,GACH;QAEF,MAAM,MAAM,CAAC,CAAC,EAAE;QAChB,eAAe;QACf,MAAM,IAAI,KAAK,CAAC,IAAI,MAAM;QAC1B,OAAO;IACT;IAEA;;GAEC,GACD,SAAS;QACP,MAAM;IACR;IAEA;;GAEC,GACD,SAAS,SACP,KAAiC;QAEjC,IAAI;QACJ,QAAQ,SAAS,EAAE;QACnB,MAAQ,IAAI,UACV,IAAI,GACF,MAAM,IAAI,CAAC;QAGf,OAAO;IACT;IAEA;;GAEC,GACD,SAAS;QACP,MAAM,MAAM;QACZ,IAAI,QAAQ,IAAI,MAAM,CAAC,MAAM,QAAQ,IAAI,MAAM,CAAC,IAC9C;QAGF,MAAM,IAAI,MAAM;QAChB,IAAI,CAAC,GACH,OAAO,MAAM;QAGf,OAAO,IAAmB;YACxB,MAAM,CAAA,GAAA,yCAAO,EAAE,OAAO;YACtB,SAAS,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG;QACzB;IACF;IAEA,SAAS,sBACP,GAAW,EACX,KAAa,EACb,KAAa;QAEb,IAAI,MAAM,QAAQ;QAClB,IAAI,QAAQ;QACZ,IAAI,mBAAmB,IAAI,OAAO,CAAC,KAAK;QACxC,MAAO,CAAC,SAAS,qBAAqB,GAAI;YACxC,MAAM,kBAAkB,IAAI,OAAO,CAAC,KAAK;YACzC,IAAI,oBAAoB,MAAM,kBAAkB,kBAAkB;gBAChE,MAAM,aAAa,sBACjB,KACA,kBAAkB,GAClB,QAAQ;gBAEV,MAAM,aAAa;gBACnB,mBAAmB,IAAI,OAAO,CAAC,KAAK;YACtC,OACE,QAAQ;QAEZ;QACA,IAAI,SAAS,qBAAqB,IAChC,OAAO;aAEP,OAAO;IAEX;IAEA;;GAEC,GACD,SAAS;QACP,MAAM,IAAI,MAAM;QAChB,IAAI,CAAC,GACH;QAGF,8BAA8B;QAC9B,IAAI,MAAM,2BAAK,CAAC,CAAC,EAAE,EAAE,OAAO,CAAC,iCAAW;QAExC,0FAA0F;QAC1F,IAAI,IAAI,OAAO,CAAC,SAAS,IACvB,OAAO;YAAC;SAAI;QAGd,iDAAiD;QACjD,IAAI,MAAM;QACV,IAAI,mBAAmB,IAAI,OAAO,CAAC,KAAK;QACxC,MAAO,qBAAqB,GAAI;YAC9B,MAAM,mBAAmB,sBAAsB,KAAK,kBAAkB;YACtE,IAAI,qBAAqB,IACvB;YAEF,MAAM,mBAAmB;YACzB,MACE,IAAI,SAAS,CAAC,GAAG,oBACjB,IACG,SAAS,CAAC,kBAAkB,kBAC5B,OAAO,CAAC,MAAM,YACjB,IAAI,SAAS,CAAC;YAChB,mBAAmB,IAAI,OAAO,CAAC,KAAK;QACtC;QAEA,yCAAyC;QACzC,MAAM,GACJ;;;;;;;;;;;;;;;OAeC,IACA,OAAO,CAAC,wBAAwB,CAAA,IAAK,EAAE,OAAO,CAAC,MAAM;QAExD,uDAAuD;QACvD,OACE,GACE,4BAA4B;SAC3B,KAAK,CAAC,IACP,6BAA6B;SAC5B,GAAG,CAAC,CAAA;YACH,OAAO,2BAAK,EAAE,OAAO,CAAC,WAAW;QACnC;IAEN;IAEA;;GAEC,GACD,SAAS;QACP,MAAM,MAAM;QAEZ,OAAO;QACP,MAAM,YAAY,MAAM;QACxB,IAAI,CAAC,WACH;QAEF,MAAM,YAAY,2BAAK,SAAS,CAAC,EAAE;QAEnC,IAAI;QACJ,IAAI,CAAC,MAAM,UACT,OAAO,MAAM;QAGf,MAAM;QACN,MAAM,MAAM,MAAM;QAElB,MAAM,MAAM,IAAuB;YACjC,MAAM,CAAA,GAAA,yCAAO,EAAE,WAAW;YAC1B,UAAU,UAAU,OAAO,CAAC,iCAAW;YACvC,OAAO,MAAM,2BAAK,GAAG,CAAC,EAAE,EAAE,OAAO,CAAC,iCAAW,MAAM;QACrD;QAEA,IAAI;QACJ,MAAM;QAEN,OAAO;IACT;IAEA;;GAEC,GACD,SAAS;QACP,MAAM,QAAkD,EAAE;QAE1D,IAAI,CAAC,QACH,OAAO,MAAM;QAEf,SAAS;QAET,eAAe;QACf,IAAI;QACJ,MAAQ,OAAO,cACb,IAAI,MAAM;YACR,MAAM,IAAI,CAAC;YACX,SAAS;QACX;QAGF,IAAI,CAAC,SACH,OAAO,MAAM;QAEf,OAAO;IACT;IAEA;;GAEC,GACD,SAAS;QACP,IAAI;QACJ,MAAM,OAAO,EAAE;QACf,MAAM,MAAM;QAEZ,MAAQ,IAAI,MAAM,uCAAyC;YACzD,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE;YACd,MAAM;QACR;QAEA,IAAI,CAAC,KAAK,MAAM,EACd;QAGF,OAAO,IAAoB;YACzB,MAAM,CAAA,GAAA,yCAAO,EAAE,QAAQ;YACvB,QAAQ;YACR,cAAc,kBAAkB,EAAE;QACpC;IACF;IAEA;;GAEC,GACD,SAAS;QACP,MAAM,MAAM;QACZ,MAAM,KAAK,MAAM;QAEjB,IAAI,CAAC,IACH;QAEF,MAAM,SAAS,EAAE,CAAC,EAAE;QAEpB,aAAa;QACb,MAAM,KAAK,MAAM;QACjB,IAAI,CAAC,IACH,OAAO,MAAM;QAEf,MAAM,OAAO,EAAE,CAAC,EAAE;QAElB,IAAI,CAAC,QACH,OAAO,MAAM;QAGf,IAAI;QACJ,IAAI,SAAgD;QACpD,MAAQ,QAAQ,WAAa;YAC3B,OAAO,IAAI,CAAC;YACZ,SAAS,OAAO,MAAM,CAAC;QACzB;QAEA,IAAI,CAAC,SACH,OAAO,MAAM;QAGf,OAAO,IAAqB;YAC1B,MAAM,CAAA,GAAA,yCAAO,EAAE,SAAS;YACxB,MAAM;YACN,QAAQ;YACR,WAAW;QACb;IACF;IAEA;;GAEC,GACD,SAAS;QACP,MAAM,MAAM;QACZ,MAAM,IAAI,MAAM;QAEhB,IAAI,CAAC,GACH;QAEF,MAAM,WAAW,2BAAK,CAAC,CAAC,EAAE;QAE1B,IAAI,CAAC,QACH,OAAO,MAAM;QAGf,MAAM,QAAQ,WAAyB,MAAM,CAAC;QAE9C,IAAI,CAAC,SACH,OAAO,MAAM;QAGf,OAAO,IAAoB;YACzB,MAAM,CAAA,GAAA,yCAAO,EAAE,QAAQ;YACvB,UAAU;YACV,OAAO;QACT;IACF;IAEA;;GAEC,GACD,SAAS;QACP,MAAM,MAAM;QACZ,MAAM,IAAI,MAAM;QAEhB,IAAI,CAAC,GACH;QAGF,IAAI,CAAC,QACH,OAAO,MAAM;QAGf,MAAM,QAAQ,WAAyB,MAAM,CAAC;QAE9C,IAAI,CAAC,SACH,OAAO,MAAM;QAGf,OAAO,IAAgB;YACrB,MAAM,CAAA,GAAA,yCAAO,EAAE,IAAI;YACnB,OAAO;QACT;IACF;IAEA;;GAEC,GACD,SAAS;QACP,MAAM,MAAM;QACZ,MAAM,IAAI,MAAM;QAEhB,IAAI,CAAC,GACH;QAEF,MAAM,YAAY,2BAAK,CAAC,CAAC,EAAE;QAE3B,IAAI,CAAC,QACH,OAAO,MAAM;QAGf,MAAM,QAAQ,WAAyB,MAAM,CAAC;QAE9C,IAAI,CAAC,SACH,OAAO,MAAM;QAGf,OAAO,IAAqB;YAC1B,MAAM,CAAA,GAAA,yCAAO,EAAE,SAAS;YACxB,WAAW;YACX,OAAO;QACT;IACF;IAEA;;GAEC,GACD,SAAS;QACP,MAAM,MAAM;QACZ,MAAM,IAAI,MAAM;QAEhB,IAAI,CAAC,GACH;QAEF,MAAM,QAAQ,2BAAK,CAAC,CAAC,EAAE;QAEvB,IAAI,CAAC,QAAQ;YACX,MAAM;YACN,OAAO,IAAiB;gBACtB,MAAM,CAAA,GAAA,yCAAO,EAAE,KAAK;gBACpB,OAAO;YACT;QACF;QAEA,MAAM,QAAQ,WAAyB,MAAM,CAAC;QAE9C,IAAI,CAAC,SACH,OAAO,MAAM;QAGf,OAAO,IAAiB;YACtB,MAAM,CAAA,GAAA,yCAAO,EAAE,KAAK;YACpB,OAAO;YACP,OAAO;QACT;IACF;IAEA;;GAEC,GACD,SAAS;QACP,MAAM,MAAM;QACZ,MAAM,IAAI,MAAM;QAEhB,IAAI,CAAC,GACH;QAEF,MAAM,QAAQ,2BAAK,CAAC,CAAC,EAAE;QAEvB,IAAI,CAAC,QACH,OAAO,MAAM;QAGf,MAAM,QAAQ,WAAyB,MAAM,CAAC;QAE9C,IAAI,CAAC,SACH,OAAO,MAAM;QAGf,OAAO,IAAiB;YACtB,MAAM,CAAA,GAAA,yCAAO,EAAE,KAAK;YACpB,OAAO;YACP,OAAO;QACT;IACF;IAEA;;GAEC,GACD,SAAS;QACP,MAAM,MAAM;QACZ,MAAM,IAAI,MAAM;QAChB,IAAI,CAAC,GACH;QAGF,OAAO,IAAuB;YAC5B,MAAM,CAAA,GAAA,yCAAO,EAAE,WAAW;YAC1B,MAAM,2BAAK,CAAC,CAAC,EAAE;YACf,OAAO,2BAAK,CAAC,CAAC,EAAE;QAClB;IACF;IAEA;;GAEC,GACD,SAAS;QACP,MAAM,MAAM;QACZ,MAAM,IAAI,MAAM;QAChB,IAAI,CAAC,GACH;QAGF,MAAM,MAAM,cAAc,EAAE;QAE5B,IAAI,CAAC,QACH,OAAO,MAAM;QAEf,IAAI,QAAQ;QAEZ,eAAe;QACf,IAAI;QACJ,MAAQ,OAAO,cAAgB;YAC7B,MAAM,IAAI,CAAC;YACX,QAAQ,MAAM,MAAM,CAAC;QACvB;QAEA,IAAI,CAAC,SACH,OAAO,MAAM;QAGf,OAAO,IAAgB;YACrB,MAAM,CAAA,GAAA,yCAAO,EAAE,IAAI;YACnB,WAAW;YACX,cAAc;QAChB;IACF;IAEA;;GAEC,GACD,SAAS;QACP,MAAM,MAAM;QACZ,MAAM,IAAI,MAAM;QAChB,IAAI,CAAC,GACH;QAGF,MAAM,SAAS,2BAAK,CAAC,CAAC,EAAE;QACxB,MAAM,MAAM,2BAAK,CAAC,CAAC,EAAE;QAErB,IAAI,CAAC,QACH,OAAO,MAAM;QAGf,MAAM,QAAQ,WAAyB,MAAM,CAAC;QAE9C,IAAI,CAAC,SACH,OAAO,MAAM;QAGf,OAAO,IAAoB;YACzB,MAAM,CAAA,GAAA,yCAAO,EAAE,QAAQ;YACvB,UAAU;YACV,QAAQ;YACR,OAAO;QACT;IACF;IAEA;;GAEC,GACD,SAAS;QACP,MAAM,MAAM;QACZ,MAAM,IAAI,MAAM;QAChB,IAAI,CAAC,GACH;QAGF,IAAI,CAAC,QACH,OAAO,MAAM;QAEf,IAAI,QAAQ;QAEZ,eAAe;QACf,IAAI;QACJ,MAAQ,OAAO,cAAgB;YAC7B,MAAM,IAAI,CAAC;YACX,QAAQ,MAAM,MAAM,CAAC;QACvB;QAEA,IAAI,CAAC,SACH,OAAO,MAAM;QAGf,OAAO,IAAoB;YACzB,MAAM,CAAA,GAAA,yCAAO,EAAE,QAAQ;YACvB,cAAc;QAChB;IACF;IAEA;;GAEC,GACD,MAAM,WAAW,eAA6B;IAE9C;;GAEC,GACD,MAAM,YAAY,eAA8B;IAEhD;;GAEC,GACD,MAAM,cAAc,eAAgC;IAEpD;;GAEC,GACD,SAAS,eACP,IAAY;QAEZ,MAAM,KAAK,IAAI,OACb,OACE,OACA;QAGJ,gDAAgD;QAEhD,OAAO;YACL,MAAM,MAAM;YACZ,MAAM,IAAI,MAAM;YAChB,IAAI,CAAC,GACH;YAEF,MAAM,MAA8B;gBAAC,MAAM;YAAI;YAC/C,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC,EAAE,CAAC,IAAI;YACrB,OAAO,IAAQ;QACjB;IACF;IAEA;;GAEC,GACD,SAAS;QACP,IAAI,GAAG,CAAC,EAAE,KAAK,KACb;QAGF,OACE,iBACA,aACA,mBACA,gBACA,cACA,eACA,iBACA,gBACA,YACA,YACA,gBACA,iBACA;IAEJ;IAEA;;GAEC,GACD,SAAS;QACP,MAAM,MAAM;QACZ,MAAM,MAAM;QAEZ,IAAI,CAAC,KACH,OAAO,MAAM;QAEf;QAEA,OAAO,IAAgB;YACrB,MAAM,CAAA,GAAA,yCAAO,EAAE,IAAI;YACnB,WAAW;YACX,cAAc,kBAAkB,EAAE;QACpC;IACF;IAEA,OAAO,gCAAU;AACnB;AAEA;;CAEC,GACD,SAAS,2BAAK,GAAW;IACvB,OAAO,MAAM,IAAI,IAAI,KAAK;AAC5B;AAEA;;CAEC,GACD,SAAS,gCAAsC,GAAO,EAAE,MAAgB;IACtE,MAAM,SAAS,OAAO,OAAO,IAAI,IAAI,KAAK;IAC1C,MAAM,cAAc,SAAS,MAAM;IAEnC,IAAK,MAAM,KAAK,IAAK;QACnB,MAAM,QAAQ,GAAG,CAAC,EAAE;QACpB,IAAI,MAAM,OAAO,CAAC,QAChB,MAAM,OAAO,CAAC,CAAA;YACZ,gCAAU,GAAG;QACf;aACK,IAAI,SAAS,OAAO,UAAU,UACnC,gCAAU,OAAO;IAErB;IAEA,IAAI,QACF,OAAO,cAAc,CAAC,KAAK,UAAU;QACnC,cAAc;QACd,UAAU;QACV,YAAY;QACZ,OAAO,UAAU;IACnB;IAGF,OAAO;AACT;IAEA,2CAAe;;;;AK/wBf,MAAM;IAKJ,YAAY,OAA+C,CAAE;aAJ7D,QAAQ;aACR,cAAc;aACd,WAAW;QAGT,IAAI,OAAO,SAAS,WAAW,UAC7B,IAAI,CAAC,WAAW,GAAG,SAAS;QAE9B,IAAI,SAAS,UACX,IAAI,CAAC,QAAQ,GAAG;IAEpB;IAEA,uGAAuG;IACvG,6DAA6D;IAC7D,KAAK,GAAW,EAAE,SAA4C,EAAE;QAC9D,OAAO;IACT;IAEA;;GAEC,GACD,OAAO,KAAc,EAAE;QACrB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI;QAE3B,IAAI,OAAO;YACT,IAAI,CAAC,KAAK,IAAI;YACd,OAAO;QACT;QAEA,OAAO,MAAM,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,WAAW;IAChD;IAEA,MAAM,IAAoB,EAAU;QAClC,OAAQ,KAAK,IAAI;YACf,KAAK,CAAA,GAAA,yCAAO,EAAE,UAAU;gBACtB,OAAO,IAAI,CAAC,UAAU,CAAC;YACzB,KAAK,CAAA,GAAA,yCAAO,EAAE,IAAI;gBAChB,OAAO,IAAI,CAAC,IAAI,CAAC;YACnB,KAAK,CAAA,GAAA,yCAAO,EAAE,WAAW;gBACvB,OAAO,IAAI,CAAC,WAAW,CAAC;YAC1B,KAAK,CAAA,GAAA,yCAAO,EAAE,OAAO;gBACnB,OAAO,IAAI,CAAC,OAAO,CAAC;YACtB,KAAK,CAAA,GAAA,yCAAO,EAAE,SAAS;gBACrB,OAAO,IAAI,CAAC,SAAS,CAAC;YACxB,KAAK,CAAA,GAAA,yCAAO,EAAE,OAAO;gBACnB,OAAO,IAAI,CAAC,OAAO,CAAC;YACtB,KAAK,CAAA,GAAA,yCAAO,EAAE,QAAQ;gBACpB,OAAO,IAAI,CAAC,QAAQ,CAAC;YACvB,KAAK,CAAA,GAAA,yCAAO,EAAE,WAAW;gBACvB,OAAO,IAAI,CAAC,WAAW,CAAC;YAC1B,KAAK,CAAA,GAAA,yCAAO,EAAE,QAAQ;gBACpB,OAAO,IAAI,CAAC,QAAQ,CAAC;YACvB,KAAK,CAAA,GAAA,yCAAO,EAAE,IAAI;gBAChB,OAAO,IAAI,CAAC,IAAI,CAAC;YACnB,KAAK,CAAA,GAAA,yCAAO,EAAE,MAAM;gBAClB,OAAO,IAAI,CAAC,MAAM,CAAC;YACrB,KAAK,CAAA,GAAA,yCAAO,EAAE,SAAS;gBACrB,OAAO,IAAI,CAAC,SAAS,CAAC;YACxB,KAAK,CAAA,GAAA,yCAAO,EAAE,QAAQ;gBACpB,OAAO,IAAI,CAAC,QAAQ,CAAC;YACvB,KAAK,CAAA,GAAA,yCAAO,EAAE,KAAK;gBACjB,OAAO,IAAI,CAAC,KAAK,CAAC;YACpB,KAAK,CAAA,GAAA,yCAAO,EAAE,KAAK;gBACjB,OAAO,IAAI,CAAC,KAAK,CAAC;YACpB,KAAK,CAAA,GAAA,yCAAO,EAAE,SAAS;gBACrB,OAAO,IAAI,CAAC,SAAS,CAAC;YACxB,KAAK,CAAA,GAAA,yCAAO,EAAE,IAAI;gBAChB,OAAO,IAAI,CAAC,IAAI,CAAC;YACnB,KAAK,CAAA,GAAA,yCAAO,EAAE,QAAQ;gBACpB,OAAO,IAAI,CAAC,QAAQ,CAAC;QACzB;IACF;IAEA,SAAS,KAA4B,EAAE,KAAc,EAAE;QACrD,IAAI,MAAM;QACV,QAAQ,SAAS;QAEjB,IAAK,IAAI,IAAI,GAAG,SAAS,MAAM,MAAM,EAAE,IAAI,QAAQ,IAAK;YACtD,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;YAC1B,IAAI,SAAS,IAAI,SAAS,GACxB,OAAO,IAAI,CAAC,IAAI,CAAC;QAErB;QAEA,OAAO;IACT;IAEA,QAAQ,IAAsB,EAAE;QAC9B,IAAI,IAAI,CAAC,QAAQ,EACf,OAAO,KAAK,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC;QAG1D,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB;IAEA;;GAEC,GACD,WAAW,IAAsB,EAAE;QACjC,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,UAAU,CAAC,KAAK,EAAE;IAC9C;IAEA;;GAEC,GACD,QAAQ,IAAmB,EAAE;QAC3B,IAAI,IAAI,CAAC,QAAQ,EACf,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,QAAQ;QAEpC,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,KAAK,OAAO,KAAK,OAAO,GAAG,MAAM,KAAK,QAAQ;IAC5E;IAEA;;GAEC,GACD,UAAU,IAAqB,EAAE;QAC/B,IAAI,IAAI,CAAC,QAAQ,EACf,OACE,IAAI,CAAC,IAAI,CAAC,gBAAgB,KAAK,SAAS,EAAE,KAAK,QAAQ,IACvD,IAAI,CAAC,IAAI,CAAC,OACV,IAAI,CAAC,QAAQ,CAAC,KAAK,KAAK,IACxB,IAAI,CAAC,IAAI,CAAC;QAGd,OACE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,KAAK,gBAAgB,KAAK,SAAS,EAAE,KAAK,QAAQ,IACvE,IAAI,CAAC,IAAI,CAAC,SAAS,IAAI,CAAC,MAAM,CAAC,MAC/B,IAAI,CAAC,QAAQ,CAAC,KAAK,KAAK,EAAE,UAC1B,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,MAAM,KAAK;IAEvD;IAEA;;GAEC,GACD,MAAM,IAAiB,EAAE;QACvB,IAAI,IAAI,CAAC,QAAQ,EACf,OACE,IAAI,CAAC,IAAI,CAAC,YAAY,KAAK,KAAK,EAAE,KAAK,QAAQ,IAC9C,CAAA,KAAK,KAAK,GACP,IAAI,CAAC,IAAI,CAAC,OACV,IAAI,CAAC,QAAQ,CAAmB,KAAK,KAAK,IAC1C,IAAI,CAAC,IAAI,CAAC,OACV,GAAE;QAGV,OACE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,KAAK,YAAY,KAAK,KAAK,EAAE,KAAK,QAAQ,IAC9D,CAAA,KAAK,KAAK,GACP,IAAI,CAAC,IAAI,CAAC,SAAS,IAAI,CAAC,MAAM,CAAC,MAC/B,IAAI,CAAC,QAAQ,CAAmB,KAAK,KAAK,EAAE,UAC5C,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,MAAM,KAAK,OACnD,GAAE;IAEV;IAEA;;GAEC,GACD,OAAO,IAAkB,EAAE;QACzB,OAAO,IAAI,CAAC,IAAI,CAAC,aAAa,KAAK,MAAM,GAAG,KAAK,KAAK,QAAQ;IAChE;IAEA;;GAEC,GACD,MAAM,IAAiB,EAAE;QACvB,IAAI,IAAI,CAAC,QAAQ,EACf,OACE,IAAI,CAAC,IAAI,CAAC,YAAY,KAAK,KAAK,EAAE,KAAK,QAAQ,IAC/C,IAAI,CAAC,IAAI,CAAC,OACV,IAAI,CAAC,QAAQ,CAAC,KAAK,KAAK,IACxB,IAAI,CAAC,IAAI,CAAC;QAGd,OACE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,KAAK,YAAY,KAAK,KAAK,EAAE,KAAK,QAAQ,IAC/D,IAAI,CAAC,IAAI,CAAC,SAAS,IAAI,CAAC,MAAM,CAAC,MAC/B,IAAI,CAAC,QAAQ,CAAC,KAAK,KAAK,EAAE,UAC1B,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,MAAM,KAAK;IAEvD;IAEA;;GAEC,GACD,SAAS,IAAoB,EAAE;QAC7B,MAAM,MAAM,MAAO,CAAA,KAAK,MAAM,IAAI,EAAC,IAAK,cAAc,KAAK,QAAQ;QACnE,IAAI,IAAI,CAAC,QAAQ,EACf,OACE,IAAI,CAAC,IAAI,CAAC,KAAK,KAAK,QAAQ,IAC5B,IAAI,CAAC,IAAI,CAAC,OACV,IAAI,CAAC,QAAQ,CAAC,KAAK,KAAK,IACxB,IAAI,CAAC,IAAI,CAAC;QAGd,OACE,IAAI,CAAC,IAAI,CAAC,KAAK,KAAK,QAAQ,IAC5B,IAAI,CAAC,IAAI,CAAC,UAAe,IAAI,CAAC,MAAM,CAAC,MACrC,IAAI,CAAC,QAAQ,CAAC,KAAK,KAAK,EAAE,UAC1B,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM;IAEhC;IAEA;;GAEC,GACD,QAAQ,IAAmB,EAAE;QAC3B,OAAO,IAAI,CAAC,IAAI,CAAC,cAAc,KAAK,OAAO,GAAG,KAAK,KAAK,QAAQ;IAClE;IAEA;;GAEC,GACD,UAAU,IAAqB,EAAE;QAC/B,OAAO,IAAI,CAAC,IAAI,CAAC,gBAAgB,KAAK,SAAS,GAAG,KAAK,KAAK,QAAQ;IACtE;IAEA;;GAEC,GACD,SAAS,IAAoB,EAAE;QAC7B,IAAI,IAAI,CAAC,QAAQ,EACf,OACE,IAAI,CAAC,IAAI,CAAC,eAAe,KAAK,QAAQ,EAAE,KAAK,QAAQ,IACrD,IAAI,CAAC,IAAI,CAAC,OACV,IAAI,CAAC,QAAQ,CAAC,KAAK,KAAK,IACxB,IAAI,CAAC,IAAI,CAAC;QAGd,OACE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,KAAK,eAAe,KAAK,QAAQ,EAAE,KAAK,QAAQ,IACrE,IAAI,CAAC,IAAI,CAAC,SAAS,IAAI,CAAC,MAAM,CAAC,MAC/B,IAAI,CAAC,QAAQ,CAAC,KAAK,KAAK,EAAE,UAC1B,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,MAAM,KAAK;IAEvD;IAEA;;GAEC,GACD,UAAU,IAAqB,EAAE;QAC/B,IAAI,IAAI,CAAC,QAAQ,EACf,OACE,IAAI,CAAC,IAAI,CACP,MAAO,CAAA,KAAK,MAAM,IAAI,EAAC,IAAK,eAAe,KAAK,IAAI,EACpD,KAAK,QAAQ,IAEf,IAAI,CAAC,IAAI,CAAC,OACV,IAAI,CAAC,QAAQ,CAAC,KAAK,SAAS,IAC5B,IAAI,CAAC,IAAI,CAAC;QAGd,OACE,IAAI,CAAC,IAAI,CACP,MAAO,CAAA,KAAK,MAAM,IAAI,EAAC,IAAK,eAAe,KAAK,IAAI,EACpD,KAAK,QAAQ,IAEf,IAAI,CAAC,IAAI,CAAC,SAAS,IAAI,CAAC,MAAM,CAAC,MAC/B,IAAI,CAAC,QAAQ,CAAC,KAAK,SAAS,EAAE,QAC9B,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM;IAEhC;IAEA;;GAEC,GACD,SAAS,IAAoB,EAAE;QAC7B,MAAM,QAAQ,KAAK,YAAY;QAC/B,IAAI,IAAI,CAAC,QAAQ,EACf,OACE,IAAI,CAAC,IAAI,CAAC,KAAK,MAAM,CAAC,IAAI,CAAC,MAAM,KAAK,QAAQ,IAC9C,IAAI,CAAC,IAAI,CAAC,OACV,IAAI,CAAC,QAAQ,CAAC,SACd,IAAI,CAAC,IAAI,CAAC;QAId,OACE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,MACrB,IAAI,CAAC,IAAI,CAAC,KAAK,MAAM,CAAC,IAAI,CAAC,OAAO,KAAK,QAAQ,IAC/C,IAAI,CAAC,IAAI,CAAC,SAAS,IAAI,CAAC,MAAM,CAAC,MAC/B,IAAI,CAAC,QAAQ,CAAC,OAAO,QACrB,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,OAAO,IAAI,CAAC,MAAM,KAAK;IAEvD;IAEA;;GAEC,GACD,KAAK,IAAgB,EAAE;QACrB,IAAI,IAAI,CAAC,QAAQ,EAAE;YACjB,MAAM,MAAM,KAAK,SAAS,CAAC,MAAM,GAAG,KAAK,SAAS,CAAC,IAAI,CAAC,QAAQ;YAEhE,OACE,IAAI,CAAC,IAAI,CAAC,WAAW,KAAK,KAAK,QAAQ,IACvC,IAAI,CAAC,IAAI,CAAC,OACV,IAAI,CAAC,QAAQ,CAAC,KAAK,YAAY,IAC/B,IAAI,CAAC,IAAI,CAAC;QAEd;QACA,MAAM,MAAM,KAAK,SAAS,CAAC,MAAM,GAAG,KAAK,SAAS,CAAC,IAAI,CAAC,QAAQ,MAAM;QAEtE,OACE,IAAI,CAAC,IAAI,CAAC,WAAW,KAAK,KAAK,QAAQ,IACvC,IAAI,CAAC,IAAI,CAAC,SACV,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MACtB,IAAI,CAAC,QAAQ,CAAC,KAAK,YAAY,EAAE,QACjC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,OACtB,IAAI,CAAC,IAAI,CAAC;IAEd;IAEA;;GAEC,GACD,SAAS,IAAoB,EAAE;QAC7B,IAAI,IAAI,CAAC,QAAQ,EACf,OACE,IAAI,CAAC,IAAI,CAAC,cAAc,KAAK,QAAQ,IACrC,IAAI,CAAC,IAAI,CAAC,OACV,IAAI,CAAC,QAAQ,CAAC,KAAK,YAAY,IAC/B,IAAI,CAAC,IAAI,CAAC;QAGd,OACE,IAAI,CAAC,IAAI,CAAC,eAAe,KAAK,QAAQ,IACtC,IAAI,CAAC,IAAI,CAAC,SACV,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MACtB,IAAI,CAAC,QAAQ,CAAC,KAAK,YAAY,EAAE,QACjC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,OACtB,IAAI,CAAC,IAAI,CAAC;IAEd;IAEA;;GAEC,GACD,KAAK,IAAgB,EAAE;QACrB,IAAI,IAAI,CAAC,QAAQ,EACf,OACE,IAAI,CAAC,IAAI,CAAC,SAAS,KAAK,QAAQ,IAChC,IAAI,CAAC,IAAI,CAAC,OACV,IAAI,CAAC,QAAQ,CAAC,KAAK,KAAK,IACxB,IAAI,CAAC,IAAI,CAAC;QAGd,OACE,IAAI,CAAC,IAAI,CAAC,SAAS,KAAK,QAAQ,IAChC,IAAI,CAAC,IAAI,CAAC,SAAS,IAAI,CAAC,MAAM,CAAC,MAC/B,IAAI,CAAC,QAAQ,CAAC,KAAK,KAAK,EAAE,UAC1B,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM;IAEhC;IAEA;;GAEC,GACD,YAAY,IAAuB,EAAE;QACnC,OAAO,IAAI,CAAC,IAAI,CACd,mBAAmB,KAAK,IAAI,GAAG,MAAM,KAAK,KAAK,GAAG,KAClD,KAAK,QAAQ;IAEjB;IAEA;;GAEC,GACD,KAAK,IAAgB,EAAE;QACrB,MAAM,QAAQ,KAAK,YAAY;QAC/B,IAAI,CAAC,MAAM,MAAM,EACf,OAAO;QAGT,IAAI,IAAI,CAAC,QAAQ,EACf,OACE,IAAI,CAAC,IAAI,CAAC,KAAK,SAAS,CAAC,IAAI,CAAC,MAAM,KAAK,QAAQ,IACjD,IAAI,CAAC,IAAI,CAAC,OACV,IAAI,CAAC,QAAQ,CAAC,SACd,IAAI,CAAC,IAAI,CAAC;QAGd,MAAM,SAAS,IAAI,CAAC,MAAM;QAE1B,OACE,IAAI,CAAC,IAAI,CACP,KAAK,SAAS,CACX,GAAG,CAAC,CAAA;YACH,OAAO,SAAS;QAClB,GACC,IAAI,CAAC,QACR,KAAK,QAAQ,IAEf,IAAI,CAAC,IAAI,CAAC,UACV,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MACtB,IAAI,CAAC,QAAQ,CAAC,OAAO,QACrB,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,OACtB,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,CAAC,MAAM,KAAK;IAErC;IAEA;;GAEC,GACD,YAAY,IAAuB,EAAE;QACnC,IAAI,IAAI,CAAC,QAAQ,EACf,OACE,IAAI,CAAC,IAAI,CAAC,KAAK,QAAQ,GAAG,MAAM,KAAK,KAAK,EAAE,KAAK,QAAQ,IACzD,IAAI,CAAC,IAAI,CAAC;QAGd,OACE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,MACrB,IAAI,CAAC,IAAI,CAAC,KAAK,QAAQ,GAAG,OAAO,KAAK,KAAK,EAAE,KAAK,QAAQ,IAC1D,IAAI,CAAC,IAAI,CAAC;IAEd;AACF;IAEA,2CAAe;;;ID1bf,2CAAe,CACb,MACA;IAEA,MAAM,WAAW,IAAI,CAAA,GAAA,wCAAO,EAAE,WAAW,CAAC;IAC1C,OAAO,SAAS,OAAO,CAAC;AAC1B;;;;;;ALPO,MAAM,4CAAQ,CAAA,GAAA,wCAAM;AACpB,MAAM,4CAAY,CAAA,GAAA,wCAAU;IAInC,2CAAe;WAAC;eAAO;AAAS","sources":["src/index.ts","src/parse/index.ts","src/CssParseError.ts","src/CssPosition.ts","src/type.ts","src/stringify/index.ts","src/stringify/compiler.ts"],"sourcesContent":["import {default as parseFn} from './parse';\nimport {default as stringifyFn} from './stringify';\nexport const parse = parseFn;\nexport const stringify = stringifyFn;\nexport * from './type';\nexport * from './CssParseError';\nexport * from './CssPosition';\nexport default {parse, stringify};\n","import CssParseError from '../CssParseError';\nimport Position from '../CssPosition';\nimport {\n CssAtRuleAST,\n CssCharsetAST,\n CssCommentAST,\n CssCommonPositionAST,\n CssContainerAST,\n CssCustomMediaAST,\n CssDeclarationAST,\n CssDocumentAST,\n CssFontFaceAST,\n CssHostAST,\n CssImportAST,\n CssKeyframeAST,\n CssKeyframesAST,\n CssLayerAST,\n CssMediaAST,\n CssNamespaceAST,\n CssPageAST,\n CssRuleAST,\n CssStylesheetAST,\n CssSupportsAST,\n CssTypes,\n} from '../type';\n\n// http://www.w3.org/TR/CSS21/grammar.html\n// https://github.com/visionmedia/css-parse/pull/49#issuecomment-30088027\n// New rule => https://www.w3.org/TR/CSS22/syndata.html#comments\n// [^] is equivalent to [.\\n\\r]\nconst commentre = /\\/\\*[^]*?(?:\\*\\/|$)/g;\n\nexport const parse = (\n css: string,\n options?: {source?: string; silent?: boolean}\n): CssStylesheetAST => {\n options = options || {};\n\n /**\n * Positional.\n */\n let lineno = 1;\n let column = 1;\n\n /**\n * Update lineno and column based on `str`.\n */\n function updatePosition(str: string) {\n const lines = str.match(/\\n/g);\n if (lines) lineno += lines.length;\n const i = str.lastIndexOf('\\n');\n column = ~i ? str.length - i : column + str.length;\n }\n\n /**\n * Mark position and patch `node.position`.\n */\n function position() {\n const start = {line: lineno, column: column};\n return function <T1 extends CssCommonPositionAST>(\n node: Omit<T1, 'position'>\n ): T1 {\n (node as T1).position = new Position(\n start,\n {line: lineno, column: column},\n options?.source || ''\n );\n whitespace();\n return node as T1;\n };\n }\n\n /**\n * Error `msg`.\n */\n const errorsList: Array<CssParseError> = [];\n\n function error(msg: string) {\n const err = new CssParseError(\n options?.source || '',\n msg,\n lineno,\n column,\n css\n );\n\n if (options?.silent) {\n errorsList.push(err);\n } else {\n throw err;\n }\n }\n\n /**\n * Parse stylesheet.\n */\n function stylesheet(): CssStylesheetAST {\n const rulesList = rules();\n\n const result: CssStylesheetAST = {\n type: CssTypes.stylesheet,\n stylesheet: {\n source: options?.source,\n rules: rulesList,\n parsingErrors: errorsList,\n },\n };\n\n return result;\n }\n\n /**\n * Opening brace.\n */\n function open() {\n return match(/^{\\s*/);\n }\n\n /**\n * Closing brace.\n */\n function close() {\n return match(/^}/);\n }\n\n /**\n * Parse ruleset.\n */\n function rules() {\n let node: CssRuleAST | CssAtRuleAST | void;\n const rules: Array<CssRuleAST | CssAtRuleAST> = [];\n whitespace();\n comments(rules);\n while (css.length && css.charAt(0) !== '}' && (node = atrule() || rule())) {\n if (node) {\n rules.push(node);\n comments(rules);\n }\n }\n return rules;\n }\n\n /**\n * Match `re` and return captures.\n */\n function match(re: RegExp) {\n const m = re.exec(css);\n if (!m) {\n return;\n }\n const str = m[0];\n updatePosition(str);\n css = css.slice(str.length);\n return m;\n }\n\n /**\n * Parse whitespace.\n */\n function whitespace() {\n match(/^\\s*/);\n }\n\n /**\n * Parse comments;\n */\n function comments<T1 extends CssCommonPositionAST>(\n rules?: Array<T1 | CssCommentAST>\n ) {\n let c;\n rules = rules || [];\n while ((c = comment())) {\n if (c) {\n rules.push(c);\n }\n }\n return rules;\n }\n\n /**\n * Parse comment.\n */\n function comment(): CssCommentAST | void {\n const pos = position();\n if ('/' !== css.charAt(0) || '*' !== css.charAt(1)) {\n return;\n }\n\n const m = match(/^\\/\\*[^]*?\\*\\//);\n if (!m) {\n return error('End of comment missing');\n }\n\n return pos<CssCommentAST>({\n type: CssTypes.comment,\n comment: m[0].slice(2, -2),\n });\n }\n\n function findClosingParenthese(\n str: string,\n start: number,\n depth: number\n ): number {\n let ptr = start + 1;\n let found = false;\n let closeParentheses = str.indexOf(')', ptr);\n while (!found && closeParentheses !== -1) {\n const nextParentheses = str.indexOf('(', ptr);\n if (nextParentheses !== -1 && nextParentheses < closeParentheses) {\n const nextSearch = findClosingParenthese(\n str,\n nextParentheses + 1,\n depth + 1\n );\n ptr = nextSearch + 1;\n closeParentheses = str.indexOf(')', ptr);\n } else {\n found = true;\n }\n }\n if (found && closeParentheses !== -1) {\n return closeParentheses;\n } else {\n return -1;\n }\n }\n\n /**\n * Parse selector.\n */\n function selector() {\n const m = match(/^([^{]+)/);\n if (!m) {\n return;\n }\n\n // remove comment in selector;\n let res = trim(m[0]).replace(commentre, '');\n\n // Optimisation: If there is no ',' no need to split or post-process (this is less costly)\n if (res.indexOf(',') === -1) {\n return [res];\n }\n\n // Replace all the , in the parentheses by \\u200C\n let ptr = 0;\n let startParentheses = res.indexOf('(', ptr);\n while (startParentheses !== -1) {\n const closeParentheses = findClosingParenthese(res, startParentheses, 0);\n if (closeParentheses === -1) {\n break;\n }\n ptr = closeParentheses + 1;\n res =\n res.substring(0, startParentheses) +\n res\n .substring(startParentheses, closeParentheses)\n .replace(/,/g, '\\u200C') +\n res.substring(closeParentheses);\n startParentheses = res.indexOf('(', ptr);\n }\n\n // Replace all the , in ' and \" by \\u200C\n res = res\n /**\n * replace ',' by \\u200C for data selector (div[data-lang=\"fr,de,us\"])\n *\n * Examples:\n * div[data-lang=\"fr,\\\"de,us\"]\n * div[data-lang='fr,\\'de,us']\n *\n * Regex logic:\n * (\"|')(?:\\\\\\1|.)*?\\1 => Handle the \" and '\n *\n * Optimization 1:\n * No greedy capture (see docs about the difference between .* and .*?)\n *\n * Optimization 2:\n * (\"|')(?:\\\\\\1|.)*?\\1 this use reference to capture group, it work faster.\n */\n .replace(/(\"|')(?:\\\\\\1|.)*?\\1/g, m => m.replace(/,/g, '\\u200C'));\n\n // Split all the left , and replace all the \\u200C by ,\n return (\n res\n // Split the selector by ','\n .split(',')\n // Replace back \\u200C by ','\n .map(s => {\n return trim(s.replace(/\\u200C/g, ','));\n })\n );\n }\n\n /**\n * Parse declaration.\n */\n function declaration(): CssDeclarationAST | void {\n const pos = position();\n\n // prop\n const propMatch = match(/^(\\*?[-#/*\\\\\\w]+(\\[[0-9a-z_-]+\\])?)\\s*/);\n if (!propMatch) {\n return;\n }\n const propValue = trim(propMatch[0]);\n\n // :\n if (!match(/^:\\s*/)) {\n return error(\"property missing ':'\");\n }\n\n // val\n const val = match(/^((?:'(?:\\\\'|.)*?'|\"(?:\\\\\"|.)*?\"|\\([^)]*?\\)|[^};])+)/);\n\n const ret = pos<CssDeclarationAST>({\n type: CssTypes.declaration,\n property: propValue.replace(commentre, ''),\n value: val ? trim(val[0]).replace(commentre, '') : '',\n });\n\n // ;\n match(/^[;\\s]*/);\n\n return ret;\n }\n\n /**\n * Parse declarations.\n */\n function declarations() {\n const decls: Array<CssDeclarationAST | CssCommentAST> = [];\n\n if (!open()) {\n return error(\"missing '{'\");\n }\n comments(decls);\n\n // declarations\n let decl;\n while ((decl = declaration())) {\n if (decl) {\n decls.push(decl);\n comments(decls);\n }\n }\n\n if (!close()) {\n return error(\"missing '}'\");\n }\n return decls;\n }\n\n /**\n * Parse keyframe.\n */\n function keyframe() {\n let m;\n const vals = [];\n const pos = position();\n\n while ((m = match(/^((\\d+\\.\\d+|\\.\\d+|\\d+)%?|[a-z]+)\\s*/))) {\n vals.push(m[1]);\n match(/^,\\s*/);\n }\n\n if (!vals.length) {\n return;\n }\n\n return pos<CssKeyframeAST>({\n type: CssTypes.keyframe,\n values: vals,\n declarations: declarations() || [],\n });\n }\n\n /**\n * Parse keyframes.\n */\n function atkeyframes(): CssKeyframesAST | void {\n const pos = position();\n const m1 = match(/^@([-\\w]+)?keyframes\\s*/);\n\n if (!m1) {\n return;\n }\n const vendor = m1[1];\n\n // identifier\n const m2 = match(/^([-\\w]+)\\s*/);\n if (!m2) {\n return error('@keyframes missing name');\n }\n const name = m2[1];\n\n if (!open()) {\n return error(\"@keyframes missing '{'\");\n }\n\n let frame;\n let frames: Array<CssKeyframeAST | CssCommentAST> = comments();\n while ((frame = keyframe())) {\n frames.push(frame);\n frames = frames.concat(comments());\n }\n\n if (!close()) {\n return error(\"@keyframes missing '}'\");\n }\n\n return pos<CssKeyframesAST>({\n type: CssTypes.keyframes,\n name: name,\n vendor: vendor,\n keyframes: frames,\n });\n }\n\n /**\n * Parse supports.\n */\n function atsupports(): CssSupportsAST | void {\n const pos = position();\n const m = match(/^@supports *([^{]+)/);\n\n if (!m) {\n return;\n }\n const supports = trim(m[1]);\n\n if (!open()) {\n return error(\"@supports missing '{'\");\n }\n\n const style = comments<CssAtRuleAST>().concat(rules());\n\n if (!close()) {\n return error(\"@supports missing '}'\");\n }\n\n return pos<CssSupportsAST>({\n type: CssTypes.supports,\n supports: supports,\n rules: style,\n });\n }\n\n /**\n * Parse host.\n */\n function athost() {\n const pos = position();\n const m = match(/^@host\\s*/);\n\n if (!m) {\n return;\n }\n\n if (!open()) {\n return error(\"@host missing '{'\");\n }\n\n const style = comments<CssAtRuleAST>().concat(rules());\n\n if (!close()) {\n return error(\"@host missing '}'\");\n }\n\n return pos<CssHostAST>({\n type: CssTypes.host,\n rules: style,\n });\n }\n\n /**\n * Parse container.\n */\n function atcontainer(): CssContainerAST | void {\n const pos = position();\n const m = match(/^@container *([^{]+)/);\n\n if (!m) {\n return;\n }\n const container = trim(m[1]);\n\n if (!open()) {\n return error(\"@container missing '{'\");\n }\n\n const style = comments<CssAtRuleAST>().concat(rules());\n\n if (!close()) {\n return error(\"@container missing '}'\");\n }\n\n return pos<CssContainerAST>({\n type: CssTypes.container,\n container: container,\n rules: style,\n });\n }\n\n /**\n * Parse container.\n */\n function atlayer(): CssLayerAST | void {\n const pos = position();\n const m = match(/^@layer *([^{;@]+)/);\n\n if (!m) {\n return;\n }\n const layer = trim(m[1]);\n\n if (!open()) {\n match(/^[;\\s]*/);\n return pos<CssLayerAST>({\n type: CssTypes.layer,\n layer: layer,\n });\n }\n\n const style = comments<CssAtRuleAST>().concat(rules());\n\n if (!close()) {\n return error(\"@layer missing '}'\");\n }\n\n return pos<CssLayerAST>({\n type: CssTypes.layer,\n layer: layer,\n rules: style,\n });\n }\n\n /**\n * Parse media.\n */\n function atmedia(): CssMediaAST | void {\n const pos = position();\n const m = match(/^@media *([^{]+)/);\n\n if (!m) {\n return;\n }\n const media = trim(m[1]);\n\n if (!open()) {\n return error(\"@media missing '{'\");\n }\n\n const style = comments<CssAtRuleAST>().concat(rules());\n\n if (!close()) {\n return error(\"@media missing '}'\");\n }\n\n return pos<CssMediaAST>({\n type: CssTypes.media,\n media: media,\n rules: style,\n });\n }\n\n /**\n * Parse custom-media.\n */\n function atcustommedia(): CssCustomMediaAST | void {\n const pos = position();\n const m = match(/^@custom-media\\s+(--\\S+)\\s*([^{;\\s][^{;]*);/);\n if (!m) {\n return;\n }\n\n return pos<CssCustomMediaAST>({\n type: CssTypes.customMedia,\n name: trim(m[1]),\n media: trim(m[2]),\n });\n }\n\n /**\n * Parse paged media.\n */\n function atpage(): CssPageAST | void {\n const pos = position();\n const m = match(/^@page */);\n if (!m) {\n return;\n }\n\n const sel = selector() || [];\n\n if (!open()) {\n return error(\"@page missing '{'\");\n }\n let decls = comments<CssDeclarationAST>();\n\n // declarations\n let decl;\n while ((decl = declaration())) {\n decls.push(decl);\n decls = decls.concat(comments());\n }\n\n if (!close()) {\n return error(\"@page missing '}'\");\n }\n\n return pos<CssPageAST>({\n type: CssTypes.page,\n selectors: sel,\n declarations: decls,\n });\n }\n\n /**\n * Parse document.\n */\n function atdocument(): CssDocumentAST | void {\n const pos = position();\n const m = match(/^@([-\\w]+)?document *([^{]+)/);\n if (!m) {\n return;\n }\n\n const vendor = trim(m[1]);\n const doc = trim(m[2]);\n\n if (!open()) {\n return error(\"@document missing '{'\");\n }\n\n const style = comments<CssAtRuleAST>().concat(rules());\n\n if (!close()) {\n return error(\"@document missing '}'\");\n }\n\n return pos<CssDocumentAST>({\n type: CssTypes.document,\n document: doc,\n vendor: vendor,\n rules: style,\n });\n }\n\n /**\n * Parse font-face.\n */\n function atfontface(): CssFontFaceAST | void {\n const pos = position();\n const m = match(/^@font-face\\s*/);\n if (!m) {\n return;\n }\n\n if (!open()) {\n return error(\"@font-face missing '{'\");\n }\n let decls = comments<CssDeclarationAST>();\n\n // declarations\n let decl;\n while ((decl = declaration())) {\n decls.push(decl);\n decls = decls.concat(comments());\n }\n\n if (!close()) {\n return error(\"@font-face missing '}'\");\n }\n\n return pos<CssFontFaceAST>({\n type: CssTypes.fontFace,\n declarations: decls,\n });\n }\n\n /**\n * Parse import\n */\n const atimport = _compileAtrule<CssImportAST>('import');\n\n /**\n * Parse charset\n */\n const atcharset = _compileAtrule<CssCharsetAST>('charset');\n\n /**\n * Parse namespace\n */\n const atnamespace = _compileAtrule<CssNamespaceAST>('namespace');\n\n /**\n * Parse non-block at-rules\n */\n function _compileAtrule<T1 extends CssCommonPositionAST>(\n name: string\n ): () => T1 | void {\n const re = new RegExp(\n '^@' +\n name +\n '\\\\s*((?::?[^;\\'\"]|\"(?:\\\\\\\\\"|[^\"])*?\"|\\'(?:\\\\\\\\\\'|[^\\'])*?\\')+)(?:;|$)'\n );\n\n // ^@import\\s*([^;\"']|(\"|')(?:\\\\\\2|.)*?\\2)+(;|$)\n\n return function (): T1 | void {\n const pos = position();\n const m = match(re);\n if (!m) {\n return;\n }\n const ret: Record<string, string> = {type: name};\n ret[name] = m[1].trim();\n return pos<T1>(ret as unknown as T1) as T1;\n };\n }\n\n /**\n * Parse at rule.\n */\n function atrule(): CssAtRuleAST | void {\n if (css[0] !== '@') {\n return;\n }\n\n return (\n atkeyframes() ||\n atmedia() ||\n atcustommedia() ||\n atsupports() ||\n atimport() ||\n atcharset() ||\n atnamespace() ||\n atdocument() ||\n atpage() ||\n athost() ||\n atfontface() ||\n atcontainer() ||\n atlayer()\n );\n }\n\n /**\n * Parse rule.\n */\n function rule() {\n const pos = position();\n const sel = selector();\n\n if (!sel) {\n return error('selector missing');\n }\n comments();\n\n return pos<CssRuleAST>({\n type: CssTypes.rule,\n selectors: sel,\n declarations: declarations() || [],\n });\n }\n\n return addParent(stylesheet());\n};\n\n/**\n * Trim `str`.\n */\nfunction trim(str: string) {\n return str ? str.trim() : '';\n}\n\n/**\n * Adds non-enumerable parent node reference to each node.\n */\nfunction addParent<T1 extends {type?: string}>(obj: T1, parent?: unknown): T1 {\n const isNode = obj && typeof obj.type === 'string';\n const childParent = isNode ? obj : parent;\n\n for (const k in obj) {\n const value = obj[k];\n if (Array.isArray(value)) {\n value.forEach(v => {\n addParent(v, childParent);\n });\n } else if (value && typeof value === 'object') {\n addParent(value, childParent);\n }\n }\n\n if (isNode) {\n Object.defineProperty(obj, 'parent', {\n configurable: true,\n writable: true,\n enumerable: false,\n value: parent || null,\n });\n }\n\n return obj;\n}\n\nexport default parse;\n","export default class CssParseError extends Error {\n readonly reason: string;\n readonly filename?: string;\n readonly line: number;\n readonly column: number;\n readonly source: string;\n\n constructor(\n filename: string,\n msg: string,\n lineno: number,\n column: number,\n css: string\n ) {\n super(filename + ':' + lineno + ':' + column + ': ' + msg);\n this.reason = msg;\n this.filename = filename;\n this.line = lineno;\n this.column = column;\n this.source = css;\n }\n}\n","/**\n * Store position information for a node\n */\nexport default class Position {\n start: {line: number; column: number};\n end: {line: number; column: number};\n source?: string;\n\n constructor(\n start: {line: number; column: number},\n end: {line: number; column: number},\n source: string\n ) {\n this.start = start;\n this.end = end;\n this.source = source;\n }\n}\n","import CssParseError from './CssParseError';\nimport Position from './CssPosition';\n\nexport enum CssTypes {\n stylesheet = 'stylesheet',\n rule = 'rule',\n declaration = 'declaration',\n comment = 'comment',\n container = 'container',\n charset = 'charset',\n document = 'document',\n customMedia = 'custom-media',\n fontFace = 'font-face',\n host = 'host',\n import = 'import',\n keyframes = 'keyframes',\n keyframe = 'keyframe',\n layer = 'layer',\n media = 'media',\n namespace = 'namespace',\n page = 'page',\n supports = 'supports',\n}\n\nexport type CssCommonAST = {\n type: CssTypes;\n};\n\nexport type CssCommonPositionAST = CssCommonAST & {\n position?: Position;\n parent?: unknown;\n};\n\nexport type CssStylesheetAST = CssCommonAST & {\n type: CssTypes.stylesheet;\n stylesheet: {\n source?: string;\n rules: Array<CssAtRuleAST>;\n parsingErrors?: Array<CssParseError>;\n };\n};\n\nexport type CssRuleAST = CssCommonPositionAST & {\n type: CssTypes.rule;\n selectors: Array<string>;\n declarations: Array<CssDeclarationAST | CssCommentAST>;\n};\n\nexport type CssDeclarationAST = CssCommonPositionAST & {\n type: CssTypes.declaration;\n property: string;\n value: string;\n};\n\nexport type CssCommentAST = CssCommonPositionAST & {\n type: CssTypes.comment;\n comment: string;\n};\nexport type CssContainerAST = CssCommonPositionAST & {\n type: CssTypes.container;\n container: string;\n rules: Array<CssAtRuleAST>;\n};\n\nexport type CssCharsetAST = CssCommonPositionAST & {\n type: CssTypes.charset;\n charset: string;\n};\nexport type CssCustomMediaAST = CssCommonPositionAST & {\n type: CssTypes.customMedia;\n name: string;\n media: string;\n};\nexport type CssDocumentAST = CssCommonPositionAST & {\n type: CssTypes.document;\n document: string;\n vendor?: string;\n rules: Array<CssAtRuleAST>;\n};\nexport type CssFontFaceAST = CssCommonPositionAST & {\n type: CssTypes.fontFace;\n declarations: Array<CssDeclarationAST | CssCommentAST>;\n};\nexport type CssHostAST = CssCommonPositionAST & {\n type: CssTypes.host;\n rules: Array<CssAtRuleAST>;\n};\nexport type CssImportAST = CssCommonPositionAST & {\n type: CssTypes.import;\n import: string;\n};\nexport type CssKeyframesAST = CssCommonPositionAST & {\n type: CssTypes.keyframes;\n name: string;\n vendor?: string;\n keyframes: Array<CssKeyframeAST | CssCommentAST>;\n};\nexport type CssKeyframeAST = CssCommonPositionAST & {\n type: CssTypes.keyframe;\n values: Array<string>;\n declarations: Array<CssDeclarationAST | CssCommentAST>;\n};\nexport type CssLayerAST = CssCommonPositionAST & {\n type: CssTypes.layer;\n layer: string;\n rules?: Array<CssAtRuleAST>;\n};\nexport type CssMediaAST = CssCommonPositionAST & {\n type: CssTypes.media;\n media: string;\n rules: Array<CssAtRuleAST>;\n};\nexport type CssNamespaceAST = CssCommonPositionAST & {\n type: CssTypes.namespace;\n namespace: string;\n};\nexport type CssPageAST = CssCommonPositionAST & {\n type: CssTypes.page;\n selectors: Array<string>;\n declarations: Array<CssDeclarationAST | CssCommentAST>;\n};\nexport type CssSupportsAST = CssCommonPositionAST & {\n type: CssTypes.supports;\n supports: string;\n rules: Array<CssAtRuleAST>;\n};\n\nexport type CssAtRuleAST =\n | CssRuleAST\n | CssCommentAST\n | CssContainerAST\n | CssCharsetAST\n | CssCustomMediaAST\n | CssDocumentAST\n | CssFontFaceAST\n | CssHostAST\n | CssImportAST\n | CssKeyframesAST\n | CssLayerAST\n | CssMediaAST\n | CssNamespaceAST\n | CssPageAST\n | CssSupportsAST;\n\nexport type CssAllNodesAST =\n | CssAtRuleAST\n | CssStylesheetAST\n | CssDeclarationAST\n | CssKeyframeAST;\n","import {CssStylesheetAST} from '../type';\nimport Compiler from './compiler';\n\nexport default (\n node: CssStylesheetAST,\n options?: ConstructorParameters<typeof Compiler>[0]\n) => {\n const compiler = new Compiler(options || {});\n return compiler.compile(node);\n};\n","import {\n CssAllNodesAST,\n CssCharsetAST,\n CssCommentAST,\n CssCommonPositionAST,\n CssContainerAST,\n CssCustomMediaAST,\n CssDeclarationAST,\n CssDocumentAST,\n CssFontFaceAST,\n CssHostAST,\n CssImportAST,\n CssKeyframeAST,\n CssKeyframesAST,\n CssLayerAST,\n CssMediaAST,\n CssNamespaceAST,\n CssPageAST,\n CssRuleAST,\n CssStylesheetAST,\n CssSupportsAST,\n CssTypes,\n} from '../type';\n\nclass Compiler {\n level = 0;\n indentation = ' ';\n compress = false;\n\n constructor(options?: {indent?: string; compress?: boolean}) {\n if (typeof options?.indent === 'string') {\n this.indentation = options?.indent;\n }\n if (options?.compress) {\n this.compress = true;\n }\n }\n\n // We disable no-unused-vars for _position. We keep position for potential reintroduction of source-map\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n emit(str: string, _position?: CssCommonPositionAST['position']) {\n return str;\n }\n\n /**\n * Increase, decrease or return current indentation.\n */\n indent(level?: number) {\n this.level = this.level || 1;\n\n if (level) {\n this.level += level;\n return '';\n }\n\n return Array(this.level).join(this.indentation);\n }\n\n visit(node: CssAllNodesAST): string {\n switch (node.type) {\n case CssTypes.stylesheet:\n return this.stylesheet(node);\n case CssTypes.rule:\n return this.rule(node);\n case CssTypes.declaration:\n return this.declaration(node);\n case CssTypes.comment:\n return this.comment(node);\n case CssTypes.container:\n return this.container(node);\n case CssTypes.charset:\n return this.charset(node);\n case CssTypes.document:\n return this.document(node);\n case CssTypes.customMedia:\n return this.customMedia(node);\n case CssTypes.fontFace:\n return this.fontFace(node);\n case CssTypes.host:\n return this.host(node);\n case CssTypes.import:\n return this.import(node);\n case CssTypes.keyframes:\n return this.keyframes(node);\n case CssTypes.keyframe:\n return this.keyframe(node);\n case CssTypes.layer:\n return this.layer(node);\n case CssTypes.media:\n return this.media(node);\n case CssTypes.namespace:\n return this.namespace(node);\n case CssTypes.page:\n return this.page(node);\n case CssTypes.supports:\n return this.supports(node);\n }\n }\n\n mapVisit(nodes: Array<CssAllNodesAST>, delim?: string) {\n let buf = '';\n delim = delim || '';\n\n for (let i = 0, length = nodes.length; i < length; i++) {\n buf += this.visit(nodes[i]);\n if (delim && i < length - 1) {\n buf += this.emit(delim);\n }\n }\n\n return buf;\n }\n\n compile(node: CssStylesheetAST) {\n if (this.compress) {\n return node.stylesheet.rules.map(this.visit, this).join('');\n }\n\n return this.stylesheet(node);\n }\n\n /**\n * Visit stylesheet node.\n */\n stylesheet(node: CssStylesheetAST) {\n return this.mapVisit(node.stylesheet.rules, '\\n\\n');\n }\n\n /**\n * Visit comment node.\n */\n comment(node: CssCommentAST) {\n if (this.compress) {\n return this.emit('', node.position);\n }\n return this.emit(this.indent() + '/*' + node.comment + '*/', node.position);\n }\n\n /**\n * Visit container node.\n */\n container(node: CssContainerAST) {\n if (this.compress) {\n return (\n this.emit('@container ' + node.container, node.position) +\n this.emit('{') +\n this.mapVisit(node.rules) +\n this.emit('}')\n );\n }\n return (\n this.emit(this.indent() + '@container ' + node.container, node.position) +\n this.emit(' {\\n' + this.indent(1)) +\n this.mapVisit(node.rules, '\\n\\n') +\n this.emit('\\n' + this.indent(-1) + this.indent() + '}')\n );\n }\n\n /**\n * Visit container node.\n */\n layer(node: CssLayerAST) {\n if (this.compress) {\n return (\n this.emit('@layer ' + node.layer, node.position) +\n (node.rules\n ? this.emit('{') +\n this.mapVisit(<CssAllNodesAST[]>node.rules) +\n this.emit('}')\n : ';')\n );\n }\n return (\n this.emit(this.indent() + '@layer ' + node.layer, node.position) +\n (node.rules\n ? this.emit(' {\\n' + this.indent(1)) +\n this.mapVisit(<CssAllNodesAST[]>node.rules, '\\n\\n') +\n this.emit('\\n' + this.indent(-1) + this.indent() + '}')\n : ';')\n );\n }\n\n /**\n * Visit import node.\n */\n import(node: CssImportAST) {\n return this.emit('@import ' + node.import + ';', node.position);\n }\n\n /**\n * Visit media node.\n */\n media(node: CssMediaAST) {\n if (this.compress) {\n return (\n this.emit('@media ' + node.media, node.position) +\n this.emit('{') +\n this.mapVisit(node.rules) +\n this.emit('}')\n );\n }\n return (\n this.emit(this.indent() + '@media ' + node.media, node.position) +\n this.emit(' {\\n' + this.indent(1)) +\n this.mapVisit(node.rules, '\\n\\n') +\n this.emit('\\n' + this.indent(-1) + this.indent() + '}')\n );\n }\n\n /**\n * Visit document node.\n */\n document(node: CssDocumentAST) {\n const doc = '@' + (node.vendor || '') + 'document ' + node.document;\n if (this.compress) {\n return (\n this.emit(doc, node.position) +\n this.emit('{') +\n this.mapVisit(node.rules) +\n this.emit('}')\n );\n }\n return (\n this.emit(doc, node.position) +\n this.emit(' ' + ' {\\n' + this.indent(1)) +\n this.mapVisit(node.rules, '\\n\\n') +\n this.emit(this.indent(-1) + '\\n}')\n );\n }\n\n /**\n * Visit charset node.\n */\n charset(node: CssCharsetAST) {\n return this.emit('@charset ' + node.charset + ';', node.position);\n }\n\n /**\n * Visit namespace node.\n */\n namespace(node: CssNamespaceAST) {\n return this.emit('@namespace ' + node.namespace + ';', node.position);\n }\n\n /**\n * Visit supports node.\n */\n supports(node: CssSupportsAST) {\n if (this.compress) {\n return (\n this.emit('@supports ' + node.supports, node.position) +\n this.emit('{') +\n this.mapVisit(node.rules) +\n this.emit('}')\n );\n }\n return (\n this.emit(this.indent() + '@supports ' + node.supports, node.position) +\n this.emit(' {\\n' + this.indent(1)) +\n this.mapVisit(node.rules, '\\n\\n') +\n this.emit('\\n' + this.indent(-1) + this.indent() + '}')\n );\n }\n\n /**\n * Visit keyframes node.\n */\n keyframes(node: CssKeyframesAST) {\n if (this.compress) {\n return (\n this.emit(\n '@' + (node.vendor || '') + 'keyframes ' + node.name,\n node.position\n ) +\n this.emit('{') +\n this.mapVisit(node.keyframes) +\n this.emit('}')\n );\n }\n return (\n this.emit(\n '@' + (node.vendor || '') + 'keyframes ' + node.name,\n node.position\n ) +\n this.emit(' {\\n' + this.indent(1)) +\n this.mapVisit(node.keyframes, '\\n') +\n this.emit(this.indent(-1) + '}')\n );\n }\n\n /**\n * Visit keyframe node.\n */\n keyframe(node: CssKeyframeAST) {\n const decls = node.declarations;\n if (this.compress) {\n return (\n this.emit(node.values.join(','), node.position) +\n this.emit('{') +\n this.mapVisit(decls) +\n this.emit('}')\n );\n }\n\n return (\n this.emit(this.indent()) +\n this.emit(node.values.join(', '), node.position) +\n this.emit(' {\\n' + this.indent(1)) +\n this.mapVisit(decls, '\\n') +\n this.emit(this.indent(-1) + '\\n' + this.indent() + '}\\n')\n );\n }\n\n /**\n * Visit page node.\n */\n page(node: CssPageAST) {\n if (this.compress) {\n const sel = node.selectors.length ? node.selectors.join(', ') : '';\n\n return (\n this.emit('@page ' + sel, node.position) +\n this.emit('{') +\n this.mapVisit(node.declarations) +\n this.emit('}')\n );\n }\n const sel = node.selectors.length ? node.selectors.join(', ') + ' ' : '';\n\n return (\n this.emit('@page ' + sel, node.position) +\n this.emit('{\\n') +\n this.emit(this.indent(1)) +\n this.mapVisit(node.declarations, '\\n') +\n this.emit(this.indent(-1)) +\n this.emit('\\n}')\n );\n }\n\n /**\n * Visit font-face node.\n */\n fontFace(node: CssFontFaceAST) {\n if (this.compress) {\n return (\n this.emit('@font-face', node.position) +\n this.emit('{') +\n this.mapVisit(node.declarations) +\n this.emit('}')\n );\n }\n return (\n this.emit('@font-face ', node.position) +\n this.emit('{\\n') +\n this.emit(this.indent(1)) +\n this.mapVisit(node.declarations, '\\n') +\n this.emit(this.indent(-1)) +\n this.emit('\\n}')\n );\n }\n\n /**\n * Visit host node.\n */\n host(node: CssHostAST) {\n if (this.compress) {\n return (\n this.emit('@host', node.position) +\n this.emit('{') +\n this.mapVisit(node.rules) +\n this.emit('}')\n );\n }\n return (\n this.emit('@host', node.position) +\n this.emit(' {\\n' + this.indent(1)) +\n this.mapVisit(node.rules, '\\n\\n') +\n this.emit(this.indent(-1) + '\\n}')\n );\n }\n\n /**\n * Visit custom-media node.\n */\n customMedia(node: CssCustomMediaAST) {\n return this.emit(\n '@custom-media ' + node.name + ' ' + node.media + ';',\n node.position\n );\n }\n\n /**\n * Visit rule node.\n */\n rule(node: CssRuleAST) {\n const decls = node.declarations;\n if (!decls.length) {\n return '';\n }\n\n if (this.compress) {\n return (\n this.emit(node.selectors.join(','), node.position) +\n this.emit('{') +\n this.mapVisit(decls) +\n this.emit('}')\n );\n }\n const indent = this.indent();\n\n return (\n this.emit(\n node.selectors\n .map(s => {\n return indent + s;\n })\n .join(',\\n'),\n node.position\n ) +\n this.emit(' {\\n') +\n this.emit(this.indent(1)) +\n this.mapVisit(decls, '\\n') +\n this.emit(this.indent(-1)) +\n this.emit('\\n' + this.indent() + '}')\n );\n }\n\n /**\n * Visit declaration node.\n */\n declaration(node: CssDeclarationAST) {\n if (this.compress) {\n return (\n this.emit(node.property + ':' + node.value, node.position) +\n this.emit(';')\n );\n }\n return (\n this.emit(this.indent()) +\n this.emit(node.property + ': ' + node.value, node.position) +\n this.emit(';')\n );\n }\n}\n\nexport default Compiler;\n"],"names":[],"version":3,"file":"index.mjs.map"} | ||
| 1 | \ No newline at end of file | \ No newline at end of file | |
| @@ -1,765 +0,0 @@ | |||
| 1 | |||
| 2 | function $parcel$defineInteropFlag(a) { | ||
| 3 | Object.defineProperty(a, '__esModule', {value: true, configurable: true}); | ||
| 4 | } | ||
| 5 | |||
| 6 | function $parcel$export(e, n, v, s) { | ||
| 7 | Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true}); | ||
| 8 | } | ||
| 9 | var $009ddb00d3ec72b8$exports = {}; | ||
| 10 | |||
| 11 | $parcel$defineInteropFlag($009ddb00d3ec72b8$exports); | ||
| 12 | |||
| 13 | $parcel$export($009ddb00d3ec72b8$exports, "default", () => $009ddb00d3ec72b8$export$2e2bcd8739ae039); | ||
| 14 | class $009ddb00d3ec72b8$export$2e2bcd8739ae039 extends Error { | ||
| 15 | constructor(filename, msg, lineno, column, css){ | ||
| 16 | super(filename + ":" + lineno + ":" + column + ": " + msg); | ||
| 17 | this.reason = msg; | ||
| 18 | this.filename = filename; | ||
| 19 | this.line = lineno; | ||
| 20 | this.column = column; | ||
| 21 | this.source = css; | ||
| 22 | } | ||
| 23 | } | ||
| 24 | |||
| 25 | |||
| 26 | var $0865a9fb4cc365fe$exports = {}; | ||
| 27 | |||
| 28 | $parcel$defineInteropFlag($0865a9fb4cc365fe$exports); | ||
| 29 | |||
| 30 | $parcel$export($0865a9fb4cc365fe$exports, "default", () => $0865a9fb4cc365fe$export$2e2bcd8739ae039); | ||
| 31 | /** | ||
| 32 | * Store position information for a node | ||
| 33 | */ class $0865a9fb4cc365fe$export$2e2bcd8739ae039 { | ||
| 34 | constructor(start, end, source){ | ||
| 35 | this.start = start; | ||
| 36 | this.end = end; | ||
| 37 | this.source = source; | ||
| 38 | } | ||
| 39 | } | ||
| 40 | |||
| 41 | |||
| 42 | var $b2e137848b48cf4f$exports = {}; | ||
| 43 | |||
| 44 | $parcel$export($b2e137848b48cf4f$exports, "CssTypes", () => $b2e137848b48cf4f$export$9be5dd6e61d5d73a); | ||
| 45 | var $b2e137848b48cf4f$export$9be5dd6e61d5d73a; | ||
| 46 | (function(CssTypes) { | ||
| 47 | CssTypes["stylesheet"] = "stylesheet"; | ||
| 48 | CssTypes["rule"] = "rule"; | ||
| 49 | CssTypes["declaration"] = "declaration"; | ||
| 50 | CssTypes["comment"] = "comment"; | ||
| 51 | CssTypes["container"] = "container"; | ||
| 52 | CssTypes["charset"] = "charset"; | ||
| 53 | CssTypes["document"] = "document"; | ||
| 54 | CssTypes["customMedia"] = "custom-media"; | ||
| 55 | CssTypes["fontFace"] = "font-face"; | ||
| 56 | CssTypes["host"] = "host"; | ||
| 57 | CssTypes["import"] = "import"; | ||
| 58 | CssTypes["keyframes"] = "keyframes"; | ||
| 59 | CssTypes["keyframe"] = "keyframe"; | ||
| 60 | CssTypes["layer"] = "layer"; | ||
| 61 | CssTypes["media"] = "media"; | ||
| 62 | CssTypes["namespace"] = "namespace"; | ||
| 63 | CssTypes["page"] = "page"; | ||
| 64 | CssTypes["supports"] = "supports"; | ||
| 65 | })($b2e137848b48cf4f$export$9be5dd6e61d5d73a || ($b2e137848b48cf4f$export$9be5dd6e61d5d73a = {})); | ||
| 66 | |||
| 67 | |||
| 68 | // http://www.w3.org/TR/CSS21/grammar.html | ||
| 69 | // https://github.com/visionmedia/css-parse/pull/49#issuecomment-30088027 | ||
| 70 | // New rule => https://www.w3.org/TR/CSS22/syndata.html#comments | ||
| 71 | // [^] is equivalent to [.\n\r] | ||
| 72 | const $d708735ed1303b43$var$commentre = /\/\*[^]*?(?:\*\/|$)/g; | ||
| 73 | const $d708735ed1303b43$export$98e6a39c04603d36 = (css, options)=>{ | ||
| 74 | options = options || {}; | ||
| 75 | /** | ||
| 76 | * Positional. | ||
| 77 | */ let lineno = 1; | ||
| 78 | let column = 1; | ||
| 79 | /** | ||
| 80 | * Update lineno and column based on `str`. | ||
| 81 | */ function updatePosition(str) { | ||
| 82 | const lines = str.match(/\n/g); | ||
| 83 | if (lines) lineno += lines.length; | ||
| 84 | const i = str.lastIndexOf("\n"); | ||
| 85 | column = ~i ? str.length - i : column + str.length; | ||
| 86 | } | ||
| 87 | /** | ||
| 88 | * Mark position and patch `node.position`. | ||
| 89 | */ function position() { | ||
| 90 | const start = { | ||
| 91 | line: lineno, | ||
| 92 | column: column | ||
| 93 | }; | ||
| 94 | return function(node) { | ||
| 95 | node.position = new (0, $0865a9fb4cc365fe$export$2e2bcd8739ae039)(start, { | ||
| 96 | line: lineno, | ||
| 97 | column: column | ||
| 98 | }, options?.source || ""); | ||
| 99 | whitespace(); | ||
| 100 | return node; | ||
| 101 | }; | ||
| 102 | } | ||
| 103 | /** | ||
| 104 | * Error `msg`. | ||
| 105 | */ const errorsList = []; | ||
| 106 | function error(msg) { | ||
| 107 | const err = new (0, $009ddb00d3ec72b8$export$2e2bcd8739ae039)(options?.source || "", msg, lineno, column, css); | ||
| 108 | if (options?.silent) errorsList.push(err); | ||
| 109 | else throw err; | ||
| 110 | } | ||
| 111 | /** | ||
| 112 | * Parse stylesheet. | ||
| 113 | */ function stylesheet() { | ||
| 114 | const rulesList = rules(); | ||
| 115 | const result = { | ||
| 116 | type: (0, $b2e137848b48cf4f$export$9be5dd6e61d5d73a).stylesheet, | ||
| 117 | stylesheet: { | ||
| 118 | source: options?.source, | ||
| 119 | rules: rulesList, | ||
| 120 | parsingErrors: errorsList | ||
| 121 | } | ||
| 122 | }; | ||
| 123 | return result; | ||
| 124 | } | ||
| 125 | /** | ||
| 126 | * Opening brace. | ||
| 127 | */ function open() { | ||
| 128 | return match(/^{\s*/); | ||
| 129 | } | ||
| 130 | /** | ||
| 131 | * Closing brace. | ||
| 132 | */ function close() { | ||
| 133 | return match(/^}/); | ||
| 134 | } | ||
| 135 | /** | ||
| 136 | * Parse ruleset. | ||
| 137 | */ function rules() { | ||
| 138 | let node; | ||
| 139 | const rules = []; | ||
| 140 | whitespace(); | ||
| 141 | comments(rules); | ||
| 142 | while(css.length && css.charAt(0) !== "}" && (node = atrule() || rule()))if (node) { | ||
| 143 | rules.push(node); | ||
| 144 | comments(rules); | ||
| 145 | } | ||
| 146 | return rules; | ||
| 147 | } | ||
| 148 | /** | ||
| 149 | * Match `re` and return captures. | ||
| 150 | */ function match(re) { | ||
| 151 | const m = re.exec(css); | ||
| 152 | if (!m) return; | ||
| 153 | const str = m[0]; | ||
| 154 | updatePosition(str); | ||
| 155 | css = css.slice(str.length); | ||
| 156 | return m; | ||
| 157 | } | ||
| 158 | /** | ||
| 159 | * Parse whitespace. | ||
| 160 | */ function whitespace() { | ||
| 161 | match(/^\s*/); | ||
| 162 | } | ||
| 163 | /** | ||
| 164 | * Parse comments; | ||
| 165 | */ function comments(rules) { | ||
| 166 | let c; | ||
| 167 | rules = rules || []; | ||
| 168 | while(c = comment())if (c) rules.push(c); | ||
| 169 | return rules; | ||
| 170 | } | ||
| 171 | /** | ||
| 172 | * Parse comment. | ||
| 173 | */ function comment() { | ||
| 174 | const pos = position(); | ||
| 175 | if ("/" !== css.charAt(0) || "*" !== css.charAt(1)) return; | ||
| 176 | const m = match(/^\/\*[^]*?\*\//); | ||
| 177 | if (!m) return error("End of comment missing"); | ||
| 178 | return pos({ | ||
| 179 | type: (0, $b2e137848b48cf4f$export$9be5dd6e61d5d73a).comment, | ||
| 180 | comment: m[0].slice(2, -2) | ||
| 181 | }); | ||
| 182 | } | ||
| 183 | function findClosingParenthese(str, start, depth) { | ||
| 184 | let ptr = start + 1; | ||
| 185 | let found = false; | ||
| 186 | let closeParentheses = str.indexOf(")", ptr); | ||
| 187 | while(!found && closeParentheses !== -1){ | ||
| 188 | const nextParentheses = str.indexOf("(", ptr); | ||
| 189 | if (nextParentheses !== -1 && nextParentheses < closeParentheses) { | ||
| 190 | const nextSearch = findClosingParenthese(str, nextParentheses + 1, depth + 1); | ||
| 191 | ptr = nextSearch + 1; | ||
| 192 | closeParentheses = str.indexOf(")", ptr); | ||
| 193 | } else found = true; | ||
| 194 | } | ||
| 195 | if (found && closeParentheses !== -1) return closeParentheses; | ||
| 196 | else return -1; | ||
| 197 | } | ||
| 198 | /** | ||
| 199 | * Parse selector. | ||
| 200 | */ function selector() { | ||
| 201 | const m = match(/^([^{]+)/); | ||
| 202 | if (!m) return; | ||
| 203 | // remove comment in selector; | ||
| 204 | let res = $d708735ed1303b43$var$trim(m[0]).replace($d708735ed1303b43$var$commentre, ""); | ||
| 205 | // Optimisation: If there is no ',' no need to split or post-process (this is less costly) | ||
| 206 | if (res.indexOf(",") === -1) return [ | ||
| 207 | res | ||
| 208 | ]; | ||
| 209 | // Replace all the , in the parentheses by \u200C | ||
| 210 | let ptr = 0; | ||
| 211 | let startParentheses = res.indexOf("(", ptr); | ||
| 212 | while(startParentheses !== -1){ | ||
| 213 | const closeParentheses = findClosingParenthese(res, startParentheses, 0); | ||
| 214 | if (closeParentheses === -1) break; | ||
| 215 | ptr = closeParentheses + 1; | ||
| 216 | res = res.substring(0, startParentheses) + res.substring(startParentheses, closeParentheses).replace(/,/g, "\u200C") + res.substring(closeParentheses); | ||
| 217 | startParentheses = res.indexOf("(", ptr); | ||
| 218 | } | ||
| 219 | // Replace all the , in ' and " by \u200C | ||
| 220 | res = res/** | ||
| 221 | * replace ',' by \u200C for data selector (div[data-lang="fr,de,us"]) | ||
| 222 | * | ||
| 223 | * Examples: | ||
| 224 | * div[data-lang="fr,\"de,us"] | ||
| 225 | * div[data-lang='fr,\'de,us'] | ||
| 226 | * | ||
| 227 | * Regex logic: | ||
| 228 | * ("|')(?:\\\1|.)*?\1 => Handle the " and ' | ||
| 229 | * | ||
| 230 | * Optimization 1: | ||
| 231 | * No greedy capture (see docs about the difference between .* and .*?) | ||
| 232 | * | ||
| 233 | * Optimization 2: | ||
| 234 | * ("|')(?:\\\1|.)*?\1 this use reference to capture group, it work faster. | ||
| 235 | */ .replace(/("|')(?:\\\1|.)*?\1/g, (m)=>m.replace(/,/g, "\u200C")); | ||
| 236 | // Split all the left , and replace all the \u200C by , | ||
| 237 | return res// Split the selector by ',' | ||
| 238 | .split(",")// Replace back \u200C by ',' | ||
| 239 | .map((s)=>{ | ||
| 240 | return $d708735ed1303b43$var$trim(s.replace(/\u200C/g, ",")); | ||
| 241 | }); | ||
| 242 | } | ||
| 243 | /** | ||
| 244 | * Parse declaration. | ||
| 245 | */ function declaration() { | ||
| 246 | const pos = position(); | ||
| 247 | // prop | ||
| 248 | const propMatch = match(/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/); | ||
| 249 | if (!propMatch) return; | ||
| 250 | const propValue = $d708735ed1303b43$var$trim(propMatch[0]); | ||
| 251 | // : | ||
| 252 | if (!match(/^:\s*/)) return error("property missing ':'"); | ||
| 253 | // val | ||
| 254 | const val = match(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/); | ||
| 255 | const ret = pos({ | ||
| 256 | type: (0, $b2e137848b48cf4f$export$9be5dd6e61d5d73a).declaration, | ||
| 257 | property: propValue.replace($d708735ed1303b43$var$commentre, ""), | ||
| 258 | value: val ? $d708735ed1303b43$var$trim(val[0]).replace($d708735ed1303b43$var$commentre, "") : "" | ||
| 259 | }); | ||
| 260 | // ; | ||
| 261 | match(/^[;\s]*/); | ||
| 262 | return ret; | ||
| 263 | } | ||
| 264 | /** | ||
| 265 | * Parse declarations. | ||
| 266 | */ function declarations() { | ||
| 267 | const decls = []; | ||
| 268 | if (!open()) return error("missing '{'"); | ||
| 269 | comments(decls); | ||
| 270 | // declarations | ||
| 271 | let decl; | ||
| 272 | while(decl = declaration())if (decl) { | ||
| 273 | decls.push(decl); | ||
| 274 | comments(decls); | ||
| 275 | } | ||
| 276 | if (!close()) return error("missing '}'"); | ||
| 277 | return decls; | ||
| 278 | } | ||
| 279 | /** | ||
| 280 | * Parse keyframe. | ||
| 281 | */ function keyframe() { | ||
| 282 | let m; | ||
| 283 | const vals = []; | ||
| 284 | const pos = position(); | ||
| 285 | while(m = match(/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/)){ | ||
| 286 | vals.push(m[1]); | ||
| 287 | match(/^,\s*/); | ||
| 288 | } | ||
| 289 | if (!vals.length) return; | ||
| 290 | return pos({ | ||
| 291 | type: (0, $b2e137848b48cf4f$export$9be5dd6e61d5d73a).keyframe, | ||
| 292 | values: vals, | ||
| 293 | declarations: declarations() || [] | ||
| 294 | }); | ||
| 295 | } | ||
| 296 | /** | ||
| 297 | * Parse keyframes. | ||
| 298 | */ function atkeyframes() { | ||
| 299 | const pos = position(); | ||
| 300 | const m1 = match(/^@([-\w]+)?keyframes\s*/); | ||
| 301 | if (!m1) return; | ||
| 302 | const vendor = m1[1]; | ||
| 303 | // identifier | ||
| 304 | const m2 = match(/^([-\w]+)\s*/); | ||
| 305 | if (!m2) return error("@keyframes missing name"); | ||
| 306 | const name = m2[1]; | ||
| 307 | if (!open()) return error("@keyframes missing '{'"); | ||
| 308 | let frame; | ||
| 309 | let frames = comments(); | ||
| 310 | while(frame = keyframe()){ | ||
| 311 | frames.push(frame); | ||
| 312 | frames = frames.concat(comments()); | ||
| 313 | } | ||
| 314 | if (!close()) return error("@keyframes missing '}'"); | ||
| 315 | return pos({ | ||
| 316 | type: (0, $b2e137848b48cf4f$export$9be5dd6e61d5d73a).keyframes, | ||
| 317 | name: name, | ||
| 318 | vendor: vendor, | ||
| 319 | keyframes: frames | ||
| 320 | }); | ||
| 321 | } | ||
| 322 | /** | ||
| 323 | * Parse supports. | ||
| 324 | */ function atsupports() { | ||
| 325 | const pos = position(); | ||
| 326 | const m = match(/^@supports *([^{]+)/); | ||
| 327 | if (!m) return; | ||
| 328 | const supports = $d708735ed1303b43$var$trim(m[1]); | ||
| 329 | if (!open()) return error("@supports missing '{'"); | ||
| 330 | const style = comments().concat(rules()); | ||
| 331 | if (!close()) return error("@supports missing '}'"); | ||
| 332 | return pos({ | ||
| 333 | type: (0, $b2e137848b48cf4f$export$9be5dd6e61d5d73a).supports, | ||
| 334 | supports: supports, | ||
| 335 | rules: style | ||
| 336 | }); | ||
| 337 | } | ||
| 338 | /** | ||
| 339 | * Parse host. | ||
| 340 | */ function athost() { | ||
| 341 | const pos = position(); | ||
| 342 | const m = match(/^@host\s*/); | ||
| 343 | if (!m) return; | ||
| 344 | if (!open()) return error("@host missing '{'"); | ||
| 345 | const style = comments().concat(rules()); | ||
| 346 | if (!close()) return error("@host missing '}'"); | ||
| 347 | return pos({ | ||
| 348 | type: (0, $b2e137848b48cf4f$export$9be5dd6e61d5d73a).host, | ||
| 349 | rules: style | ||
| 350 | }); | ||
| 351 | } | ||
| 352 | /** | ||
| 353 | * Parse container. | ||
| 354 | */ function atcontainer() { | ||
| 355 | const pos = position(); | ||
| 356 | const m = match(/^@container *([^{]+)/); | ||
| 357 | if (!m) return; | ||
| 358 | const container = $d708735ed1303b43$var$trim(m[1]); | ||
| 359 | if (!open()) return error("@container missing '{'"); | ||
| 360 | const style = comments().concat(rules()); | ||
| 361 | if (!close()) return error("@container missing '}'"); | ||
| 362 | return pos({ | ||
| 363 | type: (0, $b2e137848b48cf4f$export$9be5dd6e61d5d73a).container, | ||
| 364 | container: container, | ||
| 365 | rules: style | ||
| 366 | }); | ||
| 367 | } | ||
| 368 | /** | ||
| 369 | * Parse container. | ||
| 370 | */ function atlayer() { | ||
| 371 | const pos = position(); | ||
| 372 | const m = match(/^@layer *([^{;@]+)/); | ||
| 373 | if (!m) return; | ||
| 374 | const layer = $d708735ed1303b43$var$trim(m[1]); | ||
| 375 | if (!open()) { | ||
| 376 | match(/^[;\s]*/); | ||
| 377 | return pos({ | ||
| 378 | type: (0, $b2e137848b48cf4f$export$9be5dd6e61d5d73a).layer, | ||
| 379 | layer: layer | ||
| 380 | }); | ||
| 381 | } | ||
| 382 | const style = comments().concat(rules()); | ||
| 383 | if (!close()) return error("@layer missing '}'"); | ||
| 384 | return pos({ | ||
| 385 | type: (0, $b2e137848b48cf4f$export$9be5dd6e61d5d73a).layer, | ||
| 386 | layer: layer, | ||
| 387 | rules: style | ||
| 388 | }); | ||
| 389 | } | ||
| 390 | /** | ||
| 391 | * Parse media. | ||
| 392 | */ function atmedia() { | ||
| 393 | const pos = position(); | ||
| 394 | const m = match(/^@media *([^{]+)/); | ||
| 395 | if (!m) return; | ||
| 396 | const media = $d708735ed1303b43$var$trim(m[1]); | ||
| 397 | if (!open()) return error("@media missing '{'"); | ||
| 398 | const style = comments().concat(rules()); | ||
| 399 | if (!close()) return error("@media missing '}'"); | ||
| 400 | return pos({ | ||
| 401 | type: (0, $b2e137848b48cf4f$export$9be5dd6e61d5d73a).media, | ||
| 402 | media: media, | ||
| 403 | rules: style | ||
| 404 | }); | ||
| 405 | } | ||
| 406 | /** | ||
| 407 | * Parse custom-media. | ||
| 408 | */ function atcustommedia() { | ||
| 409 | const pos = position(); | ||
| 410 | const m = match(/^@custom-media\s+(--\S+)\s*([^{;\s][^{;]*);/); | ||
| 411 | if (!m) return; | ||
| 412 | return pos({ | ||
| 413 | type: (0, $b2e137848b48cf4f$export$9be5dd6e61d5d73a).customMedia, | ||
| 414 | name: $d708735ed1303b43$var$trim(m[1]), | ||
| 415 | media: $d708735ed1303b43$var$trim(m[2]) | ||
| 416 | }); | ||
| 417 | } | ||
| 418 | /** | ||
| 419 | * Parse paged media. | ||
| 420 | */ function atpage() { | ||
| 421 | const pos = position(); | ||
| 422 | const m = match(/^@page */); | ||
| 423 | if (!m) return; | ||
| 424 | const sel = selector() || []; | ||
| 425 | if (!open()) return error("@page missing '{'"); | ||
| 426 | let decls = comments(); | ||
| 427 | // declarations | ||
| 428 | let decl; | ||
| 429 | while(decl = declaration()){ | ||
| 430 | decls.push(decl); | ||
| 431 | decls = decls.concat(comments()); | ||
| 432 | } | ||
| 433 | if (!close()) return error("@page missing '}'"); | ||
| 434 | return pos({ | ||
| 435 | type: (0, $b2e137848b48cf4f$export$9be5dd6e61d5d73a).page, | ||
| 436 | selectors: sel, | ||
| 437 | declarations: decls | ||
| 438 | }); | ||
| 439 | } | ||
| 440 | /** | ||
| 441 | * Parse document. | ||
| 442 | */ function atdocument() { | ||
| 443 | const pos = position(); | ||
| 444 | const m = match(/^@([-\w]+)?document *([^{]+)/); | ||
| 445 | if (!m) return; | ||
| 446 | const vendor = $d708735ed1303b43$var$trim(m[1]); | ||
| 447 | const doc = $d708735ed1303b43$var$trim(m[2]); | ||
| 448 | if (!open()) return error("@document missing '{'"); | ||
| 449 | const style = comments().concat(rules()); | ||
| 450 | if (!close()) return error("@document missing '}'"); | ||
| 451 | return pos({ | ||
| 452 | type: (0, $b2e137848b48cf4f$export$9be5dd6e61d5d73a).document, | ||
| 453 | document: doc, | ||
| 454 | vendor: vendor, | ||
| 455 | rules: style | ||
| 456 | }); | ||
| 457 | } | ||
| 458 | /** | ||
| 459 | * Parse font-face. | ||
| 460 | */ function atfontface() { | ||
| 461 | const pos = position(); | ||
| 462 | const m = match(/^@font-face\s*/); | ||
| 463 | if (!m) return; | ||
| 464 | if (!open()) return error("@font-face missing '{'"); | ||
| 465 | let decls = comments(); | ||
| 466 | // declarations | ||
| 467 | let decl; | ||
| 468 | while(decl = declaration()){ | ||
| 469 | decls.push(decl); | ||
| 470 | decls = decls.concat(comments()); | ||
| 471 | } | ||
| 472 | if (!close()) return error("@font-face missing '}'"); | ||
| 473 | return pos({ | ||
| 474 | type: (0, $b2e137848b48cf4f$export$9be5dd6e61d5d73a).fontFace, | ||
| 475 | declarations: decls | ||
| 476 | }); | ||
| 477 | } | ||
| 478 | /** | ||
| 479 | * Parse import | ||
| 480 | */ const atimport = _compileAtrule("import"); | ||
| 481 | /** | ||
| 482 | * Parse charset | ||
| 483 | */ const atcharset = _compileAtrule("charset"); | ||
| 484 | /** | ||
| 485 | * Parse namespace | ||
| 486 | */ const atnamespace = _compileAtrule("namespace"); | ||
| 487 | /** | ||
| 488 | * Parse non-block at-rules | ||
| 489 | */ function _compileAtrule(name) { | ||
| 490 | const re = new RegExp("^@" + name + "\\s*((?::?[^;'\"]|\"(?:\\\\\"|[^\"])*?\"|'(?:\\\\'|[^'])*?')+)(?:;|$)"); | ||
| 491 | // ^@import\s*([^;"']|("|')(?:\\\2|.)*?\2)+(;|$) | ||
| 492 | return function() { | ||
| 493 | const pos = position(); | ||
| 494 | const m = match(re); | ||
| 495 | if (!m) return; | ||
| 496 | const ret = { | ||
| 497 | type: name | ||
| 498 | }; | ||
| 499 | ret[name] = m[1].trim(); | ||
| 500 | return pos(ret); | ||
| 501 | }; | ||
| 502 | } | ||
| 503 | /** | ||
| 504 | * Parse at rule. | ||
| 505 | */ function atrule() { | ||
| 506 | if (css[0] !== "@") return; | ||
| 507 | return atkeyframes() || atmedia() || atcustommedia() || atsupports() || atimport() || atcharset() || atnamespace() || atdocument() || atpage() || athost() || atfontface() || atcontainer() || atlayer(); | ||
| 508 | } | ||
| 509 | /** | ||
| 510 | * Parse rule. | ||
| 511 | */ function rule() { | ||
| 512 | const pos = position(); | ||
| 513 | const sel = selector(); | ||
| 514 | if (!sel) return error("selector missing"); | ||
| 515 | comments(); | ||
| 516 | return pos({ | ||
| 517 | type: (0, $b2e137848b48cf4f$export$9be5dd6e61d5d73a).rule, | ||
| 518 | selectors: sel, | ||
| 519 | declarations: declarations() || [] | ||
| 520 | }); | ||
| 521 | } | ||
| 522 | return $d708735ed1303b43$var$addParent(stylesheet()); | ||
| 523 | }; | ||
| 524 | /** | ||
| 525 | * Trim `str`. | ||
| 526 | */ function $d708735ed1303b43$var$trim(str) { | ||
| 527 | return str ? str.trim() : ""; | ||
| 528 | } | ||
| 529 | /** | ||
| 530 | * Adds non-enumerable parent node reference to each node. | ||
| 531 | */ function $d708735ed1303b43$var$addParent(obj, parent) { | ||
| 532 | const isNode = obj && typeof obj.type === "string"; | ||
| 533 | const childParent = isNode ? obj : parent; | ||
| 534 | for(const k in obj){ | ||
| 535 | const value = obj[k]; | ||
| 536 | if (Array.isArray(value)) value.forEach((v)=>{ | ||
| 537 | $d708735ed1303b43$var$addParent(v, childParent); | ||
| 538 | }); | ||
| 539 | else if (value && typeof value === "object") $d708735ed1303b43$var$addParent(value, childParent); | ||
| 540 | } | ||
| 541 | if (isNode) Object.defineProperty(obj, "parent", { | ||
| 542 | configurable: true, | ||
| 543 | writable: true, | ||
| 544 | enumerable: false, | ||
| 545 | value: parent || null | ||
| 546 | }); | ||
| 547 | return obj; | ||
| 548 | } | ||
| 549 | var $d708735ed1303b43$export$2e2bcd8739ae039 = $d708735ed1303b43$export$98e6a39c04603d36; | ||
| 550 | |||
| 551 | |||
| 552 | |||
| 553 | class $de9540138ed1fd01$var$Compiler { | ||
| 554 | constructor(options){ | ||
| 555 | this.level = 0; | ||
| 556 | this.indentation = " "; | ||
| 557 | this.compress = false; | ||
| 558 | if (typeof options?.indent === "string") this.indentation = options?.indent; | ||
| 559 | if (options?.compress) this.compress = true; | ||
| 560 | } | ||
| 561 | // We disable no-unused-vars for _position. We keep position for potential reintroduction of source-map | ||
| 562 | // eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
| 563 | emit(str, _position) { | ||
| 564 | return str; | ||
| 565 | } | ||
| 566 | /** | ||
| 567 | * Increase, decrease or return current indentation. | ||
| 568 | */ indent(level) { | ||
| 569 | this.level = this.level || 1; | ||
| 570 | if (level) { | ||
| 571 | this.level += level; | ||
| 572 | return ""; | ||
| 573 | } | ||
| 574 | return Array(this.level).join(this.indentation); | ||
| 575 | } | ||
| 576 | visit(node) { | ||
| 577 | switch(node.type){ | ||
| 578 | case (0, $b2e137848b48cf4f$export$9be5dd6e61d5d73a).stylesheet: | ||
| 579 | return this.stylesheet(node); | ||
| 580 | case (0, $b2e137848b48cf4f$export$9be5dd6e61d5d73a).rule: | ||
| 581 | return this.rule(node); | ||
| 582 | case (0, $b2e137848b48cf4f$export$9be5dd6e61d5d73a).declaration: | ||
| 583 | return this.declaration(node); | ||
| 584 | case (0, $b2e137848b48cf4f$export$9be5dd6e61d5d73a).comment: | ||
| 585 | return this.comment(node); | ||
| 586 | case (0, $b2e137848b48cf4f$export$9be5dd6e61d5d73a).container: | ||
| 587 | return this.container(node); | ||
| 588 | case (0, $b2e137848b48cf4f$export$9be5dd6e61d5d73a).charset: | ||
| 589 | return this.charset(node); | ||
| 590 | case (0, $b2e137848b48cf4f$export$9be5dd6e61d5d73a).document: | ||
| 591 | return this.document(node); | ||
| 592 | case (0, $b2e137848b48cf4f$export$9be5dd6e61d5d73a).customMedia: | ||
| 593 | return this.customMedia(node); | ||
| 594 | case (0, $b2e137848b48cf4f$export$9be5dd6e61d5d73a).fontFace: | ||
| 595 | return this.fontFace(node); | ||
| 596 | case (0, $b2e137848b48cf4f$export$9be5dd6e61d5d73a).host: | ||
| 597 | return this.host(node); | ||
| 598 | case (0, $b2e137848b48cf4f$export$9be5dd6e61d5d73a).import: | ||
| 599 | return this.import(node); | ||
| 600 | case (0, $b2e137848b48cf4f$export$9be5dd6e61d5d73a).keyframes: | ||
| 601 | return this.keyframes(node); | ||
| 602 | case (0, $b2e137848b48cf4f$export$9be5dd6e61d5d73a).keyframe: | ||
| 603 | return this.keyframe(node); | ||
| 604 | case (0, $b2e137848b48cf4f$export$9be5dd6e61d5d73a).layer: | ||
| 605 | return this.layer(node); | ||
| 606 | case (0, $b2e137848b48cf4f$export$9be5dd6e61d5d73a).media: | ||
| 607 | return this.media(node); | ||
| 608 | case (0, $b2e137848b48cf4f$export$9be5dd6e61d5d73a).namespace: | ||
| 609 | return this.namespace(node); | ||
| 610 | case (0, $b2e137848b48cf4f$export$9be5dd6e61d5d73a).page: | ||
| 611 | return this.page(node); | ||
| 612 | case (0, $b2e137848b48cf4f$export$9be5dd6e61d5d73a).supports: | ||
| 613 | return this.supports(node); | ||
| 614 | } | ||
| 615 | } | ||
| 616 | mapVisit(nodes, delim) { | ||
| 617 | let buf = ""; | ||
| 618 | delim = delim || ""; | ||
| 619 | for(let i = 0, length = nodes.length; i < length; i++){ | ||
| 620 | buf += this.visit(nodes[i]); | ||
| 621 | if (delim && i < length - 1) buf += this.emit(delim); | ||
| 622 | } | ||
| 623 | return buf; | ||
| 624 | } | ||
| 625 | compile(node) { | ||
| 626 | if (this.compress) return node.stylesheet.rules.map(this.visit, this).join(""); | ||
| 627 | return this.stylesheet(node); | ||
| 628 | } | ||
| 629 | /** | ||
| 630 | * Visit stylesheet node. | ||
| 631 | */ stylesheet(node) { | ||
| 632 | return this.mapVisit(node.stylesheet.rules, "\n\n"); | ||
| 633 | } | ||
| 634 | /** | ||
| 635 | * Visit comment node. | ||
| 636 | */ comment(node) { | ||
| 637 | if (this.compress) return this.emit("", node.position); | ||
| 638 | return this.emit(this.indent() + "/*" + node.comment + "*/", node.position); | ||
| 639 | } | ||
| 640 | /** | ||
| 641 | * Visit container node. | ||
| 642 | */ container(node) { | ||
| 643 | if (this.compress) return this.emit("@container " + node.container, node.position) + this.emit("{") + this.mapVisit(node.rules) + this.emit("}"); | ||
| 644 | return this.emit(this.indent() + "@container " + node.container, node.position) + this.emit(" {\n" + this.indent(1)) + this.mapVisit(node.rules, "\n\n") + this.emit("\n" + this.indent(-1) + this.indent() + "}"); | ||
| 645 | } | ||
| 646 | /** | ||
| 647 | * Visit container node. | ||
| 648 | */ layer(node) { | ||
| 649 | if (this.compress) return this.emit("@layer " + node.layer, node.position) + (node.rules ? this.emit("{") + this.mapVisit(node.rules) + this.emit("}") : ";"); | ||
| 650 | return this.emit(this.indent() + "@layer " + node.layer, node.position) + (node.rules ? this.emit(" {\n" + this.indent(1)) + this.mapVisit(node.rules, "\n\n") + this.emit("\n" + this.indent(-1) + this.indent() + "}") : ";"); | ||
| 651 | } | ||
| 652 | /** | ||
| 653 | * Visit import node. | ||
| 654 | */ import(node) { | ||
| 655 | return this.emit("@import " + node.import + ";", node.position); | ||
| 656 | } | ||
| 657 | /** | ||
| 658 | * Visit media node. | ||
| 659 | */ media(node) { | ||
| 660 | if (this.compress) return this.emit("@media " + node.media, node.position) + this.emit("{") + this.mapVisit(node.rules) + this.emit("}"); | ||
| 661 | return this.emit(this.indent() + "@media " + node.media, node.position) + this.emit(" {\n" + this.indent(1)) + this.mapVisit(node.rules, "\n\n") + this.emit("\n" + this.indent(-1) + this.indent() + "}"); | ||
| 662 | } | ||
| 663 | /** | ||
| 664 | * Visit document node. | ||
| 665 | */ document(node) { | ||
| 666 | const doc = "@" + (node.vendor || "") + "document " + node.document; | ||
| 667 | if (this.compress) return this.emit(doc, node.position) + this.emit("{") + this.mapVisit(node.rules) + this.emit("}"); | ||
| 668 | return this.emit(doc, node.position) + this.emit(" {\n" + this.indent(1)) + this.mapVisit(node.rules, "\n\n") + this.emit(this.indent(-1) + "\n}"); | ||
| 669 | } | ||
| 670 | /** | ||
| 671 | * Visit charset node. | ||
| 672 | */ charset(node) { | ||
| 673 | return this.emit("@charset " + node.charset + ";", node.position); | ||
| 674 | } | ||
| 675 | /** | ||
| 676 | * Visit namespace node. | ||
| 677 | */ namespace(node) { | ||
| 678 | return this.emit("@namespace " + node.namespace + ";", node.position); | ||
| 679 | } | ||
| 680 | /** | ||
| 681 | * Visit supports node. | ||
| 682 | */ supports(node) { | ||
| 683 | if (this.compress) return this.emit("@supports " + node.supports, node.position) + this.emit("{") + this.mapVisit(node.rules) + this.emit("}"); | ||
| 684 | return this.emit(this.indent() + "@supports " + node.supports, node.position) + this.emit(" {\n" + this.indent(1)) + this.mapVisit(node.rules, "\n\n") + this.emit("\n" + this.indent(-1) + this.indent() + "}"); | ||
| 685 | } | ||
| 686 | /** | ||
| 687 | * Visit keyframes node. | ||
| 688 | */ keyframes(node) { | ||
| 689 | if (this.compress) return this.emit("@" + (node.vendor || "") + "keyframes " + node.name, node.position) + this.emit("{") + this.mapVisit(node.keyframes) + this.emit("}"); | ||
| 690 | return this.emit("@" + (node.vendor || "") + "keyframes " + node.name, node.position) + this.emit(" {\n" + this.indent(1)) + this.mapVisit(node.keyframes, "\n") + this.emit(this.indent(-1) + "}"); | ||
| 691 | } | ||
| 692 | /** | ||
| 693 | * Visit keyframe node. | ||
| 694 | */ keyframe(node) { | ||
| 695 | const decls = node.declarations; | ||
| 696 | if (this.compress) return this.emit(node.values.join(","), node.position) + this.emit("{") + this.mapVisit(decls) + this.emit("}"); | ||
| 697 | return this.emit(this.indent()) + this.emit(node.values.join(", "), node.position) + this.emit(" {\n" + this.indent(1)) + this.mapVisit(decls, "\n") + this.emit(this.indent(-1) + "\n" + this.indent() + "}\n"); | ||
| 698 | } | ||
| 699 | /** | ||
| 700 | * Visit page node. | ||
| 701 | */ page(node) { | ||
| 702 | if (this.compress) { | ||
| 703 | const sel = node.selectors.length ? node.selectors.join(", ") : ""; | ||
| 704 | return this.emit("@page " + sel, node.position) + this.emit("{") + this.mapVisit(node.declarations) + this.emit("}"); | ||
| 705 | } | ||
| 706 | const sel = node.selectors.length ? node.selectors.join(", ") + " " : ""; | ||
| 707 | return this.emit("@page " + sel, node.position) + this.emit("{\n") + this.emit(this.indent(1)) + this.mapVisit(node.declarations, "\n") + this.emit(this.indent(-1)) + this.emit("\n}"); | ||
| 708 | } | ||
| 709 | /** | ||
| 710 | * Visit font-face node. | ||
| 711 | */ fontFace(node) { | ||
| 712 | if (this.compress) return this.emit("@font-face", node.position) + this.emit("{") + this.mapVisit(node.declarations) + this.emit("}"); | ||
| 713 | return this.emit("@font-face ", node.position) + this.emit("{\n") + this.emit(this.indent(1)) + this.mapVisit(node.declarations, "\n") + this.emit(this.indent(-1)) + this.emit("\n}"); | ||
| 714 | } | ||
| 715 | /** | ||
| 716 | * Visit host node. | ||
| 717 | */ host(node) { | ||
| 718 | if (this.compress) return this.emit("@host", node.position) + this.emit("{") + this.mapVisit(node.rules) + this.emit("}"); | ||
| 719 | return this.emit("@host", node.position) + this.emit(" {\n" + this.indent(1)) + this.mapVisit(node.rules, "\n\n") + this.emit(this.indent(-1) + "\n}"); | ||
| 720 | } | ||
| 721 | /** | ||
| 722 | * Visit custom-media node. | ||
| 723 | */ customMedia(node) { | ||
| 724 | return this.emit("@custom-media " + node.name + " " + node.media + ";", node.position); | ||
| 725 | } | ||
| 726 | /** | ||
| 727 | * Visit rule node. | ||
| 728 | */ rule(node) { | ||
| 729 | const decls = node.declarations; | ||
| 730 | if (!decls.length) return ""; | ||
| 731 | if (this.compress) return this.emit(node.selectors.join(","), node.position) + this.emit("{") + this.mapVisit(decls) + this.emit("}"); | ||
| 732 | const indent = this.indent(); | ||
| 733 | return this.emit(node.selectors.map((s)=>{ | ||
| 734 | return indent + s; | ||
| 735 | }).join(",\n"), node.position) + this.emit(" {\n") + this.emit(this.indent(1)) + this.mapVisit(decls, "\n") + this.emit(this.indent(-1)) + this.emit("\n" + this.indent() + "}"); | ||
| 736 | } | ||
| 737 | /** | ||
| 738 | * Visit declaration node. | ||
| 739 | */ declaration(node) { | ||
| 740 | if (this.compress) return this.emit(node.property + ":" + node.value, node.position) + this.emit(";"); | ||
| 741 | return this.emit(this.indent()) + this.emit(node.property + ": " + node.value, node.position) + this.emit(";"); | ||
| 742 | } | ||
| 743 | } | ||
| 744 | var $de9540138ed1fd01$export$2e2bcd8739ae039 = $de9540138ed1fd01$var$Compiler; | ||
| 745 | |||
| 746 | |||
| 747 | var $fdf773ab87e20450$export$2e2bcd8739ae039 = (node, options)=>{ | ||
| 748 | const compiler = new (0, $de9540138ed1fd01$export$2e2bcd8739ae039)(options || {}); | ||
| 749 | return compiler.compile(node); | ||
| 750 | }; | ||
| 751 | |||
| 752 | |||
| 753 | |||
| 754 | |||
| 755 | |||
| 756 | const $149c1bd638913645$export$98e6a39c04603d36 = (0, $d708735ed1303b43$export$2e2bcd8739ae039); | ||
| 757 | const $149c1bd638913645$export$fac44ee5b035f737 = (0, $fdf773ab87e20450$export$2e2bcd8739ae039); | ||
| 758 | var $149c1bd638913645$export$2e2bcd8739ae039 = { | ||
| 759 | parse: $149c1bd638913645$export$98e6a39c04603d36, | ||
| 760 | stringify: $149c1bd638913645$export$fac44ee5b035f737 | ||
| 761 | }; | ||
| 762 | |||
| 763 | |||
| 764 | export {$149c1bd638913645$export$98e6a39c04603d36 as parse, $149c1bd638913645$export$fac44ee5b035f737 as stringify, $149c1bd638913645$export$2e2bcd8739ae039 as default, $b2e137848b48cf4f$export$9be5dd6e61d5d73a as CssTypes}; | ||
| 765 | //# sourceMappingURL=index.mjs.map | ||
| @@ -1,55 +0,0 @@ | |||
| 1 | var diff_match_patch=function(){this.Diff_Timeout=1;this.Diff_EditCost=4;this.Match_Threshold=.5;this.Match_Distance=1E3;this.Patch_DeleteThreshold=.5;this.Patch_Margin=4;this.Match_MaxBits=32},DIFF_DELETE=-1,DIFF_INSERT=1,DIFF_EQUAL=0;diff_match_patch.Diff=function(a,b){this[0]=a;this[1]=b};diff_match_patch.Diff.prototype.length=2;diff_match_patch.Diff.prototype.toString=function(){return this[0]+","+this[1]}; | ||
| 2 | diff_match_patch.prototype.diff_main=function(a,b,c,d){"undefined"==typeof d&&(d=0>=this.Diff_Timeout?Number.MAX_VALUE:(new Date).getTime()+1E3*this.Diff_Timeout);if(null==a||null==b)throw Error("Null input. (diff_main)");if(a==b)return a?[new diff_match_patch.Diff(DIFF_EQUAL,a)]:[];"undefined"==typeof c&&(c=!0);var e=c,f=this.diff_commonPrefix(a,b);c=a.substring(0,f);a=a.substring(f);b=b.substring(f);f=this.diff_commonSuffix(a,b);var g=a.substring(a.length-f);a=a.substring(0,a.length-f);b=b.substring(0, | ||
| 3 | b.length-f);a=this.diff_compute_(a,b,e,d);c&&a.unshift(new diff_match_patch.Diff(DIFF_EQUAL,c));g&&a.push(new diff_match_patch.Diff(DIFF_EQUAL,g));this.diff_cleanupMerge(a);return a}; | ||
| 4 | diff_match_patch.prototype.diff_compute_=function(a,b,c,d){if(!a)return[new diff_match_patch.Diff(DIFF_INSERT,b)];if(!b)return[new diff_match_patch.Diff(DIFF_DELETE,a)];var e=a.length>b.length?a:b,f=a.length>b.length?b:a,g=e.indexOf(f);return-1!=g?(c=[new diff_match_patch.Diff(DIFF_INSERT,e.substring(0,g)),new diff_match_patch.Diff(DIFF_EQUAL,f),new diff_match_patch.Diff(DIFF_INSERT,e.substring(g+f.length))],a.length>b.length&&(c[0][0]=c[2][0]=DIFF_DELETE),c):1==f.length?[new diff_match_patch.Diff(DIFF_DELETE, | ||
| 5 | a),new diff_match_patch.Diff(DIFF_INSERT,b)]:(e=this.diff_halfMatch_(a,b))?(b=e[1],f=e[3],a=e[4],e=this.diff_main(e[0],e[2],c,d),c=this.diff_main(b,f,c,d),e.concat([new diff_match_patch.Diff(DIFF_EQUAL,a)],c)):c&&100<a.length&&100<b.length?this.diff_lineMode_(a,b,d):this.diff_bisect_(a,b,d)}; | ||
| 6 | diff_match_patch.prototype.diff_lineMode_=function(a,b,c){var d=this.diff_linesToChars_(a,b);a=d.chars1;b=d.chars2;d=d.lineArray;a=this.diff_main(a,b,!1,c);this.diff_charsToLines_(a,d);this.diff_cleanupSemantic(a);a.push(new diff_match_patch.Diff(DIFF_EQUAL,""));for(var e=d=b=0,f="",g="";b<a.length;){switch(a[b][0]){case DIFF_INSERT:e++;g+=a[b][1];break;case DIFF_DELETE:d++;f+=a[b][1];break;case DIFF_EQUAL:if(1<=d&&1<=e){a.splice(b-d-e,d+e);b=b-d-e;d=this.diff_main(f,g,!1,c);for(e=d.length-1;0<=e;e--)a.splice(b, | ||
| 7 | 0,d[e]);b+=d.length}d=e=0;g=f=""}b++}a.pop();return a}; | ||
| 8 | diff_match_patch.prototype.diff_bisect_=function(a,b,c){for(var d=a.length,e=b.length,f=Math.ceil((d+e)/2),g=2*f,h=Array(g),l=Array(g),k=0;k<g;k++)h[k]=-1,l[k]=-1;h[f+1]=0;l[f+1]=0;k=d-e;for(var m=0!=k%2,p=0,x=0,w=0,q=0,t=0;t<f&&!((new Date).getTime()>c);t++){for(var v=-t+p;v<=t-x;v+=2){var n=f+v;var r=v==-t||v!=t&&h[n-1]<h[n+1]?h[n+1]:h[n-1]+1;for(var y=r-v;r<d&&y<e&&a.charAt(r)==b.charAt(y);)r++,y++;h[n]=r;if(r>d)x+=2;else if(y>e)p+=2;else if(m&&(n=f+k-v,0<=n&&n<g&&-1!=l[n])){var u=d-l[n];if(r>= | ||
| 9 | u)return this.diff_bisectSplit_(a,b,r,y,c)}}for(v=-t+w;v<=t-q;v+=2){n=f+v;u=v==-t||v!=t&&l[n-1]<l[n+1]?l[n+1]:l[n-1]+1;for(r=u-v;u<d&&r<e&&a.charAt(d-u-1)==b.charAt(e-r-1);)u++,r++;l[n]=u;if(u>d)q+=2;else if(r>e)w+=2;else if(!m&&(n=f+k-v,0<=n&&n<g&&-1!=h[n]&&(r=h[n],y=f+r-n,u=d-u,r>=u)))return this.diff_bisectSplit_(a,b,r,y,c)}}return[new diff_match_patch.Diff(DIFF_DELETE,a),new diff_match_patch.Diff(DIFF_INSERT,b)]}; | ||
| 10 | diff_match_patch.prototype.diff_bisectSplit_=function(a,b,c,d,e){var f=a.substring(0,c),g=b.substring(0,d);a=a.substring(c);b=b.substring(d);f=this.diff_main(f,g,!1,e);e=this.diff_main(a,b,!1,e);return f.concat(e)}; | ||
| 11 | diff_match_patch.prototype.diff_linesToChars_=function(a,b){function c(a){for(var b="",c=0,g=-1,h=d.length;g<a.length-1;){g=a.indexOf("\n",c);-1==g&&(g=a.length-1);var l=a.substring(c,g+1);(e.hasOwnProperty?e.hasOwnProperty(l):void 0!==e[l])?b+=String.fromCharCode(e[l]):(h==f&&(l=a.substring(c),g=a.length),b+=String.fromCharCode(h),e[l]=h,d[h++]=l);c=g+1}return b}var d=[],e={};d[0]="";var f=4E4,g=c(a);f=65535;var h=c(b);return{chars1:g,chars2:h,lineArray:d}}; | ||
| 12 | diff_match_patch.prototype.diff_charsToLines_=function(a,b){for(var c=0;c<a.length;c++){for(var d=a[c][1],e=[],f=0;f<d.length;f++)e[f]=b[d.charCodeAt(f)];a[c][1]=e.join("")}};diff_match_patch.prototype.diff_commonPrefix=function(a,b){if(!a||!b||a.charAt(0)!=b.charAt(0))return 0;for(var c=0,d=Math.min(a.length,b.length),e=d,f=0;c<e;)a.substring(f,e)==b.substring(f,e)?f=c=e:d=e,e=Math.floor((d-c)/2+c);return e}; | ||
| 13 | diff_match_patch.prototype.diff_commonSuffix=function(a,b){if(!a||!b||a.charAt(a.length-1)!=b.charAt(b.length-1))return 0;for(var c=0,d=Math.min(a.length,b.length),e=d,f=0;c<e;)a.substring(a.length-e,a.length-f)==b.substring(b.length-e,b.length-f)?f=c=e:d=e,e=Math.floor((d-c)/2+c);return e}; | ||
| 14 | diff_match_patch.prototype.diff_commonOverlap_=function(a,b){var c=a.length,d=b.length;if(0==c||0==d)return 0;c>d?a=a.substring(c-d):c<d&&(b=b.substring(0,c));c=Math.min(c,d);if(a==b)return c;d=0;for(var e=1;;){var f=a.substring(c-e);f=b.indexOf(f);if(-1==f)return d;e+=f;if(0==f||a.substring(c-e)==b.substring(0,e))d=e,e++}}; | ||
| 15 | diff_match_patch.prototype.diff_halfMatch_=function(a,b){function c(a,b,c){for(var d=a.substring(c,c+Math.floor(a.length/4)),e=-1,g="",h,k,l,m;-1!=(e=b.indexOf(d,e+1));){var p=f.diff_commonPrefix(a.substring(c),b.substring(e)),u=f.diff_commonSuffix(a.substring(0,c),b.substring(0,e));g.length<u+p&&(g=b.substring(e-u,e)+b.substring(e,e+p),h=a.substring(0,c-u),k=a.substring(c+p),l=b.substring(0,e-u),m=b.substring(e+p))}return 2*g.length>=a.length?[h,k,l,m,g]:null}if(0>=this.Diff_Timeout)return null; | ||
| 16 | var d=a.length>b.length?a:b,e=a.length>b.length?b:a;if(4>d.length||2*e.length<d.length)return null;var f=this,g=c(d,e,Math.ceil(d.length/4));d=c(d,e,Math.ceil(d.length/2));if(g||d)g=d?g?g[4].length>d[4].length?g:d:d:g;else return null;if(a.length>b.length){d=g[0];e=g[1];var h=g[2];var l=g[3]}else h=g[0],l=g[1],d=g[2],e=g[3];return[d,e,h,l,g[4]]}; | ||
| 17 | diff_match_patch.prototype.diff_cleanupSemantic=function(a){for(var b=!1,c=[],d=0,e=null,f=0,g=0,h=0,l=0,k=0;f<a.length;)a[f][0]==DIFF_EQUAL?(c[d++]=f,g=l,h=k,k=l=0,e=a[f][1]):(a[f][0]==DIFF_INSERT?l+=a[f][1].length:k+=a[f][1].length,e&&e.length<=Math.max(g,h)&&e.length<=Math.max(l,k)&&(a.splice(c[d-1],0,new diff_match_patch.Diff(DIFF_DELETE,e)),a[c[d-1]+1][0]=DIFF_INSERT,d--,d--,f=0<d?c[d-1]:-1,k=l=h=g=0,e=null,b=!0)),f++;b&&this.diff_cleanupMerge(a);this.diff_cleanupSemanticLossless(a);for(f=1;f< | ||
| 18 | a.length;){if(a[f-1][0]==DIFF_DELETE&&a[f][0]==DIFF_INSERT){b=a[f-1][1];c=a[f][1];d=this.diff_commonOverlap_(b,c);e=this.diff_commonOverlap_(c,b);if(d>=e){if(d>=b.length/2||d>=c.length/2)a.splice(f,0,new diff_match_patch.Diff(DIFF_EQUAL,c.substring(0,d))),a[f-1][1]=b.substring(0,b.length-d),a[f+1][1]=c.substring(d),f++}else if(e>=b.length/2||e>=c.length/2)a.splice(f,0,new diff_match_patch.Diff(DIFF_EQUAL,b.substring(0,e))),a[f-1][0]=DIFF_INSERT,a[f-1][1]=c.substring(0,c.length-e),a[f+1][0]=DIFF_DELETE, | ||
| 19 | a[f+1][1]=b.substring(e),f++;f++}f++}}; | ||
| 20 | diff_match_patch.prototype.diff_cleanupSemanticLossless=function(a){function b(a,b){if(!a||!b)return 6;var c=a.charAt(a.length-1),d=b.charAt(0),e=c.match(diff_match_patch.nonAlphaNumericRegex_),f=d.match(diff_match_patch.nonAlphaNumericRegex_),g=e&&c.match(diff_match_patch.whitespaceRegex_),h=f&&d.match(diff_match_patch.whitespaceRegex_);c=g&&c.match(diff_match_patch.linebreakRegex_);d=h&&d.match(diff_match_patch.linebreakRegex_);var k=c&&a.match(diff_match_patch.blanklineEndRegex_),l=d&&b.match(diff_match_patch.blanklineStartRegex_); | ||
| 21 | return k||l?5:c||d?4:e&&!g&&h?3:g||h?2:e||f?1:0}for(var c=1;c<a.length-1;){if(a[c-1][0]==DIFF_EQUAL&&a[c+1][0]==DIFF_EQUAL){var d=a[c-1][1],e=a[c][1],f=a[c+1][1],g=this.diff_commonSuffix(d,e);if(g){var h=e.substring(e.length-g);d=d.substring(0,d.length-g);e=h+e.substring(0,e.length-g);f=h+f}g=d;h=e;for(var l=f,k=b(d,e)+b(e,f);e.charAt(0)===f.charAt(0);){d+=e.charAt(0);e=e.substring(1)+f.charAt(0);f=f.substring(1);var m=b(d,e)+b(e,f);m>=k&&(k=m,g=d,h=e,l=f)}a[c-1][1]!=g&&(g?a[c-1][1]=g:(a.splice(c- | ||
| 22 | 1,1),c--),a[c][1]=h,l?a[c+1][1]=l:(a.splice(c+1,1),c--))}c++}};diff_match_patch.nonAlphaNumericRegex_=/[^a-zA-Z0-9]/;diff_match_patch.whitespaceRegex_=/\s/;diff_match_patch.linebreakRegex_=/[\r\n]/;diff_match_patch.blanklineEndRegex_=/\n\r?\n$/;diff_match_patch.blanklineStartRegex_=/^\r?\n\r?\n/; | ||
| 23 | diff_match_patch.prototype.diff_cleanupEfficiency=function(a){for(var b=!1,c=[],d=0,e=null,f=0,g=!1,h=!1,l=!1,k=!1;f<a.length;)a[f][0]==DIFF_EQUAL?(a[f][1].length<this.Diff_EditCost&&(l||k)?(c[d++]=f,g=l,h=k,e=a[f][1]):(d=0,e=null),l=k=!1):(a[f][0]==DIFF_DELETE?k=!0:l=!0,e&&(g&&h&&l&&k||e.length<this.Diff_EditCost/2&&3==g+h+l+k)&&(a.splice(c[d-1],0,new diff_match_patch.Diff(DIFF_DELETE,e)),a[c[d-1]+1][0]=DIFF_INSERT,d--,e=null,g&&h?(l=k=!0,d=0):(d--,f=0<d?c[d-1]:-1,l=k=!1),b=!0)),f++;b&&this.diff_cleanupMerge(a)}; | ||
| 24 | diff_match_patch.prototype.diff_cleanupMerge=function(a){a.push(new diff_match_patch.Diff(DIFF_EQUAL,""));for(var b=0,c=0,d=0,e="",f="",g;b<a.length;)switch(a[b][0]){case DIFF_INSERT:d++;f+=a[b][1];b++;break;case DIFF_DELETE:c++;e+=a[b][1];b++;break;case DIFF_EQUAL:1<c+d?(0!==c&&0!==d&&(g=this.diff_commonPrefix(f,e),0!==g&&(0<b-c-d&&a[b-c-d-1][0]==DIFF_EQUAL?a[b-c-d-1][1]+=f.substring(0,g):(a.splice(0,0,new diff_match_patch.Diff(DIFF_EQUAL,f.substring(0,g))),b++),f=f.substring(g),e=e.substring(g)), | ||
| 25 | g=this.diff_commonSuffix(f,e),0!==g&&(a[b][1]=f.substring(f.length-g)+a[b][1],f=f.substring(0,f.length-g),e=e.substring(0,e.length-g))),b-=c+d,a.splice(b,c+d),e.length&&(a.splice(b,0,new diff_match_patch.Diff(DIFF_DELETE,e)),b++),f.length&&(a.splice(b,0,new diff_match_patch.Diff(DIFF_INSERT,f)),b++),b++):0!==b&&a[b-1][0]==DIFF_EQUAL?(a[b-1][1]+=a[b][1],a.splice(b,1)):b++,c=d=0,f=e=""}""===a[a.length-1][1]&&a.pop();c=!1;for(b=1;b<a.length-1;)a[b-1][0]==DIFF_EQUAL&&a[b+1][0]==DIFF_EQUAL&&(a[b][1].substring(a[b][1].length- | ||
| 26 | a[b-1][1].length)==a[b-1][1]?(a[b][1]=a[b-1][1]+a[b][1].substring(0,a[b][1].length-a[b-1][1].length),a[b+1][1]=a[b-1][1]+a[b+1][1],a.splice(b-1,1),c=!0):a[b][1].substring(0,a[b+1][1].length)==a[b+1][1]&&(a[b-1][1]+=a[b+1][1],a[b][1]=a[b][1].substring(a[b+1][1].length)+a[b+1][1],a.splice(b+1,1),c=!0)),b++;c&&this.diff_cleanupMerge(a)}; | ||
| 27 | diff_match_patch.prototype.diff_xIndex=function(a,b){var c=0,d=0,e=0,f=0,g;for(g=0;g<a.length;g++){a[g][0]!==DIFF_INSERT&&(c+=a[g][1].length);a[g][0]!==DIFF_DELETE&&(d+=a[g][1].length);if(c>b)break;e=c;f=d}return a.length!=g&&a[g][0]===DIFF_DELETE?f:f+(b-e)}; | ||
| 28 | diff_match_patch.prototype.diff_prettyHtml=function(a){for(var b=[],c=/&/g,d=/</g,e=/>/g,f=/\n/g,g=0;g<a.length;g++){var h=a[g][0],l=a[g][1].replace(c,"&").replace(d,"<").replace(e,">").replace(f,"¶<br>");switch(h){case DIFF_INSERT:b[g]='<ins style="background:#e6ffe6;">'+l+"</ins>";break;case DIFF_DELETE:b[g]='<del style="background:#ffe6e6;">'+l+"</del>";break;case DIFF_EQUAL:b[g]="<span>"+l+"</span>"}}return b.join("")}; | ||
| 29 | diff_match_patch.prototype.diff_text1=function(a){for(var b=[],c=0;c<a.length;c++)a[c][0]!==DIFF_INSERT&&(b[c]=a[c][1]);return b.join("")};diff_match_patch.prototype.diff_text2=function(a){for(var b=[],c=0;c<a.length;c++)a[c][0]!==DIFF_DELETE&&(b[c]=a[c][1]);return b.join("")}; | ||
| 30 | diff_match_patch.prototype.diff_levenshtein=function(a){for(var b=0,c=0,d=0,e=0;e<a.length;e++){var f=a[e][1];switch(a[e][0]){case DIFF_INSERT:c+=f.length;break;case DIFF_DELETE:d+=f.length;break;case DIFF_EQUAL:b+=Math.max(c,d),d=c=0}}return b+=Math.max(c,d)}; | ||
| 31 | diff_match_patch.prototype.diff_toDelta=function(a){for(var b=[],c=0;c<a.length;c++)switch(a[c][0]){case DIFF_INSERT:b[c]="+"+encodeURI(a[c][1]);break;case DIFF_DELETE:b[c]="-"+a[c][1].length;break;case DIFF_EQUAL:b[c]="="+a[c][1].length}return b.join("\t").replace(/%20/g," ")}; | ||
| 32 | diff_match_patch.prototype.diff_fromDelta=function(a,b){for(var c=[],d=0,e=0,f=b.split(/\t/g),g=0;g<f.length;g++){var h=f[g].substring(1);switch(f[g].charAt(0)){case "+":try{c[d++]=new diff_match_patch.Diff(DIFF_INSERT,decodeURI(h))}catch(k){throw Error("Illegal escape in diff_fromDelta: "+h);}break;case "-":case "=":var l=parseInt(h,10);if(isNaN(l)||0>l)throw Error("Invalid number in diff_fromDelta: "+h);h=a.substring(e,e+=l);"="==f[g].charAt(0)?c[d++]=new diff_match_patch.Diff(DIFF_EQUAL,h):c[d++]= | ||
| 33 | new diff_match_patch.Diff(DIFF_DELETE,h);break;default:if(f[g])throw Error("Invalid diff operation in diff_fromDelta: "+f[g]);}}if(e!=a.length)throw Error("Delta length ("+e+") does not equal source text length ("+a.length+").");return c};diff_match_patch.prototype.match_main=function(a,b,c){if(null==a||null==b||null==c)throw Error("Null input. (match_main)");c=Math.max(0,Math.min(c,a.length));return a==b?0:a.length?a.substring(c,c+b.length)==b?c:this.match_bitap_(a,b,c):-1}; | ||
| 34 | diff_match_patch.prototype.match_bitap_=function(a,b,c){function d(a,d){var e=a/b.length,g=Math.abs(c-d);return f.Match_Distance?e+g/f.Match_Distance:g?1:e}if(b.length>this.Match_MaxBits)throw Error("Pattern too long for this browser.");var e=this.match_alphabet_(b),f=this,g=this.Match_Threshold,h=a.indexOf(b,c);-1!=h&&(g=Math.min(d(0,h),g),h=a.lastIndexOf(b,c+b.length),-1!=h&&(g=Math.min(d(0,h),g)));var l=1<<b.length-1;h=-1;for(var k,m,p=b.length+a.length,x,w=0;w<b.length;w++){k=0;for(m=p;k<m;)d(w, | ||
| 35 | c+m)<=g?k=m:p=m,m=Math.floor((p-k)/2+k);p=m;k=Math.max(1,c-m+1);var q=Math.min(c+m,a.length)+b.length;m=Array(q+2);for(m[q+1]=(1<<w)-1;q>=k;q--){var t=e[a.charAt(q-1)];m[q]=0===w?(m[q+1]<<1|1)&t:(m[q+1]<<1|1)&t|(x[q+1]|x[q])<<1|1|x[q+1];if(m[q]&l&&(t=d(w,q-1),t<=g))if(g=t,h=q-1,h>c)k=Math.max(1,2*c-h);else break}if(d(w+1,c)>g)break;x=m}return h}; | ||
| 36 | diff_match_patch.prototype.match_alphabet_=function(a){for(var b={},c=0;c<a.length;c++)b[a.charAt(c)]=0;for(c=0;c<a.length;c++)b[a.charAt(c)]|=1<<a.length-c-1;return b}; | ||
| 37 | diff_match_patch.prototype.patch_addContext_=function(a,b){if(0!=b.length){if(null===a.start2)throw Error("patch not initialized");for(var c=b.substring(a.start2,a.start2+a.length1),d=0;b.indexOf(c)!=b.lastIndexOf(c)&&c.length<this.Match_MaxBits-this.Patch_Margin-this.Patch_Margin;)d+=this.Patch_Margin,c=b.substring(a.start2-d,a.start2+a.length1+d);d+=this.Patch_Margin;(c=b.substring(a.start2-d,a.start2))&&a.diffs.unshift(new diff_match_patch.Diff(DIFF_EQUAL,c));(d=b.substring(a.start2+a.length1, | ||
| 38 | a.start2+a.length1+d))&&a.diffs.push(new diff_match_patch.Diff(DIFF_EQUAL,d));a.start1-=c.length;a.start2-=c.length;a.length1+=c.length+d.length;a.length2+=c.length+d.length}}; | ||
| 39 | diff_match_patch.prototype.patch_make=function(a,b,c){if("string"==typeof a&&"string"==typeof b&&"undefined"==typeof c){var d=a;b=this.diff_main(d,b,!0);2<b.length&&(this.diff_cleanupSemantic(b),this.diff_cleanupEfficiency(b))}else if(a&&"object"==typeof a&&"undefined"==typeof b&&"undefined"==typeof c)b=a,d=this.diff_text1(b);else if("string"==typeof a&&b&&"object"==typeof b&&"undefined"==typeof c)d=a;else if("string"==typeof a&&"string"==typeof b&&c&&"object"==typeof c)d=a,b=c;else throw Error("Unknown call format to patch_make."); | ||
| 40 | if(0===b.length)return[];c=[];a=new diff_match_patch.patch_obj;for(var e=0,f=0,g=0,h=d,l=0;l<b.length;l++){var k=b[l][0],m=b[l][1];e||k===DIFF_EQUAL||(a.start1=f,a.start2=g);switch(k){case DIFF_INSERT:a.diffs[e++]=b[l];a.length2+=m.length;d=d.substring(0,g)+m+d.substring(g);break;case DIFF_DELETE:a.length1+=m.length;a.diffs[e++]=b[l];d=d.substring(0,g)+d.substring(g+m.length);break;case DIFF_EQUAL:m.length<=2*this.Patch_Margin&&e&&b.length!=l+1?(a.diffs[e++]=b[l],a.length1+=m.length,a.length2+=m.length): | ||
| 41 | m.length>=2*this.Patch_Margin&&e&&(this.patch_addContext_(a,h),c.push(a),a=new diff_match_patch.patch_obj,e=0,h=d,f=g)}k!==DIFF_INSERT&&(f+=m.length);k!==DIFF_DELETE&&(g+=m.length)}e&&(this.patch_addContext_(a,h),c.push(a));return c}; | ||
| 42 | diff_match_patch.prototype.patch_deepCopy=function(a){for(var b=[],c=0;c<a.length;c++){var d=a[c],e=new diff_match_patch.patch_obj;e.diffs=[];for(var f=0;f<d.diffs.length;f++)e.diffs[f]=new diff_match_patch.Diff(d.diffs[f][0],d.diffs[f][1]);e.start1=d.start1;e.start2=d.start2;e.length1=d.length1;e.length2=d.length2;b[c]=e}return b}; | ||
| 43 | diff_match_patch.prototype.patch_apply=function(a,b){if(0==a.length)return[b,[]];a=this.patch_deepCopy(a);var c=this.patch_addPadding(a);b=c+b+c;this.patch_splitMax(a);for(var d=0,e=[],f=0;f<a.length;f++){var g=a[f].start2+d,h=this.diff_text1(a[f].diffs),l=-1;if(h.length>this.Match_MaxBits){var k=this.match_main(b,h.substring(0,this.Match_MaxBits),g);-1!=k&&(l=this.match_main(b,h.substring(h.length-this.Match_MaxBits),g+h.length-this.Match_MaxBits),-1==l||k>=l)&&(k=-1)}else k=this.match_main(b,h, | ||
| 44 | g);if(-1==k)e[f]=!1,d-=a[f].length2-a[f].length1;else if(e[f]=!0,d=k-g,g=-1==l?b.substring(k,k+h.length):b.substring(k,l+this.Match_MaxBits),h==g)b=b.substring(0,k)+this.diff_text2(a[f].diffs)+b.substring(k+h.length);else if(g=this.diff_main(h,g,!1),h.length>this.Match_MaxBits&&this.diff_levenshtein(g)/h.length>this.Patch_DeleteThreshold)e[f]=!1;else{this.diff_cleanupSemanticLossless(g);h=0;var m;for(l=0;l<a[f].diffs.length;l++){var p=a[f].diffs[l];p[0]!==DIFF_EQUAL&&(m=this.diff_xIndex(g,h));p[0]=== | ||
| 45 | DIFF_INSERT?b=b.substring(0,k+m)+p[1]+b.substring(k+m):p[0]===DIFF_DELETE&&(b=b.substring(0,k+m)+b.substring(k+this.diff_xIndex(g,h+p[1].length)));p[0]!==DIFF_DELETE&&(h+=p[1].length)}}}b=b.substring(c.length,b.length-c.length);return[b,e]}; | ||
| 46 | diff_match_patch.prototype.patch_addPadding=function(a){for(var b=this.Patch_Margin,c="",d=1;d<=b;d++)c+=String.fromCharCode(d);for(d=0;d<a.length;d++)a[d].start1+=b,a[d].start2+=b;d=a[0];var e=d.diffs;if(0==e.length||e[0][0]!=DIFF_EQUAL)e.unshift(new diff_match_patch.Diff(DIFF_EQUAL,c)),d.start1-=b,d.start2-=b,d.length1+=b,d.length2+=b;else if(b>e[0][1].length){var f=b-e[0][1].length;e[0][1]=c.substring(e[0][1].length)+e[0][1];d.start1-=f;d.start2-=f;d.length1+=f;d.length2+=f}d=a[a.length-1];e=d.diffs; | ||
| 47 | 0==e.length||e[e.length-1][0]!=DIFF_EQUAL?(e.push(new diff_match_patch.Diff(DIFF_EQUAL,c)),d.length1+=b,d.length2+=b):b>e[e.length-1][1].length&&(f=b-e[e.length-1][1].length,e[e.length-1][1]+=c.substring(0,f),d.length1+=f,d.length2+=f);return c}; | ||
| 48 | diff_match_patch.prototype.patch_splitMax=function(a){for(var b=this.Match_MaxBits,c=0;c<a.length;c++)if(!(a[c].length1<=b)){var d=a[c];a.splice(c--,1);for(var e=d.start1,f=d.start2,g="";0!==d.diffs.length;){var h=new diff_match_patch.patch_obj,l=!0;h.start1=e-g.length;h.start2=f-g.length;""!==g&&(h.length1=h.length2=g.length,h.diffs.push(new diff_match_patch.Diff(DIFF_EQUAL,g)));for(;0!==d.diffs.length&&h.length1<b-this.Patch_Margin;){g=d.diffs[0][0];var k=d.diffs[0][1];g===DIFF_INSERT?(h.length2+= | ||
| 49 | k.length,f+=k.length,h.diffs.push(d.diffs.shift()),l=!1):g===DIFF_DELETE&&1==h.diffs.length&&h.diffs[0][0]==DIFF_EQUAL&&k.length>2*b?(h.length1+=k.length,e+=k.length,l=!1,h.diffs.push(new diff_match_patch.Diff(g,k)),d.diffs.shift()):(k=k.substring(0,b-h.length1-this.Patch_Margin),h.length1+=k.length,e+=k.length,g===DIFF_EQUAL?(h.length2+=k.length,f+=k.length):l=!1,h.diffs.push(new diff_match_patch.Diff(g,k)),k==d.diffs[0][1]?d.diffs.shift():d.diffs[0][1]=d.diffs[0][1].substring(k.length))}g=this.diff_text2(h.diffs); | ||
| 50 | g=g.substring(g.length-this.Patch_Margin);k=this.diff_text1(d.diffs).substring(0,this.Patch_Margin);""!==k&&(h.length1+=k.length,h.length2+=k.length,0!==h.diffs.length&&h.diffs[h.diffs.length-1][0]===DIFF_EQUAL?h.diffs[h.diffs.length-1][1]+=k:h.diffs.push(new diff_match_patch.Diff(DIFF_EQUAL,k)));l||a.splice(++c,0,h)}}};diff_match_patch.prototype.patch_toText=function(a){for(var b=[],c=0;c<a.length;c++)b[c]=a[c];return b.join("")}; | ||
| 51 | diff_match_patch.prototype.patch_fromText=function(a){var b=[];if(!a)return b;a=a.split("\n");for(var c=0,d=/^@@ -(\d+),?(\d*) \+(\d+),?(\d*) @@$/;c<a.length;){var e=a[c].match(d);if(!e)throw Error("Invalid patch string: "+a[c]);var f=new diff_match_patch.patch_obj;b.push(f);f.start1=parseInt(e[1],10);""===e[2]?(f.start1--,f.length1=1):"0"==e[2]?f.length1=0:(f.start1--,f.length1=parseInt(e[2],10));f.start2=parseInt(e[3],10);""===e[4]?(f.start2--,f.length2=1):"0"==e[4]?f.length2=0:(f.start2--,f.length2= | ||
| 52 | parseInt(e[4],10));for(c++;c<a.length;){e=a[c].charAt(0);try{var g=decodeURI(a[c].substring(1))}catch(h){throw Error("Illegal escape in patch_fromText: "+g);}if("-"==e)f.diffs.push(new diff_match_patch.Diff(DIFF_DELETE,g));else if("+"==e)f.diffs.push(new diff_match_patch.Diff(DIFF_INSERT,g));else if(" "==e)f.diffs.push(new diff_match_patch.Diff(DIFF_EQUAL,g));else if("@"==e)break;else if(""!==e)throw Error('Invalid patch mode "'+e+'" in: '+g);c++}}return b}; | ||
| 53 | diff_match_patch.patch_obj=function(){this.diffs=[];this.start2=this.start1=null;this.length2=this.length1=0}; | ||
| 54 | diff_match_patch.patch_obj.prototype.toString=function(){for(var a=["@@ -"+(0===this.length1?this.start1+",0":1==this.length1?this.start1+1:this.start1+1+","+this.length1)+" +"+(0===this.length2?this.start2+",0":1==this.length2?this.start2+1:this.start2+1+","+this.length2)+" @@\n"],b,c=0;c<this.diffs.length;c++){switch(this.diffs[c][0]){case DIFF_INSERT:b="+";break;case DIFF_DELETE:b="-";break;case DIFF_EQUAL:b=" "}a[c+1]=b+encodeURI(this.diffs[c][1])+"\n"}return a.join("").replace(/%20/g," ")}; | ||
| 55 | this.diff_match_patch=diff_match_patch;this.DIFF_DELETE=DIFF_DELETE;this.DIFF_INSERT=DIFF_INSERT;this.DIFF_EQUAL=DIFF_EQUAL; | ||
| @@ -1,108 +0,0 @@ | |||
| 1 | // Borrowed from the Droll library by thebinarypenguin | ||
| 2 | // https://github.com/thebinarypenguin/droll | ||
| 3 | // Licensed under MIT license | ||
| 4 | var droll = {}; | ||
| 5 | |||
| 6 | // Define a "class" to represent a formula | ||
| 7 | function DrollFormula() { | ||
| 8 | this.numDice = 0; | ||
| 9 | this.numSides = 0; | ||
| 10 | this.modifier = 0; | ||
| 11 | |||
| 12 | this.minResult = 0; | ||
| 13 | this.maxResult = 0; | ||
| 14 | this.avgResult = 0; | ||
| 15 | } | ||
| 16 | |||
| 17 | // Define a "class" to represent the results of the roll | ||
| 18 | function DrollResult() { | ||
| 19 | this.rolls = []; | ||
| 20 | this.modifier = 0; | ||
| 21 | this.total = 0; | ||
| 22 | } | ||
| 23 | |||
| 24 | /** | ||
| 25 | * Returns a string representation of the roll result | ||
| 26 | */ | ||
| 27 | DrollResult.prototype.toString = function () { | ||
| 28 | if (this.rolls.length === 1 && this.modifier === 0) { | ||
| 29 | return this.rolls[0] + ''; | ||
| 30 | } | ||
| 31 | |||
| 32 | if (this.rolls.length > 1 && this.modifier === 0) { | ||
| 33 | return this.rolls.join(' + ') + ' = ' + this.total; | ||
| 34 | } | ||
| 35 | |||
| 36 | if (this.rolls.length === 1 && this.modifier > 0) { | ||
| 37 | return this.rolls[0] + ' + ' + this.modifier + ' = ' + this.total; | ||
| 38 | } | ||
| 39 | |||
| 40 | if (this.rolls.length > 1 && this.modifier > 0) { | ||
| 41 | return this.rolls.join(' + ') + ' + ' + this.modifier + ' = ' + this.total; | ||
| 42 | } | ||
| 43 | |||
| 44 | if (this.rolls.length === 1 && this.modifier < 0) { | ||
| 45 | return this.rolls[0] + ' - ' + Math.abs(this.modifier) + ' = ' + this.total; | ||
| 46 | } | ||
| 47 | |||
| 48 | if (this.rolls.length > 1 && this.modifier < 0) { | ||
| 49 | return this.rolls.join(' + ') + ' - ' + Math.abs(this.modifier) + ' = ' + this.total; | ||
| 50 | } | ||
| 51 | }; | ||
| 52 | |||
| 53 | /** | ||
| 54 | * Parse the formula into its component pieces. | ||
| 55 | * Returns a DrollFormula object on success or false on failure. | ||
| 56 | */ | ||
| 57 | droll.parse = function (formula) { | ||
| 58 | var pieces = null; | ||
| 59 | var result = new DrollFormula(); | ||
| 60 | |||
| 61 | pieces = formula.match(/^([1-9]\d*)?d([1-9]\d*)([+-]\d+)?$/i); | ||
| 62 | if (!pieces) { return false; } | ||
| 63 | |||
| 64 | result.numDice = (pieces[1] - 0) || 1; | ||
| 65 | result.numSides = (pieces[2] - 0); | ||
| 66 | result.modifier = (pieces[3] - 0) || 0; | ||
| 67 | |||
| 68 | result.minResult = (result.numDice * 1) + result.modifier; | ||
| 69 | result.maxResult = (result.numDice * result.numSides) + result.modifier; | ||
| 70 | result.avgResult = (result.maxResult + result.minResult) / 2; | ||
| 71 | |||
| 72 | return result; | ||
| 73 | }; | ||
| 74 | |||
| 75 | /** | ||
| 76 | * Test the validity of the formula. | ||
| 77 | * Returns true on success or false on failure. | ||
| 78 | */ | ||
| 79 | droll.validate = function (formula) { | ||
| 80 | return (droll.parse(formula)) ? true : false; | ||
| 81 | }; | ||
| 82 | |||
| 83 | /** | ||
| 84 | * Roll the dice defined by the formula. | ||
| 85 | * Returns a DrollResult object on success or false on failure. | ||
| 86 | */ | ||
| 87 | droll.roll = function (formula) { | ||
| 88 | var pieces = null; | ||
| 89 | var result = new DrollResult(); | ||
| 90 | |||
| 91 | pieces = droll.parse(formula); | ||
| 92 | if (!pieces) { return false; } | ||
| 93 | |||
| 94 | for (var a = 0; a < pieces.numDice; a++) { | ||
| 95 | result.rolls[a] = (1 + Math.floor(Math.random() * pieces.numSides)); | ||
| 96 | } | ||
| 97 | |||
| 98 | result.modifier = pieces.modifier; | ||
| 99 | |||
| 100 | for (var b = 0; b < result.rolls.length; b++) { | ||
| 101 | result.total += result.rolls[b]; | ||
| 102 | } | ||
| 103 | result.total += result.modifier; | ||
| 104 | |||
| 105 | return result; | ||
| 106 | }; | ||
| 107 | |||
| 108 | // END OF DROLL CODE | ||
| @@ -1 +1 @@ | |||
| 1 | !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("xmldom"),require("JSZip")):"function"==typeof define&&define.amd?define(["xmldom","JSZip"],e):"object"==typeof exports?exports.ePub=e(require("xmldom"),require("JSZip")):t.ePub=e(t.xmldom,t.JSZip)}(window,(function(t,e){return function(t){var e={};function i(n){if(e[n])return e[n].exports;var r=e[n]={i:n,l:!1,exports:{}};return t[n].call(r.exports,r,r.exports,i),r.l=!0,r.exports}return i.m=t,i.c=e,i.d=function(t,e,n){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)i.d(n,r,function(e){return t[e]}.bind(null,r));return n},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="/dist/",i(i.s=86)}([function(t,e,i){"use strict";i.r(e),i.d(e,"requestAnimationFrame",(function(){return r})),i.d(e,"uuid",(function(){return o})),i.d(e,"documentHeight",(function(){return a})),i.d(e,"isElement",(function(){return h})),i.d(e,"isNumber",(function(){return l})),i.d(e,"isFloat",(function(){return c})),i.d(e,"prefixed",(function(){return u})),i.d(e,"defaults",(function(){return d})),i.d(e,"extend",(function(){return f})),i.d(e,"insert",(function(){return p})),i.d(e,"locationOf",(function(){return g})),i.d(e,"indexOfSorted",(function(){return v})),i.d(e,"bounds",(function(){return m})),i.d(e,"borders",(function(){return y})),i.d(e,"nodeBounds",(function(){return b})),i.d(e,"windowBounds",(function(){return w})),i.d(e,"indexOfNode",(function(){return x})),i.d(e,"indexOfTextNode",(function(){return E})),i.d(e,"indexOfElementNode",(function(){return S})),i.d(e,"isXml",(function(){return _})),i.d(e,"createBlob",(function(){return O})),i.d(e,"createBlobUrl",(function(){return C})),i.d(e,"revokeBlobUrl",(function(){return T})),i.d(e,"createBase64Url",(function(){return k})),i.d(e,"type",(function(){return R})),i.d(e,"parse",(function(){return L})),i.d(e,"qs",(function(){return I})),i.d(e,"qsa",(function(){return j})),i.d(e,"qsp",(function(){return N})),i.d(e,"sprint",(function(){return A})),i.d(e,"treeWalker",(function(){return P})),i.d(e,"walk",(function(){return D})),i.d(e,"blob2base64",(function(){return z})),i.d(e,"defer",(function(){return B})),i.d(e,"querySelectorByType",(function(){return q})),i.d(e,"findChildren",(function(){return M})),i.d(e,"parents",(function(){return U})),i.d(e,"filterChildren",(function(){return F})),i.d(e,"getParentByTagName",(function(){return W})),i.d(e,"RangeObject",(function(){return H}));i(24),i(14),i(20);var n=i(38);const r="undefined"!=typeof window&&(window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame),s="undefined"!=typeof URL?URL:"undefined"!=typeof window?window.URL||window.webkitURL||window.mozURL:void 0;function o(){var t=(new Date).getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var i=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"==e?i:7&i|8).toString(16)}))}function a(){return Math.max(document.documentElement.clientHeight,document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight)}function h(t){return!(!t||1!=t.nodeType)}function l(t){return!isNaN(parseFloat(t))&&isFinite(t)}function c(t){let e=parseFloat(t);return!1!==l(t)&&("string"==typeof t&&t.indexOf(".")>-1||Math.floor(e)!==e)}function u(t){var e=["-webkit-","-webkit-","-moz-","-o-","-ms-"],i=t.toLowerCase(),n=["Webkit","webkit","Moz","O","ms"].length;if("undefined"==typeof document||void 0!==document.body.style[i])return t;for(var r=0;r<n;r++)if(void 0!==document.body.style[e[r]+i])return e[r]+i;return t}function d(t){for(var e=1,i=arguments.length;e<i;e++){var n=arguments[e];for(var r in n)void 0===t[r]&&(t[r]=n[r])}return t}function f(t){var e=[].slice.call(arguments,1);return e.forEach((function(e){e&&Object.getOwnPropertyNames(e).forEach((function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(e,i))}))})),t}function p(t,e,i){var n=g(t,e,i);return e.splice(n,0,t),n}function g(t,e,i,n,r){var s,o=n||0,a=r||e.length,h=parseInt(o+(a-o)/2);return i||(i=function(t,e){return t>e?1:t<e?-1:t==e?0:void 0}),a-o<=0?h:(s=i(e[h],t),a-o==1?s>=0?h:h+1:0===s?h:-1===s?g(t,e,i,h,a):g(t,e,i,o,h))}function v(t,e,i,n,r){var s,o=n||0,a=r||e.length,h=parseInt(o+(a-o)/2);return i||(i=function(t,e){return t>e?1:t<e?-1:t==e?0:void 0}),a-o<=0?-1:(s=i(e[h],t),a-o==1?0===s?h:-1:0===s?h:-1===s?v(t,e,i,h,a):v(t,e,i,o,h))}function m(t){var e=window.getComputedStyle(t),i=0,n=0;return["width","paddingRight","paddingLeft","marginRight","marginLeft","borderRightWidth","borderLeftWidth"].forEach((function(t){i+=parseFloat(e[t])||0})),["height","paddingTop","paddingBottom","marginTop","marginBottom","borderTopWidth","borderBottomWidth"].forEach((function(t){n+=parseFloat(e[t])||0})),{height:n,width:i}}function y(t){var e=window.getComputedStyle(t),i=0,n=0;return["paddingRight","paddingLeft","marginRight","marginLeft","borderRightWidth","borderLeftWidth"].forEach((function(t){i+=parseFloat(e[t])||0})),["paddingTop","paddingBottom","marginTop","marginBottom","borderTopWidth","borderBottomWidth"].forEach((function(t){n+=parseFloat(e[t])||0})),{height:n,width:i}}function b(t){let e,i=t.ownerDocument;if(t.nodeType==Node.TEXT_NODE){let n=i.createRange();n.selectNodeContents(t),e=n.getBoundingClientRect()}else e=t.getBoundingClientRect();return e}function w(){var t=window.innerWidth,e=window.innerHeight;return{top:0,left:0,right:t,bottom:e,width:t,height:e}}function x(t,e){for(var i,n=t.parentNode.childNodes,r=-1,s=0;s<n.length&&((i=n[s]).nodeType===e&&r++,i!=t);s++);return r}function E(t){return x(t,3)}function S(t){return x(t,1)}function _(t){return["xml","opf","ncx"].indexOf(t)>-1}function O(t,e){return new Blob([t],{type:e})}function C(t,e){var i=O(t,e);return s.createObjectURL(i)}function T(t){return s.revokeObjectURL(t)}function k(t,e){if("string"==typeof t)return"data:"+e+";base64,"+btoa(encodeURIComponent(t))}function R(t){return Object.prototype.toString.call(t).slice(8,-1)}function L(t,e,i){var r;return r="undefined"==typeof DOMParser||i?n.DOMParser:DOMParser,65279===t.charCodeAt(0)&&(t=t.slice(1)),(new r).parseFromString(t,e)}function I(t,e){var i;if(!t)throw new Error("No Element Provided");return void 0!==t.querySelector?t.querySelector(e):(i=t.getElementsByTagName(e)).length?i[0]:void 0}function j(t,e){return void 0!==t.querySelector?t.querySelectorAll(e):t.getElementsByTagName(e)}function N(t,e,i){var n,r;if(void 0!==t.querySelector){for(var s in e+="[",i)e+=s+"~='"+i[s]+"'";return e+="]",t.querySelector(e)}if(n=t.getElementsByTagName(e),r=Array.prototype.slice.call(n,0).filter((function(t){for(var e in i)if(t.getAttribute(e)===i[e])return!0;return!1})))return r[0]}function A(t,e){void 0!==(t.ownerDocument||t).createTreeWalker?P(t,e,NodeFilter.SHOW_TEXT):D(t,(function(t){t&&3===t.nodeType&&e(t)}))}function P(t,e,i){var n=document.createTreeWalker(t,i,null,!1);let r;for(;r=n.nextNode();)e(r)}function D(t,e){if(e(t))return!0;if(t=t.firstChild)do{if(D(t,e))return!0;t=t.nextSibling}while(t)}function z(t){return new Promise((function(e,i){var n=new FileReader;n.readAsDataURL(t),n.onloadend=function(){e(n.result)}}))}function B(){this.resolve=null,this.reject=null,this.id=o(),this.promise=new Promise((t,e)=>{this.resolve=t,this.reject=e}),Object.freeze(this)}function q(t,e,i){var n;if(void 0!==t.querySelector&&(n=t.querySelector(`${e}[*|type="${i}"]`)),n&&0!==n.length)return n;n=j(t,e);for(var r=0;r<n.length;r++)if(n[r].getAttributeNS("http://www.idpf.org/2007/ops","type")===i||n[r].getAttribute("epub:type")===i)return n[r]}function M(t){for(var e=[],i=t.childNodes,n=0;n<i.length;n++){let t=i[n];1===t.nodeType&&e.push(t)}return e}function U(t){for(var e=[t];t;t=t.parentNode)e.unshift(t);return e}function F(t,e,i){for(var n=[],r=t.childNodes,s=0;s<r.length;s++){let t=r[s];if(1===t.nodeType&&t.nodeName.toLowerCase()===e){if(i)return t;n.push(t)}}if(!i)return n}function W(t,e){let i;if(null!==t&&""!==e)for(i=t.parentNode;1===i.nodeType;){if(i.tagName.toLowerCase()===e)return i;i=i.parentNode}}class H{constructor(){this.collapsed=!1,this.commonAncestorContainer=void 0,this.endContainer=void 0,this.endOffset=void 0,this.startContainer=void 0,this.startOffset=void 0}setStart(t,e){this.startContainer=t,this.startOffset=e,this.endContainer?this.commonAncestorContainer=this._commonAncestorContainer():this.collapse(!0),this._checkCollapsed()}setEnd(t,e){this.endContainer=t,this.endOffset=e,this.startContainer?(this.collapsed=!1,this.commonAncestorContainer=this._commonAncestorContainer()):this.collapse(!1),this._checkCollapsed()}collapse(t){this.collapsed=!0,t?(this.endContainer=this.startContainer,this.endOffset=this.startOffset,this.commonAncestorContainer=this.startContainer.parentNode):(this.startContainer=this.endContainer,this.startOffset=this.endOffset,this.commonAncestorContainer=this.endOffset.parentNode)}selectNode(t){let e=t.parentNode,i=Array.prototype.indexOf.call(e.childNodes,t);this.setStart(e,i),this.setEnd(e,i+1)}selectNodeContents(t){t.childNodes[t.childNodes-1];let e=3===t.nodeType?t.textContent.length:parent.childNodes.length;this.setStart(t,0),this.setEnd(t,e)}_commonAncestorContainer(t,e){var i=U(t||this.startContainer),n=U(e||this.endContainer);if(i[0]==n[0])for(var r=0;r<i.length;r++)if(i[r]!=n[r])return i[r-1]}_checkCollapsed(){this.startContainer===this.endContainer&&this.startOffset===this.endOffset?this.collapsed=!0:this.collapsed=!1}toString(){}}},function(t,e,i){"use strict";i.d(e,"b",(function(){return n})),i.d(e,"a",(function(){return r})),i.d(e,"c",(function(){return s}));const n="0.3",r=["keydown","keyup","keypressed","mouseup","mousedown","click","touchend","touchstart","touchmove"],s={BOOK:{OPEN_FAILED:"openFailed"},CONTENTS:{EXPAND:"expand",RESIZE:"resize",SELECTED:"selected",SELECTED_RANGE:"selectedRange",LINK_CLICKED:"linkClicked"},LOCATIONS:{CHANGED:"changed"},MANAGERS:{RESIZE:"resize",RESIZED:"resized",ORIENTATION_CHANGE:"orientationchange",ADDED:"added",SCROLL:"scroll",SCROLLED:"scrolled",REMOVED:"removed"},VIEWS:{AXIS:"axis",WRITING_MODE:"writingMode",LOAD_ERROR:"loaderror",RENDERED:"rendered",RESIZED:"resized",DISPLAYED:"displayed",SHOWN:"shown",HIDDEN:"hidden",MARK_CLICKED:"markClicked"},RENDITION:{STARTED:"started",ATTACHED:"attached",DISPLAYED:"displayed",DISPLAY_ERROR:"displayerror",RENDERED:"rendered",REMOVED:"removed",RESIZED:"resized",ORIENTATION_CHANGE:"orientationchange",LOCATION_CHANGED:"locationChanged",RELOCATED:"relocated",MARK_CLICKED:"markClicked",SELECTED:"selected",LAYOUT:"layout"},LAYOUT:{UPDATED:"updated"},ANNOTATION:{ATTACH:"attach",DETACH:"detach"}}},function(t,e,i){"use strict";var n=i(0);class r{constructor(t,e,i){var s;if(this.str="",this.base={},this.spinePos=0,this.range=!1,this.path={},this.start=null,this.end=null,!(this instanceof r))return new r(t,e,i);if("string"==typeof e?this.base=this.parseComponent(e):"object"==typeof e&&e.steps&&(this.base=e),"string"===(s=this.checkType(t)))return this.str=t,Object(n.extend)(this,this.parse(t));if("range"===s)return Object(n.extend)(this,this.fromRange(t,this.base,i));if("node"===s)return Object(n.extend)(this,this.fromNode(t,this.base,i));if("EpubCFI"===s&&t.path)return t;if(t)throw new TypeError("not a valid argument for EpubCFI");return this}checkType(t){return this.isCfiString(t)?"string":!t||"object"!=typeof t||"Range"!==Object(n.type)(t)&&void 0===t.startContainer?t&&"object"==typeof t&&void 0!==t.nodeType?"node":!!(t&&"object"==typeof t&&t instanceof r)&&"EpubCFI":"range"}parse(t){var e,i,n,r={spinePos:-1,range:!1,base:{},path:{},start:null,end:null};return"string"!=typeof t?{spinePos:-1}:(0===t.indexOf("epubcfi(")&&")"===t[t.length-1]&&(t=t.slice(8,t.length-1)),(e=this.getChapterComponent(t))?(r.base=this.parseComponent(e),i=this.getPathComponent(t),r.path=this.parseComponent(i),(n=this.getRange(t))&&(r.range=!0,r.start=this.parseComponent(n[0]),r.end=this.parseComponent(n[1])),r.spinePos=r.base.steps[1].index,r):{spinePos:-1})}parseComponent(t){var e,i={steps:[],terminal:{offset:null,assertion:null}},n=t.split(":"),r=n[0].split("/");return n.length>1&&(e=n[1],i.terminal=this.parseTerminal(e)),""===r[0]&&r.shift(),i.steps=r.map(function(t){return this.parseStep(t)}.bind(this)),i}parseStep(t){var e,i,n,r,s;if((r=t.match(/\[(.*)\]/))&&r[1]&&(s=r[1]),i=parseInt(t),!isNaN(i))return i%2==0?(e="element",n=i/2-1):(e="text",n=(i-1)/2),{type:e,index:n,id:s||null}}parseTerminal(t){var e,i,r=t.match(/\[(.*)\]/);return r&&r[1]?(e=parseInt(t.split("[")[0]),i=r[1]):e=parseInt(t),Object(n.isNumber)(e)||(e=null),{offset:e,assertion:i}}getChapterComponent(t){return t.split("!")[0]}getPathComponent(t){var e=t.split("!");if(e[1]){return e[1].split(",")[0]}}getRange(t){var e=t.split(",");return 3===e.length&&[e[1],e[2]]}getCharecterOffsetComponent(t){return t.split(":")[1]||""}joinSteps(t){return t?t.map((function(t){var e="";return"element"===t.type&&(e+=2*(t.index+1)),"text"===t.type&&(e+=1+2*t.index),t.id&&(e+="["+t.id+"]"),e})).join("/"):""}segmentString(t){var e="/";return e+=this.joinSteps(t.steps),t.terminal&&null!=t.terminal.offset&&(e+=":"+t.terminal.offset),t.terminal&&null!=t.terminal.assertion&&(e+="["+t.terminal.assertion+"]"),e}toString(){var t="epubcfi(";return t+=this.segmentString(this.base),t+="!",t+=this.segmentString(this.path),this.range&&this.start&&(t+=",",t+=this.segmentString(this.start)),this.range&&this.end&&(t+=",",t+=this.segmentString(this.end)),t+=")"}compare(t,e){var i,n,s,o;if("string"==typeof t&&(t=new r(t)),"string"==typeof e&&(e=new r(e)),t.spinePos>e.spinePos)return 1;if(t.spinePos<e.spinePos)return-1;t.range?(i=t.path.steps.concat(t.start.steps),s=t.start.terminal):(i=t.path.steps,s=t.path.terminal),e.range?(n=e.path.steps.concat(e.start.steps),o=e.start.terminal):(n=e.path.steps,o=e.path.terminal);for(var a=0;a<i.length;a++){if(!i[a])return-1;if(!n[a])return 1;if(i[a].index>n[a].index)return 1;if(i[a].index<n[a].index)return-1}return i.length<n.length?-1:s.offset>o.offset?1:s.offset<o.offset?-1:0}step(t){var e=3===t.nodeType?"text":"element";return{id:t.id,tagName:t.tagName,type:e,index:this.position(t)}}filteredStep(t,e){var i,n=this.filter(t,e);if(n)return i=3===n.nodeType?"text":"element",{id:n.id,tagName:n.tagName,type:i,index:this.filteredPosition(n,e)}}pathTo(t,e,i){for(var n,r={steps:[],terminal:{offset:null,assertion:null}},s=t;s&&s.parentNode&&9!=s.parentNode.nodeType;)(n=i?this.filteredStep(s,i):this.step(s))&&r.steps.unshift(n),s=s.parentNode;return null!=e&&e>=0&&(r.terminal.offset=e,"text"!=r.steps[r.steps.length-1].type&&r.steps.push({type:"text",index:0})),r}equalStep(t,e){return!(!t||!e)&&(t.index===e.index&&t.id===e.id&&t.type===e.type)}fromRange(t,e,i){var n={range:!1,base:{},path:{},start:null,end:null},r=t.startContainer,s=t.endContainer,o=t.startOffset,a=t.endOffset,h=!1;if(i&&(h=null!=r.ownerDocument.querySelector("."+i)),"string"==typeof e?(n.base=this.parseComponent(e),n.spinePos=n.base.steps[1].index):"object"==typeof e&&(n.base=e),t.collapsed)h&&(o=this.patchOffset(r,o,i)),n.path=this.pathTo(r,o,i);else{n.range=!0,h&&(o=this.patchOffset(r,o,i)),n.start=this.pathTo(r,o,i),h&&(a=this.patchOffset(s,a,i)),n.end=this.pathTo(s,a,i),n.path={steps:[],terminal:null};var l,c=n.start.steps.length;for(l=0;l<c&&this.equalStep(n.start.steps[l],n.end.steps[l]);l++)l===c-1?n.start.terminal===n.end.terminal&&(n.path.steps.push(n.start.steps[l]),n.range=!1):n.path.steps.push(n.start.steps[l]);n.start.steps=n.start.steps.slice(n.path.steps.length),n.end.steps=n.end.steps.slice(n.path.steps.length)}return n}fromNode(t,e,i){var n={range:!1,base:{},path:{},start:null,end:null};return"string"==typeof e?(n.base=this.parseComponent(e),n.spinePos=n.base.steps[1].index):"object"==typeof e&&(n.base=e),n.path=this.pathTo(t,null,i),n}filter(t,e){var i,n,r,s,o,a=!1;return 3===t.nodeType?(a=!0,r=t.parentNode,i=t.parentNode.classList.contains(e)):(a=!1,i=t.classList.contains(e)),i&&a?(s=r.previousSibling,o=r.nextSibling,s&&3===s.nodeType?n=s:o&&3===o.nodeType&&(n=o),n||t):!(i&&!a)&&t}patchOffset(t,e,i){if(3!=t.nodeType)throw new Error("Anchor must be a text node");var n=t,r=e;for(t.parentNode.classList.contains(i)&&(n=t.parentNode);n.previousSibling;){if(1===n.previousSibling.nodeType){if(!n.previousSibling.classList.contains(i))break;r+=n.previousSibling.textContent.length}else r+=n.previousSibling.textContent.length;n=n.previousSibling}return r}normalizedMap(t,e,i){var n,r,s,o={},a=-1,h=t.length;for(n=0;n<h;n++)1===(r=t[n].nodeType)&&t[n].classList.contains(i)&&(r=3),n>0&&3===r&&3===s?o[n]=a:e===r&&(a+=1,o[n]=a),s=r;return o}position(t){var e,i;return 1===t.nodeType?((e=t.parentNode.children)||(e=Object(n.findChildren)(t.parentNode)),i=Array.prototype.indexOf.call(e,t)):i=(e=this.textNodes(t.parentNode)).indexOf(t),i}filteredPosition(t,e){var i,n;return 1===t.nodeType?(i=t.parentNode.children,n=this.normalizedMap(i,1,e)):(i=t.parentNode.childNodes,t.parentNode.classList.contains(e)&&(i=(t=t.parentNode).parentNode.childNodes),n=this.normalizedMap(i,3,e)),n[Array.prototype.indexOf.call(i,t)]}stepsToXpath(t){var e=[".","*"];return t.forEach((function(t){var i=t.index+1;t.id?e.push("*[position()="+i+" and @id='"+t.id+"']"):"text"===t.type?e.push("text()["+i+"]"):e.push("*["+i+"]")})),e.join("/")}stepsToQuerySelector(t){var e=["html"];return t.forEach((function(t){var i=t.index+1;t.id?e.push("#"+t.id):"text"===t.type||e.push("*:nth-child("+i+")")})),e.join(">")}textNodes(t,e){return Array.prototype.slice.call(t.childNodes).filter((function(t){return 3===t.nodeType||!(!e||!t.classList.contains(e))}))}walkToNode(t,e,i){var r,s,o=e||document,a=o.documentElement,h=t.length;for(s=0;s<h&&("element"===(r=t[s]).type?a=r.id?o.getElementById(r.id):(a.children||Object(n.findChildren)(a))[r.index]:"text"===r.type&&(a=this.textNodes(a,i)[r.index]),a);s++);return a}findNode(t,e,i){var n,r,s=e||document;return i||void 0===s.evaluate?n=i?this.walkToNode(t,s,i):this.walkToNode(t,s):(r=this.stepsToXpath(t),n=s.evaluate(r,s,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue),n}fixMiss(t,e,i,n){var r,s,o=this.findNode(t.slice(0,-1),i,n),a=o.childNodes,h=this.normalizedMap(a,3,n),l=t[t.length-1].index;for(let t in h){if(!h.hasOwnProperty(t))return;if(h[t]===l){if(!(e>(s=(r=a[t]).textContent.length))){o=1===r.nodeType?r.childNodes[0]:r;break}e-=s}}return{container:o,offset:e}}toRange(t,e){var i,r,s,o,a,h,l,c,u=t||document,d=!!e&&null!=u.querySelector("."+e);if(i=void 0!==u.createRange?u.createRange():new n.RangeObject,this.range?(r=this.start,h=this.path.steps.concat(r.steps),o=this.findNode(h,u,d?e:null),s=this.end,l=this.path.steps.concat(s.steps),a=this.findNode(l,u,d?e:null)):(r=this.path,h=this.path.steps,o=this.findNode(this.path.steps,u,d?e:null)),!o)return console.log("No startContainer found for",this.toString()),null;try{null!=r.terminal.offset?i.setStart(o,r.terminal.offset):i.setStart(o,0)}catch(t){c=this.fixMiss(h,r.terminal.offset,u,d?e:null),i.setStart(c.container,c.offset)}if(a)try{null!=s.terminal.offset?i.setEnd(a,s.terminal.offset):i.setEnd(a,0)}catch(t){c=this.fixMiss(l,this.end.terminal.offset,u,d?e:null),i.setEnd(c.container,c.offset)}return i}isCfiString(t){return"string"==typeof t&&0===t.indexOf("epubcfi(")&&")"===t[t.length-1]}generateChapterComponent(t,e,i){var n="/"+2*(t+1)+"/";return n+=2*(parseInt(e)+1),i&&(n+="["+i+"]"),n}collapse(t){this.range&&(this.range=!1,t?(this.path.steps=this.path.steps.concat(this.start.steps),this.path.terminal=this.start.terminal):(this.path.steps=this.path.steps.concat(this.end.steps),this.path.terminal=this.end.terminal))}}e.a=r},function(t,e,i){"use strict";var n,r,s,o,a,h,l,c=i(108),u=i(122),d=Function.prototype.apply,f=Function.prototype.call,p=Object.create,g=Object.defineProperty,v=Object.defineProperties,m=Object.prototype.hasOwnProperty,y={configurable:!0,enumerable:!1,writable:!0};r=function(t,e){var i,r;return u(e),r=this,n.call(this,t,i=function(){s.call(r,t,i),d.call(e,this,arguments)}),i.__eeOnceListener__=e,this},a={on:n=function(t,e){var i;return u(e),m.call(this,"__ee__")?i=this.__ee__:(i=y.value=p(null),g(this,"__ee__",y),y.value=null),i[t]?"object"==typeof i[t]?i[t].push(e):i[t]=[i[t],e]:i[t]=e,this},once:r,off:s=function(t,e){var i,n,r,s;if(u(e),!m.call(this,"__ee__"))return this;if(!(i=this.__ee__)[t])return this;if("object"==typeof(n=i[t]))for(s=0;r=n[s];++s)r!==e&&r.__eeOnceListener__!==e||(2===n.length?i[t]=n[s?0:1]:n.splice(s,1));else n!==e&&n.__eeOnceListener__!==e||delete i[t];return this},emit:o=function(t){var e,i,n,r,s;if(m.call(this,"__ee__")&&(r=this.__ee__[t]))if("object"==typeof r){for(i=arguments.length,s=new Array(i-1),e=1;e<i;++e)s[e-1]=arguments[e];for(r=r.slice(),e=0;n=r[e];++e)d.call(n,this,s)}else switch(arguments.length){case 1:f.call(r,this);break;case 2:f.call(r,this,arguments[1]);break;case 3:f.call(r,this,arguments[1],arguments[2]);break;default:for(i=arguments.length,s=new Array(i-1),e=1;e<i;++e)s[e-1]=arguments[e];d.call(r,this,s)}}},h={on:c(n),once:c(r),off:c(s),emit:c(o)},l=v({},h),t.exports=e=function(t){return null==t?p(l):v(Object(t),h)},e.methods=a},function(t,e,i){"use strict";i(14),i(20);var n=i(9),r=i.n(n);e.a=class{constructor(t){var e;t.indexOf("://")>-1&&(t=new URL(t).pathname),e=this.parse(t),this.path=t,this.isDirectory(t)?this.directory=t:this.directory=e.dir+"/",this.filename=e.base,this.extension=e.ext.slice(1)}parse(t){return r.a.parse(t)}isAbsolute(t){return r.a.isAbsolute(t||this.path)}isDirectory(t){return"/"===t.charAt(t.length-1)}resolve(t){return r.a.resolve(this.directory,t)}relative(t){return t&&t.indexOf("://")>-1?t:r.a.relative(this.directory,t)}splitPath(t){return this.splitPathRe.exec(t).slice(1)}toString(){return this.path}}},function(t,e,i){"use strict";i(14),i(20);var n=i(4),r=i(9),s=i.n(r);e.a=class{constructor(t,e){var i=t.indexOf("://")>-1,r=t;if(this.Url=void 0,this.href=t,this.protocol="",this.origin="",this.hash="",this.hash="",this.search="",this.base=e,!i&&!1!==e&&"string"!=typeof e&&window&&window.location&&(this.base=window.location.href),i||this.base)try{this.base?this.Url=new URL(t,this.base):this.Url=new URL(t),this.href=this.Url.href,this.protocol=this.Url.protocol,this.origin=this.Url.origin,this.hash=this.Url.hash,this.search=this.Url.search,r=this.Url.pathname+(this.Url.search?this.Url.search:"")}catch(t){this.Url=void 0,this.base&&(r=new n.a(this.base).resolve(r))}this.Path=new n.a(r),this.directory=this.Path.directory,this.filename=this.Path.filename,this.extension=this.Path.extension}path(){return this.Path}resolve(t){var e;return t.indexOf("://")>-1?t:(e=s.a.resolve(this.directory,t),this.origin+e)}relative(t){return s.a.relative(t,this.directory)}toString(){return this.href}}},function(t,e,i){"use strict";i(14);e.a=class{constructor(t){this.context=t||this,this.hooks=[]}register(){for(var t=0;t<arguments.length;++t)if("function"==typeof arguments[t])this.hooks.push(arguments[t]);else for(var e=0;e<arguments[t].length;++e)this.hooks.push(arguments[t][e])}deregister(t){let e;for(let i=0;i<this.hooks.length;i++)if(e=this.hooks[i],e===t){this.hooks.splice(i,1);break}}trigger(){var t=arguments,e=this.context,i=[];return this.hooks.forEach((function(n){var r=n.apply(e,t);r&&"function"==typeof r.then&&i.push(r)})),Promise.all(i)}list(){return this.hooks}clear(){return this.hooks=[]}}},function(t,e,i){(function(e){var i=function(t){return t&&t.Math==Math&&t};t.exports=i("object"==typeof globalThis&&globalThis)||i("object"==typeof window&&window)||i("object"==typeof self&&self)||i("object"==typeof e&&e)||Function("return this")()}).call(this,i(30))},function(t,e,i){var n=i(7),r=i(66),s=i(10),o=i(67),a=i(70),h=i(99),l=r("wks"),c=n.Symbol,u=h?c:c&&c.withoutSetter||o;t.exports=function(t){return s(l,t)||(a&&s(c,t)?l[t]=c[t]:l[t]=u("Symbol."+t)),l[t]}},function(t,e,i){"use strict";if(!n)var n={cwd:function(){return"/"}};function r(t){if("string"!=typeof t)throw new TypeError("Path must be a string. Received "+t)}function s(t,e){for(var i,n="",r=-1,s=0,o=0;o<=t.length;++o){if(o<t.length)i=t.charCodeAt(o);else{if(47===i)break;i=47}if(47===i){if(r===o-1||1===s);else if(r!==o-1&&2===s){if(n.length<2||46!==n.charCodeAt(n.length-1)||46!==n.charCodeAt(n.length-2))if(n.length>2){for(var a=n.length-1,h=a;h>=0&&47!==n.charCodeAt(h);--h);if(h!==a){n=-1===h?"":n.slice(0,h),r=o,s=0;continue}}else if(2===n.length||1===n.length){n="",r=o,s=0;continue}e&&(n.length>0?n+="/..":n="..")}else n.length>0?n+="/"+t.slice(r+1,o):n=t.slice(r+1,o);r=o,s=0}else 46===i&&-1!==s?++s:s=-1}return n}var o={resolve:function(){for(var t,e="",i=!1,o=arguments.length-1;o>=-1&&!i;o--){var a;o>=0?a=arguments[o]:(void 0===t&&(t=n.cwd()),a=t),r(a),0!==a.length&&(e=a+"/"+e,i=47===a.charCodeAt(0))}return e=s(e,!i),i?e.length>0?"/"+e:"/":e.length>0?e:"."},normalize:function(t){if(r(t),0===t.length)return".";var e=47===t.charCodeAt(0),i=47===t.charCodeAt(t.length-1);return 0!==(t=s(t,!e)).length||e||(t="."),t.length>0&&i&&(t+="/"),e?"/"+t:t},isAbsolute:function(t){return r(t),t.length>0&&47===t.charCodeAt(0)},join:function(){if(0===arguments.length)return".";for(var t,e=0;e<arguments.length;++e){var i=arguments[e];r(i),i.length>0&&(void 0===t?t=i:t+="/"+i)}return void 0===t?".":o.normalize(t)},relative:function(t,e){if(r(t),r(e),t===e)return"";if((t=o.resolve(t))===(e=o.resolve(e)))return"";for(var i=1;i<t.length&&47===t.charCodeAt(i);++i);for(var n=t.length,s=n-i,a=1;a<e.length&&47===e.charCodeAt(a);++a);for(var h=e.length-a,l=s<h?s:h,c=-1,u=0;u<=l;++u){if(u===l){if(h>l){if(47===e.charCodeAt(a+u))return e.slice(a+u+1);if(0===u)return e.slice(a+u)}else s>l&&(47===t.charCodeAt(i+u)?c=u:0===u&&(c=0));break}var d=t.charCodeAt(i+u);if(d!==e.charCodeAt(a+u))break;47===d&&(c=u)}var f="";for(u=i+c+1;u<=n;++u)u!==n&&47!==t.charCodeAt(u)||(0===f.length?f+="..":f+="/..");return f.length>0?f+e.slice(a+c):(a+=c,47===e.charCodeAt(a)&&++a,e.slice(a))},_makeLong:function(t){return t},dirname:function(t){if(r(t),0===t.length)return".";for(var e=t.charCodeAt(0),i=47===e,n=-1,s=!0,o=t.length-1;o>=1;--o)if(47===(e=t.charCodeAt(o))){if(!s){n=o;break}}else s=!1;return-1===n?i?"/":".":i&&1===n?"//":t.slice(0,n)},basename:function(t,e){if(void 0!==e&&"string"!=typeof e)throw new TypeError('"ext" argument must be a string');r(t);var i,n=0,s=-1,o=!0;if(void 0!==e&&e.length>0&&e.length<=t.length){if(e.length===t.length&&e===t)return"";var a=e.length-1,h=-1;for(i=t.length-1;i>=0;--i){var l=t.charCodeAt(i);if(47===l){if(!o){n=i+1;break}}else-1===h&&(o=!1,h=i+1),a>=0&&(l===e.charCodeAt(a)?-1==--a&&(s=i):(a=-1,s=h))}return n===s?s=h:-1===s&&(s=t.length),t.slice(n,s)}for(i=t.length-1;i>=0;--i)if(47===t.charCodeAt(i)){if(!o){n=i+1;break}}else-1===s&&(o=!1,s=i+1);return-1===s?"":t.slice(n,s)},extname:function(t){r(t);for(var e=-1,i=0,n=-1,s=!0,o=0,a=t.length-1;a>=0;--a){var h=t.charCodeAt(a);if(47!==h)-1===n&&(s=!1,n=a+1),46===h?-1===e?e=a:1!==o&&(o=1):-1!==e&&(o=-1);else if(!s){i=a+1;break}}return-1===e||-1===n||0===o||1===o&&e===n-1&&e===i+1?"":t.slice(e,n)},format:function(t){if(null===t||"object"!=typeof t)throw new TypeError('Parameter "pathObject" must be an object, not '+typeof t);return function(t,e){var i=e.dir||e.root,n=e.base||(e.name||"")+(e.ext||"");return i?i===e.root?i+n:i+t+n:n}("/",t)},parse:function(t){r(t);var e={root:"",dir:"",base:"",ext:"",name:""};if(0===t.length)return e;var i,n=t.charCodeAt(0),s=47===n;s?(e.root="/",i=1):i=0;for(var o=-1,a=0,h=-1,l=!0,c=t.length-1,u=0;c>=i;--c)if(47!==(n=t.charCodeAt(c)))-1===h&&(l=!1,h=c+1),46===n?-1===o?o=c:1!==u&&(u=1):-1!==o&&(u=-1);else if(!l){a=c+1;break}return-1===o||-1===h||0===u||1===u&&o===h-1&&o===a+1?-1!==h&&(e.base=e.name=0===a&&s?t.slice(1,h):t.slice(a,h)):(0===a&&s?(e.name=t.slice(1,o),e.base=t.slice(1,h)):(e.name=t.slice(a,o),e.base=t.slice(a,h)),e.ext=t.slice(o,h)),a>0?e.dir=t.slice(0,a-1):s&&(e.dir="/"),e},sep:"/",delimiter:":",posix:null};t.exports=o},function(t,e){var i={}.hasOwnProperty;t.exports=function(t,e){return i.call(t,e)}},function(t,e,i){"use strict";i.d(e,"a",(function(){return s})),i.d(e,"b",(function(){return o})),i.d(e,"d",(function(){return a})),i.d(e,"c",(function(){return h})),i.d(e,"e",(function(){return l}));i(24);var n=i(0),r=i(5);i(4);function s(t,e){var i,r,s=e.url,o=s.indexOf("://")>-1;t&&(r=Object(n.qs)(t,"head"),(i=Object(n.qs)(r,"base"))||(i=t.createElement("base"),r.insertBefore(i,r.firstChild)),!o&&window&&window.location&&(s=window.location.origin+s),i.setAttribute("href",s))}function o(t,e){var i,r,s=e.canonical;t&&(i=Object(n.qs)(t,"head"),(r=Object(n.qs)(i,"link[rel='canonical']"))?r.setAttribute("href",s):((r=t.createElement("link")).setAttribute("rel","canonical"),r.setAttribute("href",s),i.appendChild(r)))}function a(t,e){var i,r,s=e.idref;t&&(i=Object(n.qs)(t,"head"),(r=Object(n.qs)(i,"link[property='dc.identifier']"))?r.setAttribute("content",s):((r=t.createElement("meta")).setAttribute("name","dc.identifier"),r.setAttribute("content",s),i.appendChild(r)))}function h(t,e){var i=t.querySelectorAll("a[href]");if(i.length)for(var s=Object(n.qs)(t.ownerDocument,"base"),o=s?s.getAttribute("href"):void 0,a=function(t){var i=t.getAttribute("href");if(0!==i.indexOf("mailto:"))if(i.indexOf("://")>-1)t.setAttribute("target","_blank");else{var n;try{n=new r.a(i,o)}catch(t){}t.onclick=function(){return n&&n.hash?e(n.Path.path+n.hash):e(n?n.Path.path:i),!1}}}.bind(this),h=0;h<i.length;h++)a(i[h])}function l(t,e,i){return e.forEach((function(e,n){e&&i[n]&&(e=e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),t=t.replace(new RegExp(e,"g"),i[n]))})),t}},function(t,e){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,e,i){var n=i(17);t.exports=function(t){if(!n(t))throw TypeError(String(t)+" is not an object");return t}},function(t,e,i){var n=i(7),r=i(102),s=i(71),o=i(15),a=i(8),h=a("iterator"),l=a("toStringTag"),c=s.values;for(var u in r){var d=n[u],f=d&&d.prototype;if(f){if(f[h]!==c)try{o(f,h,c)}catch(t){f[h]=c}if(f[l]||o(f,l,u),r[u])for(var p in s)if(f[p]!==s[p])try{o(f,p,s[p])}catch(t){f[p]=s[p]}}}},function(t,e,i){var n=i(16),r=i(18),s=i(25);t.exports=n?function(t,e,i){return r.f(t,e,s(1,i))}:function(t,e,i){return t[e]=i,t}},function(t,e,i){var n=i(12);t.exports=!n((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}))},function(t,e){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,e,i){var n=i(16),r=i(62),s=i(13),o=i(41),a=Object.defineProperty;e.f=n?a:function(t,e,i){if(s(t),e=o(e,!0),s(i),r)try{return a(t,e,i)}catch(t){}if("get"in i||"set"in i)throw TypeError("Accessors not supported");return"value"in i&&(t[e]=i.value),t}},function(t,e,i){var n=i(7),r=i(15),s=i(10),o=i(42),a=i(64),h=i(26),l=h.get,c=h.enforce,u=String(String).split("String");(t.exports=function(t,e,i,a){var h=!!a&&!!a.unsafe,l=!!a&&!!a.enumerable,d=!!a&&!!a.noTargetGet;"function"==typeof i&&("string"!=typeof e||s(i,"name")||r(i,"name",e),c(i).source=u.join("string"==typeof e?e:"")),t!==n?(h?!d&&t[e]&&(l=!0):delete t[e],l?t[e]=i:r(t,e,i)):l?t[e]=i:o(e,i)})(Function.prototype,"toString",(function(){return"function"==typeof this&&l(this).source||a(this)}))},function(t,e,i){"use strict";i(123);var n,r=i(31),s=i(16),o=i(78),a=i(7),h=i(72),l=i(19),c=i(79),u=i(10),d=i(124),f=i(125),p=i(49).codeAt,g=i(131),v=i(37),m=i(132),y=i(26),b=a.URL,w=m.URLSearchParams,x=m.getState,E=y.set,S=y.getterFor("URL"),_=Math.floor,O=Math.pow,C=/[A-Za-z]/,T=/[\d+-.A-Za-z]/,k=/\d/,R=/^(0x|0X)/,L=/^[0-7]+$/,I=/^\d+$/,j=/^[\dA-Fa-f]+$/,N=/[\u0000\u0009\u000A\u000D #%/:?@[\\]]/,A=/[\u0000\u0009\u000A\u000D #/:?@[\\]]/,P=/^[\u0000-\u001F ]+|[\u0000-\u001F ]+$/g,D=/[\u0009\u000A\u000D]/g,z=function(t,e){var i,n,r;if("["==e.charAt(0)){if("]"!=e.charAt(e.length-1))return"Invalid host";if(!(i=q(e.slice(1,-1))))return"Invalid host";t.host=i}else if(G(t)){if(e=g(e),N.test(e))return"Invalid host";if(null===(i=B(e)))return"Invalid host";t.host=i}else{if(A.test(e))return"Invalid host";for(i="",n=f(e),r=0;r<n.length;r++)i+=V(n[r],U);t.host=i}},B=function(t){var e,i,n,r,s,o,a,h=t.split(".");if(h.length&&""==h[h.length-1]&&h.pop(),(e=h.length)>4)return t;for(i=[],n=0;n<e;n++){if(""==(r=h[n]))return t;if(s=10,r.length>1&&"0"==r.charAt(0)&&(s=R.test(r)?16:8,r=r.slice(8==s?1:2)),""===r)o=0;else{if(!(10==s?I:8==s?L:j).test(r))return t;o=parseInt(r,s)}i.push(o)}for(n=0;n<e;n++)if(o=i[n],n==e-1){if(o>=O(256,5-e))return null}else if(o>255)return null;for(a=i.pop(),n=0;n<i.length;n++)a+=i[n]*O(256,3-n);return a},q=function(t){var e,i,n,r,s,o,a,h=[0,0,0,0,0,0,0,0],l=0,c=null,u=0,d=function(){return t.charAt(u)};if(":"==d()){if(":"!=t.charAt(1))return;u+=2,c=++l}for(;d();){if(8==l)return;if(":"!=d()){for(e=i=0;i<4&&j.test(d());)e=16*e+parseInt(d(),16),u++,i++;if("."==d()){if(0==i)return;if(u-=i,l>6)return;for(n=0;d();){if(r=null,n>0){if(!("."==d()&&n<4))return;u++}if(!k.test(d()))return;for(;k.test(d());){if(s=parseInt(d(),10),null===r)r=s;else{if(0==r)return;r=10*r+s}if(r>255)return;u++}h[l]=256*h[l]+r,2!=++n&&4!=n||l++}if(4!=n)return;break}if(":"==d()){if(u++,!d())return}else if(d())return;h[l++]=e}else{if(null!==c)return;u++,c=++l}}if(null!==c)for(o=l-c,l=7;0!=l&&o>0;)a=h[l],h[l--]=h[c+o-1],h[c+--o]=a;else if(8!=l)return;return h},M=function(t){var e,i,n,r;if("number"==typeof t){for(e=[],i=0;i<4;i++)e.unshift(t%256),t=_(t/256);return e.join(".")}if("object"==typeof t){for(e="",n=function(t){for(var e=null,i=1,n=null,r=0,s=0;s<8;s++)0!==t[s]?(r>i&&(e=n,i=r),n=null,r=0):(null===n&&(n=s),++r);return r>i&&(e=n,i=r),e}(t),i=0;i<8;i++)r&&0===t[i]||(r&&(r=!1),n===i?(e+=i?":":"::",r=!0):(e+=t[i].toString(16),i<7&&(e+=":")));return"["+e+"]"}return t},U={},F=d({},U,{" ":1,'"':1,"<":1,">":1,"`":1}),W=d({},F,{"#":1,"?":1,"{":1,"}":1}),H=d({},W,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),V=function(t,e){var i=p(t,0);return i>32&&i<127&&!u(e,t)?t:encodeURIComponent(t)},X={ftp:21,file:null,http:80,https:443,ws:80,wss:443},G=function(t){return u(X,t.scheme)},Y=function(t){return""!=t.username||""!=t.password},$=function(t){return!t.host||t.cannotBeABaseURL||"file"==t.scheme},K=function(t,e){var i;return 2==t.length&&C.test(t.charAt(0))&&(":"==(i=t.charAt(1))||!e&&"|"==i)},Z=function(t){var e;return t.length>1&&K(t.slice(0,2))&&(2==t.length||"/"===(e=t.charAt(2))||"\\"===e||"?"===e||"#"===e)},J=function(t){var e=t.path,i=e.length;!i||"file"==t.scheme&&1==i&&K(e[0],!0)||e.pop()},Q=function(t){return"."===t||"%2e"===t.toLowerCase()},tt={},et={},it={},nt={},rt={},st={},ot={},at={},ht={},lt={},ct={},ut={},dt={},ft={},pt={},gt={},vt={},mt={},yt={},bt={},wt={},xt=function(t,e,i,r){var s,o,a,h,l,c=i||tt,d=0,p="",g=!1,v=!1,m=!1;for(i||(t.scheme="",t.username="",t.password="",t.host=null,t.port=null,t.path=[],t.query=null,t.fragment=null,t.cannotBeABaseURL=!1,e=e.replace(P,"")),e=e.replace(D,""),s=f(e);d<=s.length;){switch(o=s[d],c){case tt:if(!o||!C.test(o)){if(i)return"Invalid scheme";c=it;continue}p+=o.toLowerCase(),c=et;break;case et:if(o&&(T.test(o)||"+"==o||"-"==o||"."==o))p+=o.toLowerCase();else{if(":"!=o){if(i)return"Invalid scheme";p="",c=it,d=0;continue}if(i&&(G(t)!=u(X,p)||"file"==p&&(Y(t)||null!==t.port)||"file"==t.scheme&&!t.host))return;if(t.scheme=p,i)return void(G(t)&&X[t.scheme]==t.port&&(t.port=null));p="","file"==t.scheme?c=ft:G(t)&&r&&r.scheme==t.scheme?c=nt:G(t)?c=at:"/"==s[d+1]?(c=rt,d++):(t.cannotBeABaseURL=!0,t.path.push(""),c=yt)}break;case it:if(!r||r.cannotBeABaseURL&&"#"!=o)return"Invalid scheme";if(r.cannotBeABaseURL&&"#"==o){t.scheme=r.scheme,t.path=r.path.slice(),t.query=r.query,t.fragment="",t.cannotBeABaseURL=!0,c=wt;break}c="file"==r.scheme?ft:st;continue;case nt:if("/"!=o||"/"!=s[d+1]){c=st;continue}c=ht,d++;break;case rt:if("/"==o){c=lt;break}c=mt;continue;case st:if(t.scheme=r.scheme,o==n)t.username=r.username,t.password=r.password,t.host=r.host,t.port=r.port,t.path=r.path.slice(),t.query=r.query;else if("/"==o||"\\"==o&&G(t))c=ot;else if("?"==o)t.username=r.username,t.password=r.password,t.host=r.host,t.port=r.port,t.path=r.path.slice(),t.query="",c=bt;else{if("#"!=o){t.username=r.username,t.password=r.password,t.host=r.host,t.port=r.port,t.path=r.path.slice(),t.path.pop(),c=mt;continue}t.username=r.username,t.password=r.password,t.host=r.host,t.port=r.port,t.path=r.path.slice(),t.query=r.query,t.fragment="",c=wt}break;case ot:if(!G(t)||"/"!=o&&"\\"!=o){if("/"!=o){t.username=r.username,t.password=r.password,t.host=r.host,t.port=r.port,c=mt;continue}c=lt}else c=ht;break;case at:if(c=ht,"/"!=o||"/"!=p.charAt(d+1))continue;d++;break;case ht:if("/"!=o&&"\\"!=o){c=lt;continue}break;case lt:if("@"==o){g&&(p="%40"+p),g=!0,a=f(p);for(var y=0;y<a.length;y++){var b=a[y];if(":"!=b||m){var w=V(b,H);m?t.password+=w:t.username+=w}else m=!0}p=""}else if(o==n||"/"==o||"?"==o||"#"==o||"\\"==o&&G(t)){if(g&&""==p)return"Invalid authority";d-=f(p).length+1,p="",c=ct}else p+=o;break;case ct:case ut:if(i&&"file"==t.scheme){c=gt;continue}if(":"!=o||v){if(o==n||"/"==o||"?"==o||"#"==o||"\\"==o&&G(t)){if(G(t)&&""==p)return"Invalid host";if(i&&""==p&&(Y(t)||null!==t.port))return;if(h=z(t,p))return h;if(p="",c=vt,i)return;continue}"["==o?v=!0:"]"==o&&(v=!1),p+=o}else{if(""==p)return"Invalid host";if(h=z(t,p))return h;if(p="",c=dt,i==ut)return}break;case dt:if(!k.test(o)){if(o==n||"/"==o||"?"==o||"#"==o||"\\"==o&&G(t)||i){if(""!=p){var x=parseInt(p,10);if(x>65535)return"Invalid port";t.port=G(t)&&x===X[t.scheme]?null:x,p=""}if(i)return;c=vt;continue}return"Invalid port"}p+=o;break;case ft:if(t.scheme="file","/"==o||"\\"==o)c=pt;else{if(!r||"file"!=r.scheme){c=mt;continue}if(o==n)t.host=r.host,t.path=r.path.slice(),t.query=r.query;else if("?"==o)t.host=r.host,t.path=r.path.slice(),t.query="",c=bt;else{if("#"!=o){Z(s.slice(d).join(""))||(t.host=r.host,t.path=r.path.slice(),J(t)),c=mt;continue}t.host=r.host,t.path=r.path.slice(),t.query=r.query,t.fragment="",c=wt}}break;case pt:if("/"==o||"\\"==o){c=gt;break}r&&"file"==r.scheme&&!Z(s.slice(d).join(""))&&(K(r.path[0],!0)?t.path.push(r.path[0]):t.host=r.host),c=mt;continue;case gt:if(o==n||"/"==o||"\\"==o||"?"==o||"#"==o){if(!i&&K(p))c=mt;else if(""==p){if(t.host="",i)return;c=vt}else{if(h=z(t,p))return h;if("localhost"==t.host&&(t.host=""),i)return;p="",c=vt}continue}p+=o;break;case vt:if(G(t)){if(c=mt,"/"!=o&&"\\"!=o)continue}else if(i||"?"!=o)if(i||"#"!=o){if(o!=n&&(c=mt,"/"!=o))continue}else t.fragment="",c=wt;else t.query="",c=bt;break;case mt:if(o==n||"/"==o||"\\"==o&&G(t)||!i&&("?"==o||"#"==o)){if(".."===(l=(l=p).toLowerCase())||"%2e."===l||".%2e"===l||"%2e%2e"===l?(J(t),"/"==o||"\\"==o&&G(t)||t.path.push("")):Q(p)?"/"==o||"\\"==o&&G(t)||t.path.push(""):("file"==t.scheme&&!t.path.length&&K(p)&&(t.host&&(t.host=""),p=p.charAt(0)+":"),t.path.push(p)),p="","file"==t.scheme&&(o==n||"?"==o||"#"==o))for(;t.path.length>1&&""===t.path[0];)t.path.shift();"?"==o?(t.query="",c=bt):"#"==o&&(t.fragment="",c=wt)}else p+=V(o,W);break;case yt:"?"==o?(t.query="",c=bt):"#"==o?(t.fragment="",c=wt):o!=n&&(t.path[0]+=V(o,U));break;case bt:i||"#"!=o?o!=n&&("'"==o&&G(t)?t.query+="%27":t.query+="#"==o?"%23":V(o,U)):(t.fragment="",c=wt);break;case wt:o!=n&&(t.fragment+=V(o,F))}d++}},Et=function(t){var e,i,n=c(this,Et,"URL"),r=arguments.length>1?arguments[1]:void 0,o=String(t),a=E(n,{type:"URL"});if(void 0!==r)if(r instanceof Et)e=S(r);else if(i=xt(e={},String(r)))throw TypeError(i);if(i=xt(a,o,null,e))throw TypeError(i);var h=a.searchParams=new w,l=x(h);l.updateSearchParams(a.query),l.updateURL=function(){a.query=String(h)||null},s||(n.href=_t.call(n),n.origin=Ot.call(n),n.protocol=Ct.call(n),n.username=Tt.call(n),n.password=kt.call(n),n.host=Rt.call(n),n.hostname=Lt.call(n),n.port=It.call(n),n.pathname=jt.call(n),n.search=Nt.call(n),n.searchParams=At.call(n),n.hash=Pt.call(n))},St=Et.prototype,_t=function(){var t=S(this),e=t.scheme,i=t.username,n=t.password,r=t.host,s=t.port,o=t.path,a=t.query,h=t.fragment,l=e+":";return null!==r?(l+="//",Y(t)&&(l+=i+(n?":"+n:"")+"@"),l+=M(r),null!==s&&(l+=":"+s)):"file"==e&&(l+="//"),l+=t.cannotBeABaseURL?o[0]:o.length?"/"+o.join("/"):"",null!==a&&(l+="?"+a),null!==h&&(l+="#"+h),l},Ot=function(){var t=S(this),e=t.scheme,i=t.port;if("blob"==e)try{return new URL(e.path[0]).origin}catch(t){return"null"}return"file"!=e&&G(t)?e+"://"+M(t.host)+(null!==i?":"+i:""):"null"},Ct=function(){return S(this).scheme+":"},Tt=function(){return S(this).username},kt=function(){return S(this).password},Rt=function(){var t=S(this),e=t.host,i=t.port;return null===e?"":null===i?M(e):M(e)+":"+i},Lt=function(){var t=S(this).host;return null===t?"":M(t)},It=function(){var t=S(this).port;return null===t?"":String(t)},jt=function(){var t=S(this),e=t.path;return t.cannotBeABaseURL?e[0]:e.length?"/"+e.join("/"):""},Nt=function(){var t=S(this).query;return t?"?"+t:""},At=function(){return S(this).searchParams},Pt=function(){var t=S(this).fragment;return t?"#"+t:""},Dt=function(t,e){return{get:t,set:e,configurable:!0,enumerable:!0}};if(s&&h(St,{href:Dt(_t,(function(t){var e=S(this),i=String(t),n=xt(e,i);if(n)throw TypeError(n);x(e.searchParams).updateSearchParams(e.query)})),origin:Dt(Ot),protocol:Dt(Ct,(function(t){var e=S(this);xt(e,String(t)+":",tt)})),username:Dt(Tt,(function(t){var e=S(this),i=f(String(t));if(!$(e)){e.username="";for(var n=0;n<i.length;n++)e.username+=V(i[n],H)}})),password:Dt(kt,(function(t){var e=S(this),i=f(String(t));if(!$(e)){e.password="";for(var n=0;n<i.length;n++)e.password+=V(i[n],H)}})),host:Dt(Rt,(function(t){var e=S(this);e.cannotBeABaseURL||xt(e,String(t),ct)})),hostname:Dt(Lt,(function(t){var e=S(this);e.cannotBeABaseURL||xt(e,String(t),ut)})),port:Dt(It,(function(t){var e=S(this);$(e)||(""==(t=String(t))?e.port=null:xt(e,t,dt))})),pathname:Dt(jt,(function(t){var e=S(this);e.cannotBeABaseURL||(e.path=[],xt(e,t+"",vt))})),search:Dt(Nt,(function(t){var e=S(this);""==(t=String(t))?e.query=null:("?"==t.charAt(0)&&(t=t.slice(1)),e.query="",xt(e,t,bt)),x(e.searchParams).updateSearchParams(e.query)})),searchParams:Dt(At),hash:Dt(Pt,(function(t){var e=S(this);""!=(t=String(t))?("#"==t.charAt(0)&&(t=t.slice(1)),e.fragment="",xt(e,t,wt)):e.fragment=null}))}),l(St,"toJSON",(function(){return _t.call(this)}),{enumerable:!0}),l(St,"toString",(function(){return _t.call(this)}),{enumerable:!0}),b){var zt=b.createObjectURL,Bt=b.revokeObjectURL;zt&&l(Et,"createObjectURL",(function(t){return zt.apply(b,arguments)})),Bt&&l(Et,"revokeObjectURL",(function(t){return Bt.apply(b,arguments)}))}v(Et,"URL"),r({global:!0,forced:!o,sham:!s},{URL:Et})},function(t,e,i){"use strict";var n=i(0);e.a=class{constructor(t){this._q=[],this.context=t,this.tick=n.requestAnimationFrame,this.running=!1,this.paused=!1}enqueue(){var t,e,i=[].shift.call(arguments),r=arguments;if(!i)throw new Error("No Task Provided");return e="function"==typeof i?{task:i,args:r,deferred:t=new n.defer,promise:t.promise}:{promise:i},this._q.push(e),0!=this.paused||this.running||this.run(),e.promise}dequeue(){var t,e,i;return!this._q.length||this.paused?((t=new n.defer).deferred.resolve(),t.promise):(e=(t=this._q.shift()).task)?(i=e.apply(this.context,t.args))&&"function"==typeof i.then?i.then(function(){t.deferred.resolve.apply(this.context,arguments)}.bind(this),function(){t.deferred.reject.apply(this.context,arguments)}.bind(this)):(t.deferred.resolve.apply(this.context,i),t.promise):t.promise?t.promise:void 0}dump(){for(;this._q.length;)this.dequeue()}run(){return this.running||(this.running=!0,this.defered=new n.defer),this.tick.call(window,()=>{this._q.length?this.dequeue().then(function(){this.run()}.bind(this)):(this.defered.resolve(),this.running=void 0)}),1==this.paused&&(this.paused=!1),this.defered.promise}flush(){return this.running?this.running:this._q.length?(this.running=this.dequeue().then(function(){return this.running=void 0,this.flush()}.bind(this)),this.running):void 0}clear(){this._q=[]}length(){return this._q.length}pause(){this.paused=!0}stop(){this._q=[],this.running=!1,this.paused=!0}}},function(t,e,i){"use strict";var n=i(3),r=i.n(n),s=i(0);function o(){var t="reverse",e=function(){var t=document.createElement("div");t.dir="rtl",t.style.position="fixed",t.style.width="1px",t.style.height="1px",t.style.top="0px",t.style.left="0px",t.style.overflow="hidden";var e=document.createElement("div");e.style.width="2px";var i=document.createElement("span");i.style.width="1px",i.style.display="inline-block";var n=document.createElement("span");return n.style.width="1px",n.style.display="inline-block",e.appendChild(i),e.appendChild(n),t.appendChild(e),t}();return document.body.appendChild(e),e.scrollLeft>0?t="default":"undefined"!=typeof Element&&Element.prototype.scrollIntoView?(e.children[0].children[1].scrollIntoView(),e.scrollLeft<0&&(t="negative")):(e.scrollLeft=1,0===e.scrollLeft&&(t="negative")),document.body.removeChild(e),t}var a=i(23),h=i(21),l=i(84),c=i.n(l);var u=class{constructor(t){this.settings=t||{},this.id="epubjs-container-"+Object(s.uuid)(),this.container=this.create(this.settings),this.settings.hidden&&(this.wrapper=this.wrap(this.container))}create(t){let e=t.height,i=t.width,n=t.overflow||!1,r=t.axis||"vertical",o=t.direction;Object(s.extend)(this.settings,t),t.height&&Object(s.isNumber)(t.height)&&(e=t.height+"px"),t.width&&Object(s.isNumber)(t.width)&&(i=t.width+"px");let a=document.createElement("div");return a.id=this.id,a.classList.add("epub-container"),a.style.wordSpacing="0",a.style.lineHeight="0",a.style.verticalAlign="top",a.style.position="relative","horizontal"===r&&(a.style.display="flex",a.style.flexDirection="row",a.style.flexWrap="nowrap"),i&&(a.style.width=i),e&&(a.style.height=e),n&&("scroll"===n&&"vertical"===r?(a.style["overflow-y"]=n,a.style["overflow-x"]="hidden"):"scroll"===n&&"horizontal"===r?(a.style["overflow-y"]="hidden",a.style["overflow-x"]=n):a.style.overflow=n),o&&(a.dir=o,a.style.direction=o),o&&this.settings.fullsize&&(document.body.style.direction=o),a}wrap(t){var e=document.createElement("div");return e.style.visibility="hidden",e.style.overflow="hidden",e.style.width="0",e.style.height="0",e.appendChild(t),e}getElement(t){var e;if(Object(s.isElement)(t)?e=t:"string"==typeof t&&(e=document.getElementById(t)),!e)throw new Error("Not an Element");return e}attachTo(t){var e,i=this.getElement(t);if(i)return e=this.settings.hidden?this.wrapper:this.container,i.appendChild(e),this.element=i,i}getContainer(){return this.container}onResize(t){Object(s.isNumber)(this.settings.width)&&Object(s.isNumber)(this.settings.height)||(this.resizeFunc=c()(t,50),window.addEventListener("resize",this.resizeFunc,!1))}onOrientationChange(t){this.orientationChangeFunc=t,window.addEventListener("orientationchange",this.orientationChangeFunc,!1)}size(t,e){var i;let n=t||this.settings.width,r=e||this.settings.height;null===t?(i=this.element.getBoundingClientRect()).width&&(t=Math.floor(i.width),this.container.style.width=t+"px"):Object(s.isNumber)(t)?this.container.style.width=t+"px":this.container.style.width=t,null===e?(i=i||this.element.getBoundingClientRect()).height&&(e=i.height,this.container.style.height=e+"px"):Object(s.isNumber)(e)?this.container.style.height=e+"px":this.container.style.height=e,Object(s.isNumber)(t)||(t=this.container.clientWidth),Object(s.isNumber)(e)||(e=this.container.clientHeight),this.containerStyles=window.getComputedStyle(this.container),this.containerPadding={left:parseFloat(this.containerStyles["padding-left"])||0,right:parseFloat(this.containerStyles["padding-right"])||0,top:parseFloat(this.containerStyles["padding-top"])||0,bottom:parseFloat(this.containerStyles["padding-bottom"])||0};let o=Object(s.windowBounds)(),a=window.getComputedStyle(document.body),h=parseFloat(a["padding-left"])||0,l=parseFloat(a["padding-right"])||0,c=parseFloat(a["padding-top"])||0,u=parseFloat(a["padding-bottom"])||0;return n||(t=o.width-h-l),(this.settings.fullsize&&!r||!r)&&(e=o.height-c-u),{width:t-this.containerPadding.left-this.containerPadding.right,height:e-this.containerPadding.top-this.containerPadding.bottom}}bounds(){let t;return"visible"!==this.container.style.overflow&&(t=this.container&&this.container.getBoundingClientRect()),t&&t.width&&t.height?t:Object(s.windowBounds)()}getSheet(){var t=document.createElement("style");return t.appendChild(document.createTextNode("")),document.head.appendChild(t),t.sheet}addStyleRules(t,e){var i="#"+this.id+" ",n="";this.sheet||(this.sheet=this.getSheet()),e.forEach((function(t){for(var e in t)t.hasOwnProperty(e)&&(n+=e+":"+t[e]+";")})),this.sheet.insertRule(i+t+" {"+n+"}",0)}axis(t){"horizontal"===t?(this.container.style.display="flex",this.container.style.flexDirection="row",this.container.style.flexWrap="nowrap"):this.container.style.display="block",this.settings.axis=t}direction(t){this.container&&(this.container.dir=t,this.container.style.direction=t),this.settings.fullsize&&(document.body.style.direction=t),this.settings.dir=t}overflow(t){this.container&&("scroll"===t&&"vertical"===this.settings.axis?(this.container.style["overflow-y"]=t,this.container.style["overflow-x"]="hidden"):"scroll"===t&&"horizontal"===this.settings.axis?(this.container.style["overflow-y"]="hidden",this.container.style["overflow-x"]=t):this.container.style.overflow=t),this.settings.overflow=t}destroy(){this.element&&(this.settings.hidden?this.wrapper:this.container,this.element.contains(this.container)&&this.element.removeChild(this.container),window.removeEventListener("resize",this.resizeFunc),window.removeEventListener("orientationChange",this.orientationChangeFunc))}};var d=class{constructor(t){this.container=t,this._views=[],this.length=0,this.hidden=!1}all(){return this._views}first(){return this._views[0]}last(){return this._views[this._views.length-1]}indexOf(t){return this._views.indexOf(t)}slice(){return this._views.slice.apply(this._views,arguments)}get(t){return this._views[t]}append(t){return this._views.push(t),this.container&&this.container.appendChild(t.element),this.length++,t}prepend(t){return this._views.unshift(t),this.container&&this.container.insertBefore(t.element,this.container.firstChild),this.length++,t}insert(t,e){return this._views.splice(e,0,t),this.container&&(e<this.container.children.length?this.container.insertBefore(t.element,this.container.children[e]):this.container.appendChild(t.element)),this.length++,t}remove(t){var e=this._views.indexOf(t);e>-1&&this._views.splice(e,1),this.destroy(t),this.length--}destroy(t){t.displayed&&t.destroy(),this.container&&this.container.removeChild(t.element),t=null}forEach(){return this._views.forEach.apply(this._views,arguments)}clear(){var t,e=this.length;if(this.length){for(var i=0;i<e;i++)t=this._views[i],this.destroy(t);this._views=[],this.length=0}}find(t){for(var e,i=this.length,n=0;n<i;n++)if((e=this._views[n]).displayed&&e.section.index==t.index)return e}displayed(){for(var t,e=[],i=this.length,n=0;n<i;n++)(t=this._views[n]).displayed&&e.push(t);return e}show(){for(var t,e=this.length,i=0;i<e;i++)(t=this._views[i]).displayed&&t.show();this.hidden=!1}hide(){for(var t,e=this.length,i=0;i<e;i++)(t=this._views[i]).displayed&&t.hide();this.hidden=!0}},f=i(1);class p{constructor(t){this.name="default",this.optsSettings=t.settings,this.View=t.view,this.request=t.request,this.renditionQueue=t.queue,this.q=new h.a(this),this.settings=Object(s.extend)(this.settings||{},{infinite:!0,hidden:!1,width:void 0,height:void 0,axis:void 0,writingMode:void 0,flow:"scrolled",ignoreClass:"",fullsize:void 0}),Object(s.extend)(this.settings,t.settings||{}),this.viewSettings={ignoreClass:this.settings.ignoreClass,axis:this.settings.axis,flow:this.settings.flow,layout:this.layout,method:this.settings.method,width:0,height:0,forceEvenPages:!0},this.rendered=!1}render(t,e){let i=t.tagName;void 0!==this.settings.fullsize||!i||"body"!=i.toLowerCase()&&"html"!=i.toLowerCase()||(this.settings.fullsize=!0),this.settings.fullsize&&(this.settings.overflow="visible",this.overflow=this.settings.overflow),this.settings.size=e,this.settings.rtlScrollType=o(),this.stage=new u({width:e.width,height:e.height,overflow:this.overflow,hidden:this.settings.hidden,axis:this.settings.axis,fullsize:this.settings.fullsize,direction:this.settings.direction}),this.stage.attachTo(t),this.container=this.stage.getContainer(),this.views=new d(this.container),this._bounds=this.bounds(),this._stageSize=this.stage.size(),this.viewSettings.width=this._stageSize.width,this.viewSettings.height=this._stageSize.height,this.stage.onResize(this.onResized.bind(this)),this.stage.onOrientationChange(this.onOrientationChange.bind(this)),this.addEventListeners(),this.layout&&this.updateLayout(),this.rendered=!0}addEventListeners(){var t;window.addEventListener("unload",function(t){this.destroy()}.bind(this)),t=this.settings.fullsize?window:this.container,this._onScroll=this.onScroll.bind(this),t.addEventListener("scroll",this._onScroll)}removeEventListeners(){(this.settings.fullsize?window:this.container).removeEventListener("scroll",this._onScroll),this._onScroll=void 0}destroy(){clearTimeout(this.orientationTimeout),clearTimeout(this.resizeTimeout),clearTimeout(this.afterScrolled),this.clear(),this.removeEventListeners(),this.stage.destroy(),this.rendered=!1}onOrientationChange(t){let{orientation:e}=window;this.optsSettings.resizeOnOrientationChange&&this.resize(),clearTimeout(this.orientationTimeout),this.orientationTimeout=setTimeout(function(){this.orientationTimeout=void 0,this.optsSettings.resizeOnOrientationChange&&this.resize(),this.emit(f.c.MANAGERS.ORIENTATION_CHANGE,e)}.bind(this),500)}onResized(t){this.resize()}resize(t,e,i){let n=this.stage.size(t,e);this.winBounds=Object(s.windowBounds)(),this.orientationTimeout&&this.winBounds.width===this.winBounds.height?this._stageSize=void 0:this._stageSize&&this._stageSize.width===n.width&&this._stageSize.height===n.height||(this._stageSize=n,this._bounds=this.bounds(),this.clear(),this.viewSettings.width=this._stageSize.width,this.viewSettings.height=this._stageSize.height,this.updateLayout(),this.emit(f.c.MANAGERS.RESIZED,{width:this._stageSize.width,height:this._stageSize.height},i))}createView(t,e){return new this.View(t,Object(s.extend)(this.viewSettings,{forceRight:e}))}handleNextPrePaginated(t,e,i){let n;if("pre-paginated"===this.layout.name&&this.layout.divisor>1){if(t||0===e.index)return;if(n=e.next(),n&&!n.properties.includes("page-spread-left"))return i.call(this,n)}}display(t,e){var i=new s.defer,n=i.promise;(e===t.href||Object(s.isNumber)(e))&&(e=void 0);var r=this.views.find(t);if(r&&t&&"pre-paginated"!==this.layout.name){let t=r.offset();if("ltr"===this.settings.direction)this.scrollTo(t.left,t.top,!0);else{let e=r.width();this.scrollTo(t.left+e,t.top,!0)}if(e){let t=r.locationOf(e);this.moveTo(t)}return i.resolve(),n}this.clear();let o=!1;return"pre-paginated"===this.layout.name&&2===this.layout.divisor&&t.properties.includes("page-spread-right")&&(o=!0),this.add(t,o).then(function(t){if(e){let i=t.locationOf(e);this.moveTo(i)}}.bind(this),t=>{i.reject(t)}).then(function(){return this.handleNextPrePaginated(o,t,this.add)}.bind(this)).then(function(){this.views.show(),i.resolve()}.bind(this)),n}afterDisplayed(t){this.emit(f.c.MANAGERS.ADDED,t)}afterResized(t){this.emit(f.c.MANAGERS.RESIZE,t.section)}moveTo(t){var e=0,i=0;this.isPaginated?(e=Math.floor(t.left/this.layout.delta)*this.layout.delta)+this.layout.delta>this.container.scrollWidth&&(e=this.container.scrollWidth-this.layout.delta):i=t.top,this.scrollTo(e,i,!0)}add(t,e){var i=this.createView(t,e);return this.views.append(i),i.onDisplayed=this.afterDisplayed.bind(this),i.onResize=this.afterResized.bind(this),i.on(f.c.VIEWS.AXIS,t=>{this.updateAxis(t)}),i.on(f.c.VIEWS.WRITING_MODE,t=>{this.updateWritingMode(t)}),i.display(this.request)}append(t,e){var i=this.createView(t,e);return this.views.append(i),i.onDisplayed=this.afterDisplayed.bind(this),i.onResize=this.afterResized.bind(this),i.on(f.c.VIEWS.AXIS,t=>{this.updateAxis(t)}),i.on(f.c.VIEWS.WRITING_MODE,t=>{this.updateWritingMode(t)}),i.display(this.request)}prepend(t,e){var i=this.createView(t,e);return i.on(f.c.VIEWS.RESIZED,t=>{this.counter(t)}),this.views.prepend(i),i.onDisplayed=this.afterDisplayed.bind(this),i.onResize=this.afterResized.bind(this),i.on(f.c.VIEWS.AXIS,t=>{this.updateAxis(t)}),i.on(f.c.VIEWS.WRITING_MODE,t=>{this.updateWritingMode(t)}),i.display(this.request)}counter(t){"vertical"===this.settings.axis?this.scrollBy(0,t.heightDelta,!0):this.scrollBy(t.widthDelta,0,!0)}next(){var t;let e=this.settings.direction;if(this.views.length){if(!this.isPaginated||"horizontal"!==this.settings.axis||e&&"ltr"!==e)if(this.isPaginated&&"horizontal"===this.settings.axis&&"rtl"===e)this.scrollLeft=this.container.scrollLeft,"default"===this.settings.rtlScrollType?this.container.scrollLeft>0?this.scrollBy(this.layout.delta,0,!0):t=this.views.last().section.next():this.container.scrollLeft+-1*this.layout.delta>-1*this.container.scrollWidth?this.scrollBy(this.layout.delta,0,!0):t=this.views.last().section.next();else if(this.isPaginated&&"vertical"===this.settings.axis){this.scrollTop=this.container.scrollTop,this.container.scrollTop+this.container.offsetHeight<this.container.scrollHeight?this.scrollBy(0,this.layout.height,!0):t=this.views.last().section.next()}else t=this.views.last().section.next();else this.scrollLeft=this.container.scrollLeft,this.container.scrollLeft+this.container.offsetWidth+this.layout.delta<=this.container.scrollWidth?this.scrollBy(this.layout.delta,0,!0):t=this.views.last().section.next();if(t){this.clear();let e=!1;return"pre-paginated"===this.layout.name&&2===this.layout.divisor&&t.properties.includes("page-spread-right")&&(e=!0),this.append(t,e).then(function(){return this.handleNextPrePaginated(e,t,this.append)}.bind(this),t=>t).then(function(){this.isPaginated||"horizontal"!==this.settings.axis||"rtl"!==this.settings.direction||"default"!==this.settings.rtlScrollType||this.scrollTo(this.container.scrollWidth,0,!0),this.views.show()}.bind(this))}}}prev(){var t;let e=this.settings.direction;if(this.views.length){if(!this.isPaginated||"horizontal"!==this.settings.axis||e&&"ltr"!==e)if(this.isPaginated&&"horizontal"===this.settings.axis&&"rtl"===e)this.scrollLeft=this.container.scrollLeft,"default"===this.settings.rtlScrollType?this.container.scrollLeft+this.container.offsetWidth<this.container.scrollWidth?this.scrollBy(-this.layout.delta,0,!0):t=this.views.first().section.prev():this.container.scrollLeft<0?this.scrollBy(-this.layout.delta,0,!0):t=this.views.first().section.prev();else if(this.isPaginated&&"vertical"===this.settings.axis){this.scrollTop=this.container.scrollTop,this.container.scrollTop>0?this.scrollBy(0,-this.layout.height,!0):t=this.views.first().section.prev()}else t=this.views.first().section.prev();else this.scrollLeft=this.container.scrollLeft,this.container.scrollLeft>0?this.scrollBy(-this.layout.delta,0,!0):t=this.views.first().section.prev();if(t){this.clear();let e=!1;return"pre-paginated"===this.layout.name&&2===this.layout.divisor&&"object"!=typeof t.prev()&&(e=!0),this.prepend(t,e).then(function(){var e;if("pre-paginated"===this.layout.name&&this.layout.divisor>1&&(e=t.prev()))return this.prepend(e)}.bind(this),t=>t).then(function(){this.isPaginated&&"horizontal"===this.settings.axis&&("rtl"===this.settings.direction?"default"===this.settings.rtlScrollType?this.scrollTo(0,0,!0):this.scrollTo(-1*this.container.scrollWidth+this.layout.delta,0,!0):this.scrollTo(this.container.scrollWidth-this.layout.delta,0,!0)),this.views.show()}.bind(this))}}}current(){var t=this.visible();return t.length?t[t.length-1]:null}clear(){this.views&&(this.views.hide(),this.scrollTo(0,0,!0),this.views.clear())}currentLocation(){return this.isPaginated&&"horizontal"===this.settings.axis?this.location=this.paginatedLocation():this.location=this.scrolledLocation(),this.location}scrolledLocation(){let t=this.visible(),e=this.container.getBoundingClientRect(),i=e.height<window.innerHeight?e.height:window.innerHeight,n=e.width<window.innerWidth?e.width:window.innerWidth,r="vertical"===this.settings.axis,s=(this.settings.direction,0);return this.settings.fullsize&&(s=r?window.scrollY:window.scrollX),t.map(t=>{let o,a,h,l,{index:c,href:u}=t.section,d=t.position(),f=t.width(),p=t.height();r?(o=s+e.top-d.top+0,a=o+i-0,l=this.layout.count(p,i).pages,h=i):(o=s+e.left-d.left+0,a=o+n-0,l=this.layout.count(f,n).pages,h=n);let g=Math.ceil(o/h),v=[],m=Math.ceil(a/h);if("rtl"===this.settings.direction&&!r){let t=g;g=l-m,m=l-t}v=[];for(var y=g;y<=m;y++){let t=y+1;v.push(t)}return{index:c,href:u,pages:v,totalPages:l,mapping:this.mapping.page(t.contents,t.section.cfiBase,o,a)}})}paginatedLocation(){let t=this.visible(),e=this.container.getBoundingClientRect(),i=0,n=0;return this.settings.fullsize&&(i=window.scrollX),t.map(t=>{let r,s,o,a,{index:h,href:l}=t.section,c=t.position(),u=t.width();"rtl"===this.settings.direction?(r=e.right-i,a=Math.min(Math.abs(r-c.left),this.layout.width)-n,o=c.width-(c.right-r)-n,s=o-a):(r=e.left+i,a=Math.min(c.right-r,this.layout.width)-n,s=r-c.left+n,o=s+a),n+=a;let d=this.mapping.page(t.contents,t.section.cfiBase,s,o),f=this.layout.count(u).pages,p=Math.floor(s/this.layout.pageWidth),g=[],v=Math.floor(o/this.layout.pageWidth);if(p<0&&(p=0,v+=1),"rtl"===this.settings.direction){let t=p;p=f-v,v=f-t}for(var m=p+1;m<=v;m++){let t=m;g.push(t)}return{index:h,href:l,pages:g,totalPages:f,mapping:d}})}isVisible(t,e,i,n){var r=t.position(),s=n||this.bounds();return"horizontal"===this.settings.axis&&r.right>s.left-e&&r.left<s.right+i||"vertical"===this.settings.axis&&r.bottom>s.top-e&&r.top<s.bottom+i}visible(){for(var t,e=this.bounds(),i=this.views.displayed(),n=i.length,r=[],s=0;s<n;s++)t=i[s],!0===this.isVisible(t,0,0,e)&&r.push(t);return r}scrollBy(t,e,i){let n="rtl"===this.settings.direction?-1:1;i&&(this.ignore=!0),this.settings.fullsize?window.scrollBy(t*n,e*n):(t&&(this.container.scrollLeft+=t*n),e&&(this.container.scrollTop+=e)),this.scrolled=!0}scrollTo(t,e,i){i&&(this.ignore=!0),this.settings.fullsize?window.scrollTo(t,e):(this.container.scrollLeft=t,this.container.scrollTop=e),this.scrolled=!0}onScroll(){let t,e;this.settings.fullsize?(t=window.scrollY,e=window.scrollX):(t=this.container.scrollTop,e=this.container.scrollLeft),this.scrollTop=t,this.scrollLeft=e,this.ignore?this.ignore=!1:(this.emit(f.c.MANAGERS.SCROLL,{top:t,left:e}),clearTimeout(this.afterScrolled),this.afterScrolled=setTimeout(function(){this.emit(f.c.MANAGERS.SCROLLED,{top:this.scrollTop,left:this.scrollLeft})}.bind(this),20))}bounds(){return this.stage.bounds()}applyLayout(t){this.layout=t,this.updateLayout(),this.views&&this.views.length>0&&"pre-paginated"===this.layout.name&&this.display(this.views.first().section)}updateLayout(){this.stage&&(this._stageSize=this.stage.size(),this.isPaginated?(this.layout.calculate(this._stageSize.width,this._stageSize.height,this.settings.gap),this.settings.offset=this.layout.delta/this.layout.divisor):this.layout.calculate(this._stageSize.width,this._stageSize.height),this.viewSettings.width=this.layout.width,this.viewSettings.height=this.layout.height,this.setLayout(this.layout))}setLayout(t){this.viewSettings.layout=t,this.mapping=new a.a(t.props,this.settings.direction,this.settings.axis),this.views&&this.views.forEach((function(e){e&&e.setLayout(t)}))}updateWritingMode(t){this.writingMode=t}updateAxis(t,e){(e||t!==this.settings.axis)&&(this.settings.axis=t,this.stage&&this.stage.axis(t),this.viewSettings.axis=t,this.mapping&&(this.mapping=new a.a(this.layout.props,this.settings.direction,this.settings.axis)),this.layout&&("vertical"===t?this.layout.spread("none"):this.layout.spread(this.layout.settings.spread)))}updateFlow(t,e="auto"){let i="paginated"===t||"auto"===t;this.isPaginated=i,"scrolled-doc"===t||"scrolled-continuous"===t||"scrolled"===t?this.updateAxis("vertical"):this.updateAxis("horizontal"),this.viewSettings.flow=t,this.settings.overflow?this.overflow=this.settings.overflow:this.overflow=i?"hidden":e,this.stage&&this.stage.overflow(this.overflow),this.updateLayout()}getContents(){var t=[];return this.views?(this.views.forEach((function(e){const i=e&&e.contents;i&&t.push(i)})),t):t}direction(t="ltr"){this.settings.direction=t,this.stage&&this.stage.direction(t),this.viewSettings.direction=t,this.updateLayout()}isRendered(){return this.rendered}}r()(p.prototype);e.a=p},function(t,e,i){"use strict";var n=i(2),r=i(0);e.a=class{constructor(t,e,i,n=!1){this.layout=t,this.horizontal="horizontal"===i,this.direction=e||"ltr",this._dev=n}section(t){var e=this.findRanges(t);return this.rangeListToCfiList(t.section.cfiBase,e)}page(t,e,i,r){var s,o=!(!t||!t.document)&&t.document.body;if(o){if(s=this.rangePairToCfiPair(e,{start:this.findStart(o,i,r),end:this.findEnd(o,i,r)}),!0===this._dev){let e=t.document,i=new n.a(s.start).toRange(e),r=new n.a(s.end).toRange(e),o=e.defaultView.getSelection(),a=e.createRange();o.removeAllRanges(),a.setStart(i.startContainer,i.startOffset),a.setEnd(r.endContainer,r.endOffset),o.addRange(a)}return s}}walk(t,e){if(!t||t.nodeType!==Node.TEXT_NODE){var i=function(t){return t.data.trim().length>0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT},n=i;n.acceptNode=i;for(var r,s,o=document.createTreeWalker(t,NodeFilter.SHOW_TEXT,n,!1);(r=o.nextNode())&&!(s=e(r)););return s}}findRanges(t){for(var e,i,n=[],r=t.contents.scrollWidth(),s=Math.ceil(r/this.layout.spreadWidth)*this.layout.divisor,o=this.layout.columnWidth,a=this.layout.gap,h=0;h<s.pages;h++)e=(o+a)*h,i=o*(h+1)+a*h,n.push({start:this.findStart(t.document.body,e,i),end:this.findEnd(t.document.body,e,i)});return n}findStart(t,e,i){for(var n,s,o=[t],a=t;o.length;)if(n=o.shift(),s=this.walk(n,t=>{var n,s,h,l,c;if(c=Object(r.nodeBounds)(t),this.horizontal&&"ltr"===this.direction){if(n=this.horizontal?c.left:c.top,s=this.horizontal?c.right:c.bottom,n>=e&&n<=i)return t;if(s>e)return t;a=t,o.push(t)}else if(this.horizontal&&"rtl"===this.direction){if(n=c.left,(s=c.right)<=i&&s>=e)return t;if(n<i)return t;a=t,o.push(t)}else{if(h=c.top,l=c.bottom,h>=e&&h<=i)return t;if(l>e)return t;a=t,o.push(t)}}))return this.findTextStartRange(s,e,i);return this.findTextStartRange(a,e,i)}findEnd(t,e,i){for(var n,s,o=[t],a=t;o.length;)if(n=o.shift(),s=this.walk(n,t=>{var n,s,h,l,c;if(c=Object(r.nodeBounds)(t),this.horizontal&&"ltr"===this.direction){if(n=Math.round(c.left),s=Math.round(c.right),n>i&&a)return a;if(s>i)return t;a=t,o.push(t)}else if(this.horizontal&&"rtl"===this.direction){if(n=Math.round(this.horizontal?c.left:c.top),(s=Math.round(this.horizontal?c.right:c.bottom))<e&&a)return a;if(n<e)return t;a=t,o.push(t)}else{if(h=Math.round(c.top),l=Math.round(c.bottom),h>i&&a)return a;if(l>i)return t;a=t,o.push(t)}}))return this.findTextEndRange(s,e,i);return this.findTextEndRange(a,e,i)}findTextStartRange(t,e,i){for(var n,r,s=this.splitTextNodeIntoRanges(t),o=0;o<s.length;o++)if(r=(n=s[o]).getBoundingClientRect(),this.horizontal&&"ltr"===this.direction){if(r.left>=e)return n}else if(this.horizontal&&"rtl"===this.direction){if(r.right<=i)return n}else if(r.top>=e)return n;return s[0]}findTextEndRange(t,e,i){for(var n,r,s,o,a,h,l,c=this.splitTextNodeIntoRanges(t),u=0;u<c.length;u++){if(s=(r=c[u]).getBoundingClientRect(),this.horizontal&&"ltr"===this.direction){if(o=s.left,a=s.right,o>i&&n)return n;if(a>i)return r}else if(this.horizontal&&"rtl"===this.direction){if(o=s.left,(a=s.right)<e&&n)return n;if(o<e)return r}else{if(h=s.top,l=s.bottom,h>i&&n)return n;if(l>i)return r}n=r}return c[c.length-1]}splitTextNodeIntoRanges(t,e){var i,n=[],r=(t.textContent||"").trim(),s=t.ownerDocument,o=e||" ",a=r.indexOf(o);if(-1===a||t.nodeType!=Node.TEXT_NODE)return(i=s.createRange()).selectNodeContents(t),[i];for((i=s.createRange()).setStart(t,0),i.setEnd(t,a),n.push(i),i=!1;-1!=a;)(a=r.indexOf(o,a+1))>0&&(i&&(i.setEnd(t,a),n.push(i)),(i=s.createRange()).setStart(t,a+1));return i&&(i.setEnd(t,r.length),n.push(i)),n}rangePairToCfiPair(t,e){var i=e.start,r=e.end;return i.collapse(!0),r.collapse(!1),{start:new n.a(i,t).toString(),end:new n.a(r,t).toString()}}rangeListToCfiList(t,e){for(var i,n=[],r=0;r<e.length;r++)i=this.rangePairToCfiPair(t,e[r]),n.push(i);return n}axis(t){return t&&(this.horizontal="horizontal"===t),this.horizontal}}},function(t,e,i){"use strict";var n=i(87),r=i(13),s=i(36),o=i(46),a=i(35),h=i(33),l=i(100),c=i(101),u=Math.max,d=Math.min,f=Math.floor,p=/\$([$&'`]|\d\d?|<[^>]*>)/g,g=/\$([$&'`]|\d\d?)/g;n("replace",2,(function(t,e,i,n){var v=n.REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE,m=n.REPLACE_KEEPS_$0,y=v?"$":"$0";return[function(i,n){var r=h(this),s=null==i?void 0:i[t];return void 0!==s?s.call(i,r,n):e.call(String(r),i,n)},function(t,n){if(!v&&m||"string"==typeof n&&-1===n.indexOf(y)){var s=i(e,t,this,n);if(s.done)return s.value}var h=r(t),f=String(this),p="function"==typeof n;p||(n=String(n));var g=h.global;if(g){var w=h.unicode;h.lastIndex=0}for(var x=[];;){var E=c(h,f);if(null===E)break;if(x.push(E),!g)break;""===String(E[0])&&(h.lastIndex=l(f,o(h.lastIndex),w))}for(var S,_="",O=0,C=0;C<x.length;C++){E=x[C];for(var T=String(E[0]),k=u(d(a(E.index),f.length),0),R=[],L=1;L<E.length;L++)R.push(void 0===(S=E[L])?S:String(S));var I=E.groups;if(p){var j=[T].concat(R,k,f);void 0!==I&&j.push(I);var N=String(n.apply(void 0,j))}else N=b(T,f,k,R,I,n);k>=O&&(_+=f.slice(O,k)+N,O=k+T.length)}return _+f.slice(O)}];function b(t,i,n,r,o,a){var h=n+t.length,l=r.length,c=g;return void 0!==o&&(o=s(o),c=p),e.call(a,c,(function(e,s){var a;switch(s.charAt(0)){case"$":return"$";case"&":return t;case"`":return i.slice(0,n);case"'":return i.slice(h);case"<":a=o[s.slice(1,-1)];break;default:var c=+s;if(0===c)return e;if(c>l){var u=f(c/10);return 0===u?e:u<=l?void 0===r[u-1]?s.charAt(1):r[u-1]+s.charAt(1):e}a=r[c-1]}return void 0===a?"":a}))}}))},function(t,e){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},function(t,e,i){var n,r,s,o=i(89),a=i(7),h=i(17),l=i(15),c=i(10),u=i(43),d=i(44),f=a.WeakMap;if(o){var p=new f,g=p.get,v=p.has,m=p.set;n=function(t,e){return m.call(p,t,e),e},r=function(t){return g.call(p,t)||{}},s=function(t){return v.call(p,t)}}else{var y=u("state");d[y]=!0,n=function(t,e){return l(t,y,e),e},r=function(t){return c(t,y)?t[y]:{}},s=function(t){return c(t,y)}}t.exports={set:n,get:r,has:s,enforce:function(t){return s(t)?r(t):n(t,{})},getterFor:function(t){return function(e){var i;if(!h(e)||(i=r(e)).type!==t)throw TypeError("Incompatible receiver, "+t+" required");return i}}}},function(t,e){t.exports={}},function(t,e,i){"use strict";var n=i(3),r=i.n(n),s=i(0),o=i(2),a=i(23),h=i(11),l=i(1);const c="undefined"!=typeof navigator,u=c&&/Chrome/.test(navigator.userAgent),d=c&&!u&&/AppleWebKit/.test(navigator.userAgent);class f{constructor(t,e,i,n){this.epubcfi=new o.a,this.document=t,this.documentElement=this.document.documentElement,this.content=e||this.document.body,this.window=this.document.defaultView,this._size={width:0,height:0},this.sectionIndex=n||0,this.cfiBase=i||"",this.epubReadingSystem("epub.js",l.b),this.called=0,this.active=!0,this.listeners()}static get listenedEvents(){return l.a}width(t){var e=this.content;return t&&Object(s.isNumber)(t)&&(t+="px"),t&&(e.style.width=t),parseInt(this.window.getComputedStyle(e).width)}height(t){var e=this.content;return t&&Object(s.isNumber)(t)&&(t+="px"),t&&(e.style.height=t),parseInt(this.window.getComputedStyle(e).height)}contentWidth(t){var e=this.content||this.document.body;return t&&Object(s.isNumber)(t)&&(t+="px"),t&&(e.style.width=t),parseInt(this.window.getComputedStyle(e).width)}contentHeight(t){var e=this.content||this.document.body;return t&&Object(s.isNumber)(t)&&(t+="px"),t&&(e.style.height=t),parseInt(this.window.getComputedStyle(e).height)}textWidth(){let t,e,i=this.document.createRange(),n=this.content||this.document.body,r=Object(s.borders)(n);return i.selectNodeContents(n),t=i.getBoundingClientRect(),e=t.width,r&&r.width&&(e+=r.width),Math.round(e)}textHeight(){let t,e,i=this.document.createRange(),n=this.content||this.document.body;return i.selectNodeContents(n),t=i.getBoundingClientRect(),e=t.bottom,Math.round(e)}scrollWidth(){return this.documentElement.scrollWidth}scrollHeight(){return this.documentElement.scrollHeight}overflow(t){return t&&(this.documentElement.style.overflow=t),this.window.getComputedStyle(this.documentElement).overflow}overflowX(t){return t&&(this.documentElement.style.overflowX=t),this.window.getComputedStyle(this.documentElement).overflowX}overflowY(t){return t&&(this.documentElement.style.overflowY=t),this.window.getComputedStyle(this.documentElement).overflowY}css(t,e,i){var n=this.content||this.document.body;return e?n.style.setProperty(t,e,i?"important":""):n.style.removeProperty(t),this.window.getComputedStyle(n)[t]}viewport(t){var e,i=this.document.querySelector("meta[name='viewport']"),n={width:void 0,height:void 0,scale:void 0,minimum:void 0,maximum:void 0,scalable:void 0},r=[];if(i&&i.hasAttribute("content")){let t=i.getAttribute("content"),e=t.match(/width\s*=\s*([^,]*)/),r=t.match(/height\s*=\s*([^,]*)/),s=t.match(/initial-scale\s*=\s*([^,]*)/),o=t.match(/minimum-scale\s*=\s*([^,]*)/),a=t.match(/maximum-scale\s*=\s*([^,]*)/),h=t.match(/user-scalable\s*=\s*([^,]*)/);e&&e.length&&void 0!==e[1]&&(n.width=e[1]),r&&r.length&&void 0!==r[1]&&(n.height=r[1]),s&&s.length&&void 0!==s[1]&&(n.scale=s[1]),o&&o.length&&void 0!==o[1]&&(n.minimum=o[1]),a&&a.length&&void 0!==a[1]&&(n.maximum=a[1]),h&&h.length&&void 0!==h[1]&&(n.scalable=h[1])}return e=Object(s.defaults)(t||{},n),t&&(e.width&&r.push("width="+e.width),e.height&&r.push("height="+e.height),e.scale&&r.push("initial-scale="+e.scale),"no"===e.scalable?(r.push("minimum-scale="+e.scale),r.push("maximum-scale="+e.scale),r.push("user-scalable="+e.scalable)):(e.scalable&&r.push("user-scalable="+e.scalable),e.minimum&&r.push("minimum-scale="+e.minimum),e.maximum&&r.push("minimum-scale="+e.maximum)),i||((i=this.document.createElement("meta")).setAttribute("name","viewport"),this.document.querySelector("head").appendChild(i)),i.setAttribute("content",r.join(", ")),this.window.scrollTo(0,0)),e}expand(){this.emit(l.c.CONTENTS.EXPAND)}listeners(){this.imageLoadListeners(),this.mediaQueryListeners(),this.addEventListeners(),this.addSelectionListeners(),"undefined"==typeof ResizeObserver?(this.resizeListeners(),this.visibilityListeners()):this.resizeObservers(),this.linksHandler()}removeListeners(){this.removeEventListeners(),this.removeSelectionListeners(),this.observer&&this.observer.disconnect(),clearTimeout(this.expanding)}resizeCheck(){let t=this.textWidth(),e=this.textHeight();t==this._size.width&&e==this._size.height||(this._size={width:t,height:e},this.onResize&&this.onResize(this._size),this.emit(l.c.CONTENTS.RESIZE,this._size))}resizeListeners(){clearTimeout(this.expanding),requestAnimationFrame(this.resizeCheck.bind(this)),this.expanding=setTimeout(this.resizeListeners.bind(this),350)}visibilityListeners(){document.addEventListener("visibilitychange",()=>{"visible"===document.visibilityState&&!1===this.active?(this.active=!0,this.resizeListeners()):(this.active=!1,clearTimeout(this.expanding))})}transitionListeners(){let t=this.content;t.style.transitionProperty="font, font-size, font-size-adjust, font-stretch, font-variation-settings, font-weight, width, height",t.style.transitionDuration="0.001ms",t.style.transitionTimingFunction="linear",t.style.transitionDelay="0",this._resizeCheck=this.resizeCheck.bind(this),this.document.addEventListener("transitionend",this._resizeCheck)}mediaQueryListeners(){for(var t=this.document.styleSheets,e=function(t){t.matches&&!this._expanding&&setTimeout(this.expand.bind(this),1)}.bind(this),i=0;i<t.length;i+=1){var n;try{n=t[i].cssRules}catch(t){return}if(!n)return;for(var r=0;r<n.length;r+=1){if(n[r].media)this.window.matchMedia(n[r].media.mediaText).addListener(e)}}}resizeObservers(){this.observer=new ResizeObserver(t=>{requestAnimationFrame(this.resizeCheck.bind(this))}),this.observer.observe(this.document.documentElement)}mutationObservers(){this.observer=new MutationObserver(t=>{this.resizeCheck()});this.observer.observe(this.document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})}imageLoadListeners(){for(var t,e=this.document.querySelectorAll("img"),i=0;i<e.length;i++)void 0!==(t=e[i]).naturalWidth&&0===t.naturalWidth&&(t.onload=this.expand.bind(this))}fontLoadListeners(){this.document&&this.document.fonts&&this.document.fonts.ready.then(function(){this.resizeCheck()}.bind(this))}root(){return this.document?this.document.documentElement:null}locationOf(t,e){var i,n={left:0,top:0};if(!this.document)return n;if(this.epubcfi.isCfiString(t)){let r=new o.a(t).toRange(this.document,e);if(r){try{if(!r.endContainer||r.startContainer==r.endContainer&&r.startOffset==r.endOffset){let t=r.startContainer.textContent.indexOf(" ",r.startOffset);-1==t&&(t=r.startContainer.textContent.length),r.setEnd(r.startContainer,t)}}catch(t){console.error("setting end offset to start container length failed",t)}if(r.startContainer.nodeType===Node.ELEMENT_NODE)i=r.startContainer.getBoundingClientRect(),n.left=i.left,n.top=i.top;else if(d){let t=r.startContainer,e=new Range;try{1===t.nodeType?i=t.getBoundingClientRect():r.startOffset+2<t.length?(e.setStart(t,r.startOffset),e.setEnd(t,r.startOffset+2),i=e.getBoundingClientRect()):r.startOffset-2>0?(e.setStart(t,r.startOffset-2),e.setEnd(t,r.startOffset),i=e.getBoundingClientRect()):i=t.parentNode.getBoundingClientRect()}catch(t){console.error(t,t.stack)}}else i=r.getBoundingClientRect()}}else if("string"==typeof t&&t.indexOf("#")>-1){let e=t.substring(t.indexOf("#")+1),n=this.document.getElementById(e);if(n)if(d){let t=new Range;t.selectNode(n),i=t.getBoundingClientRect()}else i=n.getBoundingClientRect()}return i&&(n.left=i.left,n.top=i.top),n}addStylesheet(t){return new Promise(function(e,i){var n,r=!1;this.document?(n=this.document.querySelector("link[href='"+t+"']"))?e(!0):((n=this.document.createElement("link")).type="text/css",n.rel="stylesheet",n.href=t,n.onload=n.onreadystatechange=function(){r||this.readyState&&"complete"!=this.readyState||(r=!0,setTimeout(()=>{e(!0)},1))},this.document.head.appendChild(n)):e(!1)}.bind(this))}_getStylesheetNode(t){var e;return t="epubjs-inserted-css-"+(t||""),!!this.document&&((e=this.document.getElementById(t))||((e=this.document.createElement("style")).id=t,this.document.head.appendChild(e)),e)}addStylesheetCss(t,e){return!(!this.document||!t)&&(this._getStylesheetNode(e).innerHTML=t,!0)}addStylesheetRules(t,e){var i;if(this.document&&t&&0!==t.length)if(i=this._getStylesheetNode(e).sheet,"[object Array]"===Object.prototype.toString.call(t))for(var n=0,r=t.length;n<r;n++){var s=1,o=t[n],a=t[n][0],h="";"[object Array]"===Object.prototype.toString.call(o[1][0])&&(o=o[1],s=0);for(var l=o.length;s<l;s++){var c=o[s];h+=c[0]+":"+c[1]+(c[2]?" !important":"")+";\n"}i.insertRule(a+"{"+h+"}",i.cssRules.length)}else{Object.keys(t).forEach(e=>{const n=t[e];if(Array.isArray(n))n.forEach(t=>{const n=Object.keys(t).map(e=>`${e}:${t[e]}`).join(";");i.insertRule(`${e}{${n}}`,i.cssRules.length)});else{const t=Object.keys(n).map(t=>`${t}:${n[t]}`).join(";");i.insertRule(`${e}{${t}}`,i.cssRules.length)}})}}addScript(t){return new Promise(function(e,i){var n,r=!1;this.document?((n=this.document.createElement("script")).type="text/javascript",n.async=!0,n.src=t,n.onload=n.onreadystatechange=function(){r||this.readyState&&"complete"!=this.readyState||(r=!0,setTimeout((function(){e(!0)}),1))},this.document.head.appendChild(n)):e(!1)}.bind(this))}addClass(t){var e;this.document&&(e=this.content||this.document.body)&&e.classList.add(t)}removeClass(t){var e;this.document&&(e=this.content||this.document.body)&&e.classList.remove(t)}addEventListeners(){this.document&&(this._triggerEvent=this.triggerEvent.bind(this),l.a.forEach((function(t){this.document.addEventListener(t,this._triggerEvent,{passive:!0})}),this))}removeEventListeners(){this.document&&(l.a.forEach((function(t){this.document.removeEventListener(t,this._triggerEvent,{passive:!0})}),this),this._triggerEvent=void 0)}triggerEvent(t){this.emit(t.type,t)}addSelectionListeners(){this.document&&(this._onSelectionChange=this.onSelectionChange.bind(this),this.document.addEventListener("selectionchange",this._onSelectionChange,{passive:!0}))}removeSelectionListeners(){this.document&&(this.document.removeEventListener("selectionchange",this._onSelectionChange,{passive:!0}),this._onSelectionChange=void 0)}onSelectionChange(t){this.selectionEndTimeout&&clearTimeout(this.selectionEndTimeout),this.selectionEndTimeout=setTimeout(function(){var t=this.window.getSelection();this.triggerSelectedEvent(t)}.bind(this),250)}triggerSelectedEvent(t){var e,i;t&&t.rangeCount>0&&((e=t.getRangeAt(0)).collapsed||(i=new o.a(e,this.cfiBase).toString(),this.emit(l.c.CONTENTS.SELECTED,i),this.emit(l.c.CONTENTS.SELECTED_RANGE,e)))}range(t,e){return new o.a(t).toRange(this.document,e)}cfiFromRange(t,e){return new o.a(t,this.cfiBase,e).toString()}cfiFromNode(t,e){return new o.a(t,this.cfiBase,e).toString()}map(t){return new a.a(t).section()}size(t,e){var i={scale:1,scalable:"no"};this.layoutStyle("scrolling"),t>=0&&(this.width(t),i.width=t,this.css("padding","0 "+t/12+"px")),e>=0&&(this.height(e),i.height=e),this.css("margin","0"),this.css("box-sizing","border-box"),this.viewport(i)}columns(t,e,i,n,r){let o=Object(s.prefixed)("column-axis"),a=Object(s.prefixed)("column-gap"),h=Object(s.prefixed)("column-width"),l=Object(s.prefixed)("column-fill"),c=0===this.writingMode().indexOf("vertical")?"vertical":"horizontal";this.layoutStyle("paginated"),"rtl"===r&&"horizontal"===c&&this.direction(r),this.width(t),this.height(e),this.viewport({width:t,height:e,scale:1,scalable:"no"}),this.css("overflow-y","hidden"),this.css("margin","0",!0),"vertical"===c?(this.css("padding-top",n/2+"px",!0),this.css("padding-bottom",n/2+"px",!0),this.css("padding-left","20px"),this.css("padding-right","20px"),this.css(o,"vertical")):(this.css("padding-top","20px"),this.css("padding-bottom","20px"),this.css("padding-left",n/2+"px",!0),this.css("padding-right",n/2+"px",!0),this.css(o,"horizontal")),this.css("box-sizing","border-box"),this.css("max-width","inherit"),this.css(l,"auto"),this.css(a,n+"px"),this.css(h,i+"px"),this.css("-webkit-line-box-contain","block glyphs replaced")}scaler(t,e,i){var n="scale("+t+")",r="";this.css("transform-origin","top left"),(e>=0||i>=0)&&(r=" translate("+(e||0)+"px, "+(i||0)+"px )"),this.css("transform",n+r)}fit(t,e,i){var n=this.viewport(),r=parseInt(n.width),s=parseInt(n.height),o=t/r,a=e/s,h=o<a?o:a;if(this.layoutStyle("paginated"),this.width(r),this.height(s),this.overflow("hidden"),this.scaler(h,0,0),this.css("background-size",r*h+"px "+s*h+"px"),this.css("background-color","transparent"),i&&i.properties.includes("page-spread-left")){var l=t-r*h;this.css("margin-left",l+"px")}}direction(t){this.documentElement&&(this.documentElement.style.direction=t)}mapPage(t,e,i,n,r){return new a.a(e,r).page(this,t,i,n)}linksHandler(){Object(h.c)(this.content,t=>{this.emit(l.c.CONTENTS.LINK_CLICKED,t)})}writingMode(t){let e=Object(s.prefixed)("writing-mode");return t&&this.documentElement&&(this.documentElement.style[e]=t),this.window.getComputedStyle(this.documentElement)[e]||""}layoutStyle(t){return t&&(this._layoutStyle=t,navigator.epubReadingSystem.layoutStyle=this._layoutStyle),this._layoutStyle||"paginated"}epubReadingSystem(t,e){return navigator.epubReadingSystem={name:t,version:e,layoutStyle:this.layoutStyle(),hasFeature:function(t){switch(t){case"dom-manipulation":case"layout-changes":case"touch-events":case"mouse-events":case"keyboard-events":return!0;case"spine-scripting":default:return!1}}},navigator.epubReadingSystem}destroy(){this.removeListeners()}}r()(f.prototype),e.a=f},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Underline=e.Highlight=e.Mark=e.Pane=void 0;var n=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),r=o(i(135)),s=o(i(136));function o(t){return t&&t.__esModule?t:{default:t}}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function h(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function l(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}e.Pane=function(){function t(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document.body;l(this,t),this.target=e,this.element=r.default.createElement("svg"),this.marks=[],this.element.style.position="absolute",this.element.setAttribute("pointer-events","none"),s.default.proxyMouse(this.target,this.marks),this.container=i,this.container.appendChild(this.element),this.render()}return n(t,[{key:"addMark",value:function(t){var e=r.default.createElement("g");return this.element.appendChild(e),t.bind(e,this.container),this.marks.push(t),t.render(),t}},{key:"removeMark",value:function(t){var e=this.marks.indexOf(t);if(-1!==e){var i=t.unbind();this.element.removeChild(i),this.marks.splice(e,1)}}},{key:"render",value:function(){var t,e,i,n;!function(t,e){t.style.setProperty("top",e.top+"px","important"),t.style.setProperty("left",e.left+"px","important"),t.style.setProperty("height",e.height+"px","important"),t.style.setProperty("width",e.width+"px","important")}(this.element,(t=this.target,e=this.container,i=e.getBoundingClientRect(),n=t.getBoundingClientRect(),{top:n.top-i.top,left:n.left-i.left,height:t.scrollHeight,width:t.scrollWidth}));var r=!0,s=!1,o=void 0;try{for(var a,h=this.marks[Symbol.iterator]();!(r=(a=h.next()).done);r=!0){a.value.render()}}catch(t){s=!0,o=t}finally{try{!r&&h.return&&h.return()}finally{if(s)throw o}}}}]),t}();var c=e.Mark=function(){function t(){l(this,t),this.element=null}return n(t,[{key:"bind",value:function(t,e){this.element=t,this.container=e}},{key:"unbind",value:function(){var t=this.element;return this.element=null,t}},{key:"render",value:function(){}},{key:"dispatchEvent",value:function(t){this.element&&this.element.dispatchEvent(t)}},{key:"getBoundingClientRect",value:function(){return this.element.getBoundingClientRect()}},{key:"getClientRects",value:function(){for(var t=[],e=this.element.firstChild;e;)t.push(e.getBoundingClientRect()),e=e.nextSibling;return t}},{key:"filteredRanges",value:function(){var t=Array.from(this.range.getClientRects());return t.filter((function(e){for(var i=0;i<t.length;i++){if(t[i]===e)return!0;if(n=t[i],(r=e).right<=n.right&&r.left>=n.left&&r.top>=n.top&&r.bottom<=n.bottom)return!1}var n,r;return!0}))}}]),t}(),u=e.Highlight=function(t){function e(t,i,n,r){l(this,e);var s=a(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));return s.range=t,s.className=i,s.data=n||{},s.attributes=r||{},s}return h(e,t),n(e,[{key:"bind",value:function(t,i){for(var n in function t(e,i,n){null===e&&(e=Function.prototype);var r=Object.getOwnPropertyDescriptor(e,i);if(void 0===r){var s=Object.getPrototypeOf(e);return null===s?void 0:t(s,i,n)}if("value"in r)return r.value;var o=r.get;return void 0!==o?o.call(n):void 0}(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"bind",this).call(this,t,i),this.data)this.data.hasOwnProperty(n)&&(this.element.dataset[n]=this.data[n]);for(var n in this.attributes)this.attributes.hasOwnProperty(n)&&this.element.setAttribute(n,this.attributes[n]);this.className&&this.element.classList.add(this.className)}},{key:"render",value:function(){for(;this.element.firstChild;)this.element.removeChild(this.element.firstChild);for(var t=this.element.ownerDocument.createDocumentFragment(),e=this.filteredRanges(),i=this.element.getBoundingClientRect(),n=this.container.getBoundingClientRect(),s=0,o=e.length;s<o;s++){var a=e[s],h=r.default.createElement("rect");h.setAttribute("x",a.left-i.left+n.left),h.setAttribute("y",a.top-i.top+n.top),h.setAttribute("height",a.height),h.setAttribute("width",a.width),t.appendChild(h)}this.element.appendChild(t)}}]),e}(c);e.Underline=function(t){function e(t,i,n,r){return l(this,e),a(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,i,n,r))}return h(e,t),n(e,[{key:"render",value:function(){for(;this.element.firstChild;)this.element.removeChild(this.element.firstChild);for(var t=this.element.ownerDocument.createDocumentFragment(),e=this.filteredRanges(),i=this.element.getBoundingClientRect(),n=this.container.getBoundingClientRect(),s=0,o=e.length;s<o;s++){var a=e[s],h=r.default.createElement("rect");h.setAttribute("x",a.left-i.left+n.left),h.setAttribute("y",a.top-i.top+n.top),h.setAttribute("height",a.height),h.setAttribute("width",a.width),h.setAttribute("fill","none");var l=r.default.createElement("line");l.setAttribute("x1",a.left-i.left+n.left),l.setAttribute("x2",a.left-i.left+n.left+a.width),l.setAttribute("y1",a.top-i.top+n.top+a.height-1),l.setAttribute("y2",a.top-i.top+n.top+a.height-1),l.setAttribute("stroke-width",1),l.setAttribute("stroke","black"),l.setAttribute("stroke-linecap","square"),t.appendChild(h),t.appendChild(l)}this.element.appendChild(t)}}]),e}(u)},function(t,e){var i;i=function(){return this}();try{i=i||new Function("return this")()}catch(t){"object"==typeof window&&(i=window)}t.exports=i},function(t,e,i){var n=i(7),r=i(59).f,s=i(15),o=i(19),a=i(42),h=i(90),l=i(96);t.exports=function(t,e){var i,c,u,d,f,p=t.target,g=t.global,v=t.stat;if(i=g?n:v?n[p]||a(p,{}):(n[p]||{}).prototype)for(c in e){if(d=e[c],u=t.noTargetGet?(f=r(i,c))&&f.value:i[c],!l(g?c:p+(v?".":"#")+c,t.forced)&&void 0!==u){if(typeof d==typeof u)continue;h(d,u)}(t.sham||u&&u.sham)&&s(d,"sham",!0),o(i,c,d,t)}}},function(t,e,i){var n=i(61),r=i(33);t.exports=function(t){return n(r(t))}},function(t,e){t.exports=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t}},function(t,e){t.exports=!1},function(t,e){var i=Math.ceil,n=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?n:i)(t)}},function(t,e,i){var n=i(33);t.exports=function(t){return Object(n(t))}},function(t,e,i){var n=i(18).f,r=i(10),s=i(8)("toStringTag");t.exports=function(t,e,i){t&&!r(t=i?t:t.prototype,s)&&n(t,s,{configurable:!0,value:e})}},function(e,i){e.exports=t},function(t,e,i){"use strict";var n=i(3),r=i.n(n),s=i(0),o=i(6),a=i(2),h=i(21),l=i(1);class c{constructor(t){this.settings=t,this.name=t.layout||"reflowable",this._spread="none"!==t.spread,this._minSpreadWidth=t.minSpreadWidth||800,this._evenSpreads=t.evenSpreads||!1,"scrolled"===t.flow||"scrolled-continuous"===t.flow||"scrolled-doc"===t.flow?this._flow="scrolled":this._flow="paginated",this.width=0,this.height=0,this.spreadWidth=0,this.delta=0,this.columnWidth=0,this.gap=0,this.divisor=1,this.props={name:this.name,spread:this._spread,flow:this._flow,width:0,height:0,spreadWidth:0,delta:0,columnWidth:0,gap:0,divisor:1}}flow(t){return void 0!==t&&(this._flow="scrolled"===t||"scrolled-continuous"===t||"scrolled-doc"===t?"scrolled":"paginated",this.update({flow:this._flow})),this._flow}spread(t,e){return t&&(this._spread="none"!==t,this.update({spread:this._spread})),e>=0&&(this._minSpreadWidth=e),this._spread}calculate(t,e,i){var n,r,s,o,a=1,h=i||0,l=t,c=e,u=Math.floor(l/12);a=this._spread&&l>=this._minSpreadWidth?2:1,"reflowable"!==this.name||"paginated"!==this._flow||i>=0||(h=u%2==0?u:u-1),"pre-paginated"===this.name&&(h=0),a>1?s=(n=l/a-h)+h:(n=l,s=l),"pre-paginated"===this.name&&a>1&&(l=n),r=n*a+h,o=l,this.width=l,this.height=c,this.spreadWidth=r,this.pageWidth=s,this.delta=o,this.columnWidth=n,this.gap=h,this.divisor=a,this.update({width:l,height:c,spreadWidth:r,pageWidth:s,delta:o,columnWidth:n,gap:h,divisor:a})}format(t,e,i){return"pre-paginated"===this.name?t.fit(this.columnWidth,this.height,e):"paginated"===this._flow?t.columns(this.width,this.height,this.columnWidth,this.gap,this.settings.direction):i&&"horizontal"===i?t.size(null,this.height):t.size(this.width,null)}count(t,e){let i,n;return"pre-paginated"===this.name?(i=1,n=1):"paginated"===this._flow?(e=e||this.delta,i=Math.ceil(t/e),n=i*this.divisor):(e=e||this.height,i=Math.ceil(t/e),n=i),{spreads:i,pages:n}}update(t){if(Object.keys(t).forEach(e=>{this.props[e]===t[e]&&delete t[e]}),Object.keys(t).length>0){let e=Object(s.extend)(this.props,t);this.emit(l.c.LAYOUT.UPDATED,e,t)}}}r()(c.prototype);var u=c,d=i(5);var f=class{constructor(t){this.rendition=t,this._themes={default:{rules:{},url:"",serialized:""}},this._overrides={},this._current="default",this._injected=[],this.rendition.hooks.content.register(this.inject.bind(this)),this.rendition.hooks.content.register(this.overrides.bind(this))}register(){if(0!==arguments.length)return 1===arguments.length&&"object"==typeof arguments[0]?this.registerThemes(arguments[0]):1===arguments.length&&"string"==typeof arguments[0]?this.default(arguments[0]):2===arguments.length&&"string"==typeof arguments[1]?this.registerUrl(arguments[0],arguments[1]):2===arguments.length&&"object"==typeof arguments[1]?this.registerRules(arguments[0],arguments[1]):void 0}default(t){if(t)return"string"==typeof t?this.registerUrl("default",t):"object"==typeof t?this.registerRules("default",t):void 0}registerThemes(t){for(var e in t)t.hasOwnProperty(e)&&("string"==typeof t[e]?this.registerUrl(e,t[e]):this.registerRules(e,t[e]))}registerCss(t,e){this._themes[t]={serialized:e},(this._injected[t]||"default"==t)&&this.update(t)}registerUrl(t,e){var i=new d.a(e);this._themes[t]={url:i.toString()},(this._injected[t]||"default"==t)&&this.update(t)}registerRules(t,e){this._themes[t]={rules:e},(this._injected[t]||"default"==t)&&this.update(t)}select(t){var e=this._current;this._current=t,this.update(t),this.rendition.getContents().forEach(i=>{i.removeClass(e),i.addClass(t)})}update(t){this.rendition.getContents().forEach(e=>{this.add(t,e)})}inject(t){var e,i=[],n=this._themes;for(var r in n)!n.hasOwnProperty(r)||r!==this._current&&"default"!==r||(((e=n[r]).rules&&Object.keys(e.rules).length>0||e.url&&-1===i.indexOf(e.url))&&this.add(r,t),this._injected.push(r));"default"!=this._current&&t.addClass(this._current)}add(t,e){var i=this._themes[t];i&&e&&(i.url?e.addStylesheet(i.url):i.serialized?(e.addStylesheetCss(i.serialized,t),i.injected=!0):i.rules&&(e.addStylesheetRules(i.rules,t),i.injected=!0))}override(t,e,i){var n=this.rendition.getContents();this._overrides[t]={value:e,priority:!0===i},n.forEach(e=>{e.css(t,this._overrides[t].value,this._overrides[t].priority)})}removeOverride(t){var e=this.rendition.getContents();delete this._overrides[t],e.forEach(e=>{e.css(t)})}overrides(t){var e=this._overrides;for(var i in e)e.hasOwnProperty(i)&&t.css(i,e[i].value,e[i].priority)}fontSize(t){this.override("font-size",t)}font(t){this.override("font-family",t,!0)}destroy(){this.rendition=void 0,this._themes=void 0,this._overrides=void 0,this._current=void 0,this._injected=void 0}};i(28);class p{constructor({type:t,cfiRange:e,data:i,sectionIndex:n,cb:r,className:s,styles:o}){this.type=t,this.cfiRange=e,this.data=i,this.sectionIndex=n,this.mark=void 0,this.cb=r,this.className=s,this.styles=o}update(t){this.data=t}attach(t){let e,{cfiRange:i,data:n,type:r,mark:s,cb:o,className:a,styles:h}=this;return"highlight"===r?e=t.highlight(i,n,o,a,h):"underline"===r?e=t.underline(i,n,o,a,h):"mark"===r&&(e=t.mark(i,n,o)),this.mark=e,this.emit(l.c.ANNOTATION.ATTACH,e),e}detach(t){let e,{cfiRange:i,type:n}=this;return t&&("highlight"===n?e=t.unhighlight(i):"underline"===n?e=t.ununderline(i):"mark"===n&&(e=t.unmark(i))),this.mark=void 0,this.emit(l.c.ANNOTATION.DETACH,e),e}text(){}}r()(p.prototype);var g=class{constructor(t){this.rendition=t,this.highlights=[],this.underlines=[],this.marks=[],this._annotations={},this._annotationsBySectionIndex={},this.rendition.hooks.render.register(this.inject.bind(this)),this.rendition.hooks.unloaded.register(this.clear.bind(this))}add(t,e,i,n,r,s){let o=encodeURI(e+t),h=new a.a(e).spinePos,l=new p({type:t,cfiRange:e,data:i,sectionIndex:h,cb:n,className:r,styles:s});return this._annotations[o]=l,h in this._annotationsBySectionIndex?this._annotationsBySectionIndex[h].push(o):this._annotationsBySectionIndex[h]=[o],this.rendition.views().forEach(t=>{l.sectionIndex===t.index&&l.attach(t)}),l}remove(t,e){let i=encodeURI(t+e);if(i in this._annotations){let t=this._annotations[i];if(e&&t.type!==e)return;this.rendition.views().forEach(e=>{this._removeFromAnnotationBySectionIndex(t.sectionIndex,i),t.sectionIndex===e.index&&t.detach(e)}),delete this._annotations[i]}}_removeFromAnnotationBySectionIndex(t,e){this._annotationsBySectionIndex[t]=this._annotationsAt(t).filter(t=>t!==e)}_annotationsAt(t){return this._annotationsBySectionIndex[t]}highlight(t,e,i,n,r){return this.add("highlight",t,e,i,n,r)}underline(t,e,i,n,r){return this.add("underline",t,e,i,n,r)}mark(t,e,i){return this.add("mark",t,e,i)}each(){return this._annotations.forEach.apply(this._annotations,arguments)}inject(t){let e=t.index;if(e in this._annotationsBySectionIndex){this._annotationsBySectionIndex[e].forEach(e=>{this._annotations[e].attach(t)})}}clear(t){let e=t.index;if(e in this._annotationsBySectionIndex){this._annotationsBySectionIndex[e].forEach(e=>{this._annotations[e].detach(t)})}}show(){}hide(){}},v=i(54),m=i(22),y=i(56);class b{constructor(t,e){this.settings=Object(s.extend)(this.settings||{},{width:null,height:null,ignoreClass:"",manager:"default",view:"iframe",flow:null,layout:null,spread:null,minSpreadWidth:800,stylesheet:null,resizeOnOrientationChange:!0,script:null,snap:!1,defaultDirection:"ltr"}),Object(s.extend)(this.settings,e),"object"==typeof this.settings.manager&&(this.manager=this.settings.manager),this.book=t,this.hooks={},this.hooks.display=new o.a(this),this.hooks.serialize=new o.a(this),this.hooks.content=new o.a(this),this.hooks.unloaded=new o.a(this),this.hooks.layout=new o.a(this),this.hooks.render=new o.a(this),this.hooks.show=new o.a(this),this.hooks.content.register(this.handleLinks.bind(this)),this.hooks.content.register(this.passEvents.bind(this)),this.hooks.content.register(this.adjustImages.bind(this)),this.book.spine.hooks.content.register(this.injectIdentifier.bind(this)),this.settings.stylesheet&&this.book.spine.hooks.content.register(this.injectStylesheet.bind(this)),this.settings.script&&this.book.spine.hooks.content.register(this.injectScript.bind(this)),this.themes=new f(this),this.annotations=new g(this),this.epubcfi=new a.a,this.q=new h.a(this),this.location=void 0,this.q.enqueue(this.book.opened),this.starting=new s.defer,this.started=this.starting.promise,this.q.enqueue(this.start)}setManager(t){this.manager=t}requireManager(t){return"string"==typeof t&&"default"===t?m.a:"string"==typeof t&&"continuous"===t?y.a:t}requireView(t){return"string"==typeof t&&"iframe"===t?v.a:t}start(){switch(this.settings.layout||"pre-paginated"!==this.book.package.metadata.layout&&"true"!==this.book.displayOptions.fixedLayout||(this.settings.layout="pre-paginated"),this.book.package.metadata.spread){case"none":this.settings.spread="none";break;case"both":this.settings.spread=!0}this.manager||(this.ViewManager=this.requireManager(this.settings.manager),this.View=this.requireView(this.settings.view),this.manager=new this.ViewManager({view:this.View,queue:this.q,request:this.book.load.bind(this.book),settings:this.settings})),this.direction(this.book.package.metadata.direction||this.settings.defaultDirection),this.settings.globalLayoutProperties=this.determineLayoutProperties(this.book.package.metadata),this.flow(this.settings.globalLayoutProperties.flow),this.layout(this.settings.globalLayoutProperties),this.manager.on(l.c.MANAGERS.ADDED,this.afterDisplayed.bind(this)),this.manager.on(l.c.MANAGERS.REMOVED,this.afterRemoved.bind(this)),this.manager.on(l.c.MANAGERS.RESIZED,this.onResized.bind(this)),this.manager.on(l.c.MANAGERS.ORIENTATION_CHANGE,this.onOrientationChange.bind(this)),this.manager.on(l.c.MANAGERS.SCROLLED,this.reportLocation.bind(this)),this.emit(l.c.RENDITION.STARTED),this.starting.resolve()}attachTo(t){return this.q.enqueue(function(){this.manager.render(t,{width:this.settings.width,height:this.settings.height}),this.emit(l.c.RENDITION.ATTACHED)}.bind(this))}display(t){return this.displaying&&this.displaying.resolve(),this.q.enqueue(this._display,t)}_display(t){if(this.book){this.epubcfi.isCfiString(t);var e,i=new s.defer,n=i.promise;return this.displaying=i,this.book.locations.length()&&Object(s.isFloat)(t)&&(t=this.book.locations.cfiFromPercentage(parseFloat(t))),(e=this.book.spine.get(t))?(this.manager.display(e,t).then(()=>{i.resolve(e),this.displaying=void 0,this.emit(l.c.RENDITION.DISPLAYED,e),this.reportLocation()},t=>{this.emit(l.c.RENDITION.DISPLAY_ERROR,t)}),n):(i.reject(new Error("No Section Found")),n)}}afterDisplayed(t){t.on(l.c.VIEWS.MARK_CLICKED,(e,i)=>this.triggerMarkEvent(e,i,t.contents)),this.hooks.render.trigger(t,this).then(()=>{t.contents?this.hooks.content.trigger(t.contents,this).then(()=>{this.emit(l.c.RENDITION.RENDERED,t.section,t)}):this.emit(l.c.RENDITION.RENDERED,t.section,t)})}afterRemoved(t){this.hooks.unloaded.trigger(t,this).then(()=>{this.emit(l.c.RENDITION.REMOVED,t.section,t)})}onResized(t,e){this.emit(l.c.RENDITION.RESIZED,{width:t.width,height:t.height},e),this.location&&this.location.start&&this.display(e||this.location.start.cfi)}onOrientationChange(t){this.emit(l.c.RENDITION.ORIENTATION_CHANGE,t)}moveTo(t){this.manager.moveTo(t)}resize(t,e,i){t&&(this.settings.width=t),e&&(this.settings.height=e),this.manager.resize(t,e,i)}clear(){this.manager.clear()}next(){return this.q.enqueue(this.manager.next.bind(this.manager)).then(this.reportLocation.bind(this))}prev(){return this.q.enqueue(this.manager.prev.bind(this.manager)).then(this.reportLocation.bind(this))}determineLayoutProperties(t){var e=this.settings.layout||t.layout||"reflowable",i=this.settings.spread||t.spread||"auto",n=this.settings.orientation||t.orientation||"auto",r=this.settings.flow||t.flow||"auto",s=t.viewport||"",o=this.settings.minSpreadWidth||t.minSpreadWidth||800,a=this.settings.direction||t.direction||"ltr";return(0===this.settings.width||this.settings.width>0)&&(0===this.settings.height||this.settings.height),{layout:e,spread:i,orientation:n,flow:r,viewport:s,minSpreadWidth:o,direction:a}}flow(t){var e=t;"scrolled"!==t&&"scrolled-doc"!==t&&"scrolled-continuous"!==t||(e="scrolled"),"auto"!==t&&"paginated"!==t||(e="paginated"),this.settings.flow=t,this._layout&&this._layout.flow(e),this.manager&&this._layout&&this.manager.applyLayout(this._layout),this.manager&&this.manager.updateFlow(e),this.manager&&this.manager.isRendered()&&this.location&&(this.manager.clear(),this.display(this.location.start.cfi))}layout(t){return t&&(this._layout=new u(t),this._layout.spread(t.spread,this.settings.minSpreadWidth),this._layout.on(l.c.LAYOUT.UPDATED,(t,e)=>{this.emit(l.c.RENDITION.LAYOUT,t,e)})),this.manager&&this._layout&&this.manager.applyLayout(this._layout),this._layout}spread(t,e){this.settings.spread=t,e&&(this.settings.minSpreadWidth=e),this._layout&&this._layout.spread(t,e),this.manager&&this.manager.isRendered()&&this.manager.updateLayout()}direction(t){this.settings.direction=t||"ltr",this.manager&&this.manager.direction(this.settings.direction),this.manager&&this.manager.isRendered()&&this.location&&(this.manager.clear(),this.display(this.location.start.cfi))}reportLocation(){return this.q.enqueue(function(){requestAnimationFrame(function(){var t=this.manager.currentLocation();if(t&&t.then&&"function"==typeof t.then)t.then(function(t){let e=this.located(t);e&&e.start&&e.end&&(this.location=e,this.emit(l.c.RENDITION.LOCATION_CHANGED,{index:this.location.start.index,href:this.location.start.href,start:this.location.start.cfi,end:this.location.end.cfi,percentage:this.location.start.percentage}),this.emit(l.c.RENDITION.RELOCATED,this.location))}.bind(this));else if(t){let e=this.located(t);if(!e||!e.start||!e.end)return;this.location=e,this.emit(l.c.RENDITION.LOCATION_CHANGED,{index:this.location.start.index,href:this.location.start.href,start:this.location.start.cfi,end:this.location.end.cfi,percentage:this.location.start.percentage}),this.emit(l.c.RENDITION.RELOCATED,this.location)}}.bind(this))}.bind(this))}currentLocation(){var t=this.manager.currentLocation();if(t&&t.then&&"function"==typeof t.then)t.then(function(t){return this.located(t)}.bind(this));else if(t){return this.located(t)}}located(t){if(!t.length)return{};let e=t[0],i=t[t.length-1],n={start:{index:e.index,href:e.href,cfi:e.mapping.start,displayed:{page:e.pages[0]||1,total:e.totalPages}},end:{index:i.index,href:i.href,cfi:i.mapping.end,displayed:{page:i.pages[i.pages.length-1]||1,total:i.totalPages}}},r=this.book.locations.locationFromCfi(e.mapping.start),s=this.book.locations.locationFromCfi(i.mapping.end);null!=r&&(n.start.location=r,n.start.percentage=this.book.locations.percentageFromLocation(r)),null!=s&&(n.end.location=s,n.end.percentage=this.book.locations.percentageFromLocation(s));let o=this.book.pageList.pageFromCfi(e.mapping.start),a=this.book.pageList.pageFromCfi(i.mapping.end);return-1!=o&&(n.start.page=o),-1!=a&&(n.end.page=a),i.index===this.book.spine.last().index&&n.end.displayed.page>=n.end.displayed.total&&(n.atEnd=!0),e.index===this.book.spine.first().index&&1===n.start.displayed.page&&(n.atStart=!0),n}destroy(){this.manager&&this.manager.destroy(),this.book=void 0}passEvents(t){l.a.forEach(e=>{t.on(e,e=>this.triggerViewEvent(e,t))}),t.on(l.c.CONTENTS.SELECTED,e=>this.triggerSelectedEvent(e,t))}triggerViewEvent(t,e){this.emit(t.type,t,e)}triggerSelectedEvent(t,e){this.emit(l.c.RENDITION.SELECTED,t,e)}triggerMarkEvent(t,e,i){this.emit(l.c.RENDITION.MARK_CLICKED,t,e,i)}getRange(t,e){var i=new a.a(t),n=this.manager.visible().filter((function(t){if(i.spinePos===t.index)return!0}));if(n.length)return n[0].contents.range(i,e)}adjustImages(t){if("pre-paginated"===this._layout.name)return new Promise((function(t){t()}));let e=t.window.getComputedStyle(t.content,null),i=.95*(t.content.offsetHeight-(parseFloat(e.paddingTop)+parseFloat(e.paddingBottom))),n=parseFloat(e.paddingLeft)+parseFloat(e.paddingRight);return t.addStylesheetRules({img:{"max-width":(this._layout.columnWidth?this._layout.columnWidth-n+"px":"100%")+"!important","max-height":i+"px!important","object-fit":"contain","page-break-inside":"avoid","break-inside":"avoid","box-sizing":"border-box"},svg:{"max-width":(this._layout.columnWidth?this._layout.columnWidth-n+"px":"100%")+"!important","max-height":i+"px!important","page-break-inside":"avoid","break-inside":"avoid"}}),new Promise((function(t,e){setTimeout((function(){t()}),1)}))}getContents(){return this.manager?this.manager.getContents():[]}views(){return(this.manager?this.manager.views:void 0)||[]}handleLinks(t){t&&t.on(l.c.CONTENTS.LINK_CLICKED,t=>{let e=this.book.path.relative(t);this.display(e)})}injectStylesheet(t,e){let i=t.createElement("link");i.setAttribute("type","text/css"),i.setAttribute("rel","stylesheet"),i.setAttribute("href",this.settings.stylesheet),t.getElementsByTagName("head")[0].appendChild(i)}injectScript(t,e){let i=t.createElement("script");i.setAttribute("type","text/javascript"),i.setAttribute("src",this.settings.script),i.textContent=" ",t.getElementsByTagName("head")[0].appendChild(i)}injectIdentifier(t,e){let i=this.book.packaging.metadata.identifier,n=t.createElement("meta");n.setAttribute("name","dc.relation.ispartof"),i&&n.setAttribute("content",i),t.getElementsByTagName("head")[0].appendChild(n)}}r()(b.prototype);e.a=b},function(t,e){var i={}.toString;t.exports=function(t){return i.call(t).slice(8,-1)}},function(t,e,i){var n=i(17);t.exports=function(t,e){if(!n(t))return t;var i,r;if(e&&"function"==typeof(i=t.toString)&&!n(r=i.call(t)))return r;if("function"==typeof(i=t.valueOf)&&!n(r=i.call(t)))return r;if(!e&&"function"==typeof(i=t.toString)&&!n(r=i.call(t)))return r;throw TypeError("Can't convert object to primitive value")}},function(t,e,i){var n=i(7),r=i(15);t.exports=function(t,e){try{r(n,t,e)}catch(i){n[t]=e}return e}},function(t,e,i){var n=i(66),r=i(67),s=n("keys");t.exports=function(t){return s[t]||(s[t]=r(t))}},function(t,e){t.exports={}},function(t,e,i){var n=i(92),r=i(7),s=function(t){return"function"==typeof t?t:void 0};t.exports=function(t,e){return arguments.length<2?s(n[t])||s(r[t]):n[t]&&n[t][e]||r[t]&&r[t][e]}},function(t,e,i){var n=i(35),r=Math.min;t.exports=function(t){return t>0?r(n(t),9007199254740991):0}},function(t,e){t.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},function(t,e,i){"use strict";var n,r,s=i(97),o=i(98),a=RegExp.prototype.exec,h=String.prototype.replace,l=a,c=(n=/a/,r=/b*/g,a.call(n,"a"),a.call(r,"a"),0!==n.lastIndex||0!==r.lastIndex),u=o.UNSUPPORTED_Y||o.BROKEN_CARET,d=void 0!==/()??/.exec("")[1];(c||d||u)&&(l=function(t){var e,i,n,r,o=this,l=u&&o.sticky,f=s.call(o),p=o.source,g=0,v=t;return l&&(-1===(f=f.replace("y","")).indexOf("g")&&(f+="g"),v=String(t).slice(o.lastIndex),o.lastIndex>0&&(!o.multiline||o.multiline&&"\n"!==t[o.lastIndex-1])&&(p="(?: "+p+")",v=" "+v,g++),i=new RegExp("^(?:"+p+")",f)),d&&(i=new RegExp("^"+p+"$(?!\\s)",f)),c&&(e=o.lastIndex),n=a.call(l?i:o,v),l?n?(n.input=n.input.slice(g),n[0]=n[0].slice(g),n.index=o.lastIndex,o.lastIndex+=n[0].length):o.lastIndex=0:c&&n&&(o.lastIndex=o.global?n.index+n[0].length:e),d&&n&&n.length>1&&h.call(n[0],i,(function(){for(r=1;r<arguments.length-2;r++)void 0===arguments[r]&&(n[r]=void 0)})),n}),t.exports=l},function(t,e,i){var n=i(35),r=i(33),s=function(t){return function(e,i){var s,o,a=String(r(e)),h=n(i),l=a.length;return h<0||h>=l?t?"":void 0:(s=a.charCodeAt(h))<55296||s>56319||h+1===l||(o=a.charCodeAt(h+1))<56320||o>57343?t?a.charAt(h):s:t?a.slice(h,h+2):o-56320+(s-55296<<10)+65536}};t.exports={codeAt:s(!1),charAt:s(!0)}},function(t,e,i){var n,r=i(13),s=i(72),o=i(47),a=i(44),h=i(104),l=i(63),c=i(43),u=c("IE_PROTO"),d=function(){},f=function(t){return"<script>"+t+"<\/script>"},p=function(){try{n=document.domain&&new ActiveXObject("htmlfile")}catch(t){}var t,e;p=n?function(t){t.write(f("")),t.close();var e=t.parentWindow.Object;return t=null,e}(n):((e=l("iframe")).style.display="none",h.appendChild(e),e.src=String("javascript:"),(t=e.contentWindow.document).open(),t.write(f("document.F=Object")),t.close(),t.F);for(var i=o.length;i--;)delete p.prototype[o[i]];return p()};a[u]=!0,t.exports=Object.create||function(t,e){var i;return null!==t?(d.prototype=r(t),i=new d,d.prototype=null,i[u]=t):i=p(),void 0===e?i:s(i,e)}},function(t,e,i){"use strict";var n=i(115)();t.exports=function(t){return t!==n&&null!==t}},function(t,e,i){var n=i(81),r=i(27),s=i(8)("iterator");t.exports=function(t){if(null!=t)return t[s]||t["@@iterator"]||r[n(t)]}},function(t,e){t.exports=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}},function(t,e,i){"use strict";var n=i(3),r=i.n(n),s=i(0),o=i(2),a=i(28),h=i(1),l=i(29);class c{constructor(t,e){this.settings=Object(s.extend)({ignoreClass:"",axis:void 0,direction:void 0,width:0,height:0,layout:void 0,globalLayoutProperties:{},method:void 0,forceRight:!1},e||{}),this.id="epubjs-view-"+Object(s.uuid)(),this.section=t,this.index=t.index,this.element=this.container(this.settings.axis),this.added=!1,this.displayed=!1,this.rendered=!1,this.fixedWidth=0,this.fixedHeight=0,this.epubcfi=new o.a,this.layout=this.settings.layout,this.pane=void 0,this.highlights={},this.underlines={},this.marks={}}container(t){var e=document.createElement("div");return e.classList.add("epub-view"),e.style.height="0px",e.style.width="0px",e.style.overflow="hidden",e.style.position="relative",e.style.display="block",e.style.flex=t&&"horizontal"==t?"none":"initial",e}create(){return this.iframe||(this.element||(this.element=this.createContainer()),this.iframe=document.createElement("iframe"),this.iframe.id=this.id,this.iframe.scrolling="no",this.iframe.style.overflow="hidden",this.iframe.seamless="seamless",this.iframe.style.border="none",this.iframe.setAttribute("enable-annotation","true"),this.resizing=!0,this.element.style.visibility="hidden",this.iframe.style.visibility="hidden",this.iframe.style.width="0",this.iframe.style.height="0",this._width=0,this._height=0,this.element.setAttribute("ref",this.index),this.added=!0,this.elementBounds=Object(s.bounds)(this.element),"srcdoc"in this.iframe?this.supportsSrcdoc=!0:this.supportsSrcdoc=!1,this.settings.method||(this.settings.method=this.supportsSrcdoc?"srcdoc":"write")),this.iframe}render(t,e){return this.create(),this.size(),this.sectionRender||(this.sectionRender=this.section.render(t)),this.sectionRender.then(function(t){return this.load(t)}.bind(this)).then(function(){let t,e=this.contents.writingMode();return t="scrolled"===this.settings.flow?0===e.indexOf("vertical")?"horizontal":"vertical":0===e.indexOf("vertical")?"vertical":"horizontal",0===e.indexOf("vertical")&&"paginated"===this.settings.flow&&(this.layout.delta=this.layout.height),this.setAxis(t),this.emit(h.c.VIEWS.AXIS,t),this.setWritingMode(e),this.emit(h.c.VIEWS.WRITING_MODE,e),this.layout.format(this.contents,this.section,this.axis),this.addListeners(),new Promise((t,e)=>{this.expand(),this.settings.forceRight&&(this.element.style.marginLeft=this.width()+"px"),t()})}.bind(this),function(t){return this.emit(h.c.VIEWS.LOAD_ERROR,t),new Promise((e,i)=>{i(t)})}.bind(this)).then(function(){this.emit(h.c.VIEWS.RENDERED,this.section)}.bind(this))}reset(){this.iframe&&(this.iframe.style.width="0",this.iframe.style.height="0",this._width=0,this._height=0,this._textWidth=void 0,this._contentWidth=void 0,this._textHeight=void 0,this._contentHeight=void 0),this._needsReframe=!0}size(t,e){var i=t||this.settings.width,n=e||this.settings.height;"pre-paginated"===this.layout.name?this.lock("both",i,n):"horizontal"===this.settings.axis?this.lock("height",i,n):this.lock("width",i,n),this.settings.width=i,this.settings.height=n}lock(t,e,i){var n,r=Object(s.borders)(this.element);n=this.iframe?Object(s.borders)(this.iframe):{width:0,height:0},"width"==t&&Object(s.isNumber)(e)&&(this.lockedWidth=e-r.width-n.width),"height"==t&&Object(s.isNumber)(i)&&(this.lockedHeight=i-r.height-n.height),"both"===t&&Object(s.isNumber)(e)&&Object(s.isNumber)(i)&&(this.lockedWidth=e-r.width-n.width,this.lockedHeight=i-r.height-n.height),this.displayed&&this.iframe&&this.expand()}expand(t){var e,i=this.lockedWidth,n=this.lockedHeight;this.iframe&&!this._expanding&&(this._expanding=!0,"pre-paginated"===this.layout.name?(i=this.layout.columnWidth,n=this.layout.height):"horizontal"===this.settings.axis?((i=this.contents.textWidth())%this.layout.pageWidth>0&&(i=Math.ceil(i/this.layout.pageWidth)*this.layout.pageWidth),this.settings.forceEvenPages&&(e=i/this.layout.pageWidth,this.layout.divisor>1&&"reflowable"===this.layout.name&&e%2>0&&(i+=this.layout.pageWidth))):"vertical"===this.settings.axis&&(n=this.contents.textHeight(),"paginated"===this.settings.flow&&n%this.layout.height>0&&(n=Math.ceil(n/this.layout.height)*this.layout.height)),(this._needsReframe||i!=this._width||n!=this._height)&&this.reframe(i,n),this._expanding=!1)}reframe(t,e){var i;Object(s.isNumber)(t)&&(this.element.style.width=t+"px",this.iframe.style.width=t+"px",this._width=t),Object(s.isNumber)(e)&&(this.element.style.height=e+"px",this.iframe.style.height=e+"px",this._height=e),i={width:t,height:e,widthDelta:this.prevBounds?t-this.prevBounds.width:t,heightDelta:this.prevBounds?e-this.prevBounds.height:e},this.pane&&this.pane.render(),requestAnimationFrame(()=>{let t;for(let e in this.marks)this.marks.hasOwnProperty(e)&&(t=this.marks[e],this.placeMark(t.element,t.range))}),this.onResize(this,i),this.emit(h.c.VIEWS.RESIZED,i),this.prevBounds=i,this.elementBounds=Object(s.bounds)(this.element)}load(t){var e=new s.defer,i=e.promise;if(!this.iframe)return e.reject(new Error("No Iframe Available")),i;if(this.iframe.onload=function(t){this.onLoad(t,e)}.bind(this),"blobUrl"===this.settings.method)this.blobUrl=Object(s.createBlobUrl)(t,"application/xhtml+xml"),this.iframe.src=this.blobUrl,this.element.appendChild(this.iframe);else if("srcdoc"===this.settings.method)this.iframe.srcdoc=t,this.element.appendChild(this.iframe);else{if(this.element.appendChild(this.iframe),this.document=this.iframe.contentDocument,!this.document)return e.reject(new Error("No Document Available")),i;if(this.iframe.contentDocument.open(),window.MSApp&&MSApp.execUnsafeLocalFunction){var n=this;MSApp.execUnsafeLocalFunction((function(){n.iframe.contentDocument.write(t)}))}else this.iframe.contentDocument.write(t);this.iframe.contentDocument.close()}return i}onLoad(t,e){this.window=this.iframe.contentWindow,this.document=this.iframe.contentDocument,this.contents=new a.a(this.document,this.document.body,this.section.cfiBase,this.section.index),this.rendering=!1;var i=this.document.querySelector("link[rel='canonical']");i?i.setAttribute("href",this.section.canonical):((i=this.document.createElement("link")).setAttribute("rel","canonical"),i.setAttribute("href",this.section.canonical),this.document.querySelector("head").appendChild(i)),this.contents.on(h.c.CONTENTS.EXPAND,()=>{this.displayed&&this.iframe&&(this.expand(),this.contents&&this.layout.format(this.contents))}),this.contents.on(h.c.CONTENTS.RESIZE,t=>{this.displayed&&this.iframe&&(this.expand(),this.contents&&this.layout.format(this.contents))}),e.resolve(this.contents)}setLayout(t){this.layout=t,this.contents&&(this.layout.format(this.contents),this.expand())}setAxis(t){this.settings.axis=t,this.element.style.flex="horizontal"==t?"none":"initial",this.size()}setWritingMode(t){this.writingMode=t}addListeners(){}removeListeners(t){}display(t){var e=new s.defer;return this.displayed?e.resolve(this):this.render(t).then(function(){this.emit(h.c.VIEWS.DISPLAYED,this),this.onDisplayed(this),this.displayed=!0,e.resolve(this)}.bind(this),(function(t){e.reject(t,this)})),e.promise}show(){this.element.style.visibility="visible",this.iframe&&(this.iframe.style.visibility="visible",this.iframe.style.transform="translateZ(0)",this.iframe.offsetWidth,this.iframe.style.transform=null),this.emit(h.c.VIEWS.SHOWN,this)}hide(){this.element.style.visibility="hidden",this.iframe.style.visibility="hidden",this.stopExpanding=!0,this.emit(h.c.VIEWS.HIDDEN,this)}offset(){return{top:this.element.offsetTop,left:this.element.offsetLeft}}width(){return this._width}height(){return this._height}position(){return this.element.getBoundingClientRect()}locationOf(t){this.iframe.getBoundingClientRect();var e=this.contents.locationOf(t,this.settings.ignoreClass);return{left:e.left,top:e.top}}onDisplayed(t){}onResize(t,e){}bounds(t){return!t&&this.elementBounds||(this.elementBounds=Object(s.bounds)(this.element)),this.elementBounds}highlight(t,e={},i,n="epubjs-hl",r={}){if(!this.contents)return;const s=Object.assign({fill:"yellow","fill-opacity":"0.3","mix-blend-mode":"multiply"},r);let o=this.contents.range(t),a=()=>{this.emit(h.c.VIEWS.MARK_CLICKED,t,e)};e.epubcfi=t,this.pane||(this.pane=new l.Pane(this.iframe,this.element));let c=new l.Highlight(o,n,e,s),u=this.pane.addMark(c);return this.highlights[t]={mark:u,element:u.element,listeners:[a,i]},u.element.setAttribute("ref",n),u.element.addEventListener("click",a),u.element.addEventListener("touchstart",a),i&&(u.element.addEventListener("click",i),u.element.addEventListener("touchstart",i)),u}underline(t,e={},i,n="epubjs-ul",r={}){if(!this.contents)return;const s=Object.assign({stroke:"black","stroke-opacity":"0.3","mix-blend-mode":"multiply"},r);let o=this.contents.range(t),a=()=>{this.emit(h.c.VIEWS.MARK_CLICKED,t,e)};e.epubcfi=t,this.pane||(this.pane=new l.Pane(this.iframe,this.element));let c=new l.Underline(o,n,e,s),u=this.pane.addMark(c);return this.underlines[t]={mark:u,element:u.element,listeners:[a,i]},u.element.setAttribute("ref",n),u.element.addEventListener("click",a),u.element.addEventListener("touchstart",a),i&&(u.element.addEventListener("click",i),u.element.addEventListener("touchstart",i)),u}mark(t,e={},i){if(!this.contents)return;if(t in this.marks){return this.marks[t]}let n=this.contents.range(t);if(!n)return;let r=n.commonAncestorContainer,s=1===r.nodeType?r:r.parentNode,o=i=>{this.emit(h.c.VIEWS.MARK_CLICKED,t,e)};n.collapsed&&1===r.nodeType?(n=new Range,n.selectNodeContents(r)):n.collapsed&&(n=new Range,n.selectNodeContents(s));let a=this.document.createElement("a");return a.setAttribute("ref","epubjs-mk"),a.style.position="absolute",a.dataset.epubcfi=t,e&&Object.keys(e).forEach(t=>{a.dataset[t]=e[t]}),i&&(a.addEventListener("click",i),a.addEventListener("touchstart",i)),a.addEventListener("click",o),a.addEventListener("touchstart",o),this.placeMark(a,n),this.element.appendChild(a),this.marks[t]={element:a,range:n,listeners:[o,i]},s}placeMark(t,e){let i,n,r;if("pre-paginated"===this.layout.name||"horizontal"!==this.settings.axis){let t=e.getBoundingClientRect();i=t.top,n=t.right}else{let t,o=e.getClientRects();for(var s=0;s!=o.length;s++)t=o[s],(!r||t.left<r)&&(r=t.left,n=Math.ceil(r/this.layout.props.pageWidth)*this.layout.props.pageWidth-this.layout.gap/2,i=t.top)}t.style.top=i+"px",t.style.left=n+"px"}unhighlight(t){let e;t in this.highlights&&(e=this.highlights[t],this.pane.removeMark(e.mark),e.listeners.forEach(t=>{t&&(e.element.removeEventListener("click",t),e.element.removeEventListener("touchstart",t))}),delete this.highlights[t])}ununderline(t){let e;t in this.underlines&&(e=this.underlines[t],this.pane.removeMark(e.mark),e.listeners.forEach(t=>{t&&(e.element.removeEventListener("click",t),e.element.removeEventListener("touchstart",t))}),delete this.underlines[t])}unmark(t){let e;t in this.marks&&(e=this.marks[t],this.element.removeChild(e.element),e.listeners.forEach(t=>{t&&(e.element.removeEventListener("click",t),e.element.removeEventListener("touchstart",t))}),delete this.marks[t])}destroy(){for(let t in this.highlights)this.unhighlight(t);for(let t in this.underlines)this.ununderline(t);for(let t in this.marks)this.unmark(t);this.blobUrl&&Object(s.revokeBlobUrl)(this.blobUrl),this.displayed&&(this.displayed=!1,this.removeListeners(),this.contents.destroy(),this.stopExpanding=!0,this.element.removeChild(this.iframe),this.iframe=void 0,this.contents=void 0,this._textWidth=null,this._textHeight=null,this._width=null,this._height=null)}}r()(c.prototype),e.a=c},function(t,e,i){var n=i(53),r=i(137),s=i(139),o=Math.max,a=Math.min;t.exports=function(t,e,i){var h,l,c,u,d,f,p=0,g=!1,v=!1,m=!0;if("function"!=typeof t)throw new TypeError("Expected a function");function y(e){var i=h,n=l;return h=l=void 0,p=e,u=t.apply(n,i)}function b(t){return p=t,d=setTimeout(x,e),g?y(t):u}function w(t){var i=t-f;return void 0===f||i>=e||i<0||v&&t-p>=c}function x(){var t=r();if(w(t))return E(t);d=setTimeout(x,function(t){var i=e-(t-f);return v?a(i,c-(t-p)):i}(t))}function E(t){return d=void 0,m&&h?y(t):(h=l=void 0,u)}function S(){var t=r(),i=w(t);if(h=arguments,l=this,f=t,i){if(void 0===d)return b(f);if(v)return clearTimeout(d),d=setTimeout(x,e),y(f)}return void 0===d&&(d=setTimeout(x,e)),u}return e=s(e)||0,n(i)&&(g=!!i.leading,c=(v="maxWait"in i)?o(s(i.maxWait)||0,e):c,m="trailing"in i?!!i.trailing:m),S.cancel=function(){void 0!==d&&clearTimeout(d),p=0,h=f=l=d=void 0},S.flush=function(){return void 0===d?u:E(r())},S}},function(t,e,i){"use strict";i(14);var n=i(0),r=i(22),s=i(1),o=i(3),a=i.n(o);const h=Math.PI/2,l={easeOutSine:function(t){return Math.sin(t*h)},easeInOutSine:function(t){return-.5*(Math.cos(Math.PI*t)-1)},easeInOutQuint:function(t){return(t/=.5)<1?.5*Math.pow(t,5):.5*(Math.pow(t-2,5)+2)},easeInCubic:function(t){return Math.pow(t,3)}};class c{constructor(t,e){this.settings=Object(n.extend)({duration:80,minVelocity:.2,minDistance:10,easing:l.easeInCubic},e||{}),this.supportsTouch=this.supportsTouch(),this.supportsTouch&&this.setup(t)}setup(t){this.manager=t,this.layout=this.manager.layout,this.fullsize=this.manager.settings.fullsize,this.fullsize?(this.element=this.manager.stage.element,this.scroller=window,this.disableScroll()):(this.element=this.manager.stage.container,this.scroller=this.element,this.element.style.WebkitOverflowScrolling="touch"),this.manager.settings.offset=this.layout.width,this.manager.settings.afterScrolledTimeout=2*this.settings.duration,this.isVertical="vertical"===this.manager.settings.axis,this.manager.isPaginated&&!this.isVertical&&(this.touchCanceler=!1,this.resizeCanceler=!1,this.snapping=!1,this.scrollLeft,this.scrollTop,this.startTouchX=void 0,this.startTouchY=void 0,this.startTime=void 0,this.endTouchX=void 0,this.endTouchY=void 0,this.endTime=void 0,this.addListeners())}supportsTouch(){return!!("ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch)}disableScroll(){this.element.style.overflow="hidden"}enableScroll(){this.element.style.overflow=""}addListeners(){this._onResize=this.onResize.bind(this),window.addEventListener("resize",this._onResize),this._onScroll=this.onScroll.bind(this),this.scroller.addEventListener("scroll",this._onScroll),this._onTouchStart=this.onTouchStart.bind(this),this.scroller.addEventListener("touchstart",this._onTouchStart,{passive:!0}),this.on("touchstart",this._onTouchStart),this._onTouchMove=this.onTouchMove.bind(this),this.scroller.addEventListener("touchmove",this._onTouchMove,{passive:!0}),this.on("touchmove",this._onTouchMove),this._onTouchEnd=this.onTouchEnd.bind(this),this.scroller.addEventListener("touchend",this._onTouchEnd,{passive:!0}),this.on("touchend",this._onTouchEnd),this._afterDisplayed=this.afterDisplayed.bind(this),this.manager.on(s.c.MANAGERS.ADDED,this._afterDisplayed)}removeListeners(){window.removeEventListener("resize",this._onResize),this._onResize=void 0,this.scroller.removeEventListener("scroll",this._onScroll),this._onScroll=void 0,this.scroller.removeEventListener("touchstart",this._onTouchStart,{passive:!0}),this.off("touchstart",this._onTouchStart),this._onTouchStart=void 0,this.scroller.removeEventListener("touchmove",this._onTouchMove,{passive:!0}),this.off("touchmove",this._onTouchMove),this._onTouchMove=void 0,this.scroller.removeEventListener("touchend",this._onTouchEnd,{passive:!0}),this.off("touchend",this._onTouchEnd),this._onTouchEnd=void 0,this.manager.off(s.c.MANAGERS.ADDED,this._afterDisplayed),this._afterDisplayed=void 0}afterDisplayed(t){let e=t.contents;["touchstart","touchmove","touchend"].forEach(t=>{e.on(t,t=>this.triggerViewEvent(t,e))})}triggerViewEvent(t,e){this.emit(t.type,t,e)}onScroll(t){this.scrollLeft=this.fullsize?window.scrollX:this.scroller.scrollLeft,this.scrollTop=this.fullsize?window.scrollY:this.scroller.scrollTop}onResize(t){this.resizeCanceler=!0}onTouchStart(t){let{screenX:e,screenY:i}=t.touches[0];this.fullsize&&this.enableScroll(),this.touchCanceler=!0,this.startTouchX||(this.startTouchX=e,this.startTouchY=i,this.startTime=this.now()),this.endTouchX=e,this.endTouchY=i,this.endTime=this.now()}onTouchMove(t){let{screenX:e,screenY:i}=t.touches[0],n=Math.abs(i-this.endTouchY);this.touchCanceler=!0,!this.fullsize&&n<10&&(this.element.scrollLeft-=e-this.endTouchX),this.endTouchX=e,this.endTouchY=i,this.endTime=this.now()}onTouchEnd(t){this.fullsize&&this.disableScroll(),this.touchCanceler=!1;let e=this.wasSwiped();0!==e?this.snap(e):this.snap(),this.startTouchX=void 0,this.startTouchY=void 0,this.startTime=void 0,this.endTouchX=void 0,this.endTouchY=void 0,this.endTime=void 0}wasSwiped(){let t=this.layout.pageWidth*this.layout.divisor,e=this.endTouchX-this.startTouchX,i=Math.abs(e),n=e/(this.endTime-this.startTime),r=this.settings.minVelocity;return i<=this.settings.minDistance||i>=t?0:n>r?-1:n<-r?1:void 0}needsSnap(){return this.scrollLeft%(this.layout.pageWidth*this.layout.divisor)!=0}snap(t=0){let e=this.scrollLeft,i=this.layout.pageWidth*this.layout.divisor,n=Math.round(e/i)*i;return t&&(n+=t*i),this.smoothScrollTo(n)}smoothScrollTo(t){const e=new n.defer,i=this.scrollLeft,r=this.now(),s=this.settings.duration,o=this.settings.easing;return this.snapping=!0,function n(){const a=this.now(),h=Math.min(1,(a-r)/s);if(o(h),this.touchCanceler||this.resizeCanceler)return this.resizeCanceler=!1,this.snapping=!1,void e.resolve();h<1?(window.requestAnimationFrame(n.bind(this)),this.scrollTo(i+(t-i)*h,0)):(this.scrollTo(t,0),this.snapping=!1,e.resolve())}.call(this),e.promise}scrollTo(t=0,e=0){this.fullsize?window.scroll(t,e):(this.scroller.scrollLeft=t,this.scroller.scrollTop=e)}now(){return"now"in window.performance?performance.now():(new Date).getTime()}destroy(){this.scroller&&(this.fullsize&&this.enableScroll(),this.removeListeners(),this.scroller=void 0)}}a()(c.prototype);var u=c,d=i(55),f=i.n(d);class p extends r.a{constructor(t){super(t),this.name="continuous",this.settings=Object(n.extend)(this.settings||{},{infinite:!0,overflow:void 0,axis:void 0,writingMode:void 0,flow:"scrolled",offset:500,offsetDelta:250,width:void 0,height:void 0,snap:!1,afterScrolledTimeout:10}),Object(n.extend)(this.settings,t.settings||{}),"undefined"!=t.settings.gap&&0===t.settings.gap&&(this.settings.gap=t.settings.gap),this.viewSettings={ignoreClass:this.settings.ignoreClass,axis:this.settings.axis,flow:this.settings.flow,layout:this.layout,width:0,height:0,forceEvenPages:!1},this.scrollTop=0,this.scrollLeft=0}display(t,e){return r.a.prototype.display.call(this,t,e).then(function(){return this.fill()}.bind(this))}fill(t){var e=t||new n.defer;return this.q.enqueue(()=>this.check()).then(t=>{t?this.fill(e):e.resolve()}),e.promise}moveTo(t){var e=0,i=0;this.isPaginated?(e=Math.floor(t.left/this.layout.delta)*this.layout.delta,this.settings.offsetDelta):(i=t.top,t.top,this.settings.offsetDelta),(e>0||i>0)&&this.scrollBy(e,i,!0)}afterResized(t){this.emit(s.c.MANAGERS.RESIZE,t.section)}removeShownListeners(t){t.onDisplayed=function(){}}add(t){var e=this.createView(t);return this.views.append(e),e.on(s.c.VIEWS.RESIZED,t=>{e.expanded=!0}),e.on(s.c.VIEWS.AXIS,t=>{this.updateAxis(t)}),e.on(s.c.VIEWS.WRITING_MODE,t=>{this.updateWritingMode(t)}),e.onDisplayed=this.afterDisplayed.bind(this),e.onResize=this.afterResized.bind(this),e.display(this.request)}append(t){var e=this.createView(t);return e.on(s.c.VIEWS.RESIZED,t=>{e.expanded=!0}),e.on(s.c.VIEWS.AXIS,t=>{this.updateAxis(t)}),e.on(s.c.VIEWS.WRITING_MODE,t=>{this.updateWritingMode(t)}),this.views.append(e),e.onDisplayed=this.afterDisplayed.bind(this),e}prepend(t){var e=this.createView(t);return e.on(s.c.VIEWS.RESIZED,t=>{this.counter(t),e.expanded=!0}),e.on(s.c.VIEWS.AXIS,t=>{this.updateAxis(t)}),e.on(s.c.VIEWS.WRITING_MODE,t=>{this.updateWritingMode(t)}),this.views.prepend(e),e.onDisplayed=this.afterDisplayed.bind(this),e}counter(t){"vertical"===this.settings.axis?this.scrollBy(0,t.heightDelta,!0):this.scrollBy(t.widthDelta,0,!0)}update(t){for(var e,i=this.bounds(),r=this.views.all(),s=r.length,o=[],a=void 0!==t?t:this.settings.offset||0,h=new n.defer,l=[],c=0;c<s;c++)if(e=r[c],!0===this.isVisible(e,a,a,i)){if(e.displayed)e.show();else{let t=e.display(this.request).then((function(t){t.show()}),t=>{e.hide()});l.push(t)}o.push(e)}else this.q.enqueue(e.destroy.bind(e)),clearTimeout(this.trimTimeout),this.trimTimeout=setTimeout(function(){this.q.enqueue(this.trim.bind(this))}.bind(this),250);return l.length?Promise.all(l).catch(t=>{h.reject(t)}):(h.resolve(),h.promise)}check(t,e){var i=new n.defer,r=[],s="horizontal"===this.settings.axis,o=this.settings.offset||0;t&&s&&(o=t),e&&!s&&(o=e);var a=this._bounds;let h=s?this.scrollLeft:this.scrollTop,l=s?Math.floor(a.width):a.height,c=s?this.container.scrollWidth:this.container.scrollHeight,u=this.writingMode&&0===this.writingMode.indexOf("vertical")?"vertical":"horizontal",d=this.settings.rtlScrollType,f="rtl"===this.settings.direction;this.settings.fullsize?(s&&f&&"negative"===d||!s&&f&&"default"===d)&&(h*=-1):(f&&"default"===d&&"horizontal"===u&&(h=c-l-h),f&&"negative"===d&&"horizontal"===u&&(h*=-1));let p=()=>{let t=this.views.first(),e=t&&t.section.prev();e&&r.push(this.prepend(e))},g=h-o;h+l+o>=c&&(()=>{let t=this.views.last(),e=t&&t.section.next();e&&r.push(this.append(e))})(),g<0&&p();let v=r.map(t=>t.display(this.request));return r.length?Promise.all(v).then(()=>this.check()).then(()=>this.update(o),t=>t):(this.q.enqueue(function(){this.update()}.bind(this)),i.resolve(!1),i.promise)}trim(){for(var t=new n.defer,e=this.views.displayed(),i=e[0],r=e[e.length-1],s=this.views.indexOf(i),o=this.views.indexOf(r),a=this.views.slice(0,s),h=this.views.slice(o+1),l=0;l<a.length-1;l++)this.erase(a[l],a);for(var c=1;c<h.length;c++)this.erase(h[c]);return t.resolve(),t.promise}erase(t,e){var i,n;this.settings.fullsize?(i=window.scrollY,n=window.scrollX):(i=this.container.scrollTop,n=this.container.scrollLeft);var r=t.bounds();this.views.remove(t),e&&("vertical"===this.settings.axis?this.scrollTo(0,i-r.height,!0):"rtl"===this.settings.direction?this.settings.fullsize?this.scrollTo(n+Math.floor(r.width),0,!0):this.scrollTo(n,0,!0):this.scrollTo(n-Math.floor(r.width),0,!0))}addEventListeners(t){window.addEventListener("unload",function(t){this.ignore=!0,this.destroy()}.bind(this)),this.addScrollListeners(),this.isPaginated&&this.settings.snap&&(this.snapper=new u(this,this.settings.snap&&"object"==typeof this.settings.snap&&this.settings.snap))}addScrollListeners(){var t;this.tick=n.requestAnimationFrame;let e="rtl"===this.settings.direction&&"default"===this.settings.rtlScrollType?-1:1;this.scrollDeltaVert=0,this.scrollDeltaHorz=0,this.settings.fullsize?(t=window,this.scrollTop=window.scrollY*e,this.scrollLeft=window.scrollX*e):(t=this.container,this.scrollTop=this.container.scrollTop,this.scrollLeft=this.container.scrollLeft),this._onScroll=this.onScroll.bind(this),t.addEventListener("scroll",this._onScroll),this._scrolled=f()(this.scrolled.bind(this),30),this.didScroll=!1}removeEventListeners(){(this.settings.fullsize?window:this.container).removeEventListener("scroll",this._onScroll),this._onScroll=void 0}onScroll(){let t,e,i="rtl"===this.settings.direction&&"default"===this.settings.rtlScrollType?-1:1;this.settings.fullsize?(t=window.scrollY*i,e=window.scrollX*i):(t=this.container.scrollTop,e=this.container.scrollLeft),this.scrollTop=t,this.scrollLeft=e,this.ignore?this.ignore=!1:this._scrolled(),this.scrollDeltaVert+=Math.abs(t-this.prevScrollTop),this.scrollDeltaHorz+=Math.abs(e-this.prevScrollLeft),this.prevScrollTop=t,this.prevScrollLeft=e,clearTimeout(this.scrollTimeout),this.scrollTimeout=setTimeout(function(){this.scrollDeltaVert=0,this.scrollDeltaHorz=0}.bind(this),150),clearTimeout(this.afterScrolled),this.didScroll=!1}scrolled(){this.q.enqueue(function(){return this.check()}.bind(this)),this.emit(s.c.MANAGERS.SCROLL,{top:this.scrollTop,left:this.scrollLeft}),clearTimeout(this.afterScrolled),this.afterScrolled=setTimeout(function(){this.snapper&&this.snapper.supportsTouch&&this.snapper.needsSnap()||this.emit(s.c.MANAGERS.SCROLLED,{top:this.scrollTop,left:this.scrollLeft})}.bind(this),this.settings.afterScrolledTimeout)}next(){let t="pre-paginated"===this.layout.props.name&&this.layout.props.spread?2*this.layout.props.delta:this.layout.props.delta;this.views.length&&(this.isPaginated&&"horizontal"===this.settings.axis?this.scrollBy(t,0,!0):this.scrollBy(0,this.layout.height,!0),this.q.enqueue(function(){return this.check()}.bind(this)))}prev(){let t="pre-paginated"===this.layout.props.name&&this.layout.props.spread?2*this.layout.props.delta:this.layout.props.delta;this.views.length&&(this.isPaginated&&"horizontal"===this.settings.axis?this.scrollBy(-t,0,!0):this.scrollBy(0,-this.layout.height,!0),this.q.enqueue(function(){return this.check()}.bind(this)))}updateFlow(t){this.rendered&&this.snapper&&(this.snapper.destroy(),this.snapper=void 0),super.updateFlow(t,"scroll"),this.rendered&&this.isPaginated&&this.settings.snap&&(this.snapper=new u(this,this.settings.snap&&"object"==typeof this.settings.snap&&this.settings.snap))}destroy(){super.destroy(),this.snapper&&this.snapper.destroy()}}e.a=p},function(t,e,i){(function(e){t.exports=function t(e,i,n){function r(o,a){if(!i[o]){if(!e[o]){if(s)return s(o,!0);var h=new Error("Cannot find module '"+o+"'");throw h.code="MODULE_NOT_FOUND",h}var l=i[o]={exports:{}};e[o][0].call(l.exports,(function(t){var i=e[o][1][t];return r(i||t)}),l,l.exports,t,e,i,n)}return i[o].exports}for(var s=!1,o=0;o<n.length;o++)r(n[o]);return r}({1:[function(t,i,n){(function(t){"use strict";var e,n,r=t.MutationObserver||t.WebKitMutationObserver;if(r){var s=0,o=new r(c),a=t.document.createTextNode("");o.observe(a,{characterData:!0}),e=function(){a.data=s=++s%2}}else if(t.setImmediate||void 0===t.MessageChannel)e="document"in t&&"onreadystatechange"in t.document.createElement("script")?function(){var e=t.document.createElement("script");e.onreadystatechange=function(){c(),e.onreadystatechange=null,e.parentNode.removeChild(e),e=null},t.document.documentElement.appendChild(e)}:function(){setTimeout(c,0)};else{var h=new t.MessageChannel;h.port1.onmessage=c,e=function(){h.port2.postMessage(0)}}var l=[];function c(){var t,e;n=!0;for(var i=l.length;i;){for(e=l,l=[],t=-1;++t<i;)e[t]();i=l.length}n=!1}i.exports=function(t){1!==l.push(t)||n||e()}}).call(this,void 0!==e?e:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(t,e,i){"use strict";var n=t(1);function r(){}var s={},o=["REJECTED"],a=["FULFILLED"],h=["PENDING"];function l(t){if("function"!=typeof t)throw new TypeError("resolver must be a function");this.state=h,this.queue=[],this.outcome=void 0,t!==r&&f(this,t)}function c(t,e,i){this.promise=t,"function"==typeof e&&(this.onFulfilled=e,this.callFulfilled=this.otherCallFulfilled),"function"==typeof i&&(this.onRejected=i,this.callRejected=this.otherCallRejected)}function u(t,e,i){n((function(){var n;try{n=e(i)}catch(e){return s.reject(t,e)}n===t?s.reject(t,new TypeError("Cannot resolve promise with itself")):s.resolve(t,n)}))}function d(t){var e=t&&t.then;if(t&&("object"==typeof t||"function"==typeof t)&&"function"==typeof e)return function(){e.apply(t,arguments)}}function f(t,e){var i=!1;function n(e){i||(i=!0,s.reject(t,e))}function r(e){i||(i=!0,s.resolve(t,e))}var o=p((function(){e(r,n)}));"error"===o.status&&n(o.value)}function p(t,e){var i={};try{i.value=t(e),i.status="success"}catch(t){i.status="error",i.value=t}return i}e.exports=l,l.prototype.catch=function(t){return this.then(null,t)},l.prototype.then=function(t,e){if("function"!=typeof t&&this.state===a||"function"!=typeof e&&this.state===o)return this;var i=new this.constructor(r);return this.state!==h?u(i,this.state===a?t:e,this.outcome):this.queue.push(new c(i,t,e)),i},c.prototype.callFulfilled=function(t){s.resolve(this.promise,t)},c.prototype.otherCallFulfilled=function(t){u(this.promise,this.onFulfilled,t)},c.prototype.callRejected=function(t){s.reject(this.promise,t)},c.prototype.otherCallRejected=function(t){u(this.promise,this.onRejected,t)},s.resolve=function(t,e){var i=p(d,e);if("error"===i.status)return s.reject(t,i.value);var n=i.value;if(n)f(t,n);else{t.state=a,t.outcome=e;for(var r=-1,o=t.queue.length;++r<o;)t.queue[r].callFulfilled(e)}return t},s.reject=function(t,e){t.state=o,t.outcome=e;for(var i=-1,n=t.queue.length;++i<n;)t.queue[i].callRejected(e);return t},l.resolve=function(t){return t instanceof this?t:s.resolve(new this(r),t)},l.reject=function(t){var e=new this(r);return s.reject(e,t)},l.all=function(t){var e=this;if("[object Array]"!==Object.prototype.toString.call(t))return this.reject(new TypeError("must be an array"));var i=t.length,n=!1;if(!i)return this.resolve([]);for(var o=new Array(i),a=0,h=-1,l=new this(r);++h<i;)c(t[h],h);return l;function c(t,r){e.resolve(t).then((function(t){o[r]=t,++a!==i||n||(n=!0,s.resolve(l,o))}),(function(t){n||(n=!0,s.reject(l,t))}))}},l.race=function(t){var e=this;if("[object Array]"!==Object.prototype.toString.call(t))return this.reject(new TypeError("must be an array"));var i=t.length,n=!1;if(!i)return this.resolve([]);for(var o,a=-1,h=new this(r);++a<i;)o=t[a],e.resolve(o).then((function(t){n||(n=!0,s.resolve(h,t))}),(function(t){n||(n=!0,s.reject(h,t))}));return h}},{1:1}],3:[function(t,i,n){(function(e){"use strict";"function"!=typeof e.Promise&&(e.Promise=t(2))}).call(this,void 0!==e?e:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{2:2}],4:[function(t,e,i){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r=function(){try{if("undefined"!=typeof indexedDB)return indexedDB;if("undefined"!=typeof webkitIndexedDB)return webkitIndexedDB;if("undefined"!=typeof mozIndexedDB)return mozIndexedDB;if("undefined"!=typeof OIndexedDB)return OIndexedDB;if("undefined"!=typeof msIndexedDB)return msIndexedDB}catch(t){return}}();function s(t,e){t=t||[],e=e||{};try{return new Blob(t,e)}catch(r){if("TypeError"!==r.name)throw r;for(var i=new("undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder?MozBlobBuilder:WebKitBlobBuilder),n=0;n<t.length;n+=1)i.append(t[n]);return i.getBlob(e.type)}}"undefined"==typeof Promise&&t(3);var o=Promise;function a(t,e){e&&t.then((function(t){e(null,t)}),(function(t){e(t)}))}function h(t,e,i){"function"==typeof e&&t.then(e),"function"==typeof i&&t.catch(i)}function l(t){return"string"!=typeof t&&(console.warn(t+" used as a key, but it is not a string."),t=String(t)),t}function c(){if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}var u=void 0,d={},f=Object.prototype.toString;function p(t){return"boolean"==typeof u?o.resolve(u):function(t){return new o((function(e){var i=t.transaction("local-forage-detect-blob-support","readwrite"),n=s([""]);i.objectStore("local-forage-detect-blob-support").put(n,"key"),i.onabort=function(t){t.preventDefault(),t.stopPropagation(),e(!1)},i.oncomplete=function(){var t=navigator.userAgent.match(/Chrome\/(\d+)/),i=navigator.userAgent.match(/Edge\//);e(i||!t||parseInt(t[1],10)>=43)}})).catch((function(){return!1}))}(t).then((function(t){return u=t}))}function g(t){var e=d[t.name],i={};i.promise=new o((function(t,e){i.resolve=t,i.reject=e})),e.deferredOperations.push(i),e.dbReady?e.dbReady=e.dbReady.then((function(){return i.promise})):e.dbReady=i.promise}function v(t){var e=d[t.name].deferredOperations.pop();if(e)return e.resolve(),e.promise}function m(t,e){var i=d[t.name].deferredOperations.pop();if(i)return i.reject(e),i.promise}function y(t,e){return new o((function(i,n){if(d[t.name]=d[t.name]||{forages:[],db:null,dbReady:null,deferredOperations:[]},t.db){if(!e)return i(t.db);g(t),t.db.close()}var s=[t.name];e&&s.push(t.version);var o=r.open.apply(r,s);e&&(o.onupgradeneeded=function(e){var i=o.result;try{i.createObjectStore(t.storeName),e.oldVersion<=1&&i.createObjectStore("local-forage-detect-blob-support")}catch(i){if("ConstraintError"!==i.name)throw i;console.warn('The database "'+t.name+'" has been upgraded from version '+e.oldVersion+" to version "+e.newVersion+', but the storage "'+t.storeName+'" already exists.')}}),o.onerror=function(t){t.preventDefault(),n(o.error)},o.onsuccess=function(){i(o.result),v(t)}}))}function b(t){return y(t,!1)}function w(t){return y(t,!0)}function x(t,e){if(!t.db)return!0;var i=!t.db.objectStoreNames.contains(t.storeName),n=t.version<t.db.version,r=t.version>t.db.version;if(n&&(t.version!==e&&console.warn('The database "'+t.name+"\" can't be downgraded from version "+t.db.version+" to version "+t.version+"."),t.version=t.db.version),r||i){if(i){var s=t.db.version+1;s>t.version&&(t.version=s)}return!0}return!1}function E(t){return s([function(t){for(var e=t.length,i=new ArrayBuffer(e),n=new Uint8Array(i),r=0;r<e;r++)n[r]=t.charCodeAt(r);return i}(atob(t.data))],{type:t.type})}function S(t){return t&&t.__local_forage_encoded_blob}function _(t){var e=this,i=e._initReady().then((function(){var t=d[e._dbInfo.name];if(t&&t.dbReady)return t.dbReady}));return h(i,t,t),i}function O(t,e,i,n){void 0===n&&(n=1);try{var r=t.db.transaction(t.storeName,e);i(null,r)}catch(r){if(n>0&&(!t.db||"InvalidStateError"===r.name||"NotFoundError"===r.name))return o.resolve().then((function(){if(!t.db||"NotFoundError"===r.name&&!t.db.objectStoreNames.contains(t.storeName)&&t.version<=t.db.version)return t.db&&(t.version=t.db.version+1),w(t)})).then((function(){return function(t){g(t);for(var e=d[t.name],i=e.forages,n=0;n<i.length;n++){var r=i[n];r._dbInfo.db&&(r._dbInfo.db.close(),r._dbInfo.db=null)}return t.db=null,b(t).then((function(e){return t.db=e,x(t)?w(t):e})).then((function(n){t.db=e.db=n;for(var r=0;r<i.length;r++)i[r]._dbInfo.db=n})).catch((function(e){throw m(t,e),e}))}(t).then((function(){O(t,e,i,n-1)}))})).catch(i);i(r)}}var C={_driver:"asyncStorage",_initStorage:function(t){var e=this,i={db:null};if(t)for(var n in t)i[n]=t[n];var r=d[i.name];r||(r={forages:[],db:null,dbReady:null,deferredOperations:[]},d[i.name]=r),r.forages.push(e),e._initReady||(e._initReady=e.ready,e.ready=_);var s=[];function a(){return o.resolve()}for(var h=0;h<r.forages.length;h++){var l=r.forages[h];l!==e&&s.push(l._initReady().catch(a))}var c=r.forages.slice(0);return o.all(s).then((function(){return i.db=r.db,b(i)})).then((function(t){return i.db=t,x(i,e._defaultConfig.version)?w(i):t})).then((function(t){i.db=r.db=t,e._dbInfo=i;for(var n=0;n<c.length;n++){var s=c[n];s!==e&&(s._dbInfo.db=i.db,s._dbInfo.version=i.version)}}))},_support:function(){try{if(!r)return!1;var t="undefined"!=typeof openDatabase&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),e="function"==typeof fetch&&-1!==fetch.toString().indexOf("[native code");return(!t||e)&&"undefined"!=typeof indexedDB&&"undefined"!=typeof IDBKeyRange}catch(t){return!1}}(),iterate:function(t,e){var i=this,n=new o((function(e,n){i.ready().then((function(){O(i._dbInfo,"readonly",(function(r,s){if(r)return n(r);try{var o=s.objectStore(i._dbInfo.storeName).openCursor(),a=1;o.onsuccess=function(){var i=o.result;if(i){var n=i.value;S(n)&&(n=E(n));var r=t(n,i.key,a++);void 0!==r?e(r):i.continue()}else e()},o.onerror=function(){n(o.error)}}catch(t){n(t)}}))})).catch(n)}));return a(n,e),n},getItem:function(t,e){var i=this;t=l(t);var n=new o((function(e,n){i.ready().then((function(){O(i._dbInfo,"readonly",(function(r,s){if(r)return n(r);try{var o=s.objectStore(i._dbInfo.storeName).get(t);o.onsuccess=function(){var t=o.result;void 0===t&&(t=null),S(t)&&(t=E(t)),e(t)},o.onerror=function(){n(o.error)}}catch(t){n(t)}}))})).catch(n)}));return a(n,e),n},setItem:function(t,e,i){var n=this;t=l(t);var r=new o((function(i,r){var s;n.ready().then((function(){return s=n._dbInfo,"[object Blob]"===f.call(e)?p(s.db).then((function(t){return t?e:(i=e,new o((function(t,e){var n=new FileReader;n.onerror=e,n.onloadend=function(e){var n=btoa(e.target.result||"");t({__local_forage_encoded_blob:!0,data:n,type:i.type})},n.readAsBinaryString(i)})));var i})):e})).then((function(e){O(n._dbInfo,"readwrite",(function(s,o){if(s)return r(s);try{var a=o.objectStore(n._dbInfo.storeName);null===e&&(e=void 0);var h=a.put(e,t);o.oncomplete=function(){void 0===e&&(e=null),i(e)},o.onabort=o.onerror=function(){var t=h.error?h.error:h.transaction.error;r(t)}}catch(t){r(t)}}))})).catch(r)}));return a(r,i),r},removeItem:function(t,e){var i=this;t=l(t);var n=new o((function(e,n){i.ready().then((function(){O(i._dbInfo,"readwrite",(function(r,s){if(r)return n(r);try{var o=s.objectStore(i._dbInfo.storeName).delete(t);s.oncomplete=function(){e()},s.onerror=function(){n(o.error)},s.onabort=function(){var t=o.error?o.error:o.transaction.error;n(t)}}catch(t){n(t)}}))})).catch(n)}));return a(n,e),n},clear:function(t){var e=this,i=new o((function(t,i){e.ready().then((function(){O(e._dbInfo,"readwrite",(function(n,r){if(n)return i(n);try{var s=r.objectStore(e._dbInfo.storeName).clear();r.oncomplete=function(){t()},r.onabort=r.onerror=function(){var t=s.error?s.error:s.transaction.error;i(t)}}catch(t){i(t)}}))})).catch(i)}));return a(i,t),i},length:function(t){var e=this,i=new o((function(t,i){e.ready().then((function(){O(e._dbInfo,"readonly",(function(n,r){if(n)return i(n);try{var s=r.objectStore(e._dbInfo.storeName).count();s.onsuccess=function(){t(s.result)},s.onerror=function(){i(s.error)}}catch(t){i(t)}}))})).catch(i)}));return a(i,t),i},key:function(t,e){var i=this,n=new o((function(e,n){t<0?e(null):i.ready().then((function(){O(i._dbInfo,"readonly",(function(r,s){if(r)return n(r);try{var o=s.objectStore(i._dbInfo.storeName),a=!1,h=o.openCursor();h.onsuccess=function(){var i=h.result;i?0===t||a?e(i.key):(a=!0,i.advance(t)):e(null)},h.onerror=function(){n(h.error)}}catch(t){n(t)}}))})).catch(n)}));return a(n,e),n},keys:function(t){var e=this,i=new o((function(t,i){e.ready().then((function(){O(e._dbInfo,"readonly",(function(n,r){if(n)return i(n);try{var s=r.objectStore(e._dbInfo.storeName).openCursor(),o=[];s.onsuccess=function(){var e=s.result;e?(o.push(e.key),e.continue()):t(o)},s.onerror=function(){i(s.error)}}catch(t){i(t)}}))})).catch(i)}));return a(i,t),i},dropInstance:function(t,e){e=c.apply(this,arguments);var i=this.config();(t="function"!=typeof t&&t||{}).name||(t.name=t.name||i.name,t.storeName=t.storeName||i.storeName);var n,s=this;if(t.name){var h=t.name===i.name&&s._dbInfo.db,l=h?o.resolve(s._dbInfo.db):b(t).then((function(e){var i=d[t.name],n=i.forages;i.db=e;for(var r=0;r<n.length;r++)n[r]._dbInfo.db=e;return e}));n=t.storeName?l.then((function(e){if(e.objectStoreNames.contains(t.storeName)){var i=e.version+1;g(t);var n=d[t.name],s=n.forages;e.close();for(var a=0;a<s.length;a++){var h=s[a];h._dbInfo.db=null,h._dbInfo.version=i}return new o((function(e,n){var s=r.open(t.name,i);s.onerror=function(t){s.result.close(),n(t)},s.onupgradeneeded=function(){s.result.deleteObjectStore(t.storeName)},s.onsuccess=function(){var t=s.result;t.close(),e(t)}})).then((function(t){n.db=t;for(var e=0;e<s.length;e++){var i=s[e];i._dbInfo.db=t,v(i._dbInfo)}})).catch((function(e){throw(m(t,e)||o.resolve()).catch((function(){})),e}))}})):l.then((function(e){g(t);var i=d[t.name],n=i.forages;e.close();for(var s=0;s<n.length;s++)n[s]._dbInfo.db=null;return new o((function(e,i){var n=r.deleteDatabase(t.name);n.onerror=n.onblocked=function(t){var e=n.result;e&&e.close(),i(t)},n.onsuccess=function(){var t=n.result;t&&t.close(),e(t)}})).then((function(t){i.db=t;for(var e=0;e<n.length;e++)v(n[e]._dbInfo)})).catch((function(e){throw(m(t,e)||o.resolve()).catch((function(){})),e}))}))}else n=o.reject("Invalid arguments");return a(n,e),n}},T="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",k=/^~~local_forage_type~([^~]+)~/,R="__lfsc__:".length,L=R+"arbf".length,I=Object.prototype.toString;function j(t){var e,i,n,r,s,o=.75*t.length,a=t.length,h=0;"="===t[t.length-1]&&(o--,"="===t[t.length-2]&&o--);var l=new ArrayBuffer(o),c=new Uint8Array(l);for(e=0;e<a;e+=4)i=T.indexOf(t[e]),n=T.indexOf(t[e+1]),r=T.indexOf(t[e+2]),s=T.indexOf(t[e+3]),c[h++]=i<<2|n>>4,c[h++]=(15&n)<<4|r>>2,c[h++]=(3&r)<<6|63&s;return l}function N(t){var e,i=new Uint8Array(t),n="";for(e=0;e<i.length;e+=3)n+=T[i[e]>>2],n+=T[(3&i[e])<<4|i[e+1]>>4],n+=T[(15&i[e+1])<<2|i[e+2]>>6],n+=T[63&i[e+2]];return i.length%3==2?n=n.substring(0,n.length-1)+"=":i.length%3==1&&(n=n.substring(0,n.length-2)+"=="),n}var A={serialize:function(t,e){var i="";if(t&&(i=I.call(t)),t&&("[object ArrayBuffer]"===i||t.buffer&&"[object ArrayBuffer]"===I.call(t.buffer))){var n,r="__lfsc__:";t instanceof ArrayBuffer?(n=t,r+="arbf"):(n=t.buffer,"[object Int8Array]"===i?r+="si08":"[object Uint8Array]"===i?r+="ui08":"[object Uint8ClampedArray]"===i?r+="uic8":"[object Int16Array]"===i?r+="si16":"[object Uint16Array]"===i?r+="ur16":"[object Int32Array]"===i?r+="si32":"[object Uint32Array]"===i?r+="ui32":"[object Float32Array]"===i?r+="fl32":"[object Float64Array]"===i?r+="fl64":e(new Error("Failed to get type for BinaryArray"))),e(r+N(n))}else if("[object Blob]"===i){var s=new FileReader;s.onload=function(){var i="~~local_forage_type~"+t.type+"~"+N(this.result);e("__lfsc__:blob"+i)},s.readAsArrayBuffer(t)}else try{e(JSON.stringify(t))}catch(i){console.error("Couldn't convert value into a JSON string: ",t),e(null,i)}},deserialize:function(t){if("__lfsc__:"!==t.substring(0,R))return JSON.parse(t);var e,i=t.substring(L),n=t.substring(R,L);if("blob"===n&&k.test(i)){var r=i.match(k);e=r[1],i=i.substring(r[0].length)}var o=j(i);switch(n){case"arbf":return o;case"blob":return s([o],{type:e});case"si08":return new Int8Array(o);case"ui08":return new Uint8Array(o);case"uic8":return new Uint8ClampedArray(o);case"si16":return new Int16Array(o);case"ur16":return new Uint16Array(o);case"si32":return new Int32Array(o);case"ui32":return new Uint32Array(o);case"fl32":return new Float32Array(o);case"fl64":return new Float64Array(o);default:throw new Error("Unkown type: "+n)}},stringToBuffer:j,bufferToString:N};function P(t,e,i,n){t.executeSql("CREATE TABLE IF NOT EXISTS "+e.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],i,n)}function D(t,e,i,n,r,s){t.executeSql(i,n,r,(function(t,o){o.code===o.SYNTAX_ERR?t.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[e.storeName],(function(t,a){a.rows.length?s(t,o):P(t,e,(function(){t.executeSql(i,n,r,s)}),s)}),s):s(t,o)}),s)}function z(t,e,i,n){var r=this;t=l(t);var s=new o((function(s,o){r.ready().then((function(){void 0===e&&(e=null);var a=e,h=r._dbInfo;h.serializer.serialize(e,(function(e,l){l?o(l):h.db.transaction((function(i){D(i,h,"INSERT OR REPLACE INTO "+h.storeName+" (key, value) VALUES (?, ?)",[t,e],(function(){s(a)}),(function(t,e){o(e)}))}),(function(e){if(e.code===e.QUOTA_ERR){if(n>0)return void s(z.apply(r,[t,a,i,n-1]));o(e)}}))}))})).catch(o)}));return a(s,i),s}function B(t){return new o((function(e,i){t.transaction((function(n){n.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],(function(i,n){for(var r=[],s=0;s<n.rows.length;s++)r.push(n.rows.item(s).name);e({db:t,storeNames:r})}),(function(t,e){i(e)}))}),(function(t){i(t)}))}))}var q={_driver:"webSQLStorage",_initStorage:function(t){var e=this,i={db:null};if(t)for(var n in t)i[n]="string"!=typeof t[n]?t[n].toString():t[n];var r=new o((function(t,n){try{i.db=openDatabase(i.name,String(i.version),i.description,i.size)}catch(t){return n(t)}i.db.transaction((function(r){P(r,i,(function(){e._dbInfo=i,t()}),(function(t,e){n(e)}))}),n)}));return i.serializer=A,r},_support:"function"==typeof openDatabase,iterate:function(t,e){var i=this,n=new o((function(e,n){i.ready().then((function(){var r=i._dbInfo;r.db.transaction((function(i){D(i,r,"SELECT * FROM "+r.storeName,[],(function(i,n){for(var s=n.rows,o=s.length,a=0;a<o;a++){var h=s.item(a),l=h.value;if(l&&(l=r.serializer.deserialize(l)),void 0!==(l=t(l,h.key,a+1)))return void e(l)}e()}),(function(t,e){n(e)}))}))})).catch(n)}));return a(n,e),n},getItem:function(t,e){var i=this;t=l(t);var n=new o((function(e,n){i.ready().then((function(){var r=i._dbInfo;r.db.transaction((function(i){D(i,r,"SELECT * FROM "+r.storeName+" WHERE key = ? LIMIT 1",[t],(function(t,i){var n=i.rows.length?i.rows.item(0).value:null;n&&(n=r.serializer.deserialize(n)),e(n)}),(function(t,e){n(e)}))}))})).catch(n)}));return a(n,e),n},setItem:function(t,e,i){return z.apply(this,[t,e,i,1])},removeItem:function(t,e){var i=this;t=l(t);var n=new o((function(e,n){i.ready().then((function(){var r=i._dbInfo;r.db.transaction((function(i){D(i,r,"DELETE FROM "+r.storeName+" WHERE key = ?",[t],(function(){e()}),(function(t,e){n(e)}))}))})).catch(n)}));return a(n,e),n},clear:function(t){var e=this,i=new o((function(t,i){e.ready().then((function(){var n=e._dbInfo;n.db.transaction((function(e){D(e,n,"DELETE FROM "+n.storeName,[],(function(){t()}),(function(t,e){i(e)}))}))})).catch(i)}));return a(i,t),i},length:function(t){var e=this,i=new o((function(t,i){e.ready().then((function(){var n=e._dbInfo;n.db.transaction((function(e){D(e,n,"SELECT COUNT(key) as c FROM "+n.storeName,[],(function(e,i){var n=i.rows.item(0).c;t(n)}),(function(t,e){i(e)}))}))})).catch(i)}));return a(i,t),i},key:function(t,e){var i=this,n=new o((function(e,n){i.ready().then((function(){var r=i._dbInfo;r.db.transaction((function(i){D(i,r,"SELECT key FROM "+r.storeName+" WHERE id = ? LIMIT 1",[t+1],(function(t,i){var n=i.rows.length?i.rows.item(0).key:null;e(n)}),(function(t,e){n(e)}))}))})).catch(n)}));return a(n,e),n},keys:function(t){var e=this,i=new o((function(t,i){e.ready().then((function(){var n=e._dbInfo;n.db.transaction((function(e){D(e,n,"SELECT key FROM "+n.storeName,[],(function(e,i){for(var n=[],r=0;r<i.rows.length;r++)n.push(i.rows.item(r).key);t(n)}),(function(t,e){i(e)}))}))})).catch(i)}));return a(i,t),i},dropInstance:function(t,e){e=c.apply(this,arguments);var i=this.config();(t="function"!=typeof t&&t||{}).name||(t.name=t.name||i.name,t.storeName=t.storeName||i.storeName);var n,r=this;return a(n=t.name?new o((function(e){var n;n=t.name===i.name?r._dbInfo.db:openDatabase(t.name,"","",0),t.storeName?e({db:n,storeNames:[t.storeName]}):e(B(n))})).then((function(t){return new o((function(e,i){t.db.transaction((function(n){function r(t){return new o((function(e,i){n.executeSql("DROP TABLE IF EXISTS "+t,[],(function(){e()}),(function(t,e){i(e)}))}))}for(var s=[],a=0,h=t.storeNames.length;a<h;a++)s.push(r(t.storeNames[a]));o.all(s).then((function(){e()})).catch((function(t){i(t)}))}),(function(t){i(t)}))}))})):o.reject("Invalid arguments"),e),n}};function M(t,e){var i=t.name+"/";return t.storeName!==e.storeName&&(i+=t.storeName+"/"),i}function U(){return!function(){try{return localStorage.setItem("_localforage_support_test",!0),localStorage.removeItem("_localforage_support_test"),!1}catch(t){return!0}}()||localStorage.length>0}var F={_driver:"localStorageWrapper",_initStorage:function(t){var e={};if(t)for(var i in t)e[i]=t[i];return e.keyPrefix=M(t,this._defaultConfig),U()?(this._dbInfo=e,e.serializer=A,o.resolve()):o.reject()},_support:function(){try{return"undefined"!=typeof localStorage&&"setItem"in localStorage&&!!localStorage.setItem}catch(t){return!1}}(),iterate:function(t,e){var i=this,n=i.ready().then((function(){for(var e=i._dbInfo,n=e.keyPrefix,r=n.length,s=localStorage.length,o=1,a=0;a<s;a++){var h=localStorage.key(a);if(0===h.indexOf(n)){var l=localStorage.getItem(h);if(l&&(l=e.serializer.deserialize(l)),void 0!==(l=t(l,h.substring(r),o++)))return l}}}));return a(n,e),n},getItem:function(t,e){var i=this;t=l(t);var n=i.ready().then((function(){var e=i._dbInfo,n=localStorage.getItem(e.keyPrefix+t);return n&&(n=e.serializer.deserialize(n)),n}));return a(n,e),n},setItem:function(t,e,i){var n=this;t=l(t);var r=n.ready().then((function(){void 0===e&&(e=null);var i=e;return new o((function(r,s){var o=n._dbInfo;o.serializer.serialize(e,(function(e,n){if(n)s(n);else try{localStorage.setItem(o.keyPrefix+t,e),r(i)}catch(t){"QuotaExceededError"!==t.name&&"NS_ERROR_DOM_QUOTA_REACHED"!==t.name||s(t),s(t)}}))}))}));return a(r,i),r},removeItem:function(t,e){var i=this;t=l(t);var n=i.ready().then((function(){var e=i._dbInfo;localStorage.removeItem(e.keyPrefix+t)}));return a(n,e),n},clear:function(t){var e=this,i=e.ready().then((function(){for(var t=e._dbInfo.keyPrefix,i=localStorage.length-1;i>=0;i--){var n=localStorage.key(i);0===n.indexOf(t)&&localStorage.removeItem(n)}}));return a(i,t),i},length:function(t){var e=this.keys().then((function(t){return t.length}));return a(e,t),e},key:function(t,e){var i=this,n=i.ready().then((function(){var e,n=i._dbInfo;try{e=localStorage.key(t)}catch(t){e=null}return e&&(e=e.substring(n.keyPrefix.length)),e}));return a(n,e),n},keys:function(t){var e=this,i=e.ready().then((function(){for(var t=e._dbInfo,i=localStorage.length,n=[],r=0;r<i;r++){var s=localStorage.key(r);0===s.indexOf(t.keyPrefix)&&n.push(s.substring(t.keyPrefix.length))}return n}));return a(i,t),i},dropInstance:function(t,e){if(e=c.apply(this,arguments),!(t="function"!=typeof t&&t||{}).name){var i=this.config();t.name=t.name||i.name,t.storeName=t.storeName||i.storeName}var n,r=this;return a(n=t.name?new o((function(e){t.storeName?e(M(t,r._defaultConfig)):e(t.name+"/")})).then((function(t){for(var e=localStorage.length-1;e>=0;e--){var i=localStorage.key(e);0===i.indexOf(t)&&localStorage.removeItem(i)}})):o.reject("Invalid arguments"),e),n}},W=function(t,e){for(var i,n,r=t.length,s=0;s<r;){if((i=t[s])===(n=e)||"number"==typeof i&&"number"==typeof n&&isNaN(i)&&isNaN(n))return!0;s++}return!1},H=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},V={},X={},G={INDEXEDDB:C,WEBSQL:q,LOCALSTORAGE:F},Y=[G.INDEXEDDB._driver,G.WEBSQL._driver,G.LOCALSTORAGE._driver],$=["dropInstance"],K=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat($),Z={description:"",driver:Y.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function J(t,e){t[e]=function(){var i=arguments;return t.ready().then((function(){return t[e].apply(t,i)}))}}function Q(){for(var t=1;t<arguments.length;t++){var e=arguments[t];if(e)for(var i in e)e.hasOwnProperty(i)&&(H(e[i])?arguments[0][i]=e[i].slice():arguments[0][i]=e[i])}return arguments[0]}var tt=new(function(){function t(e){for(var i in function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),G)if(G.hasOwnProperty(i)){var n=G[i],r=n._driver;this[i]=r,V[r]||this.defineDriver(n)}this._defaultConfig=Q({},Z),this._config=Q({},this._defaultConfig,e),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch((function(){}))}return t.prototype.config=function(t){if("object"===(void 0===t?"undefined":n(t))){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var e in t){if("storeName"===e&&(t[e]=t[e].replace(/\W/g,"_")),"version"===e&&"number"!=typeof t[e])return new Error("Database version must be a number.");this._config[e]=t[e]}return!("driver"in t)||!t.driver||this.setDriver(this._config.driver)}return"string"==typeof t?this._config[t]:this._config},t.prototype.defineDriver=function(t,e,i){var n=new o((function(e,i){try{var n=t._driver,r=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!t._driver)return void i(r);for(var s=K.concat("_initStorage"),h=0,l=s.length;h<l;h++){var c=s[h];if((!W($,c)||t[c])&&"function"!=typeof t[c])return void i(r)}!function(){for(var e=function(t){return function(){var e=new Error("Method "+t+" is not implemented by the current driver"),i=o.reject(e);return a(i,arguments[arguments.length-1]),i}},i=0,n=$.length;i<n;i++){var r=$[i];t[r]||(t[r]=e(r))}}();var u=function(i){V[n]&&console.info("Redefining LocalForage driver: "+n),V[n]=t,X[n]=i,e()};"_support"in t?t._support&&"function"==typeof t._support?t._support().then(u,i):u(!!t._support):u(!0)}catch(t){i(t)}}));return h(n,e,i),n},t.prototype.driver=function(){return this._driver||null},t.prototype.getDriver=function(t,e,i){var n=V[t]?o.resolve(V[t]):o.reject(new Error("Driver not found."));return h(n,e,i),n},t.prototype.getSerializer=function(t){var e=o.resolve(A);return h(e,t),e},t.prototype.ready=function(t){var e=this,i=e._driverSet.then((function(){return null===e._ready&&(e._ready=e._initDriver()),e._ready}));return h(i,t,t),i},t.prototype.setDriver=function(t,e,i){var n=this;H(t)||(t=[t]);var r=this._getSupportedDrivers(t);function s(){n._config.driver=n.driver()}function a(t){return n._extend(t),s(),n._ready=n._initStorage(n._config),n._ready}var l=null!==this._driverSet?this._driverSet.catch((function(){return o.resolve()})):o.resolve();return this._driverSet=l.then((function(){var t=r[0];return n._dbInfo=null,n._ready=null,n.getDriver(t).then((function(t){n._driver=t._driver,s(),n._wrapLibraryMethodsWithReady(),n._initDriver=function(t){return function(){var e=0;return function i(){for(;e<t.length;){var r=t[e];return e++,n._dbInfo=null,n._ready=null,n.getDriver(r).then(a).catch(i)}s();var h=new Error("No available storage method found.");return n._driverSet=o.reject(h),n._driverSet}()}}(r)}))})).catch((function(){s();var t=new Error("No available storage method found.");return n._driverSet=o.reject(t),n._driverSet})),h(this._driverSet,e,i),this._driverSet},t.prototype.supports=function(t){return!!X[t]},t.prototype._extend=function(t){Q(this,t)},t.prototype._getSupportedDrivers=function(t){for(var e=[],i=0,n=t.length;i<n;i++){var r=t[i];this.supports(r)&&e.push(r)}return e},t.prototype._wrapLibraryMethodsWithReady=function(){for(var t=0,e=K.length;t<e;t++)J(this,K[t])},t.prototype.createInstance=function(e){return new t(e)},t}());e.exports=tt},{3:3}]},{},[4])(4)}).call(this,i(30))},function(t,e,i){"use strict";i(24),i(14);var n=i(3),r=i.n(n),s=i(0),o=i(5),a=i(4),h=i(2),l=i(6),c=i(11);i(20);var u=function(t,e,i,n){var r,o="undefined"!=typeof window&&window.URL,h=o?"blob":"arraybuffer",l=new s.defer,c=new XMLHttpRequest,u=XMLHttpRequest.prototype;for(r in"overrideMimeType"in u||Object.defineProperty(u,"overrideMimeType",{value:function(){}}),i&&(c.withCredentials=!0),c.onreadystatechange=function(){if(this.readyState===XMLHttpRequest.DONE){var t=!1;if(""!==this.responseType&&"document"!==this.responseType||(t=this.responseXML),200===this.status||0===this.status||t){var i;if(!this.response&&!t)return l.reject({status:this.status,message:"Empty Response",stack:(new Error).stack}),l.promise;if(403===this.status)return l.reject({status:this.status,response:this.response,message:"Forbidden",stack:(new Error).stack}),l.promise;i=t?this.responseXML:Object(s.isXml)(e)?Object(s.parse)(this.response,"text/xml"):"xhtml"==e?Object(s.parse)(this.response,"application/xhtml+xml"):"html"==e||"htm"==e?Object(s.parse)(this.response,"text/html"):"json"==e?JSON.parse(this.response):"blob"==e?o?this.response:new Blob([this.response]):this.response,l.resolve(i)}else l.reject({status:this.status,message:this.response,stack:(new Error).stack})}},c.onerror=function(t){l.reject(t)},c.open("GET",t,!0),n)c.setRequestHeader(r,n[r]);return"json"==e&&c.setRequestHeader("Accept","application/json"),e||(e=new a.a(t).extension),"blob"==e&&(c.responseType=h),Object(s.isXml)(e)&&c.overrideMimeType("text/xml"),"binary"==e&&(c.responseType="arraybuffer"),c.send(),l.promise},d=i(38);var f=class{constructor(t,e){this.idref=t.idref,this.linear="yes"===t.linear,this.properties=t.properties,this.index=t.index,this.href=t.href,this.url=t.url,this.canonical=t.canonical,this.next=t.next,this.prev=t.prev,this.cfiBase=t.cfiBase,e?this.hooks=e:(this.hooks={},this.hooks.serialize=new l.a(this),this.hooks.content=new l.a(this)),this.document=void 0,this.contents=void 0,this.output=void 0}load(t){var e=t||this.request||u,i=new s.defer,n=i.promise;return this.contents?i.resolve(this.contents):e(this.url).then(function(t){return this.document=t,this.contents=t.documentElement,this.hooks.content.trigger(this.document,this)}.bind(this)).then(function(){i.resolve(this.contents)}.bind(this)).catch((function(t){i.reject(t)})),n}base(){return Object(c.a)(this.document,this)}render(t){var e=new s.defer,i=e.promise;return this.output,this.load(t).then(function(t){var e=("undefined"!=typeof navigator&&navigator.userAgent||"").indexOf("Trident")>=0,i=new("undefined"==typeof XMLSerializer||e?d.XMLDOMParser:XMLSerializer);return this.output=i.serializeToString(t),this.output}.bind(this)).then(function(){return this.hooks.serialize.trigger(this.output,this)}.bind(this)).then(function(){e.resolve(this.output)}.bind(this)).catch((function(t){e.reject(t)})),i}find(t){var e=this,i=[],n=t.toLowerCase();return Object(s.sprint)(e.document,(function(t){!function(t){for(var r,s,o,a=t.textContent.toLowerCase(),h=e.document.createRange(),l=-1;-1!=s;)-1!=(s=a.indexOf(n,l+1))&&((h=e.document.createRange()).setStart(t,s),h.setEnd(t,s+n.length),r=e.cfiFromRange(h),o=t.textContent.length<150?t.textContent:"..."+(o=t.textContent.substring(s-75,s+75))+"...",i.push({cfi:r,excerpt:o})),l=s}(t)})),i}search(t,e=5){if(void 0===document.createTreeWalker)return this.find(t);let i=[];const n=this,r=t.toLowerCase(),s=function(t){const e=t.reduce((t,e)=>t+e.textContent,"").toLowerCase().indexOf(r);if(-1!=e){const s=0,o=e+r.length;let a=0,h=0;if(e<t[s].length){let r;for(;a<t.length-1&&(h+=t[a].length,!(o<=h));)a+=1;let l=t[s],c=t[a],u=n.document.createRange();u.setStart(l,e);let d=t.slice(0,a).reduce((t,e)=>t+e.textContent.length,0);u.setEnd(c,d>o?o:o-d),r=n.cfiFromRange(u);let f=t.slice(0,a+1).reduce((t,e)=>t+e.textContent,"");f.length>150&&(f=f.substring(e-75,e+75),f="..."+f+"..."),i.push({cfi:r,excerpt:f})}}},o=document.createTreeWalker(n.document,NodeFilter.SHOW_TEXT,null,!1);let a,h=[];for(;a=o.nextNode();)h.push(a),h.length==e&&(s(h.slice(0,e)),h=h.slice(1,e));return h.length>0&&s(h),i}reconcileLayoutSettings(t){var e={layout:t.layout,spread:t.spread,orientation:t.orientation};return this.properties.forEach((function(t){var i,n,r=t.replace("rendition:",""),s=r.indexOf("-");-1!=s&&(i=r.slice(0,s),n=r.slice(s+1),e[i]=n)})),e}cfiFromRange(t){return new h.a(t,this.cfiBase).toString()}cfiFromElement(t){return new h.a(t,this.cfiBase).toString()}unload(){this.document=void 0,this.contents=void 0,this.output=void 0}destroy(){this.unload(),this.hooks.serialize.clear(),this.hooks.content.clear(),this.hooks=void 0,this.idref=void 0,this.linear=void 0,this.properties=void 0,this.index=void 0,this.href=void 0,this.url=void 0,this.next=void 0,this.prev=void 0,this.cfiBase=void 0}};var p=class{constructor(){this.spineItems=[],this.spineByHref={},this.spineById={},this.hooks={},this.hooks.serialize=new l.a,this.hooks.content=new l.a,this.hooks.content.register(c.a),this.hooks.content.register(c.b),this.hooks.content.register(c.d),this.epubcfi=new h.a,this.loaded=!1,this.items=void 0,this.manifest=void 0,this.spineNodeIndex=void 0,this.baseUrl=void 0,this.length=void 0}unpack(t,e,i){this.items=t.spine,this.manifest=t.manifest,this.spineNodeIndex=t.spineNodeIndex,this.baseUrl=t.baseUrl||t.basePath||"",this.length=this.items.length,this.items.forEach((t,n)=>{var r,s=this.manifest[t.idref];t.index=n,t.cfiBase=this.epubcfi.generateChapterComponent(this.spineNodeIndex,t.index,t.idref),t.href&&(t.url=e(t.href,!0),t.canonical=i(t.href)),s&&(t.href=s.href,t.url=e(t.href,!0),t.canonical=i(t.href),s.properties.length&&t.properties.push.apply(t.properties,s.properties)),"yes"===t.linear?(t.prev=function(){let e=t.index;for(;e>0;){let t=this.get(e-1);if(t&&t.linear)return t;e-=1}}.bind(this),t.next=function(){let e=t.index;for(;e<this.spineItems.length-1;){let t=this.get(e+1);if(t&&t.linear)return t;e+=1}}.bind(this)):(t.prev=function(){},t.next=function(){}),r=new f(t,this.hooks),this.append(r)}),this.loaded=!0}get(t){var e=0;if(void 0===t)for(;e<this.spineItems.length;){let t=this.spineItems[e];if(t&&t.linear)break;e+=1}else if(this.epubcfi.isCfiString(t)){e=new h.a(t).spinePos}else"number"==typeof t||!1===isNaN(t)?e=t:"string"==typeof t&&0===t.indexOf("#")?e=this.spineById[t.substring(1)]:"string"==typeof t&&(t=t.split("#")[0],e=this.spineByHref[t]||this.spineByHref[encodeURI(t)]);return this.spineItems[e]||null}append(t){var e=this.spineItems.length;return t.index=e,this.spineItems.push(t),this.spineByHref[decodeURI(t.href)]=e,this.spineByHref[encodeURI(t.href)]=e,this.spineByHref[t.href]=e,this.spineById[t.idref]=e,e}prepend(t){return this.spineByHref[t.href]=0,this.spineById[t.idref]=0,this.spineItems.forEach((function(t,e){t.index=e})),0}remove(t){var e=this.spineItems.indexOf(t);if(e>-1)return delete this.spineByHref[t.href],delete this.spineById[t.idref],this.spineItems.splice(e,1)}each(){return this.spineItems.forEach.apply(this.spineItems,arguments)}first(){let t=0;do{let e=this.get(t);if(e&&e.linear)return e;t+=1}while(t<this.spineItems.length)}last(){let t=this.spineItems.length-1;do{let e=this.get(t);if(e&&e.linear)return e;t-=1}while(t>=0)}destroy(){this.each(t=>t.destroy()),this.spineItems=void 0,this.spineByHref=void 0,this.spineById=void 0,this.hooks.serialize.clear(),this.hooks.content.clear(),this.hooks=void 0,this.epubcfi=void 0,this.loaded=!1,this.items=void 0,this.manifest=void 0,this.spineNodeIndex=void 0,this.baseUrl=void 0,this.length=void 0}},g=i(21),v=i(1);class m{constructor(t,e,i){this.spine=t,this.request=e,this.pause=i||100,this.q=new g.a(this),this.epubcfi=new h.a,this._locations=[],this._locationsWords=[],this.total=0,this.break=150,this._current=0,this._wordCounter=0,this.currentLocation="",this._currentCfi="",this.processingTimeout=void 0}generate(t){return t&&(this.break=t),this.q.pause(),this.spine.each(function(t){t.linear&&this.q.enqueue(this.process.bind(this),t)}.bind(this)),this.q.run().then(function(){return this.total=this._locations.length-1,this._currentCfi&&(this.currentLocation=this._currentCfi),this._locations}.bind(this))}createRange(){return{startContainer:void 0,startOffset:void 0,endContainer:void 0,endOffset:void 0}}process(t){return t.load(this.request).then(function(e){var i=new s.defer,n=this.parse(e,t.cfiBase);return this._locations=this._locations.concat(n),t.unload(),this.processingTimeout=setTimeout(()=>i.resolve(n),this.pause),i.promise}.bind(this))}parse(t,e,i){var n,r,o=[],a=t.ownerDocument,l=Object(s.qs)(a,"body"),c=0,u=i||this.break;if(Object(s.sprint)(l,function(t){var i,s=t.length,a=0;if(0===t.textContent.trim().length)return!1;for(0==c&&((n=this.createRange()).startContainer=t,n.startOffset=0),(i=u-c)>s&&(c+=s,a=s);a<s;)if(i=u-c,0===c&&(a+=1,(n=this.createRange()).startContainer=t,n.startOffset=a),a+i>=s)c+=s-a,a=s;else{a+=i,n.endContainer=t,n.endOffset=a;let r=new h.a(n,e).toString();o.push(r),c=0}r=t}.bind(this)),n&&n.startContainer&&r){n.endContainer=r,n.endOffset=r.length;let t=new h.a(n,e).toString();o.push(t),c=0}return o}generateFromWords(t,e,i){var n=t?new h.a(t):void 0;return this.q.pause(),this._locationsWords=[],this._wordCounter=0,this.spine.each(function(t){t.linear&&(n?t.index>=n.spinePos&&this.q.enqueue(this.processWords.bind(this),t,e,n,i):this.q.enqueue(this.processWords.bind(this),t,e,n,i))}.bind(this)),this.q.run().then(function(){return this._currentCfi&&(this.currentLocation=this._currentCfi),this._locationsWords}.bind(this))}processWords(t,e,i,n){return n&&this._locationsWords.length>=n?Promise.resolve():t.load(this.request).then(function(r){var o=new s.defer,a=this.parseWords(r,t,e,i),h=n-this._locationsWords.length;return this._locationsWords=this._locationsWords.concat(a.length>=n?a.slice(0,h):a),t.unload(),this.processingTimeout=setTimeout(()=>o.resolve(a),this.pause),o.promise}.bind(this))}countWords(t){return(t=(t=(t=t.replace(/(^\s*)|(\s*$)/gi,"")).replace(/[ ]{2,}/gi," ")).replace(/\n /,"\n")).split(" ").length}parseWords(t,e,i,n){var r,o=e.cfiBase,a=[],l=t.ownerDocument,c=Object(s.qs)(l,"body"),u=i,d=!n||n.spinePos!==e.index;n&&e.index===n.spinePos&&(r=n.findNode(n.range?n.path.steps.concat(n.start.steps):n.path.steps,t.ownerDocument));return Object(s.sprint)(c,function(t){if(!d){if(t!==r)return!1;d=!0}if(t.textContent.length<10&&0===t.textContent.trim().length)return!1;var e,i=this.countWords(t.textContent),n=0;if(0===i)return!1;for((e=u-this._wordCounter)>i&&(this._wordCounter+=i,n=i);n<i;)if(n+(e=u-this._wordCounter)>=i)this._wordCounter+=i-n,n=i;else{n+=e;let i=new h.a(t,o);a.push({cfi:i.toString(),wordCount:this._wordCounter}),this._wordCounter=0}t}.bind(this)),a}locationFromCfi(t){let e;return h.a.prototype.isCfiString(t)&&(t=new h.a(t)),0===this._locations.length?-1:(e=Object(s.locationOf)(t,this._locations,this.epubcfi.compare),e>this.total?this.total:e)}percentageFromCfi(t){if(0===this._locations.length)return null;var e=this.locationFromCfi(t);return this.percentageFromLocation(e)}percentageFromLocation(t){return t&&this.total?t/this.total:0}cfiFromLocation(t){var e=-1;return"number"!=typeof t&&(t=parseInt(t)),t>=0&&t<this._locations.length&&(e=this._locations[t]),e}cfiFromPercentage(t){let e;if(t>1&&console.warn("Normalize cfiFromPercentage value to between 0 - 1"),t>=1){let t=new h.a(this._locations[this.total]);return t.collapse(),t.toString()}return e=Math.ceil(this.total*t),this.cfiFromLocation(e)}load(t){return this._locations="string"==typeof t?JSON.parse(t):t,this.total=this._locations.length-1,this._locations}save(){return JSON.stringify(this._locations)}getCurrent(){return this._current}setCurrent(t){var e;if("string"==typeof t)this._currentCfi=t;else{if("number"!=typeof t)return;this._current=t}0!==this._locations.length&&("string"==typeof t?(e=this.locationFromCfi(t),this._current=e):e=t,this.emit(v.c.LOCATIONS.CHANGED,{percentage:this.percentageFromLocation(e)}))}get currentLocation(){return this._current}set currentLocation(t){this.setCurrent(t)}length(){return this._locations.length}destroy(){this.spine=void 0,this.request=void 0,this.pause=void 0,this.q.stop(),this.q=void 0,this.epubcfi=void 0,this._locations=void 0,this.total=void 0,this.break=void 0,this._current=void 0,this.currentLocation=void 0,this._currentCfi=void 0,clearTimeout(this.processingTimeout)}}r()(m.prototype);var y=m,b=i(9),w=i.n(b);var x=class{constructor(t){this.packagePath="",this.directory="",this.encoding="",t&&this.parse(t)}parse(t){var e;if(!t)throw new Error("Container File Not Found");if(!(e=Object(s.qs)(t,"rootfile")))throw new Error("No RootFile Found");this.packagePath=e.getAttribute("full-path"),this.directory=w.a.dirname(this.packagePath),this.encoding=t.xmlEncoding}destroy(){this.packagePath=void 0,this.directory=void 0,this.encoding=void 0}};var E=class{constructor(t){this.manifest={},this.navPath="",this.ncxPath="",this.coverPath="",this.spineNodeIndex=0,this.spine=[],this.metadata={},t&&this.parse(t)}parse(t){var e,i,n;if(!t)throw new Error("Package File Not Found");if(!(e=Object(s.qs)(t,"metadata")))throw new Error("No Metadata Found");if(!(i=Object(s.qs)(t,"manifest")))throw new Error("No Manifest Found");if(!(n=Object(s.qs)(t,"spine")))throw new Error("No Spine Found");return this.manifest=this.parseManifest(i),this.navPath=this.findNavPath(i),this.ncxPath=this.findNcxPath(i,n),this.coverPath=this.findCoverPath(t),this.spineNodeIndex=Object(s.indexOfElementNode)(n),this.spine=this.parseSpine(n,this.manifest),this.uniqueIdentifier=this.findUniqueIdentifier(t),this.metadata=this.parseMetadata(e),this.metadata.direction=n.getAttribute("page-progression-direction"),{metadata:this.metadata,spine:this.spine,manifest:this.manifest,navPath:this.navPath,ncxPath:this.ncxPath,coverPath:this.coverPath,spineNodeIndex:this.spineNodeIndex}}parseMetadata(t){var e={};return e.title=this.getElementText(t,"title"),e.creator=this.getElementText(t,"creator"),e.description=this.getElementText(t,"description"),e.pubdate=this.getElementText(t,"date"),e.publisher=this.getElementText(t,"publisher"),e.identifier=this.getElementText(t,"identifier"),e.language=this.getElementText(t,"language"),e.rights=this.getElementText(t,"rights"),e.modified_date=this.getPropertyText(t,"dcterms:modified"),e.layout=this.getPropertyText(t,"rendition:layout"),e.orientation=this.getPropertyText(t,"rendition:orientation"),e.flow=this.getPropertyText(t,"rendition:flow"),e.viewport=this.getPropertyText(t,"rendition:viewport"),e.media_active_class=this.getPropertyText(t,"media:active-class"),e.spread=this.getPropertyText(t,"rendition:spread"),e}parseManifest(t){var e={},i=Object(s.qsa)(t,"item");return Array.prototype.slice.call(i).forEach((function(t){var i=t.getAttribute("id"),n=t.getAttribute("href")||"",r=t.getAttribute("media-type")||"",s=t.getAttribute("media-overlay")||"",o=t.getAttribute("properties")||"";e[i]={href:n,type:r,overlay:s,properties:o.length?o.split(" "):[]}})),e}parseSpine(t,e){var i=[],n=Object(s.qsa)(t,"itemref");return Array.prototype.slice.call(n).forEach((function(t,e){var n=t.getAttribute("idref"),r=t.getAttribute("properties")||"",s=r.length?r.split(" "):[],o={idref:n,linear:t.getAttribute("linear")||"yes",properties:s,index:e};i.push(o)})),i}findUniqueIdentifier(t){var e=t.documentElement.getAttribute("unique-identifier");if(!e)return"";var i=t.getElementById(e);return i&&"identifier"===i.localName&&"http://purl.org/dc/elements/1.1/"===i.namespaceURI&&i.childNodes.length>0?i.childNodes[0].nodeValue.trim():""}findNavPath(t){var e=Object(s.qsp)(t,"item",{properties:"nav"});return!!e&&e.getAttribute("href")}findNcxPath(t,e){var i,n=Object(s.qsp)(t,"item",{"media-type":"application/x-dtbncx+xml"});return n||(i=e.getAttribute("toc"))&&(n=t.querySelector("#"+i)),!!n&&n.getAttribute("href")}findCoverPath(t){Object(s.qs)(t,"package").getAttribute("version");var e=Object(s.qsp)(t,"item",{properties:"cover-image"});if(e)return e.getAttribute("href");var i=Object(s.qsp)(t,"meta",{name:"cover"});if(i){var n=i.getAttribute("content"),r=t.getElementById(n);return r?r.getAttribute("href"):""}return!1}getElementText(t,e){var i,n=t.getElementsByTagNameNS("http://purl.org/dc/elements/1.1/",e);return n&&0!==n.length&&(i=n[0]).childNodes.length?i.childNodes[0].nodeValue:""}getPropertyText(t,e){var i=Object(s.qsp)(t,"meta",{property:e});return i&&i.childNodes.length?i.childNodes[0].nodeValue:""}load(t){this.metadata=t.metadata;let e=t.readingOrder||t.spine;return this.spine=e.map((t,e)=>(t.index=e,t.linear=t.linear||"yes",t)),t.resources.forEach((t,e)=>{this.manifest[e]=t,t.rel&&"cover"===t.rel[0]&&(this.coverPath=t.href)}),this.spineNodeIndex=0,this.toc=t.toc.map((t,e)=>(t.label=t.title,t)),{metadata:this.metadata,spine:this.spine,manifest:this.manifest,navPath:this.navPath,ncxPath:this.ncxPath,coverPath:this.coverPath,spineNodeIndex:this.spineNodeIndex,toc:this.toc}}destroy(){this.manifest=void 0,this.navPath=void 0,this.ncxPath=void 0,this.coverPath=void 0,this.spineNodeIndex=void 0,this.spine=void 0,this.metadata=void 0}};var S=class{constructor(t){this.toc=[],this.tocByHref={},this.tocById={},this.landmarks=[],this.landmarksByType={},this.length=0,t&&this.parse(t)}parse(t){let e,i,n=t.nodeType;n&&(e=Object(s.qs)(t,"html"),i=Object(s.qs)(t,"ncx")),n?e?(this.toc=this.parseNav(t),this.landmarks=this.parseLandmarks(t)):i&&(this.toc=this.parseNcx(t)):this.toc=this.load(t),this.length=0,this.unpack(this.toc)}unpack(t){for(var e,i=0;i<t.length;i++)(e=t[i]).href&&(this.tocByHref[e.href]=i),e.id&&(this.tocById[e.id]=i),this.length++,e.subitems.length&&this.unpack(e.subitems)}get(t){var e;return t?(0===t.indexOf("#")?e=this.tocById[t.substring(1)]:t in this.tocByHref&&(e=this.tocByHref[t]),this.getByIndex(t,e,this.toc)):this.toc}getByIndex(t,e,i){if(0===i.length)return;const n=i[e];if(!n||t!==n.id&&t!==n.href){let n;for(let r=0;r<i.length&&(n=this.getByIndex(t,e,i[r].subitems),!n);++r);return n}return n}landmark(t){var e;return t?(e=this.landmarksByType[t],this.landmarks[e]):this.landmarks}parseNav(t){var e,i,n=Object(s.querySelectorByType)(t,"nav","toc"),r=n?Object(s.qsa)(n,"li"):[],o=r.length,a={},h=[];if(!r||0===o)return h;for(e=0;e<o;++e)(i=this.navItem(r[e]))&&(a[i.id]=i,i.parent?a[i.parent].subitems.push(i):h.push(i));return h}navItem(t){let e=t.getAttribute("id")||void 0,i=Object(s.filterChildren)(t,"a",!0);if(!i)return;let n=i.getAttribute("href")||"";e||(e=n);let r,o=i.textContent||"",a=Object(s.getParentByTagName)(t,"li");if(a&&(r=a.getAttribute("id"),!r)){const t=Object(s.filterChildren)(a,"a",!0);r=t&&t.getAttribute("href")}for(;!r&&a;)if(a=Object(s.getParentByTagName)(a,"li"),a&&(r=a.getAttribute("id"),!r)){const t=Object(s.filterChildren)(a,"a",!0);r=t&&t.getAttribute("href")}return{id:e,href:n,label:o,subitems:[],parent:r}}parseLandmarks(t){var e,i,n=Object(s.querySelectorByType)(t,"nav","landmarks"),r=n?Object(s.qsa)(n,"li"):[],o=r.length,a=[];if(!r||0===o)return a;for(e=0;e<o;++e)(i=this.landmarkItem(r[e]))&&(a.push(i),this.landmarksByType[i.type]=e);return a}landmarkItem(t){let e=Object(s.filterChildren)(t,"a",!0);if(!e)return;let i=e.getAttributeNS("http://www.idpf.org/2007/ops","type")||void 0;return{href:e.getAttribute("href")||"",label:e.textContent||"",type:i}}parseNcx(t){var e,i,n=Object(s.qsa)(t,"navPoint"),r=n.length,o={},a=[];if(!n||0===r)return a;for(e=0;e<r;++e)o[(i=this.ncxItem(n[e])).id]=i,i.parent?o[i.parent].subitems.push(i):a.push(i);return a}ncxItem(t){var e,i=t.getAttribute("id")||!1,n=Object(s.qs)(t,"content").getAttribute("src"),r=Object(s.qs)(t,"navLabel"),o=r.textContent?r.textContent:"",a=t.parentNode;return!a||"navPoint"!==a.nodeName&&"navPoint"!==a.nodeName.split(":").slice(-1)[0]||(e=a.getAttribute("id")),{id:i,href:n,label:o,subitems:[],parent:e}}load(t){return t.map(t=>(t.label=t.title,t.subitems=t.children?this.load(t.children):[],t))}forEach(t){return this.toc.forEach(t)}},_={application:{ecmascript:["es","ecma"],javascript:"js",ogg:"ogx",pdf:"pdf",postscript:["ps","ai","eps","epsi","epsf","eps2","eps3"],"rdf+xml":"rdf",smil:["smi","smil"],"xhtml+xml":["xhtml","xht"],xml:["xml","xsl","xsd","opf","ncx"],zip:"zip","x-httpd-eruby":"rhtml","x-latex":"latex","x-maker":["frm","maker","frame","fm","fb","book","fbdoc"],"x-object":"o","x-shockwave-flash":["swf","swfl"],"x-silverlight":"scr","epub+zip":"epub","font-tdpfr":"pfr","inkml+xml":["ink","inkml"],json:"json","jsonml+json":"jsonml","mathml+xml":"mathml","metalink+xml":"metalink",mp4:"mp4s","omdoc+xml":"omdoc",oxps:"oxps","vnd.amazon.ebook":"azw",widget:"wgt","x-dtbook+xml":"dtb","x-dtbresource+xml":"res","x-font-bdf":"bdf","x-font-ghostscript":"gsf","x-font-linux-psf":"psf","x-font-otf":"otf","x-font-pcf":"pcf","x-font-snf":"snf","x-font-ttf":["ttf","ttc"],"x-font-type1":["pfa","pfb","pfm","afm"],"x-font-woff":"woff","x-mobipocket-ebook":["prc","mobi"],"x-mspublisher":"pub","x-nzb":"nzb","x-tgif":"obj","xaml+xml":"xaml","xml-dtd":"dtd","xproc+xml":"xpl","xslt+xml":"xslt","internet-property-stream":"acx","x-compress":"z","x-compressed":"tgz","x-gzip":"gz"},audio:{flac:"flac",midi:["mid","midi","kar","rmi"],mpeg:["mpga","mpega","mp2","mp3","m4a","mp2a","m2a","m3a"],mpegurl:"m3u",ogg:["oga","ogg","spx"],"x-aiff":["aif","aiff","aifc"],"x-ms-wma":"wma","x-wav":"wav",adpcm:"adp",mp4:"mp4a",webm:"weba","x-aac":"aac","x-caf":"caf","x-matroska":"mka","x-pn-realaudio-plugin":"rmp",xm:"xm",mid:["mid","rmi"]},image:{gif:"gif",ief:"ief",jpeg:["jpeg","jpg","jpe"],pcx:"pcx",png:"png","svg+xml":["svg","svgz"],tiff:["tiff","tif"],"x-icon":"ico",bmp:"bmp",webp:"webp","x-pict":["pic","pct"],"x-tga":"tga","cis-cod":"cod"},text:{"cache-manifest":["manifest","appcache"],css:"css",csv:"csv",html:["html","htm","shtml","stm"],mathml:"mml",plain:["txt","text","brf","conf","def","list","log","in","bas"],richtext:"rtx","tab-separated-values":"tsv","x-bibtex":"bib"},video:{mpeg:["mpeg","mpg","mpe","m1v","m2v","mp2","mpa","mpv2"],mp4:["mp4","mp4v","mpg4"],quicktime:["qt","mov"],ogg:"ogv","vnd.mpegurl":["mxu","m4u"],"x-flv":"flv","x-la-asf":["lsf","lsx"],"x-mng":"mng","x-ms-asf":["asf","asx","asr"],"x-ms-wm":"wm","x-ms-wmv":"wmv","x-ms-wmx":"wmx","x-ms-wvx":"wvx","x-msvideo":"avi","x-sgi-movie":"movie","x-matroska":["mpv","mkv","mk3d","mks"],"3gpp2":"3g2",h261:"h261",h263:"h263",h264:"h264",jpeg:"jpgv",jpm:["jpm","jpgm"],mj2:["mj2","mjp2"],"vnd.ms-playready.media.pyv":"pyv","vnd.uvvu.mp4":["uvu","uvvu"],"vnd.vivo":"viv",webm:"webm","x-f4v":"f4v","x-m4v":"m4v","x-ms-vob":"vob","x-smv":"smv"}},O=function(){var t,e,i,n,r={};for(t in _)if(_.hasOwnProperty(t))for(e in _[t])if(_[t].hasOwnProperty(e))if("string"==typeof(i=_[t][e]))r[i]=t+"/"+e;else for(n=0;n<i.length;n++)r[i[n]]=t+"/"+e;return r}();var C={lookup:function(t){return t&&O[t.split(".").pop().toLowerCase()]||"text/plain"}};var T=class{constructor(t,e){this.settings={replacements:e&&e.replacements||"base64",archive:e&&e.archive,resolver:e&&e.resolver,request:e&&e.request},this.process(t)}process(t){this.manifest=t,this.resources=Object.keys(t).map((function(e){return t[e]})),this.replacementUrls=[],this.html=[],this.assets=[],this.css=[],this.urls=[],this.cssUrls=[],this.split(),this.splitUrls()}split(){this.html=this.resources.filter((function(t){if("application/xhtml+xml"===t.type||"text/html"===t.type)return!0})),this.assets=this.resources.filter((function(t){if("application/xhtml+xml"!==t.type&&"text/html"!==t.type)return!0})),this.css=this.resources.filter((function(t){if("text/css"===t.type)return!0}))}splitUrls(){this.urls=this.assets.map(function(t){return t.href}.bind(this)),this.cssUrls=this.css.map((function(t){return t.href}))}createUrl(t){var e=new o.a(t),i=C.lookup(e.filename);return this.settings.archive?this.settings.archive.createUrl(t,{base64:"base64"===this.settings.replacements}):"base64"===this.settings.replacements?this.settings.request(t,"blob").then(t=>Object(s.blob2base64)(t)).then(t=>Object(s.createBase64Url)(t,i)):this.settings.request(t,"blob").then(t=>Object(s.createBlobUrl)(t,i))}replacements(){if("none"===this.settings.replacements)return new Promise(function(t){t(this.urls)}.bind(this));var t=this.urls.map(t=>{var e=this.settings.resolver(t);return this.createUrl(e).catch(t=>(console.error(t),null))});return Promise.all(t).then(t=>(this.replacementUrls=t.filter(t=>"string"==typeof t),t))}replaceCss(t,e){var i=[];return t=t||this.settings.archive,e=e||this.settings.resolver,this.cssUrls.forEach(function(n){var r=this.createCssFile(n,t,e).then(function(t){var e=this.urls.indexOf(n);e>-1&&(this.replacementUrls[e]=t)}.bind(this));i.push(r)}.bind(this)),Promise.all(i)}createCssFile(t){if(w.a.isAbsolute(t))return new Promise((function(t){t()}));var e,i=this.settings.resolver(t);e=this.settings.archive?this.settings.archive.getText(i):this.settings.request(i,"text");var n=this.urls.map(t=>{var e=this.settings.resolver(t);return new a.a(i).relative(e)});return e?e.then(t=>(t=Object(c.e)(t,n,this.replacementUrls),"base64"===this.settings.replacements?Object(s.createBase64Url)(t,"text/css"):Object(s.createBlobUrl)(t,"text/css")),t=>new Promise((function(t){t()}))):new Promise((function(t){t()}))}relativeTo(t,e){return e=e||this.settings.resolver,this.urls.map(function(i){var n=e(i);return new a.a(t).relative(n)}.bind(this))}get(t){var e=this.urls.indexOf(t);if(-1!==e)return this.replacementUrls.length?new Promise(function(t,i){t(this.replacementUrls[e])}.bind(this)):this.createUrl(t)}substitute(t,e){var i;return i=e?this.relativeTo(e):this.urls,Object(c.e)(t,i,this.replacementUrls)}destroy(){this.settings=void 0,this.manifest=void 0,this.resources=void 0,this.replacementUrls=void 0,this.html=void 0,this.assets=void 0,this.css=void 0,this.urls=void 0,this.cssUrls=void 0}};var k=class{constructor(t){this.pages=[],this.locations=[],this.epubcfi=new h.a,this.firstPage=0,this.lastPage=0,this.totalPages=0,this.toc=void 0,this.ncx=void 0,t&&(this.pageList=this.parse(t)),this.pageList&&this.pageList.length&&this.process(this.pageList)}parse(t){var e=Object(s.qs)(t,"html"),i=Object(s.qs)(t,"ncx");return e?this.parseNav(t):i?this.parseNcx(t):void 0}parseNav(t){var e,i,n=Object(s.querySelectorByType)(t,"nav","page-list"),r=n?Object(s.qsa)(n,"li"):[],o=r.length,a=[];if(!r||0===o)return a;for(e=0;e<o;++e)i=this.item(r[e]),a.push(i);return a}parseNcx(t){var e,i,n,r,o=[],a=0;if(!(i=Object(s.qs)(t,"pageList")))return o;if(r=(n=Object(s.qsa)(i,"pageTarget")).length,!n||0===n.length)return o;for(a=0;a<r;++a)e=this.ncxItem(n[a]),o.push(e);return o}ncxItem(t){var e=Object(s.qs)(t,"navLabel"),i=Object(s.qs)(e,"text").textContent;return{href:Object(s.qs)(t,"content").getAttribute("src"),page:parseInt(i,10)}}item(t){var e,i,n=Object(s.qs)(t,"a"),r=n.getAttribute("href")||"",o=n.textContent||"",a=parseInt(o);return-1!=r.indexOf("epubcfi")?(i=(e=r.split("#"))[0],{cfi:e.length>1&&e[1],href:r,packageUrl:i,page:a}):{href:r,page:a}}process(t){t.forEach((function(t){this.pages.push(t.page),t.cfi&&this.locations.push(t.cfi)}),this),this.firstPage=parseInt(this.pages[0]),this.lastPage=parseInt(this.pages[this.pages.length-1]),this.totalPages=this.lastPage-this.firstPage}pageFromCfi(t){var e=-1;if(0===this.locations.length)return-1;var i=Object(s.indexOfSorted)(t,this.locations,this.epubcfi.compare);return-1!=i?e=this.pages[i]:void 0!==(e=(i=Object(s.locationOf)(t,this.locations,this.epubcfi.compare))-1>=0?this.pages[i-1]:this.pages[0])||(e=-1),e}cfiFromPage(t){var e=-1;"number"!=typeof t&&(t=parseInt(t));var i=this.pages.indexOf(t);return-1!=i&&(e=this.locations[i]),e}pageFromPercentage(t){return Math.round(this.totalPages*t)}percentageFromPage(t){var e=(t-this.firstPage)/this.totalPages;return Math.round(1e3*e)/1e3}percentageFromCfi(t){var e=this.pageFromCfi(t);return this.percentageFromPage(e)}destroy(){this.pages=void 0,this.locations=void 0,this.epubcfi=void 0,this.pageList=void 0,this.toc=void 0,this.ncx=void 0}},R=i(39),L=i(85),I=i.n(L);var j=class{constructor(){this.zip=void 0,this.urlCache={},this.checkRequirements()}checkRequirements(){try{this.zip=new I.a}catch(t){throw new Error("JSZip lib not loaded")}}open(t,e){return this.zip.loadAsync(t,{base64:e})}openUrl(t,e){return u(t,"binary").then(function(t){return this.zip.loadAsync(t,{base64:e})}.bind(this))}request(t,e){var i,n=new s.defer,r=new a.a(t);return e||(e=r.extension),(i="blob"==e?this.getBlob(t):this.getText(t))?i.then(function(t){let i=this.handleResponse(t,e);n.resolve(i)}.bind(this)):n.reject({message:"File not found in the epub: "+t,stack:(new Error).stack}),n.promise}handleResponse(t,e){return"json"==e?JSON.parse(t):Object(s.isXml)(e)?Object(s.parse)(t,"text/xml"):"xhtml"==e?Object(s.parse)(t,"application/xhtml+xml"):"html"==e||"htm"==e?Object(s.parse)(t,"text/html"):t}getBlob(t,e){var i=window.decodeURIComponent(t.substr(1)),n=this.zip.file(i);if(n)return e=e||C.lookup(n.name),n.async("uint8array").then((function(t){return new Blob([t],{type:e})}))}getText(t,e){var i=window.decodeURIComponent(t.substr(1)),n=this.zip.file(i);if(n)return n.async("string").then((function(t){return t}))}getBase64(t,e){var i=window.decodeURIComponent(t.substr(1)),n=this.zip.file(i);if(n)return e=e||C.lookup(n.name),n.async("base64").then((function(t){return"data:"+e+";base64,"+t}))}createUrl(t,e){var i,n,r=new s.defer,o=window.URL||window.webkitURL||window.mozURL,a=e&&e.base64;return t in this.urlCache?(r.resolve(this.urlCache[t]),r.promise):(a?(n=this.getBase64(t))&&n.then(function(e){this.urlCache[t]=e,r.resolve(e)}.bind(this)):(n=this.getBlob(t))&&n.then(function(e){i=o.createObjectURL(e),this.urlCache[t]=i,r.resolve(i)}.bind(this)),n||r.reject({message:"File not found in the epub: "+t,stack:(new Error).stack}),r.promise)}revokeUrl(t){var e=window.URL||window.webkitURL||window.mozURL,i=this.urlCache[t];i&&e.revokeObjectURL(i)}destroy(){var t=window.URL||window.webkitURL||window.mozURL;for(let e in this.urlCache)t.revokeObjectURL(e);this.zip=void 0,this.urlCache={}}},N=i(57),A=i.n(N);class P{constructor(t,e,i){this.urlCache={},this.storage=void 0,this.name=t,this.requester=e||u,this.resolver=i,this.online=!0,this.checkRequirements(),this.addListeners()}checkRequirements(){try{let t;void 0===A.a&&(t=A.a),this.storage=t.createInstance({name:this.name})}catch(t){throw new Error("localForage lib not loaded")}}addListeners(){this._status=this.status.bind(this),window.addEventListener("online",this._status),window.addEventListener("offline",this._status)}removeListeners(){window.removeEventListener("online",this._status),window.removeEventListener("offline",this._status),this._status=void 0}status(t){let e=navigator.onLine;this.online=e,e?this.emit("online",this):this.emit("offline",this)}add(t,e){let i=t.resources.map(t=>{let{href:i}=t,n=this.resolver(i),r=window.encodeURIComponent(n);return this.storage.getItem(r).then(t=>!t||e?this.requester(n,"binary").then(t=>this.storage.setItem(r,t)):t)});return Promise.all(i)}put(t,e,i){let n=window.encodeURIComponent(t);return this.storage.getItem(n).then(r=>r||this.requester(t,"binary",e,i).then(t=>this.storage.setItem(n,t)))}request(t,e,i,n){return this.online?this.requester(t,e,i,n).then(e=>(this.put(t),e)):this.retrieve(t,e)}retrieve(t,e){new s.defer;var i=new a.a(t);return e||(e=i.extension),("blob"==e?this.getBlob(t):this.getText(t)).then(i=>{var n,r=new s.defer;return i?(n=this.handleResponse(i,e),r.resolve(n)):r.reject({message:"File not found in storage: "+t,stack:(new Error).stack}),r.promise})}handleResponse(t,e){return"json"==e?JSON.parse(t):Object(s.isXml)(e)?Object(s.parse)(t,"text/xml"):"xhtml"==e?Object(s.parse)(t,"application/xhtml+xml"):"html"==e||"htm"==e?Object(s.parse)(t,"text/html"):t}getBlob(t,e){let i=window.encodeURIComponent(t);return this.storage.getItem(i).then((function(i){if(i)return e=e||C.lookup(t),new Blob([i],{type:e})}))}getText(t,e){let i=window.encodeURIComponent(t);return e=e||C.lookup(t),this.storage.getItem(i).then((function(t){var i,n=new s.defer,r=new FileReader;if(t)return i=new Blob([t],{type:e}),r.addEventListener("loadend",()=>{n.resolve(r.result)}),r.readAsText(i,e),n.promise}))}getBase64(t,e){let i=window.encodeURIComponent(t);return e=e||C.lookup(t),this.storage.getItem(i).then(t=>{var i,n=new s.defer,r=new FileReader;if(t)return i=new Blob([t],{type:e}),r.addEventListener("loadend",()=>{n.resolve(r.result)}),r.readAsDataURL(i,e),n.promise})}createUrl(t,e){var i,n,r=new s.defer,o=window.URL||window.webkitURL||window.mozURL,a=e&&e.base64;return t in this.urlCache?(r.resolve(this.urlCache[t]),r.promise):(a?(n=this.getBase64(t))&&n.then(function(e){this.urlCache[t]=e,r.resolve(e)}.bind(this)):(n=this.getBlob(t))&&n.then(function(e){i=o.createObjectURL(e),this.urlCache[t]=i,r.resolve(i)}.bind(this)),n||r.reject({message:"File not found in storage: "+t,stack:(new Error).stack}),r.promise)}revokeUrl(t){var e=window.URL||window.webkitURL||window.mozURL,i=this.urlCache[t];i&&e.revokeObjectURL(i)}destroy(){var t=window.URL||window.webkitURL||window.mozURL;for(let e in this.urlCache)t.revokeObjectURL(e);this.urlCache={},this.removeListeners()}}r()(P.prototype);var D=P;var z=class{constructor(t){this.interactive="",this.fixedLayout="",this.openToSpread="",this.orientationLock="",t&&this.parse(t)}parse(t){if(!t)return this;const e=Object(s.qs)(t,"display_options");if(!e)return this;return Object(s.qsa)(e,"option").forEach(t=>{let e="";switch(t.childNodes.length&&(e=t.childNodes[0].nodeValue),t.attributes.name.value){case"interactive":this.interactive=e;break;case"fixed-layout":this.fixedLayout=e;break;case"open-to-spread":this.openToSpread=e;break;case"orientation-lock":this.orientationLock=e}}),this}destroy(){this.interactive=void 0,this.fixedLayout=void 0,this.openToSpread=void 0,this.orientationLock=void 0}};const B="binary",q="base64",M="epub",U="opf",F="json",W="directory";class H{constructor(t,e){void 0===e&&"string"!=typeof t&&t instanceof Blob==!1&&t instanceof ArrayBuffer==!1&&(e=t,t=void 0),this.settings=Object(s.extend)(this.settings||{},{requestMethod:void 0,requestCredentials:void 0,requestHeaders:void 0,encoding:void 0,replacements:void 0,canonical:void 0,openAs:void 0,store:void 0}),Object(s.extend)(this.settings,e),this.opening=new s.defer,this.opened=this.opening.promise,this.isOpen=!1,this.loading={manifest:new s.defer,spine:new s.defer,metadata:new s.defer,cover:new s.defer,navigation:new s.defer,pageList:new s.defer,resources:new s.defer,displayOptions:new s.defer},this.loaded={manifest:this.loading.manifest.promise,spine:this.loading.spine.promise,metadata:this.loading.metadata.promise,cover:this.loading.cover.promise,navigation:this.loading.navigation.promise,pageList:this.loading.pageList.promise,resources:this.loading.resources.promise,displayOptions:this.loading.displayOptions.promise},this.ready=Promise.all([this.loaded.manifest,this.loaded.spine,this.loaded.metadata,this.loaded.cover,this.loaded.navigation,this.loaded.resources,this.loaded.displayOptions]),this.isRendered=!1,this.request=this.settings.requestMethod||u,this.spine=new p,this.locations=new y(this.spine,this.load.bind(this)),this.navigation=void 0,this.pageList=void 0,this.url=void 0,this.path=void 0,this.archived=!1,this.archive=void 0,this.storage=void 0,this.resources=void 0,this.rendition=void 0,this.container=void 0,this.packaging=void 0,this.displayOptions=void 0,this.settings.store&&this.store(this.settings.store),t&&this.open(t,this.settings.openAs).catch(e=>{var i=new Error("Cannot load book at "+t);this.emit(v.c.BOOK.OPEN_FAILED,i)})}open(t,e){var i,n=e||this.determineType(t);return n===B?(this.archived=!0,this.url=new o.a("/",""),i=this.openEpub(t)):n===q?(this.archived=!0,this.url=new o.a("/",""),i=this.openEpub(t,n)):n===M?(this.archived=!0,this.url=new o.a("/",""),i=this.request(t,"binary",this.settings.requestCredentials,this.settings.requestHeaders).then(this.openEpub.bind(this))):n==U?(this.url=new o.a(t),i=this.openPackaging(this.url.Path.toString())):n==F?(this.url=new o.a(t),i=this.openManifest(this.url.Path.toString())):(this.url=new o.a(t),i=this.openContainer("META-INF/container.xml").then(this.openPackaging.bind(this))),i}openEpub(t,e){return this.unarchive(t,e||this.settings.encoding).then(()=>this.openContainer("META-INF/container.xml")).then(t=>this.openPackaging(t))}openContainer(t){return this.load(t).then(t=>(this.container=new x(t),this.resolve(this.container.packagePath)))}openPackaging(t){return this.path=new a.a(t),this.load(t).then(t=>(this.packaging=new E(t),this.unpack(this.packaging)))}openManifest(t){return this.path=new a.a(t),this.load(t).then(t=>(this.packaging=new E,this.packaging.load(t),this.unpack(this.packaging)))}load(t){var e=this.resolve(t);return this.archived?this.archive.request(e):this.request(e,null,this.settings.requestCredentials,this.settings.requestHeaders)}resolve(t,e){if(t){var i=t;return t.indexOf("://")>-1?t:(this.path&&(i=this.path.resolve(t)),0!=e&&this.url&&(i=this.url.resolve(i)),i)}}canonical(t){return t?this.settings.canonical?this.settings.canonical(t):this.resolve(t,!0):""}determineType(t){var e;return"base64"===this.settings.encoding?q:"string"!=typeof t?B:((e=new o.a(t).path().extension)&&(e=e.replace(/\?.*$/,"")),e?"epub"===e?M:"opf"===e?U:"json"===e?F:void 0:W)}unpack(t){this.package=t,""===this.packaging.metadata.layout?this.load(this.url.resolve("META-INF/com.apple.ibooks.display-options.xml")).then(t=>{this.displayOptions=new z(t),this.loading.displayOptions.resolve(this.displayOptions)}).catch(t=>{this.displayOptions=new z,this.loading.displayOptions.resolve(this.displayOptions)}):(this.displayOptions=new z,this.loading.displayOptions.resolve(this.displayOptions)),this.spine.unpack(this.packaging,this.resolve.bind(this),this.canonical.bind(this)),this.resources=new T(this.packaging.manifest,{archive:this.archive,resolver:this.resolve.bind(this),request:this.request.bind(this),replacements:this.settings.replacements||(this.archived?"blobUrl":"base64")}),this.loadNavigation(this.packaging).then(()=>{this.loading.navigation.resolve(this.navigation)}),this.packaging.coverPath&&(this.cover=this.resolve(this.packaging.coverPath)),this.loading.manifest.resolve(this.packaging.manifest),this.loading.metadata.resolve(this.packaging.metadata),this.loading.spine.resolve(this.spine),this.loading.cover.resolve(this.cover),this.loading.resources.resolve(this.resources),this.loading.pageList.resolve(this.pageList),this.isOpen=!0,this.archived||this.settings.replacements&&"none"!=this.settings.replacements?this.replacements().then(()=>{this.loaded.displayOptions.then(()=>{this.opening.resolve(this)})}).catch(t=>{console.error(t)}):this.loaded.displayOptions.then(()=>{this.opening.resolve(this)})}loadNavigation(t){let e=t.navPath||t.ncxPath,i=t.toc;return i?new Promise((e,n)=>{this.navigation=new S(i),t.pageList&&(this.pageList=new k(t.pageList)),e(this.navigation)}):e?this.load(e,"xml").then(t=>(this.navigation=new S(t),this.pageList=new k(t),this.navigation)):new Promise((t,e)=>{this.navigation=new S,this.pageList=new k,t(this.navigation)})}section(t){return this.spine.get(t)}renderTo(t,e){return this.rendition=new R.a(this,e),this.rendition.attachTo(t),this.rendition}setRequestCredentials(t){this.settings.requestCredentials=t}setRequestHeaders(t){this.settings.requestHeaders=t}unarchive(t,e){return this.archive=new j,this.archive.open(t,e)}store(t){let e=this.settings.replacements&&"none"!==this.settings.replacements,i=this.url,n=this.settings.requestMethod||u.bind(this);return this.storage=new D(t,n,this.resolve.bind(this)),this.request=this.storage.request.bind(this.storage),this.opened.then(()=>{this.archived&&(this.storage.requester=this.archive.request.bind(this.archive));let t=(t,e)=>{e.output=this.resources.substitute(t,e.url)};this.resources.settings.replacements=e||"blobUrl",this.resources.replacements().then(()=>this.resources.replaceCss()),this.storage.on("offline",()=>{this.url=new o.a("/",""),this.spine.hooks.serialize.register(t)}),this.storage.on("online",()=>{this.url=i,this.spine.hooks.serialize.deregister(t)})}),this.storage}coverUrl(){return this.loaded.cover.then(()=>this.cover?this.archived?this.archive.createUrl(this.cover):this.cover:null)}replacements(){return this.spine.hooks.serialize.register((t,e)=>{e.output=this.resources.substitute(t,e.url)}),this.resources.replacements().then(()=>this.resources.replaceCss())}getRange(t){var e=new h.a(t),i=this.spine.get(e.spinePos),n=this.load.bind(this);return i?i.load(n).then((function(t){return e.toRange(i.document)})):new Promise((t,e)=>{e("CFI could not be found")})}key(t){var e=t||this.packaging.metadata.identifier||this.url.filename;return`epubjs:${v.b}:${e}`}destroy(){this.opened=void 0,this.loading=void 0,this.loaded=void 0,this.ready=void 0,this.isOpen=!1,this.isRendered=!1,this.spine&&this.spine.destroy(),this.locations&&this.locations.destroy(),this.pageList&&this.pageList.destroy(),this.archive&&this.archive.destroy(),this.resources&&this.resources.destroy(),this.container&&this.container.destroy(),this.packaging&&this.packaging.destroy(),this.rendition&&this.rendition.destroy(),this.displayOptions&&this.displayOptions.destroy(),this.spine=void 0,this.locations=void 0,this.pageList=void 0,this.archive=void 0,this.resources=void 0,this.container=void 0,this.packaging=void 0,this.rendition=void 0,this.navigation=void 0,this.url=void 0,this.path=void 0,this.archived=!1}}r()(H.prototype);e.a=H},function(t,e,i){var n=i(16),r=i(60),s=i(25),o=i(32),a=i(41),h=i(10),l=i(62),c=Object.getOwnPropertyDescriptor;e.f=n?c:function(t,e){if(t=o(t),e=a(e,!0),l)try{return c(t,e)}catch(t){}if(h(t,e))return s(!r.f.call(t,e),t[e])}},function(t,e,i){"use strict";var n={}.propertyIsEnumerable,r=Object.getOwnPropertyDescriptor,s=r&&!n.call({1:2},1);e.f=s?function(t){var e=r(this,t);return!!e&&e.enumerable}:n},function(t,e,i){var n=i(12),r=i(40),s="".split;t.exports=n((function(){return!Object("z").propertyIsEnumerable(0)}))?function(t){return"String"==r(t)?s.call(t,""):Object(t)}:Object},function(t,e,i){var n=i(16),r=i(12),s=i(63);t.exports=!n&&!r((function(){return 7!=Object.defineProperty(s("div"),"a",{get:function(){return 7}}).a}))},function(t,e,i){var n=i(7),r=i(17),s=n.document,o=r(s)&&r(s.createElement);t.exports=function(t){return o?s.createElement(t):{}}},function(t,e,i){var n=i(65),r=Function.toString;"function"!=typeof n.inspectSource&&(n.inspectSource=function(t){return r.call(t)}),t.exports=n.inspectSource},function(t,e,i){var n=i(7),r=i(42),s=n["__core-js_shared__"]||r("__core-js_shared__",{});t.exports=s},function(t,e,i){var n=i(34),r=i(65);(t.exports=function(t,e){return r[t]||(r[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.6.5",mode:n?"pure":"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})},function(t,e){var i=0,n=Math.random();t.exports=function(t){return"Symbol("+String(void 0===t?"":t)+")_"+(++i+n).toString(36)}},function(t,e,i){var n=i(10),r=i(32),s=i(94).indexOf,o=i(44);t.exports=function(t,e){var i,a=r(t),h=0,l=[];for(i in a)!n(o,i)&&n(a,i)&&l.push(i);for(;e.length>h;)n(a,i=e[h++])&&(~s(l,i)||l.push(i));return l}},function(t,e){e.f=Object.getOwnPropertySymbols},function(t,e,i){var n=i(12);t.exports=!!Object.getOwnPropertySymbols&&!n((function(){return!String(Symbol())}))},function(t,e,i){"use strict";var n=i(32),r=i(103),s=i(27),o=i(26),a=i(74),h=o.set,l=o.getterFor("Array Iterator");t.exports=a(Array,"Array",(function(t,e){h(this,{type:"Array Iterator",target:n(t),index:0,kind:e})}),(function(){var t=l(this),e=t.target,i=t.kind,n=t.index++;return!e||n>=e.length?(t.target=void 0,{value:void 0,done:!0}):"keys"==i?{value:n,done:!1}:"values"==i?{value:e[n],done:!1}:{value:[n,e[n]],done:!1}}),"values"),s.Arguments=s.Array,r("keys"),r("values"),r("entries")},function(t,e,i){var n=i(16),r=i(18),s=i(13),o=i(73);t.exports=n?Object.defineProperties:function(t,e){s(t);for(var i,n=o(e),a=n.length,h=0;a>h;)r.f(t,i=n[h++],e[i]);return t}},function(t,e,i){var n=i(68),r=i(47);t.exports=Object.keys||function(t){return n(t,r)}},function(t,e,i){"use strict";var n=i(31),r=i(75),s=i(77),o=i(106),a=i(37),h=i(15),l=i(19),c=i(8),u=i(34),d=i(27),f=i(76),p=f.IteratorPrototype,g=f.BUGGY_SAFARI_ITERATORS,v=c("iterator"),m=function(){return this};t.exports=function(t,e,i,c,f,y,b){r(i,e,c);var w,x,E,S=function(t){if(t===f&&k)return k;if(!g&&t in C)return C[t];switch(t){case"keys":case"values":case"entries":return function(){return new i(this,t)}}return function(){return new i(this)}},_=e+" Iterator",O=!1,C=t.prototype,T=C[v]||C["@@iterator"]||f&&C[f],k=!g&&T||S(f),R="Array"==e&&C.entries||T;if(R&&(w=s(R.call(new t)),p!==Object.prototype&&w.next&&(u||s(w)===p||(o?o(w,p):"function"!=typeof w[v]&&h(w,v,m)),a(w,_,!0,!0),u&&(d[_]=m))),"values"==f&&T&&"values"!==T.name&&(O=!0,k=function(){return T.call(this)}),u&&!b||C[v]===k||h(C,v,k),d[e]=k,f)if(x={values:S("values"),keys:y?k:S("keys"),entries:S("entries")},b)for(E in x)(g||O||!(E in C))&&l(C,E,x[E]);else n({target:e,proto:!0,forced:g||O},x);return x}},function(t,e,i){"use strict";var n=i(76).IteratorPrototype,r=i(50),s=i(25),o=i(37),a=i(27),h=function(){return this};t.exports=function(t,e,i){var l=e+" Iterator";return t.prototype=r(n,{next:s(1,i)}),o(t,l,!1,!0),a[l]=h,t}},function(t,e,i){"use strict";var n,r,s,o=i(77),a=i(15),h=i(10),l=i(8),c=i(34),u=l("iterator"),d=!1;[].keys&&("next"in(s=[].keys())?(r=o(o(s)))!==Object.prototype&&(n=r):d=!0),null==n&&(n={}),c||h(n,u)||a(n,u,(function(){return this})),t.exports={IteratorPrototype:n,BUGGY_SAFARI_ITERATORS:d}},function(t,e,i){var n=i(10),r=i(36),s=i(43),o=i(105),a=s("IE_PROTO"),h=Object.prototype;t.exports=o?Object.getPrototypeOf:function(t){return t=r(t),n(t,a)?t[a]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?h:null}},function(t,e,i){var n=i(12),r=i(8),s=i(34),o=r("iterator");t.exports=!n((function(){var t=new URL("b?a=1&b=2&c=3","http://a"),e=t.searchParams,i="";return t.pathname="c%20d",e.forEach((function(t,n){e.delete("b"),i+=n+t})),s&&!t.toJSON||!e.sort||"http://a/c%20d?a=1&c=3"!==t.href||"3"!==e.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!e[o]||"a"!==new URL("https://a@b").username||"b"!==new URLSearchParams(new URLSearchParams("a=b")).get("a")||"xn--e1aybc"!==new URL("http://тест").host||"#%D0%B1"!==new URL("http://a#б").hash||"a1c3"!==i||"x"!==new URL("http://x",void 0).host}))},function(t,e){t.exports=function(t,e,i){if(!(t instanceof e))throw TypeError("Incorrect "+(i?i+" ":"")+"invocation");return t}},function(t,e,i){var n=i(126);t.exports=function(t,e,i){if(n(t),void 0===e)return t;switch(i){case 0:return function(){return t.call(e)};case 1:return function(i){return t.call(e,i)};case 2:return function(i,n){return t.call(e,i,n)};case 3:return function(i,n,r){return t.call(e,i,n,r)}}return function(){return t.apply(e,arguments)}}},function(t,e,i){var n=i(130),r=i(40),s=i(8)("toStringTag"),o="Arguments"==r(function(){return arguments}());t.exports=n?r:function(t){var e,i,n;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(i=function(t,e){try{return t[e]}catch(t){}}(e=Object(t),s))?i:o?r(e):"Object"==(n=r(e))&&"function"==typeof e.callee?"Arguments":n}},function(t,e,i){var n=i(138),r="object"==typeof self&&self&&self.Object===Object&&self,s=n||r||Function("return this")();t.exports=s},function(t,e,i){var n=i(82).Symbol;t.exports=n},function(t,e,i){var n=i(55),r=i(53);t.exports=function(t,e,i){var s=!0,o=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return r(i)&&(s="leading"in i?!!i.leading:s,o="trailing"in i?!!i.trailing:o),n(t,e,{leading:s,maxWait:e,trailing:o})}},function(t,i){t.exports=e},function(t,e,i){"use strict";i.r(e),function(t){var n=i(58),r=i(39),s=i(2),o=i(28),a=i(0),h=i(1);i(54),i(22),i(56);function l(t,e){return new n.a(t,e)}l.VERSION=h.b,void 0!==t&&(t.EPUBJS_VERSION=h.b),l.Book=n.a,l.Rendition=r.a,l.Contents=o.a,l.CFI=s.a,l.utils=a,e.default=l}.call(this,i(30))},function(t,e,i){"use strict";i(88);var n=i(19),r=i(12),s=i(8),o=i(48),a=i(15),h=s("species"),l=!r((function(){var t=/./;return t.exec=function(){var t=[];return t.groups={a:"7"},t},"7"!=="".replace(t,"$<a>")})),c="$0"==="a".replace(/./,"$0"),u=s("replace"),d=!!/./[u]&&""===/./[u]("a","$0"),f=!r((function(){var t=/(?:)/,e=t.exec;t.exec=function(){return e.apply(this,arguments)};var i="ab".split(t);return 2!==i.length||"a"!==i[0]||"b"!==i[1]}));t.exports=function(t,e,i,u){var p=s(t),g=!r((function(){var e={};return e[p]=function(){return 7},7!=""[t](e)})),v=g&&!r((function(){var e=!1,i=/a/;return"split"===t&&((i={}).constructor={},i.constructor[h]=function(){return i},i.flags="",i[p]=/./[p]),i.exec=function(){return e=!0,null},i[p](""),!e}));if(!g||!v||"replace"===t&&(!l||!c||d)||"split"===t&&!f){var m=/./[p],y=i(p,""[t],(function(t,e,i,n,r){return e.exec===o?g&&!r?{done:!0,value:m.call(e,i,n)}:{done:!0,value:t.call(i,e,n)}:{done:!1}}),{REPLACE_KEEPS_$0:c,REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE:d}),b=y[0],w=y[1];n(String.prototype,t,b),n(RegExp.prototype,p,2==e?function(t,e){return w.call(t,this,e)}:function(t){return w.call(t,this)})}u&&a(RegExp.prototype[p],"sham",!0)}},function(t,e,i){"use strict";var n=i(31),r=i(48);n({target:"RegExp",proto:!0,forced:/./.exec!==r},{exec:r})},function(t,e,i){var n=i(7),r=i(64),s=n.WeakMap;t.exports="function"==typeof s&&/native code/.test(r(s))},function(t,e,i){var n=i(10),r=i(91),s=i(59),o=i(18);t.exports=function(t,e){for(var i=r(e),a=o.f,h=s.f,l=0;l<i.length;l++){var c=i[l];n(t,c)||a(t,c,h(e,c))}}},function(t,e,i){var n=i(45),r=i(93),s=i(69),o=i(13);t.exports=n("Reflect","ownKeys")||function(t){var e=r.f(o(t)),i=s.f;return i?e.concat(i(t)):e}},function(t,e,i){var n=i(7);t.exports=n},function(t,e,i){var n=i(68),r=i(47).concat("length","prototype");e.f=Object.getOwnPropertyNames||function(t){return n(t,r)}},function(t,e,i){var n=i(32),r=i(46),s=i(95),o=function(t){return function(e,i,o){var a,h=n(e),l=r(h.length),c=s(o,l);if(t&&i!=i){for(;l>c;)if((a=h[c++])!=a)return!0}else for(;l>c;c++)if((t||c in h)&&h[c]===i)return t||c||0;return!t&&-1}};t.exports={includes:o(!0),indexOf:o(!1)}},function(t,e,i){var n=i(35),r=Math.max,s=Math.min;t.exports=function(t,e){var i=n(t);return i<0?r(i+e,0):s(i,e)}},function(t,e,i){var n=i(12),r=/#|\.prototype\./,s=function(t,e){var i=a[o(t)];return i==l||i!=h&&("function"==typeof e?n(e):!!e)},o=s.normalize=function(t){return String(t).replace(r,".").toLowerCase()},a=s.data={},h=s.NATIVE="N",l=s.POLYFILL="P";t.exports=s},function(t,e,i){"use strict";var n=i(13);t.exports=function(){var t=n(this),e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),t.dotAll&&(e+="s"),t.unicode&&(e+="u"),t.sticky&&(e+="y"),e}},function(t,e,i){"use strict";var n=i(12);function r(t,e){return RegExp(t,e)}e.UNSUPPORTED_Y=n((function(){var t=r("a","y");return t.lastIndex=2,null!=t.exec("abcd")})),e.BROKEN_CARET=n((function(){var t=r("^r","gy");return t.lastIndex=2,null!=t.exec("str")}))},function(t,e,i){var n=i(70);t.exports=n&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},function(t,e,i){"use strict";var n=i(49).charAt;t.exports=function(t,e,i){return e+(i?n(t,e).length:1)}},function(t,e,i){var n=i(40),r=i(48);t.exports=function(t,e){var i=t.exec;if("function"==typeof i){var s=i.call(t,e);if("object"!=typeof s)throw TypeError("RegExp exec method returned something other than an Object or null");return s}if("RegExp"!==n(t))throw TypeError("RegExp#exec called on incompatible receiver");return r.call(t,e)}},function(t,e){t.exports={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}},function(t,e,i){var n=i(8),r=i(50),s=i(18),o=n("unscopables"),a=Array.prototype;null==a[o]&&s.f(a,o,{configurable:!0,value:r(null)}),t.exports=function(t){a[o][t]=!0}},function(t,e,i){var n=i(45);t.exports=n("document","documentElement")},function(t,e,i){var n=i(12);t.exports=!n((function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype}))},function(t,e,i){var n=i(13),r=i(107);t.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var t,e=!1,i={};try{(t=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set).call(i,[]),e=i instanceof Array}catch(t){}return function(i,s){return n(i),r(s),e?t.call(i,s):i.__proto__=s,i}}():void 0)},function(t,e,i){var n=i(17);t.exports=function(t){if(!n(t)&&null!==t)throw TypeError("Can't set "+String(t)+" as a prototype");return t}},function(t,e,i){"use strict";var n=i(109),r=i(117),s=i(118),o=i(119);(t.exports=function(t,e){var i,s,a,h,l;return arguments.length<2||"string"!=typeof t?(h=e,e=t,t=null):h=arguments[2],null==t?(i=a=!0,s=!1):(i=o.call(t,"c"),s=o.call(t,"e"),a=o.call(t,"w")),l={value:e,configurable:i,enumerable:s,writable:a},h?n(r(h),l):l}).gs=function(t,e,i){var a,h,l,c;return"string"!=typeof t?(l=i,i=e,e=t,t=null):l=arguments[3],null==e?e=void 0:s(e)?null==i?i=void 0:s(i)||(l=i,i=void 0):(l=e,e=i=void 0),null==t?(a=!0,h=!1):(a=o.call(t,"c"),h=o.call(t,"e")),c={get:e,set:i,configurable:a,enumerable:h},l?n(r(l),c):c}},function(t,e,i){"use strict";t.exports=i(110)()?Object.assign:i(111)},function(t,e,i){"use strict";t.exports=function(){var t,e=Object.assign;return"function"==typeof e&&(e(t={foo:"raz"},{bar:"dwa"},{trzy:"trzy"}),t.foo+t.bar+t.trzy==="razdwatrzy")}},function(t,e,i){"use strict";var n=i(112),r=i(116),s=Math.max;t.exports=function(t,e){var i,o,a,h=s(arguments.length,2);for(t=Object(r(t)),a=function(n){try{t[n]=e[n]}catch(t){i||(i=t)}},o=1;o<h;++o)n(e=arguments[o]).forEach(a);if(void 0!==i)throw i;return t}},function(t,e,i){"use strict";t.exports=i(113)()?Object.keys:i(114)},function(t,e,i){"use strict";t.exports=function(){try{return Object.keys("primitive"),!0}catch(t){return!1}}},function(t,e,i){"use strict";var n=i(51),r=Object.keys;t.exports=function(t){return r(n(t)?Object(t):t)}},function(t,e,i){"use strict";t.exports=function(){}},function(t,e,i){"use strict";var n=i(51);t.exports=function(t){if(!n(t))throw new TypeError("Cannot use null or undefined");return t}},function(t,e,i){"use strict";var n=i(51),r=Array.prototype.forEach,s=Object.create,o=function(t,e){var i;for(i in t)e[i]=t[i]};t.exports=function(t){var e=s(null);return r.call(arguments,(function(t){n(t)&&o(Object(t),e)})),e}},function(t,e,i){"use strict";t.exports=function(t){return"function"==typeof t}},function(t,e,i){"use strict";t.exports=i(120)()?String.prototype.contains:i(121)},function(t,e,i){"use strict";var n="razdwatrzy";t.exports=function(){return"function"==typeof n.contains&&(!0===n.contains("dwa")&&!1===n.contains("foo"))}},function(t,e,i){"use strict";var n=String.prototype.indexOf;t.exports=function(t){return n.call(this,t,arguments[1])>-1}},function(t,e,i){"use strict";t.exports=function(t){if("function"!=typeof t)throw new TypeError(t+" is not a function");return t}},function(t,e,i){"use strict";var n=i(49).charAt,r=i(26),s=i(74),o=r.set,a=r.getterFor("String Iterator");s(String,"String",(function(t){o(this,{type:"String Iterator",string:String(t),index:0})}),(function(){var t,e=a(this),i=e.string,r=e.index;return r>=i.length?{value:void 0,done:!0}:(t=n(i,r),e.index+=t.length,{value:t,done:!1})}))},function(t,e,i){"use strict";var n=i(16),r=i(12),s=i(73),o=i(69),a=i(60),h=i(36),l=i(61),c=Object.assign,u=Object.defineProperty;t.exports=!c||r((function(){if(n&&1!==c({b:1},c(u({},"a",{enumerable:!0,get:function(){u(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var t={},e={},i=Symbol();return t[i]=7,"abcdefghijklmnopqrst".split("").forEach((function(t){e[t]=t})),7!=c({},t)[i]||"abcdefghijklmnopqrst"!=s(c({},e)).join("")}))?function(t,e){for(var i=h(t),r=arguments.length,c=1,u=o.f,d=a.f;r>c;)for(var f,p=l(arguments[c++]),g=u?s(p).concat(u(p)):s(p),v=g.length,m=0;v>m;)f=g[m++],n&&!d.call(p,f)||(i[f]=p[f]);return i}:c},function(t,e,i){"use strict";var n=i(80),r=i(36),s=i(127),o=i(128),a=i(46),h=i(129),l=i(52);t.exports=function(t){var e,i,c,u,d,f,p=r(t),g="function"==typeof this?this:Array,v=arguments.length,m=v>1?arguments[1]:void 0,y=void 0!==m,b=l(p),w=0;if(y&&(m=n(m,v>2?arguments[2]:void 0,2)),null==b||g==Array&&o(b))for(i=new g(e=a(p.length));e>w;w++)f=y?m(p[w],w):p[w],h(i,w,f);else for(d=(u=b.call(p)).next,i=new g;!(c=d.call(u)).done;w++)f=y?s(u,m,[c.value,w],!0):c.value,h(i,w,f);return i.length=w,i}},function(t,e){t.exports=function(t){if("function"!=typeof t)throw TypeError(String(t)+" is not a function");return t}},function(t,e,i){var n=i(13);t.exports=function(t,e,i,r){try{return r?e(n(i)[0],i[1]):e(i)}catch(e){var s=t.return;throw void 0!==s&&n(s.call(t)),e}}},function(t,e,i){var n=i(8),r=i(27),s=n("iterator"),o=Array.prototype;t.exports=function(t){return void 0!==t&&(r.Array===t||o[s]===t)}},function(t,e,i){"use strict";var n=i(41),r=i(18),s=i(25);t.exports=function(t,e,i){var o=n(e);o in t?r.f(t,o,s(0,i)):t[o]=i}},function(t,e,i){var n={};n[i(8)("toStringTag")]="z",t.exports="[object z]"===String(n)},function(t,e,i){"use strict";var n=/[^\0-\u007E]/,r=/[.\u3002\uFF0E\uFF61]/g,s="Overflow: input needs wider integers to process",o=Math.floor,a=String.fromCharCode,h=function(t){return t+22+75*(t<26)},l=function(t,e,i){var n=0;for(t=i?o(t/700):t>>1,t+=o(t/e);t>455;n+=36)t=o(t/35);return o(n+36*t/(t+38))},c=function(t){var e,i,n=[],r=(t=function(t){for(var e=[],i=0,n=t.length;i<n;){var r=t.charCodeAt(i++);if(r>=55296&&r<=56319&&i<n){var s=t.charCodeAt(i++);56320==(64512&s)?e.push(((1023&r)<<10)+(1023&s)+65536):(e.push(r),i--)}else e.push(r)}return e}(t)).length,c=128,u=0,d=72;for(e=0;e<t.length;e++)(i=t[e])<128&&n.push(a(i));var f=n.length,p=f;for(f&&n.push("-");p<r;){var g=2147483647;for(e=0;e<t.length;e++)(i=t[e])>=c&&i<g&&(g=i);var v=p+1;if(g-c>o((2147483647-u)/v))throw RangeError(s);for(u+=(g-c)*v,c=g,e=0;e<t.length;e++){if((i=t[e])<c&&++u>2147483647)throw RangeError(s);if(i==c){for(var m=u,y=36;;y+=36){var b=y<=d?1:y>=d+26?26:y-d;if(m<b)break;var w=m-b,x=36-b;n.push(a(h(b+w%x))),m=o(w/x)}n.push(a(h(m))),d=l(u,v,p==f),u=0,++p}}++u,++c}return n.join("")};t.exports=function(t){var e,i,s=[],o=t.toLowerCase().replace(r,".").split(".");for(e=0;e<o.length;e++)i=o[e],s.push(n.test(i)?"xn--"+c(i):i);return s.join(".")}},function(t,e,i){"use strict";i(71);var n=i(31),r=i(45),s=i(78),o=i(19),a=i(133),h=i(37),l=i(75),c=i(26),u=i(79),d=i(10),f=i(80),p=i(81),g=i(13),v=i(17),m=i(50),y=i(25),b=i(134),w=i(52),x=i(8),E=r("fetch"),S=r("Headers"),_=x("iterator"),O=c.set,C=c.getterFor("URLSearchParams"),T=c.getterFor("URLSearchParamsIterator"),k=/\+/g,R=Array(4),L=function(t){return R[t-1]||(R[t-1]=RegExp("((?:%[\\da-f]{2}){"+t+"})","gi"))},I=function(t){try{return decodeURIComponent(t)}catch(e){return t}},j=function(t){var e=t.replace(k," "),i=4;try{return decodeURIComponent(e)}catch(t){for(;i;)e=e.replace(L(i--),I);return e}},N=/[!'()~]|%20/g,A={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},P=function(t){return A[t]},D=function(t){return encodeURIComponent(t).replace(N,P)},z=function(t,e){if(e)for(var i,n,r=e.split("&"),s=0;s<r.length;)(i=r[s++]).length&&(n=i.split("="),t.push({key:j(n.shift()),value:j(n.join("="))}))},B=function(t){this.entries.length=0,z(this.entries,t)},q=function(t,e){if(t<e)throw TypeError("Not enough arguments")},M=l((function(t,e){O(this,{type:"URLSearchParamsIterator",iterator:b(C(t).entries),kind:e})}),"Iterator",(function(){var t=T(this),e=t.kind,i=t.iterator.next(),n=i.value;return i.done||(i.value="keys"===e?n.key:"values"===e?n.value:[n.key,n.value]),i})),U=function(){u(this,U,"URLSearchParams");var t,e,i,n,r,s,o,a,h,l=arguments.length>0?arguments[0]:void 0,c=this,f=[];if(O(c,{type:"URLSearchParams",entries:f,updateURL:function(){},updateSearchParams:B}),void 0!==l)if(v(l))if("function"==typeof(t=w(l)))for(i=(e=t.call(l)).next;!(n=i.call(e)).done;){if((o=(s=(r=b(g(n.value))).next).call(r)).done||(a=s.call(r)).done||!s.call(r).done)throw TypeError("Expected sequence with length 2");f.push({key:o.value+"",value:a.value+""})}else for(h in l)d(l,h)&&f.push({key:h,value:l[h]+""});else z(f,"string"==typeof l?"?"===l.charAt(0)?l.slice(1):l:l+"")},F=U.prototype;a(F,{append:function(t,e){q(arguments.length,2);var i=C(this);i.entries.push({key:t+"",value:e+""}),i.updateURL()},delete:function(t){q(arguments.length,1);for(var e=C(this),i=e.entries,n=t+"",r=0;r<i.length;)i[r].key===n?i.splice(r,1):r++;e.updateURL()},get:function(t){q(arguments.length,1);for(var e=C(this).entries,i=t+"",n=0;n<e.length;n++)if(e[n].key===i)return e[n].value;return null},getAll:function(t){q(arguments.length,1);for(var e=C(this).entries,i=t+"",n=[],r=0;r<e.length;r++)e[r].key===i&&n.push(e[r].value);return n},has:function(t){q(arguments.length,1);for(var e=C(this).entries,i=t+"",n=0;n<e.length;)if(e[n++].key===i)return!0;return!1},set:function(t,e){q(arguments.length,1);for(var i,n=C(this),r=n.entries,s=!1,o=t+"",a=e+"",h=0;h<r.length;h++)(i=r[h]).key===o&&(s?r.splice(h--,1):(s=!0,i.value=a));s||r.push({key:o,value:a}),n.updateURL()},sort:function(){var t,e,i,n=C(this),r=n.entries,s=r.slice();for(r.length=0,i=0;i<s.length;i++){for(t=s[i],e=0;e<i;e++)if(r[e].key>t.key){r.splice(e,0,t);break}e===i&&r.push(t)}n.updateURL()},forEach:function(t){for(var e,i=C(this).entries,n=f(t,arguments.length>1?arguments[1]:void 0,3),r=0;r<i.length;)n((e=i[r++]).value,e.key,this)},keys:function(){return new M(this,"keys")},values:function(){return new M(this,"values")},entries:function(){return new M(this,"entries")}},{enumerable:!0}),o(F,_,F.entries),o(F,"toString",(function(){for(var t,e=C(this).entries,i=[],n=0;n<e.length;)t=e[n++],i.push(D(t.key)+"="+D(t.value));return i.join("&")}),{enumerable:!0}),h(U,"URLSearchParams"),n({global:!0,forced:!s},{URLSearchParams:U}),s||"function"!=typeof E||"function"!=typeof S||n({global:!0,enumerable:!0,forced:!0},{fetch:function(t){var e,i,n,r=[t];return arguments.length>1&&(v(e=arguments[1])&&(i=e.body,"URLSearchParams"===p(i)&&((n=e.headers?new S(e.headers):new S).has("content-type")||n.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"),e=m(e,{body:y(0,String(i)),headers:y(0,n)}))),r.push(e)),E.apply(this,r)}}),t.exports={URLSearchParams:U,getState:C}},function(t,e,i){var n=i(19);t.exports=function(t,e,i){for(var r in e)n(t,r,e[r],i);return t}},function(t,e,i){var n=i(13),r=i(52);t.exports=function(t){var e=r(t);if("function"!=typeof e)throw TypeError(String(t)+" is not iterable");return n(e.call(t))}},function(t,e,i){"use strict";function n(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}Object.defineProperty(e,"__esModule",{value:!0}),e.createElement=n,e.default={createElement:n}},function(t,e,i){"use strict";function n(t,e){function i(i){for(var n=e.length-1;n>=0;n--){var o=e[n],a=i.clientX,h=i.clientY;if(i.touches&&i.touches.length&&(a=i.touches[0].clientX,h=i.touches[0].clientY),s(o,t,a,h)){o.dispatchEvent(r(i));break}}}if("iframe"===t.nodeName||"IFRAME"===t.nodeName)try{this.target=t.contentDocument}catch(e){this.target=t}else this.target=t;for(var n=["mouseup","mousedown","click","touchstart"],o=0;o<n.length;o++){var a=n[o];this.target.addEventListener(a,(function(t){return i(t)}),!1)}}function r(t){var e=Object.assign({},t,{bubbles:!1});try{return new MouseEvent(t.type,e)}catch(n){var i=document.createEvent("MouseEvents");return i.initMouseEvent(t.type,!1,e.cancelable,e.view,e.detail,e.screenX,e.screenY,e.clientX,e.clientY,e.ctrlKey,e.altKey,e.shiftKey,e.metaKey,e.button,e.relatedTarget),i}}function s(t,e,i,n){var r=e.getBoundingClientRect();function s(t,e,i){var n=t.top-r.top,s=t.left-r.left,o=n+t.height,a=s+t.width;return n<=i&&s<=e&&o>i&&a>e}if(!s(t.getBoundingClientRect(),i,n))return!1;for(var o=t.getClientRects(),a=0,h=o.length;a<h;a++)if(s(o[a],i,n))return!0;return!1}Object.defineProperty(e,"__esModule",{value:!0}),e.proxyMouse=n,e.clone=r,e.default={proxyMouse:n}},function(t,e,i){var n=i(82);t.exports=function(){return n.Date.now()}},function(t,e,i){(function(e){var i="object"==typeof e&&e&&e.Object===Object&&e;t.exports=i}).call(this,i(30))},function(t,e,i){var n=i(53),r=i(140),s=/^\s+|\s+$/g,o=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,h=/^0o[0-7]+$/i,l=parseInt;t.exports=function(t){if("number"==typeof t)return t;if(r(t))return NaN;if(n(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=n(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(s,"");var i=a.test(t);return i||h.test(t)?l(t.slice(2),i?2:8):o.test(t)?NaN:+t}},function(t,e,i){var n=i(141),r=i(144);t.exports=function(t){return"symbol"==typeof t||r(t)&&"[object Symbol]"==n(t)}},function(t,e,i){var n=i(83),r=i(142),s=i(143),o=n?n.toStringTag:void 0;t.exports=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":o&&o in Object(t)?r(t):s(t)}},function(t,e,i){var n=i(83),r=Object.prototype,s=r.hasOwnProperty,o=r.toString,a=n?n.toStringTag:void 0;t.exports=function(t){var e=s.call(t,a),i=t[a];try{t[a]=void 0;var n=!0}catch(t){}var r=o.call(t);return n&&(e?t[a]=i:delete t[a]),r}},function(t,e){var i=Object.prototype.toString;t.exports=function(t){return i.call(t)}},function(t,e){t.exports=function(t){return null!=t&&"object"==typeof t}}]).default})); | ||
| 1 | \ No newline at end of file | \ No newline at end of file | |
| 1 | !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("JSZip")):"function"==typeof define&&define.amd?define(["JSZip"],e):"object"==typeof exports?exports.ePub=e(require("JSZip")):t.ePub=e(t.JSZip)}(window,(function(t){return function(t){var e={};function i(n){if(e[n])return e[n].exports;var s=e[n]={i:n,l:!1,exports:{}};return t[n].call(s.exports,s,s.exports,i),s.l=!0,s.exports}return i.m=t,i.c=e,i.d=function(t,e,n){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var s in t)i.d(n,s,function(e){return t[e]}.bind(null,s));return n},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="/dist/",i(i.s=30)}([function(t,e,i){"use strict";i.r(e),i.d(e,"requestAnimationFrame",(function(){return s})),i.d(e,"uuid",(function(){return o})),i.d(e,"documentHeight",(function(){return a})),i.d(e,"isElement",(function(){return h})),i.d(e,"isNumber",(function(){return l})),i.d(e,"isFloat",(function(){return c})),i.d(e,"prefixed",(function(){return u})),i.d(e,"defaults",(function(){return d})),i.d(e,"extend",(function(){return f})),i.d(e,"insert",(function(){return p})),i.d(e,"locationOf",(function(){return g})),i.d(e,"indexOfSorted",(function(){return m})),i.d(e,"bounds",(function(){return v})),i.d(e,"borders",(function(){return y})),i.d(e,"nodeBounds",(function(){return b})),i.d(e,"windowBounds",(function(){return w})),i.d(e,"indexOfNode",(function(){return x})),i.d(e,"indexOfTextNode",(function(){return E})),i.d(e,"indexOfElementNode",(function(){return S})),i.d(e,"isXml",(function(){return N})),i.d(e,"createBlob",(function(){return _})),i.d(e,"createBlobUrl",(function(){return T})),i.d(e,"revokeBlobUrl",(function(){return C})),i.d(e,"createBase64Url",(function(){return O})),i.d(e,"type",(function(){return I})),i.d(e,"parse",(function(){return R})),i.d(e,"qs",(function(){return k})),i.d(e,"qsa",(function(){return A})),i.d(e,"qsp",(function(){return L})),i.d(e,"sprint",(function(){return j})),i.d(e,"treeWalker",(function(){return D})),i.d(e,"walk",(function(){return P})),i.d(e,"blob2base64",(function(){return M})),i.d(e,"defer",(function(){return z})),i.d(e,"querySelectorByType",(function(){return B})),i.d(e,"findChildren",(function(){return q})),i.d(e,"parents",(function(){return F})),i.d(e,"filterChildren",(function(){return U})),i.d(e,"getParentByTagName",(function(){return W})),i.d(e,"RangeObject",(function(){return H}));var n=i(15);const s="undefined"!=typeof window&&(window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame),r="undefined"!=typeof URL?URL:"undefined"!=typeof window?window.URL||window.webkitURL||window.mozURL:void 0;function o(){var t=(new Date).getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var i=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"==e?i:7&i|8).toString(16)}))}function a(){return Math.max(document.documentElement.clientHeight,document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight)}function h(t){return!(!t||1!=t.nodeType)}function l(t){return!isNaN(parseFloat(t))&&isFinite(t)}function c(t){let e=parseFloat(t);return!1!==l(t)&&("string"==typeof t&&t.indexOf(".")>-1||Math.floor(e)!==e)}function u(t){var e=["-webkit-","-webkit-","-moz-","-o-","-ms-"],i=t.toLowerCase(),n=["Webkit","webkit","Moz","O","ms"].length;if("undefined"==typeof document||void 0!==document.body.style[i])return t;for(var s=0;s<n;s++)if(void 0!==document.body.style[e[s]+i])return e[s]+i;return t}function d(t){for(var e=1,i=arguments.length;e<i;e++){var n=arguments[e];for(var s in n)void 0===t[s]&&(t[s]=n[s])}return t}function f(t){var e=[].slice.call(arguments,1);return e.forEach((function(e){e&&Object.getOwnPropertyNames(e).forEach((function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(e,i))}))})),t}function p(t,e,i){var n=g(t,e,i);return e.splice(n,0,t),n}function g(t,e,i,n,s){var r,o=n||0,a=s||e.length,h=parseInt(o+(a-o)/2);return i||(i=function(t,e){return t>e?1:t<e?-1:t==e?0:void 0}),a-o<=0?h:(r=i(e[h],t),a-o==1?r>=0?h:h+1:0===r?h:-1===r?g(t,e,i,h,a):g(t,e,i,o,h))}function m(t,e,i,n,s){var r,o=n||0,a=s||e.length,h=parseInt(o+(a-o)/2);return i||(i=function(t,e){return t>e?1:t<e?-1:t==e?0:void 0}),a-o<=0?-1:(r=i(e[h],t),a-o==1?0===r?h:-1:0===r?h:-1===r?m(t,e,i,h,a):m(t,e,i,o,h))}function v(t){var e=window.getComputedStyle(t),i=0,n=0;return["width","paddingRight","paddingLeft","marginRight","marginLeft","borderRightWidth","borderLeftWidth"].forEach((function(t){i+=parseFloat(e[t])||0})),["height","paddingTop","paddingBottom","marginTop","marginBottom","borderTopWidth","borderBottomWidth"].forEach((function(t){n+=parseFloat(e[t])||0})),{height:n,width:i}}function y(t){var e=window.getComputedStyle(t),i=0,n=0;return["paddingRight","paddingLeft","marginRight","marginLeft","borderRightWidth","borderLeftWidth"].forEach((function(t){i+=parseFloat(e[t])||0})),["paddingTop","paddingBottom","marginTop","marginBottom","borderTopWidth","borderBottomWidth"].forEach((function(t){n+=parseFloat(e[t])||0})),{height:n,width:i}}function b(t){let e,i=t.ownerDocument;if(t.nodeType==Node.TEXT_NODE){let n=i.createRange();n.selectNodeContents(t),e=n.getBoundingClientRect()}else e=t.getBoundingClientRect();return e}function w(){var t=window.innerWidth,e=window.innerHeight;return{top:0,left:0,right:t,bottom:e,width:t,height:e}}function x(t,e){for(var i,n=t.parentNode.childNodes,s=-1,r=0;r<n.length&&((i=n[r]).nodeType===e&&s++,i!=t);r++);return s}function E(t){return x(t,3)}function S(t){return x(t,1)}function N(t){return["xml","opf","ncx"].indexOf(t)>-1}function _(t,e){return new Blob([t],{type:e})}function T(t,e){var i=_(t,e);return r.createObjectURL(i)}function C(t){return r.revokeObjectURL(t)}function O(t,e){if("string"==typeof t)return"data:"+e+";base64,"+btoa(t)}function I(t){return Object.prototype.toString.call(t).slice(8,-1)}function R(t,e,i){var s;return s="undefined"==typeof DOMParser||i?n.DOMParser:DOMParser,65279===t.charCodeAt(0)&&(t=t.slice(1)),(new s).parseFromString(t,e)}function k(t,e){var i;if(!t)throw new Error("No Element Provided");return void 0!==t.querySelector?t.querySelector(e):(i=t.getElementsByTagName(e)).length?i[0]:void 0}function A(t,e){return void 0!==t.querySelector?t.querySelectorAll(e):t.getElementsByTagName(e)}function L(t,e,i){var n,s;if(void 0!==t.querySelector){for(var r in e+="[",i)e+=r+"~='"+i[r]+"'";return e+="]",t.querySelector(e)}if(n=t.getElementsByTagName(e),s=Array.prototype.slice.call(n,0).filter((function(t){for(var e in i)if(t.getAttribute(e)===i[e])return!0;return!1})))return s[0]}function j(t,e){void 0!==(t.ownerDocument||t).createTreeWalker?D(t,e,NodeFilter.SHOW_TEXT):P(t,(function(t){t&&3===t.nodeType&&e(t)}))}function D(t,e,i){var n=document.createTreeWalker(t,i,null,!1);let s;for(;s=n.nextNode();)e(s)}function P(t,e){if(e(t))return!0;if(t=t.firstChild)do{if(P(t,e))return!0;t=t.nextSibling}while(t)}function M(t){return new Promise((function(e,i){var n=new FileReader;n.readAsDataURL(t),n.onloadend=function(){e(n.result)}}))}function z(){this.resolve=null,this.reject=null,this.id=o(),this.promise=new Promise((t,e)=>{this.resolve=t,this.reject=e}),Object.freeze(this)}function B(t,e,i){var n;if(void 0!==t.querySelector&&(n=t.querySelector(`${e}[*|type="${i}"]`)),n&&0!==n.length)return n;n=A(t,e);for(var s=0;s<n.length;s++)if(n[s].getAttributeNS("http://www.idpf.org/2007/ops","type")===i||n[s].getAttribute("epub:type")===i)return n[s]}function q(t){for(var e=[],i=t.childNodes,n=0;n<i.length;n++){let t=i[n];1===t.nodeType&&e.push(t)}return e}function F(t){for(var e=[t];t;t=t.parentNode)e.unshift(t);return e}function U(t,e,i){for(var n=[],s=t.childNodes,r=0;r<s.length;r++){let t=s[r];if(1===t.nodeType&&t.nodeName.toLowerCase()===e){if(i)return t;n.push(t)}}if(!i)return n}function W(t,e){let i;if(null!==t&&""!==e)for(i=t.parentNode;1===i.nodeType;){if(i.tagName.toLowerCase()===e)return i;i=i.parentNode}}class H{constructor(){this.collapsed=!1,this.commonAncestorContainer=void 0,this.endContainer=void 0,this.endOffset=void 0,this.startContainer=void 0,this.startOffset=void 0}setStart(t,e){this.startContainer=t,this.startOffset=e,this.endContainer?this.commonAncestorContainer=this._commonAncestorContainer():this.collapse(!0),this._checkCollapsed()}setEnd(t,e){this.endContainer=t,this.endOffset=e,this.startContainer?(this.collapsed=!1,this.commonAncestorContainer=this._commonAncestorContainer()):this.collapse(!1),this._checkCollapsed()}collapse(t){this.collapsed=!0,t?(this.endContainer=this.startContainer,this.endOffset=this.startOffset,this.commonAncestorContainer=this.startContainer.parentNode):(this.startContainer=this.endContainer,this.startOffset=this.endOffset,this.commonAncestorContainer=this.endOffset.parentNode)}selectNode(t){let e=t.parentNode,i=Array.prototype.indexOf.call(e.childNodes,t);this.setStart(e,i),this.setEnd(e,i+1)}selectNodeContents(t){t.childNodes[t.childNodes-1];let e=3===t.nodeType?t.textContent.length:parent.childNodes.length;this.setStart(t,0),this.setEnd(t,e)}_commonAncestorContainer(t,e){var i=F(t||this.startContainer),n=F(e||this.endContainer);if(i[0]==n[0])for(var s=0;s<i.length;s++)if(i[s]!=n[s])return i[s-1]}_checkCollapsed(){this.startContainer===this.endContainer&&this.startOffset===this.endOffset?this.collapsed=!0:this.collapsed=!1}toString(){}}},function(t,e,i){"use strict";i.d(e,"b",(function(){return n})),i.d(e,"a",(function(){return s})),i.d(e,"c",(function(){return r}));const n="0.3",s=["keydown","keyup","keypressed","mouseup","mousedown","mousemove","click","touchend","touchstart","touchmove"],r={BOOK:{OPEN_FAILED:"openFailed"},CONTENTS:{EXPAND:"expand",RESIZE:"resize",SELECTED:"selected",SELECTED_RANGE:"selectedRange",LINK_CLICKED:"linkClicked"},LOCATIONS:{CHANGED:"changed"},MANAGERS:{RESIZE:"resize",RESIZED:"resized",ORIENTATION_CHANGE:"orientationchange",ADDED:"added",SCROLL:"scroll",SCROLLED:"scrolled",REMOVED:"removed"},VIEWS:{AXIS:"axis",WRITING_MODE:"writingMode",LOAD_ERROR:"loaderror",RENDERED:"rendered",RESIZED:"resized",DISPLAYED:"displayed",SHOWN:"shown",HIDDEN:"hidden",MARK_CLICKED:"markClicked"},RENDITION:{STARTED:"started",ATTACHED:"attached",DISPLAYED:"displayed",DISPLAY_ERROR:"displayerror",RENDERED:"rendered",REMOVED:"removed",RESIZED:"resized",ORIENTATION_CHANGE:"orientationchange",LOCATION_CHANGED:"locationChanged",RELOCATED:"relocated",MARK_CLICKED:"markClicked",SELECTED:"selected",LAYOUT:"layout"},LAYOUT:{UPDATED:"updated"},ANNOTATION:{ATTACH:"attach",DETACH:"detach"}}},function(t,e,i){"use strict";var n=i(0);class s{constructor(t,e,i){var r;if(this.str="",this.base={},this.spinePos=0,this.range=!1,this.path={},this.start=null,this.end=null,!(this instanceof s))return new s(t,e,i);if("string"==typeof e?this.base=this.parseComponent(e):"object"==typeof e&&e.steps&&(this.base=e),"string"===(r=this.checkType(t)))return this.str=t,Object(n.extend)(this,this.parse(t));if("range"===r)return Object(n.extend)(this,this.fromRange(t,this.base,i));if("node"===r)return Object(n.extend)(this,this.fromNode(t,this.base,i));if("EpubCFI"===r&&t.path)return t;if(t)throw new TypeError("not a valid argument for EpubCFI");return this}checkType(t){return this.isCfiString(t)?"string":!t||"object"!=typeof t||"Range"!==Object(n.type)(t)&&void 0===t.startContainer?t&&"object"==typeof t&&void 0!==t.nodeType?"node":!!(t&&"object"==typeof t&&t instanceof s)&&"EpubCFI":"range"}parse(t){var e,i,n,s={spinePos:-1,range:!1,base:{},path:{},start:null,end:null};return"string"!=typeof t?{spinePos:-1}:(0===t.indexOf("epubcfi(")&&")"===t[t.length-1]&&(t=t.slice(8,t.length-1)),(e=this.getChapterComponent(t))?(s.base=this.parseComponent(e),i=this.getPathComponent(t),s.path=this.parseComponent(i),(n=this.getRange(t))&&(s.range=!0,s.start=this.parseComponent(n[0]),s.end=this.parseComponent(n[1])),s.spinePos=s.base.steps[1].index,s):{spinePos:-1})}parseComponent(t){var e,i={steps:[],terminal:{offset:null,assertion:null}},n=t.split(":"),s=n[0].split("/");return n.length>1&&(e=n[1],i.terminal=this.parseTerminal(e)),""===s[0]&&s.shift(),i.steps=s.map(function(t){return this.parseStep(t)}.bind(this)),i}parseStep(t){var e,i,n,s,r;if((s=t.match(/\[(.*)\]/))&&s[1]&&(r=s[1]),i=parseInt(t),!isNaN(i))return i%2==0?(e="element",n=i/2-1):(e="text",n=(i-1)/2),{type:e,index:n,id:r||null}}parseTerminal(t){var e,i,s=t.match(/\[(.*)\]/);return s&&s[1]?(e=parseInt(t.split("[")[0]),i=s[1]):e=parseInt(t),Object(n.isNumber)(e)||(e=null),{offset:e,assertion:i}}getChapterComponent(t){return t.split("!")[0]}getPathComponent(t){var e=t.split("!");if(e[1]){return e[1].split(",")[0]}}getRange(t){var e=t.split(",");return 3===e.length&&[e[1],e[2]]}getCharecterOffsetComponent(t){return t.split(":")[1]||""}joinSteps(t){return t?t.map((function(t){var e="";return"element"===t.type&&(e+=2*(t.index+1)),"text"===t.type&&(e+=1+2*t.index),t.id&&(e+="["+t.id+"]"),e})).join("/"):""}segmentString(t){var e="/";return e+=this.joinSteps(t.steps),t.terminal&&null!=t.terminal.offset&&(e+=":"+t.terminal.offset),t.terminal&&null!=t.terminal.assertion&&(e+="["+t.terminal.assertion+"]"),e}toString(){var t="epubcfi(";return t+=this.segmentString(this.base),t+="!",t+=this.segmentString(this.path),this.range&&this.start&&(t+=",",t+=this.segmentString(this.start)),this.range&&this.end&&(t+=",",t+=this.segmentString(this.end)),t+=")"}compare(t,e){var i,n,r,o;if("string"==typeof t&&(t=new s(t)),"string"==typeof e&&(e=new s(e)),t.spinePos>e.spinePos)return 1;if(t.spinePos<e.spinePos)return-1;t.range?(i=t.path.steps.concat(t.start.steps),r=t.start.terminal):(i=t.path.steps,r=t.path.terminal),e.range?(n=e.path.steps.concat(e.start.steps),o=e.start.terminal):(n=e.path.steps,o=e.path.terminal);for(var a=0;a<i.length;a++){if(!i[a])return-1;if(!n[a])return 1;if(i[a].index>n[a].index)return 1;if(i[a].index<n[a].index)return-1}return i.length<n.length?-1:r.offset>o.offset?1:r.offset<o.offset?-1:0}step(t){var e=3===t.nodeType?"text":"element";return{id:t.id,tagName:t.tagName,type:e,index:this.position(t)}}filteredStep(t,e){var i,n=this.filter(t,e);if(n)return i=3===n.nodeType?"text":"element",{id:n.id,tagName:n.tagName,type:i,index:this.filteredPosition(n,e)}}pathTo(t,e,i){for(var n,s={steps:[],terminal:{offset:null,assertion:null}},r=t;r&&r.parentNode&&9!=r.parentNode.nodeType;)(n=i?this.filteredStep(r,i):this.step(r))&&s.steps.unshift(n),r=r.parentNode;return null!=e&&e>=0&&(s.terminal.offset=e,"text"!=s.steps[s.steps.length-1].type&&s.steps.push({type:"text",index:0})),s}equalStep(t,e){return!(!t||!e)&&(t.index===e.index&&t.id===e.id&&t.type===e.type)}fromRange(t,e,i){var n={range:!1,base:{},path:{},start:null,end:null},s=t.startContainer,r=t.endContainer,o=t.startOffset,a=t.endOffset,h=!1;if(i&&(h=null!=s.ownerDocument.querySelector("."+i)),"string"==typeof e?(n.base=this.parseComponent(e),n.spinePos=n.base.steps[1].index):"object"==typeof e&&(n.base=e),t.collapsed)h&&(o=this.patchOffset(s,o,i)),n.path=this.pathTo(s,o,i);else{n.range=!0,h&&(o=this.patchOffset(s,o,i)),n.start=this.pathTo(s,o,i),h&&(a=this.patchOffset(r,a,i)),n.end=this.pathTo(r,a,i),n.path={steps:[],terminal:null};var l,c=n.start.steps.length;for(l=0;l<c&&this.equalStep(n.start.steps[l],n.end.steps[l]);l++)l===c-1?n.start.terminal===n.end.terminal&&(n.path.steps.push(n.start.steps[l]),n.range=!1):n.path.steps.push(n.start.steps[l]);n.start.steps=n.start.steps.slice(n.path.steps.length),n.end.steps=n.end.steps.slice(n.path.steps.length)}return n}fromNode(t,e,i){var n={range:!1,base:{},path:{},start:null,end:null};return"string"==typeof e?(n.base=this.parseComponent(e),n.spinePos=n.base.steps[1].index):"object"==typeof e&&(n.base=e),n.path=this.pathTo(t,null,i),n}filter(t,e){var i,n,s,r,o,a=!1;return 3===t.nodeType?(a=!0,s=t.parentNode,i=t.parentNode.classList.contains(e)):(a=!1,i=t.classList.contains(e)),i&&a?(r=s.previousSibling,o=s.nextSibling,r&&3===r.nodeType?n=r:o&&3===o.nodeType&&(n=o),n||t):!(i&&!a)&&t}patchOffset(t,e,i){if(3!=t.nodeType)throw new Error("Anchor must be a text node");var n=t,s=e;for(t.parentNode.classList.contains(i)&&(n=t.parentNode);n.previousSibling;){if(1===n.previousSibling.nodeType){if(!n.previousSibling.classList.contains(i))break;s+=n.previousSibling.textContent.length}else s+=n.previousSibling.textContent.length;n=n.previousSibling}return s}normalizedMap(t,e,i){var n,s,r,o={},a=-1,h=t.length;for(n=0;n<h;n++)1===(s=t[n].nodeType)&&t[n].classList.contains(i)&&(s=3),n>0&&3===s&&3===r?o[n]=a:e===s&&(a+=1,o[n]=a),r=s;return o}position(t){var e,i;return 1===t.nodeType?((e=t.parentNode.children)||(e=Object(n.findChildren)(t.parentNode)),i=Array.prototype.indexOf.call(e,t)):i=(e=this.textNodes(t.parentNode)).indexOf(t),i}filteredPosition(t,e){var i,n;return 1===t.nodeType?(i=t.parentNode.children,n=this.normalizedMap(i,1,e)):(i=t.parentNode.childNodes,t.parentNode.classList.contains(e)&&(i=(t=t.parentNode).parentNode.childNodes),n=this.normalizedMap(i,3,e)),n[Array.prototype.indexOf.call(i,t)]}stepsToXpath(t){var e=[".","*"];return t.forEach((function(t){var i=t.index+1;t.id?e.push("*[position()="+i+" and @id='"+t.id+"']"):"text"===t.type?e.push("text()["+i+"]"):e.push("*["+i+"]")})),e.join("/")}stepsToQuerySelector(t){var e=["html"];return t.forEach((function(t){var i=t.index+1;t.id?e.push("#"+t.id):"text"===t.type||e.push("*:nth-child("+i+")")})),e.join(">")}textNodes(t,e){return Array.prototype.slice.call(t.childNodes).filter((function(t){return 3===t.nodeType||!(!e||!t.classList.contains(e))}))}walkToNode(t,e,i){var s,r,o=e||document,a=o.documentElement,h=t.length;for(r=0;r<h&&("element"===(s=t[r]).type?a=s.id?o.getElementById(s.id):(a.children||Object(n.findChildren)(a))[s.index]:"text"===s.type&&(a=this.textNodes(a,i)[s.index]),a);r++);return a}findNode(t,e,i){var n,s,r=e||document;return i||void 0===r.evaluate?n=i?this.walkToNode(t,r,i):this.walkToNode(t,r):(s=this.stepsToXpath(t),n=r.evaluate(s,r,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue),n}fixMiss(t,e,i,n){var s,r,o=this.findNode(t.slice(0,-1),i,n),a=o.childNodes,h=this.normalizedMap(a,3,n),l=t[t.length-1].index;for(let t in h){if(!h.hasOwnProperty(t))return;if(h[t]===l){if(!(e>(r=(s=a[t]).textContent.length))){o=1===s.nodeType?s.childNodes[0]:s;break}e-=r}}return{container:o,offset:e}}toRange(t,e){var i,s,r,o,a,h,l,c,u=t||document,d=!!e&&null!=u.querySelector("."+e);if(i=void 0!==u.createRange?u.createRange():new n.RangeObject,this.range?(s=this.start,h=this.path.steps.concat(s.steps),o=this.findNode(h,u,d?e:null),r=this.end,l=this.path.steps.concat(r.steps),a=this.findNode(l,u,d?e:null)):(s=this.path,h=this.path.steps,o=this.findNode(this.path.steps,u,d?e:null)),!o)return console.log("No startContainer found for",this.toString()),null;try{null!=s.terminal.offset?i.setStart(o,s.terminal.offset):i.setStart(o,0)}catch(t){c=this.fixMiss(h,s.terminal.offset,u,d?e:null),i.setStart(c.container,c.offset)}if(a)try{null!=r.terminal.offset?i.setEnd(a,r.terminal.offset):i.setEnd(a,0)}catch(t){c=this.fixMiss(l,this.end.terminal.offset,u,d?e:null),i.setEnd(c.container,c.offset)}return i}isCfiString(t){return"string"==typeof t&&0===t.indexOf("epubcfi(")&&")"===t[t.length-1]}generateChapterComponent(t,e,i){var n="/"+2*(t+1)+"/";return n+=2*(parseInt(e)+1),i&&(n+="["+i+"]"),n}collapse(t){this.range&&(this.range=!1,t?(this.path.steps=this.path.steps.concat(this.start.steps),this.path.terminal=this.start.terminal):(this.path.steps=this.path.steps.concat(this.end.steps),this.path.terminal=this.end.terminal))}}e.a=s},function(t,e,i){"use strict";var n,s,r,o,a,h,l,c=i(31),u=i(45),d=Function.prototype.apply,f=Function.prototype.call,p=Object.create,g=Object.defineProperty,m=Object.defineProperties,v=Object.prototype.hasOwnProperty,y={configurable:!0,enumerable:!1,writable:!0};s=function(t,e){var i,s;return u(e),s=this,n.call(this,t,i=function(){r.call(s,t,i),d.call(e,this,arguments)}),i.__eeOnceListener__=e,this},a={on:n=function(t,e){var i;return u(e),v.call(this,"__ee__")?i=this.__ee__:(i=y.value=p(null),g(this,"__ee__",y),y.value=null),i[t]?"object"==typeof i[t]?i[t].push(e):i[t]=[i[t],e]:i[t]=e,this},once:s,off:r=function(t,e){var i,n,s,r;if(u(e),!v.call(this,"__ee__"))return this;if(!(i=this.__ee__)[t])return this;if("object"==typeof(n=i[t]))for(r=0;s=n[r];++r)s!==e&&s.__eeOnceListener__!==e||(2===n.length?i[t]=n[r?0:1]:n.splice(r,1));else n!==e&&n.__eeOnceListener__!==e||delete i[t];return this},emit:o=function(t){var e,i,n,s,r;if(v.call(this,"__ee__")&&(s=this.__ee__[t]))if("object"==typeof s){for(i=arguments.length,r=new Array(i-1),e=1;e<i;++e)r[e-1]=arguments[e];for(s=s.slice(),e=0;n=s[e];++e)d.call(n,this,r)}else switch(arguments.length){case 1:f.call(s,this);break;case 2:f.call(s,this,arguments[1]);break;case 3:f.call(s,this,arguments[1],arguments[2]);break;default:for(i=arguments.length,r=new Array(i-1),e=1;e<i;++e)r[e-1]=arguments[e];d.call(s,this,r)}}},h={on:c(n),once:c(s),off:c(r),emit:c(o)},l=m({},h),t.exports=e=function(t){return null==t?p(l):m(Object(t),h)},e.methods=a},function(t,e,i){"use strict";var n=i(7),s=i.n(n);e.a=class{constructor(t){var e;t.indexOf("://")>-1&&(t=new URL(t).pathname),e=this.parse(t),this.path=t,this.isDirectory(t)?this.directory=t:this.directory=e.dir+"/",this.filename=e.base,this.extension=e.ext.slice(1)}parse(t){return s.a.parse(t)}isAbsolute(t){return s.a.isAbsolute(t||this.path)}isDirectory(t){return"/"===t.charAt(t.length-1)}resolve(t){return s.a.resolve(this.directory,t)}relative(t){return t&&t.indexOf("://")>-1?t:s.a.relative(this.directory,t)}splitPath(t){return this.splitPathRe.exec(t).slice(1)}toString(){return this.path}}},function(t,e,i){"use strict";var n=i(4),s=i(7),r=i.n(s);e.a=class{constructor(t,e){var i=t.indexOf("://")>-1,s=t;if(this.Url=void 0,this.href=t,this.protocol="",this.origin="",this.hash="",this.hash="",this.search="",this.base=e,!i&&!1!==e&&"string"!=typeof e&&window&&window.location&&(this.base=window.location.href),i||this.base)try{this.base?this.Url=new URL(t,this.base):this.Url=new URL(t),this.href=this.Url.href,this.protocol=this.Url.protocol,this.origin=this.Url.origin,this.hash=this.Url.hash,this.search=this.Url.search,s=this.Url.pathname+(this.Url.search?this.Url.search:"")}catch(t){this.Url=void 0,this.base&&(s=new n.a(this.base).resolve(s))}this.Path=new n.a(s),this.directory=this.Path.directory,this.filename=this.Path.filename,this.extension=this.Path.extension}path(){return this.Path}resolve(t){var e;return t.indexOf("://")>-1?t:(e=r.a.resolve(this.directory,t),this.origin+e)}relative(t){return r.a.relative(t,this.directory)}toString(){return this.href}}},function(t,e,i){"use strict";e.a=class{constructor(t){this.context=t||this,this.hooks=[]}register(){for(var t=0;t<arguments.length;++t)if("function"==typeof arguments[t])this.hooks.push(arguments[t]);else for(var e=0;e<arguments[t].length;++e)this.hooks.push(arguments[t][e])}deregister(t){let e;for(let i=0;i<this.hooks.length;i++)if(e=this.hooks[i],e===t){this.hooks.splice(i,1);break}}trigger(){var t=arguments,e=this.context,i=[];return this.hooks.forEach((function(n){try{var s=n.apply(e,t)}catch(t){console.log(t)}s&&"function"==typeof s.then&&i.push(s)})),Promise.all(i)}list(){return this.hooks}clear(){return this.hooks=[]}}},function(t,e,i){"use strict";if(!n)var n={cwd:function(){return"/"}};function s(t){if("string"!=typeof t)throw new TypeError("Path must be a string. Received "+t)}function r(t,e){for(var i,n="",s=-1,r=0,o=0;o<=t.length;++o){if(o<t.length)i=t.charCodeAt(o);else{if(47===i)break;i=47}if(47===i){if(s===o-1||1===r);else if(s!==o-1&&2===r){if(n.length<2||46!==n.charCodeAt(n.length-1)||46!==n.charCodeAt(n.length-2))if(n.length>2){for(var a=n.length-1,h=a;h>=0&&47!==n.charCodeAt(h);--h);if(h!==a){n=-1===h?"":n.slice(0,h),s=o,r=0;continue}}else if(2===n.length||1===n.length){n="",s=o,r=0;continue}e&&(n.length>0?n+="/..":n="..")}else n.length>0?n+="/"+t.slice(s+1,o):n=t.slice(s+1,o);s=o,r=0}else 46===i&&-1!==r?++r:r=-1}return n}var o={resolve:function(){for(var t,e="",i=!1,o=arguments.length-1;o>=-1&&!i;o--){var a;o>=0?a=arguments[o]:(void 0===t&&(t=n.cwd()),a=t),s(a),0!==a.length&&(e=a+"/"+e,i=47===a.charCodeAt(0))}return e=r(e,!i),i?e.length>0?"/"+e:"/":e.length>0?e:"."},normalize:function(t){if(s(t),0===t.length)return".";var e=47===t.charCodeAt(0),i=47===t.charCodeAt(t.length-1);return 0!==(t=r(t,!e)).length||e||(t="."),t.length>0&&i&&(t+="/"),e?"/"+t:t},isAbsolute:function(t){return s(t),t.length>0&&47===t.charCodeAt(0)},join:function(){if(0===arguments.length)return".";for(var t,e=0;e<arguments.length;++e){var i=arguments[e];s(i),i.length>0&&(void 0===t?t=i:t+="/"+i)}return void 0===t?".":o.normalize(t)},relative:function(t,e){if(s(t),s(e),t===e)return"";if((t=o.resolve(t))===(e=o.resolve(e)))return"";for(var i=1;i<t.length&&47===t.charCodeAt(i);++i);for(var n=t.length,r=n-i,a=1;a<e.length&&47===e.charCodeAt(a);++a);for(var h=e.length-a,l=r<h?r:h,c=-1,u=0;u<=l;++u){if(u===l){if(h>l){if(47===e.charCodeAt(a+u))return e.slice(a+u+1);if(0===u)return e.slice(a+u)}else r>l&&(47===t.charCodeAt(i+u)?c=u:0===u&&(c=0));break}var d=t.charCodeAt(i+u);if(d!==e.charCodeAt(a+u))break;47===d&&(c=u)}var f="";for(u=i+c+1;u<=n;++u)u!==n&&47!==t.charCodeAt(u)||(0===f.length?f+="..":f+="/..");return f.length>0?f+e.slice(a+c):(a+=c,47===e.charCodeAt(a)&&++a,e.slice(a))},_makeLong:function(t){return t},dirname:function(t){if(s(t),0===t.length)return".";for(var e=t.charCodeAt(0),i=47===e,n=-1,r=!0,o=t.length-1;o>=1;--o)if(47===(e=t.charCodeAt(o))){if(!r){n=o;break}}else r=!1;return-1===n?i?"/":".":i&&1===n?"//":t.slice(0,n)},basename:function(t,e){if(void 0!==e&&"string"!=typeof e)throw new TypeError('"ext" argument must be a string');s(t);var i,n=0,r=-1,o=!0;if(void 0!==e&&e.length>0&&e.length<=t.length){if(e.length===t.length&&e===t)return"";var a=e.length-1,h=-1;for(i=t.length-1;i>=0;--i){var l=t.charCodeAt(i);if(47===l){if(!o){n=i+1;break}}else-1===h&&(o=!1,h=i+1),a>=0&&(l===e.charCodeAt(a)?-1==--a&&(r=i):(a=-1,r=h))}return n===r?r=h:-1===r&&(r=t.length),t.slice(n,r)}for(i=t.length-1;i>=0;--i)if(47===t.charCodeAt(i)){if(!o){n=i+1;break}}else-1===r&&(o=!1,r=i+1);return-1===r?"":t.slice(n,r)},extname:function(t){s(t);for(var e=-1,i=0,n=-1,r=!0,o=0,a=t.length-1;a>=0;--a){var h=t.charCodeAt(a);if(47!==h)-1===n&&(r=!1,n=a+1),46===h?-1===e?e=a:1!==o&&(o=1):-1!==e&&(o=-1);else if(!r){i=a+1;break}}return-1===e||-1===n||0===o||1===o&&e===n-1&&e===i+1?"":t.slice(e,n)},format:function(t){if(null===t||"object"!=typeof t)throw new TypeError('Parameter "pathObject" must be an object, not '+typeof t);return function(t,e){var i=e.dir||e.root,n=e.base||(e.name||"")+(e.ext||"");return i?i===e.root?i+n:i+t+n:n}("/",t)},parse:function(t){s(t);var e={root:"",dir:"",base:"",ext:"",name:""};if(0===t.length)return e;var i,n=t.charCodeAt(0),r=47===n;r?(e.root="/",i=1):i=0;for(var o=-1,a=0,h=-1,l=!0,c=t.length-1,u=0;c>=i;--c)if(47!==(n=t.charCodeAt(c)))-1===h&&(l=!1,h=c+1),46===n?-1===o?o=c:1!==u&&(u=1):-1!==o&&(u=-1);else if(!l){a=c+1;break}return-1===o||-1===h||0===u||1===u&&o===h-1&&o===a+1?-1!==h&&(e.base=e.name=0===a&&r?t.slice(1,h):t.slice(a,h)):(0===a&&r?(e.name=t.slice(1,o),e.base=t.slice(1,h)):(e.name=t.slice(a,o),e.base=t.slice(a,h)),e.ext=t.slice(o,h)),a>0?e.dir=t.slice(0,a-1):r&&(e.dir="/"),e},sep:"/",delimiter:":",posix:null};t.exports=o},function(t,e,i){"use strict";i.d(e,"a",(function(){return r})),i.d(e,"b",(function(){return o})),i.d(e,"d",(function(){return a})),i.d(e,"c",(function(){return h})),i.d(e,"e",(function(){return l}));var n=i(0),s=i(5);i(4);function r(t,e){var i,s,r=e.url,o=r.indexOf("://")>-1;t&&(s=Object(n.qs)(t,"head"),(i=Object(n.qs)(s,"base"))||(i=t.createElement("base"),s.insertBefore(i,s.firstChild)),!o&&window&&window.location&&(r=window.location.origin+r),i.setAttribute("href",r))}function o(t,e){var i,s,r=e.canonical;t&&(i=Object(n.qs)(t,"head"),(s=Object(n.qs)(i,"link[rel='canonical']"))?s.setAttribute("href",r):((s=t.createElement("link")).setAttribute("rel","canonical"),s.setAttribute("href",r),i.appendChild(s)))}function a(t,e){var i,s,r=e.idref;t&&(i=Object(n.qs)(t,"head"),(s=Object(n.qs)(i,"link[property='dc.identifier']"))?s.setAttribute("content",r):((s=t.createElement("meta")).setAttribute("name","dc.identifier"),s.setAttribute("content",r),i.appendChild(s)))}function h(t,e){var i=t.querySelectorAll("a[href]");if(i.length)for(var r=Object(n.qs)(t.ownerDocument,"base"),o=r?r.getAttribute("href"):void 0,a=function(t){var i=t.getAttribute("href");if(0!==i.indexOf("mailto:"))if(i.indexOf("://")>-1)t.setAttribute("target","_blank");else{var n;try{n=new s.a(i,o)}catch(t){}t.onclick=function(){return n&&n.hash?e(n.Path.path+n.hash):e(n?n.Path.path:i),!1}}}.bind(this),h=0;h<i.length;h++)a(i[h])}function l(t,e,i){return e.forEach((function(e,n){e&&i[n]&&(e=e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),t=t.replace(new RegExp(e,"g"),i[n]))})),t}},function(t,e,i){"use strict";var n=i(0);e.a=class{constructor(t){this._q=[],this.context=t,this.tick=n.requestAnimationFrame,this.running=!1,this.paused=!1}enqueue(){var t,e,i=[].shift.call(arguments),s=arguments;if(!i)throw new Error("No Task Provided");return e="function"==typeof i?{task:i,args:s,deferred:t=new n.defer,promise:t.promise}:{promise:i},this._q.push(e),0!=this.paused||this.running||this.run(),e.promise}dequeue(){var t,e,i;return!this._q.length||this.paused?((t=new n.defer).deferred.resolve(),t.promise):(e=(t=this._q.shift()).task)?(i=e.apply(this.context,t.args))&&"function"==typeof i.then?i.then(function(){t.deferred.resolve.apply(this.context,arguments)}.bind(this),function(){t.deferred.reject.apply(this.context,arguments)}.bind(this)):(t.deferred.resolve.apply(this.context,i),t.promise):t.promise?t.promise:void 0}dump(){for(;this._q.length;)this.dequeue()}run(){return this.running||(this.running=!0,this.defered=new n.defer),this.tick.call(window,()=>{this._q.length?this.dequeue().then(function(){this.run()}.bind(this)):(this.defered.resolve(),this.running=void 0)}),1==this.paused&&(this.paused=!1),this.defered.promise}flush(){return this.running?this.running:this._q.length?(this.running=this.dequeue().then(function(){return this.running=void 0,this.flush()}.bind(this)),this.running):void 0}clear(){this._q=[]}length(){return this._q.length}pause(){this.paused=!0}stop(){this._q=[],this.running=!1,this.paused=!0}}},function(t,e,i){"use strict";var n=i(3),s=i.n(n),r=i(0);function o(){var t="reverse",e=function(){var t=document.createElement("div");t.dir="rtl",t.style.position="fixed",t.style.width="1px",t.style.height="1px",t.style.top="0px",t.style.left="0px",t.style.overflow="hidden";var e=document.createElement("div");e.style.width="2px";var i=document.createElement("span");i.style.width="1px",i.style.display="inline-block";var n=document.createElement("span");return n.style.width="1px",n.style.display="inline-block",e.appendChild(i),e.appendChild(n),t.appendChild(e),t}();return document.body.appendChild(e),e.scrollLeft>0?t="default":"undefined"!=typeof Element&&Element.prototype.scrollIntoView?(e.children[0].children[1].scrollIntoView(),e.scrollLeft<0&&(t="negative")):(e.scrollLeft=1,0===e.scrollLeft&&(t="negative")),document.body.removeChild(e),t}var a=i(11),h=i(9),l=i(28),c=i.n(l);var u=class{constructor(t){this.settings=t||{},this.id="epubjs-container-"+Object(r.uuid)(),this.container=this.create(this.settings),this.settings.hidden&&(this.wrapper=this.wrap(this.container))}create(t){let e=t.height,i=t.width,n=t.overflow||!1,s=t.axis||"vertical",o=t.direction;Object(r.extend)(this.settings,t),t.height&&Object(r.isNumber)(t.height)&&(e=t.height+"px"),t.width&&Object(r.isNumber)(t.width)&&(i=t.width+"px");let a=document.createElement("div");return a.id=this.id,a.classList.add("epub-container"),a.style.wordSpacing="0",a.style.lineHeight="0",a.style.verticalAlign="top",a.style.position="relative","horizontal"===s&&(a.style.display="flex",a.style.flexDirection="row",a.style.flexWrap="nowrap"),i&&(a.style.width=i),e&&(a.style.height=e),n&&("scroll"===n&&"vertical"===s?(a.style["overflow-y"]=n,a.style["overflow-x"]="hidden"):"scroll"===n&&"horizontal"===s?(a.style["overflow-y"]="hidden",a.style["overflow-x"]=n):a.style.overflow=n),o&&(a.dir=o,a.style.direction=o),o&&this.settings.fullsize&&(document.body.style.direction=o),a}wrap(t){var e=document.createElement("div");return e.style.visibility="hidden",e.style.overflow="hidden",e.style.width="0",e.style.height="0",e.appendChild(t),e}getElement(t){var e;if(Object(r.isElement)(t)?e=t:"string"==typeof t&&(e=document.getElementById(t)),!e)throw new Error("Not an Element");return e}attachTo(t){var e,i=this.getElement(t);if(i)return e=this.settings.hidden?this.wrapper:this.container,i.appendChild(e),this.element=i,i}getContainer(){return this.container}onResize(t){Object(r.isNumber)(this.settings.width)&&Object(r.isNumber)(this.settings.height)||(this.resizeFunc=c()(t,50),window.addEventListener("resize",this.resizeFunc,!1))}onOrientationChange(t){this.orientationChangeFunc=t,window.addEventListener("orientationchange",this.orientationChangeFunc,!1)}size(t,e){var i;let n=t||this.settings.width,s=e||this.settings.height;null===t?(i=this.element.getBoundingClientRect()).width&&(t=Math.floor(i.width),this.container.style.width=t+"px"):Object(r.isNumber)(t)?this.container.style.width=t+"px":this.container.style.width=t,null===e?(i=i||this.element.getBoundingClientRect()).height&&(e=i.height,this.container.style.height=e+"px"):Object(r.isNumber)(e)?this.container.style.height=e+"px":this.container.style.height=e,Object(r.isNumber)(t)||(t=this.container.clientWidth),Object(r.isNumber)(e)||(e=this.container.clientHeight),this.containerStyles=window.getComputedStyle(this.container),this.containerPadding={left:parseFloat(this.containerStyles["padding-left"])||0,right:parseFloat(this.containerStyles["padding-right"])||0,top:parseFloat(this.containerStyles["padding-top"])||0,bottom:parseFloat(this.containerStyles["padding-bottom"])||0};let o=Object(r.windowBounds)(),a=window.getComputedStyle(document.body),h=parseFloat(a["padding-left"])||0,l=parseFloat(a["padding-right"])||0,c=parseFloat(a["padding-top"])||0,u=parseFloat(a["padding-bottom"])||0;return n||(t=o.width-h-l),(this.settings.fullsize&&!s||!s)&&(e=o.height-c-u),{width:t-this.containerPadding.left-this.containerPadding.right,height:e-this.containerPadding.top-this.containerPadding.bottom}}bounds(){let t;return"visible"!==this.container.style.overflow&&(t=this.container&&this.container.getBoundingClientRect()),t&&t.width&&t.height?t:Object(r.windowBounds)()}getSheet(){var t=document.createElement("style");return t.appendChild(document.createTextNode("")),document.head.appendChild(t),t.sheet}addStyleRules(t,e){var i="#"+this.id+" ",n="";this.sheet||(this.sheet=this.getSheet()),e.forEach((function(t){for(var e in t)t.hasOwnProperty(e)&&(n+=e+":"+t[e]+";")})),this.sheet.insertRule(i+t+" {"+n+"}",0)}axis(t){"horizontal"===t?(this.container.style.display="flex",this.container.style.flexDirection="row",this.container.style.flexWrap="nowrap"):this.container.style.display="block",this.settings.axis=t}direction(t){this.container&&(this.container.dir=t,this.container.style.direction=t),this.settings.fullsize&&(document.body.style.direction=t),this.settings.dir=t}overflow(t){this.container&&("scroll"===t&&"vertical"===this.settings.axis?(this.container.style["overflow-y"]=t,this.container.style["overflow-x"]="hidden"):"scroll"===t&&"horizontal"===this.settings.axis?(this.container.style["overflow-y"]="hidden",this.container.style["overflow-x"]=t):this.container.style.overflow=t),this.settings.overflow=t}destroy(){this.element&&(this.settings.hidden?this.wrapper:this.container,this.element.contains(this.container)&&this.element.removeChild(this.container),window.removeEventListener("resize",this.resizeFunc),window.removeEventListener("orientationChange",this.orientationChangeFunc))}};var d=class{constructor(t){this.container=t,this._views=[],this.length=0,this.hidden=!1}all(){return this._views}first(){return this._views[0]}last(){return this._views[this._views.length-1]}indexOf(t){return this._views.indexOf(t)}slice(){return this._views.slice.apply(this._views,arguments)}get(t){return this._views[t]}append(t){return this._views.push(t),this.container&&this.container.appendChild(t.element),this.length++,t}prepend(t){return this._views.unshift(t),this.container&&this.container.insertBefore(t.element,this.container.firstChild),this.length++,t}insert(t,e){return this._views.splice(e,0,t),this.container&&(e<this.container.children.length?this.container.insertBefore(t.element,this.container.children[e]):this.container.appendChild(t.element)),this.length++,t}remove(t){var e=this._views.indexOf(t);e>-1&&this._views.splice(e,1),this.destroy(t),this.length--}destroy(t){t.displayed&&t.destroy(),this.container&&this.container.removeChild(t.element),t=null}forEach(){return this._views.forEach.apply(this._views,arguments)}clear(){var t,e=this.length;if(this.length){for(var i=0;i<e;i++)t=this._views[i],this.destroy(t);this._views=[],this.length=0}}find(t){for(var e,i=this.length,n=0;n<i;n++)if((e=this._views[n]).displayed&&e.section.index==t.index)return e}displayed(){for(var t,e=[],i=this.length,n=0;n<i;n++)(t=this._views[n]).displayed&&e.push(t);return e}show(){for(var t,e=this.length,i=0;i<e;i++)(t=this._views[i]).displayed&&t.show();this.hidden=!1}hide(){for(var t,e=this.length,i=0;i<e;i++)(t=this._views[i]).displayed&&t.hide();this.hidden=!0}},f=i(1);class p{constructor(t){this.name="default",this.optsSettings=t.settings,this.View=t.view,this.request=t.request,this.renditionQueue=t.queue,this.q=new h.a(this),this.settings=Object(r.extend)(this.settings||{},{infinite:!0,hidden:!1,width:void 0,height:void 0,axis:void 0,writingMode:void 0,flow:"scrolled",ignoreClass:"",fullsize:void 0,allowScriptedContent:!1,allowPopups:!1}),Object(r.extend)(this.settings,t.settings||{}),this.viewSettings={ignoreClass:this.settings.ignoreClass,axis:this.settings.axis,flow:this.settings.flow,layout:this.layout,method:this.settings.method,width:0,height:0,forceEvenPages:!0,allowScriptedContent:this.settings.allowScriptedContent,allowPopups:this.settings.allowPopups},this.rendered=!1}render(t,e){let i=t.tagName;void 0!==this.settings.fullsize||!i||"body"!=i.toLowerCase()&&"html"!=i.toLowerCase()||(this.settings.fullsize=!0),this.settings.fullsize&&(this.settings.overflow="visible",this.overflow=this.settings.overflow),this.settings.size=e,this.settings.rtlScrollType=o(),this.stage=new u({width:e.width,height:e.height,overflow:this.overflow,hidden:this.settings.hidden,axis:this.settings.axis,fullsize:this.settings.fullsize,direction:this.settings.direction}),this.stage.attachTo(t),this.container=this.stage.getContainer(),this.views=new d(this.container),this._bounds=this.bounds(),this._stageSize=this.stage.size(),this.viewSettings.width=this._stageSize.width,this.viewSettings.height=this._stageSize.height,this.stage.onResize(this.onResized.bind(this)),this.stage.onOrientationChange(this.onOrientationChange.bind(this)),this.addEventListeners(),this.layout&&this.updateLayout(),this.rendered=!0}addEventListeners(){var t;window.addEventListener("unload",function(t){this.destroy()}.bind(this)),t=this.settings.fullsize?window:this.container,this._onScroll=this.onScroll.bind(this),t.addEventListener("scroll",this._onScroll)}removeEventListeners(){(this.settings.fullsize?window:this.container).removeEventListener("scroll",this._onScroll),this._onScroll=void 0}destroy(){clearTimeout(this.orientationTimeout),clearTimeout(this.resizeTimeout),clearTimeout(this.afterScrolled),this.clear(),this.removeEventListeners(),this.stage.destroy(),this.rendered=!1}onOrientationChange(t){let{orientation:e}=window;this.optsSettings.resizeOnOrientationChange&&this.resize(),clearTimeout(this.orientationTimeout),this.orientationTimeout=setTimeout(function(){this.orientationTimeout=void 0,this.optsSettings.resizeOnOrientationChange&&this.resize(),this.emit(f.c.MANAGERS.ORIENTATION_CHANGE,e)}.bind(this),500)}onResized(t){this.resize()}resize(t,e,i){let n=this.stage.size(t,e);this.winBounds=Object(r.windowBounds)(),this.orientationTimeout&&this.winBounds.width===this.winBounds.height?this._stageSize=void 0:this._stageSize&&this._stageSize.width===n.width&&this._stageSize.height===n.height||(this._stageSize=n,this._bounds=this.bounds(),this.clear(),this.viewSettings.width=this._stageSize.width,this.viewSettings.height=this._stageSize.height,this.updateLayout(),this.emit(f.c.MANAGERS.RESIZED,{width:this._stageSize.width,height:this._stageSize.height},i))}createView(t,e){return new this.View(t,Object(r.extend)(this.viewSettings,{forceRight:e}))}handleNextPrePaginated(t,e,i){let n;if("pre-paginated"===this.layout.name&&this.layout.divisor>1){if(t||0===e.index)return;if(n=e.next(),n&&!n.properties.includes("page-spread-left"))return i.call(this,n)}}display(t,e){var i=new r.defer,n=i.promise;(e===t.href||Object(r.isNumber)(e))&&(e=void 0);var s=this.views.find(t);if(s&&t&&"pre-paginated"!==this.layout.name){let t=s.offset();if("ltr"===this.settings.direction)this.scrollTo(t.left,t.top,!0);else{let e=s.width();this.scrollTo(t.left+e,t.top,!0)}if(e){let t=s.locationOf(e),i=s.width();this.moveTo(t,i)}return i.resolve(),n}this.clear();let o=!1;return"pre-paginated"===this.layout.name&&2===this.layout.divisor&&t.properties.includes("page-spread-right")&&(o=!0),this.add(t,o).then(function(t){if(e){let i=t.locationOf(e),n=t.width();this.moveTo(i,n)}}.bind(this),t=>{i.reject(t)}).then(function(){return this.handleNextPrePaginated(o,t,this.add)}.bind(this)).then(function(){this.views.show(),i.resolve()}.bind(this)),n}afterDisplayed(t){this.emit(f.c.MANAGERS.ADDED,t)}afterResized(t){this.emit(f.c.MANAGERS.RESIZE,t.section)}moveTo(t,e){var i=0,n=0;this.isPaginated?((i=Math.floor(t.left/this.layout.delta)*this.layout.delta)+this.layout.delta>this.container.scrollWidth&&(i=this.container.scrollWidth-this.layout.delta),(n=Math.floor(t.top/this.layout.delta)*this.layout.delta)+this.layout.delta>this.container.scrollHeight&&(n=this.container.scrollHeight-this.layout.delta)):n=t.top,"rtl"===this.settings.direction&&(i+=this.layout.delta,i-=e),this.scrollTo(i,n,!0)}add(t,e){var i=this.createView(t,e);return this.views.append(i),i.onDisplayed=this.afterDisplayed.bind(this),i.onResize=this.afterResized.bind(this),i.on(f.c.VIEWS.AXIS,t=>{this.updateAxis(t)}),i.on(f.c.VIEWS.WRITING_MODE,t=>{this.updateWritingMode(t)}),i.display(this.request)}append(t,e){var i=this.createView(t,e);return this.views.append(i),i.onDisplayed=this.afterDisplayed.bind(this),i.onResize=this.afterResized.bind(this),i.on(f.c.VIEWS.AXIS,t=>{this.updateAxis(t)}),i.on(f.c.VIEWS.WRITING_MODE,t=>{this.updateWritingMode(t)}),i.display(this.request)}prepend(t,e){var i=this.createView(t,e);return i.on(f.c.VIEWS.RESIZED,t=>{this.counter(t)}),this.views.prepend(i),i.onDisplayed=this.afterDisplayed.bind(this),i.onResize=this.afterResized.bind(this),i.on(f.c.VIEWS.AXIS,t=>{this.updateAxis(t)}),i.on(f.c.VIEWS.WRITING_MODE,t=>{this.updateWritingMode(t)}),i.display(this.request)}counter(t){"vertical"===this.settings.axis?this.scrollBy(0,t.heightDelta,!0):this.scrollBy(t.widthDelta,0,!0)}next(){var t;let e=this.settings.direction;if(this.views.length){if(!this.isPaginated||"horizontal"!==this.settings.axis||e&&"ltr"!==e)if(this.isPaginated&&"horizontal"===this.settings.axis&&"rtl"===e)this.scrollLeft=this.container.scrollLeft,"default"===this.settings.rtlScrollType?this.container.scrollLeft>0?this.scrollBy(this.layout.delta,0,!0):t=this.views.last().section.next():this.container.scrollLeft+-1*this.layout.delta>-1*this.container.scrollWidth?this.scrollBy(this.layout.delta,0,!0):t=this.views.last().section.next();else if(this.isPaginated&&"vertical"===this.settings.axis){this.scrollTop=this.container.scrollTop,this.container.scrollTop+this.container.offsetHeight<this.container.scrollHeight?this.scrollBy(0,this.layout.height,!0):t=this.views.last().section.next()}else t=this.views.last().section.next();else this.scrollLeft=this.container.scrollLeft,this.container.scrollLeft+this.container.offsetWidth+this.layout.delta<=this.container.scrollWidth?this.scrollBy(this.layout.delta,0,!0):t=this.views.last().section.next();if(t){this.clear(),this.updateLayout();let e=!1;return"pre-paginated"===this.layout.name&&2===this.layout.divisor&&t.properties.includes("page-spread-right")&&(e=!0),this.append(t,e).then(function(){return this.handleNextPrePaginated(e,t,this.append)}.bind(this),t=>t).then(function(){this.isPaginated||"horizontal"!==this.settings.axis||"rtl"!==this.settings.direction||"default"!==this.settings.rtlScrollType||this.scrollTo(this.container.scrollWidth,0,!0),this.views.show()}.bind(this))}}}prev(){var t;let e=this.settings.direction;if(this.views.length){if(!this.isPaginated||"horizontal"!==this.settings.axis||e&&"ltr"!==e)if(this.isPaginated&&"horizontal"===this.settings.axis&&"rtl"===e)this.scrollLeft=this.container.scrollLeft,"default"===this.settings.rtlScrollType?this.container.scrollLeft+this.container.offsetWidth<this.container.scrollWidth?this.scrollBy(-this.layout.delta,0,!0):t=this.views.first().section.prev():this.container.scrollLeft<0?this.scrollBy(-this.layout.delta,0,!0):t=this.views.first().section.prev();else if(this.isPaginated&&"vertical"===this.settings.axis){this.scrollTop=this.container.scrollTop,this.container.scrollTop>0?this.scrollBy(0,-this.layout.height,!0):t=this.views.first().section.prev()}else t=this.views.first().section.prev();else this.scrollLeft=this.container.scrollLeft,this.container.scrollLeft>0?this.scrollBy(-this.layout.delta,0,!0):t=this.views.first().section.prev();if(t){this.clear(),this.updateLayout();let e=!1;return"pre-paginated"===this.layout.name&&2===this.layout.divisor&&"object"!=typeof t.prev()&&(e=!0),this.prepend(t,e).then(function(){var e;if("pre-paginated"===this.layout.name&&this.layout.divisor>1&&(e=t.prev()))return this.prepend(e)}.bind(this),t=>t).then(function(){this.isPaginated&&"horizontal"===this.settings.axis&&("rtl"===this.settings.direction?"default"===this.settings.rtlScrollType?this.scrollTo(0,0,!0):this.scrollTo(-1*this.container.scrollWidth+this.layout.delta,0,!0):this.scrollTo(this.container.scrollWidth-this.layout.delta,0,!0)),this.views.show()}.bind(this))}}}current(){var t=this.visible();return t.length?t[t.length-1]:null}clear(){this.views&&(this.views.hide(),this.scrollTo(0,0,!0),this.views.clear())}currentLocation(){return this.updateLayout(),this.isPaginated&&"horizontal"===this.settings.axis?this.location=this.paginatedLocation():this.location=this.scrolledLocation(),this.location}scrolledLocation(){let t=this.visible(),e=this.container.getBoundingClientRect(),i=e.height<window.innerHeight?e.height:window.innerHeight,n=e.width<window.innerWidth?e.width:window.innerWidth,s="vertical"===this.settings.axis,r=(this.settings.direction,0);return this.settings.fullsize&&(r=s?window.scrollY:window.scrollX),t.map(t=>{let o,a,h,l,{index:c,href:u}=t.section,d=t.position(),f=t.width(),p=t.height();s?(o=r+e.top-d.top+0,a=o+i-0,l=this.layout.count(p,i).pages,h=i):(o=r+e.left-d.left+0,a=o+n-0,l=this.layout.count(f,n).pages,h=n);let g=Math.ceil(o/h),m=[],v=Math.ceil(a/h);if("rtl"===this.settings.direction&&!s){let t=g;g=l-v,v=l-t}m=[];for(var y=g;y<=v;y++){let t=y+1;m.push(t)}return{index:c,href:u,pages:m,totalPages:l,mapping:this.mapping.page(t.contents,t.section.cfiBase,o,a)}})}paginatedLocation(){let t=this.visible(),e=this.container.getBoundingClientRect(),i=0,n=0;return this.settings.fullsize&&(i=window.scrollX),t.map(t=>{let s,r,o,a,{index:h,href:l}=t.section,c=t.position(),u=t.width();"rtl"===this.settings.direction?(s=e.right-i,a=Math.min(Math.abs(s-c.left),this.layout.width)-n,o=c.width-(c.right-s)-n,r=o-a):(s=e.left+i,a=Math.min(c.right-s,this.layout.width)-n,r=s-c.left+n,o=r+a),n+=a;let d=this.mapping.page(t.contents,t.section.cfiBase,r,o),f=this.layout.count(u).pages,p=Math.floor(r/this.layout.pageWidth),g=[],m=Math.floor(o/this.layout.pageWidth);if(p<0&&(p=0,m+=1),"rtl"===this.settings.direction){let t=p;p=f-m,m=f-t}for(var v=p+1;v<=m;v++){let t=v;g.push(t)}return{index:h,href:l,pages:g,totalPages:f,mapping:d}})}isVisible(t,e,i,n){var s=t.position(),r=n||this.bounds();return"horizontal"===this.settings.axis&&s.right>r.left-e&&s.left<r.right+i||"vertical"===this.settings.axis&&s.bottom>r.top-e&&s.top<r.bottom+i}visible(){for(var t,e=this.bounds(),i=this.views.displayed(),n=i.length,s=[],r=0;r<n;r++)t=i[r],!0===this.isVisible(t,0,0,e)&&s.push(t);return s}scrollBy(t,e,i){let n="rtl"===this.settings.direction?-1:1;i&&(this.ignore=!0),this.settings.fullsize?window.scrollBy(t*n,e*n):(t&&(this.container.scrollLeft+=t*n),e&&(this.container.scrollTop+=e)),this.scrolled=!0}scrollTo(t,e,i){i&&(this.ignore=!0),this.settings.fullsize?window.scrollTo(t,e):(this.container.scrollLeft=t,this.container.scrollTop=e),this.scrolled=!0}onScroll(){let t,e;this.settings.fullsize?(t=window.scrollY,e=window.scrollX):(t=this.container.scrollTop,e=this.container.scrollLeft),this.scrollTop=t,this.scrollLeft=e,this.ignore?this.ignore=!1:(this.emit(f.c.MANAGERS.SCROLL,{top:t,left:e}),clearTimeout(this.afterScrolled),this.afterScrolled=setTimeout(function(){this.emit(f.c.MANAGERS.SCROLLED,{top:this.scrollTop,left:this.scrollLeft})}.bind(this),20))}bounds(){return this.stage.bounds()}applyLayout(t){this.layout=t,this.updateLayout(),this.views&&this.views.length>0&&"pre-paginated"===this.layout.name&&this.display(this.views.first().section)}updateLayout(){this.stage&&(this._stageSize=this.stage.size(),this.isPaginated?(this.layout.calculate(this._stageSize.width,this._stageSize.height,this.settings.gap),this.settings.offset=this.layout.delta/this.layout.divisor):this.layout.calculate(this._stageSize.width,this._stageSize.height),this.viewSettings.width=this.layout.width,this.viewSettings.height=this.layout.height,this.setLayout(this.layout))}setLayout(t){this.viewSettings.layout=t,this.mapping=new a.a(t.props,this.settings.direction,this.settings.axis),this.views&&this.views.forEach((function(e){e&&e.setLayout(t)}))}updateWritingMode(t){this.writingMode=t}updateAxis(t,e){(e||t!==this.settings.axis)&&(this.settings.axis=t,this.stage&&this.stage.axis(t),this.viewSettings.axis=t,this.mapping&&(this.mapping=new a.a(this.layout.props,this.settings.direction,this.settings.axis)),this.layout&&("vertical"===t?this.layout.spread("none"):this.layout.spread(this.layout.settings.spread)))}updateFlow(t,e="auto"){let i="paginated"===t||"auto"===t;this.isPaginated=i,"scrolled-doc"===t||"scrolled-continuous"===t||"scrolled"===t?this.updateAxis("vertical"):this.updateAxis("horizontal"),this.viewSettings.flow=t,this.settings.overflow?this.overflow=this.settings.overflow:this.overflow=i?"hidden":e,this.stage&&this.stage.overflow(this.overflow),this.updateLayout()}getContents(){var t=[];return this.views?(this.views.forEach((function(e){const i=e&&e.contents;i&&t.push(i)})),t):t}direction(t="ltr"){this.settings.direction=t,this.stage&&this.stage.direction(t),this.viewSettings.direction=t,this.updateLayout()}isRendered(){return this.rendered}}s()(p.prototype);e.a=p},function(t,e,i){"use strict";var n=i(2),s=i(0);e.a=class{constructor(t,e,i,n=!1){this.layout=t,this.horizontal="horizontal"===i,this.direction=e||"ltr",this._dev=n}section(t){var e=this.findRanges(t);return this.rangeListToCfiList(t.section.cfiBase,e)}page(t,e,i,s){var r,o=!(!t||!t.document)&&t.document.body;if(o){if(r=this.rangePairToCfiPair(e,{start:this.findStart(o,i,s),end:this.findEnd(o,i,s)}),!0===this._dev){let e=t.document,i=new n.a(r.start).toRange(e),s=new n.a(r.end).toRange(e),o=e.defaultView.getSelection(),a=e.createRange();o.removeAllRanges(),a.setStart(i.startContainer,i.startOffset),a.setEnd(s.endContainer,s.endOffset),o.addRange(a)}return r}}walk(t,e){if(!t||t.nodeType!==Node.TEXT_NODE){var i=function(t){return t.data.trim().length>0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT},n=i;n.acceptNode=i;for(var s,r,o=document.createTreeWalker(t,NodeFilter.SHOW_TEXT,n,!1);(s=o.nextNode())&&!(r=e(s)););return r}}findRanges(t){for(var e,i,n=[],s=t.contents.scrollWidth(),r=Math.ceil(s/this.layout.spreadWidth)*this.layout.divisor,o=this.layout.columnWidth,a=this.layout.gap,h=0;h<r.pages;h++)e=(o+a)*h,i=o*(h+1)+a*h,n.push({start:this.findStart(t.document.body,e,i),end:this.findEnd(t.document.body,e,i)});return n}findStart(t,e,i){for(var n,r,o=[t],a=t;o.length;)if(n=o.shift(),r=this.walk(n,t=>{var n,r,h,l,c;if(c=Object(s.nodeBounds)(t),this.horizontal&&"ltr"===this.direction){if(n=this.horizontal?c.left:c.top,r=this.horizontal?c.right:c.bottom,n>=e&&n<=i)return t;if(r>e)return t;a=t,o.push(t)}else if(this.horizontal&&"rtl"===this.direction){if(n=c.left,(r=c.right)<=i&&r>=e)return t;if(n<i)return t;a=t,o.push(t)}else{if(h=c.top,l=c.bottom,h>=e&&h<=i)return t;if(l>e)return t;a=t,o.push(t)}}))return this.findTextStartRange(r,e,i);return this.findTextStartRange(a,e,i)}findEnd(t,e,i){for(var n,r,o=[t],a=t;o.length;)if(n=o.shift(),r=this.walk(n,t=>{var n,r,h,l,c;if(c=Object(s.nodeBounds)(t),this.horizontal&&"ltr"===this.direction){if(n=Math.round(c.left),r=Math.round(c.right),n>i&&a)return a;if(r>i)return t;a=t,o.push(t)}else if(this.horizontal&&"rtl"===this.direction){if(n=Math.round(this.horizontal?c.left:c.top),(r=Math.round(this.horizontal?c.right:c.bottom))<e&&a)return a;if(n<e)return t;a=t,o.push(t)}else{if(h=Math.round(c.top),l=Math.round(c.bottom),h>i&&a)return a;if(l>i)return t;a=t,o.push(t)}}))return this.findTextEndRange(r,e,i);return this.findTextEndRange(a,e,i)}findTextStartRange(t,e,i){for(var n,s,r=this.splitTextNodeIntoRanges(t),o=0;o<r.length;o++)if(s=(n=r[o]).getBoundingClientRect(),this.horizontal&&"ltr"===this.direction){if(s.left>=e)return n}else if(this.horizontal&&"rtl"===this.direction){if(s.right<=i)return n}else if(s.top>=e)return n;return r[0]}findTextEndRange(t,e,i){for(var n,s,r,o,a,h,l,c=this.splitTextNodeIntoRanges(t),u=0;u<c.length;u++){if(r=(s=c[u]).getBoundingClientRect(),this.horizontal&&"ltr"===this.direction){if(o=r.left,a=r.right,o>i&&n)return n;if(a>i)return s}else if(this.horizontal&&"rtl"===this.direction){if(o=r.left,(a=r.right)<e&&n)return n;if(o<e)return s}else{if(h=r.top,l=r.bottom,h>i&&n)return n;if(l>i)return s}n=s}return c[c.length-1]}splitTextNodeIntoRanges(t,e){var i,n=[],s=(t.textContent||"").trim(),r=t.ownerDocument,o=e||" ",a=s.indexOf(o);if(-1===a||t.nodeType!=Node.TEXT_NODE)return(i=r.createRange()).selectNodeContents(t),[i];for((i=r.createRange()).setStart(t,0),i.setEnd(t,a),n.push(i),i=!1;-1!=a;)(a=s.indexOf(o,a+1))>0&&(i&&(i.setEnd(t,a),n.push(i)),(i=r.createRange()).setStart(t,a+1));return i&&(i.setEnd(t,s.length),n.push(i)),n}rangePairToCfiPair(t,e){var i=e.start,s=e.end;return i.collapse(!0),s.collapse(!1),{start:new n.a(i,t).toString(),end:new n.a(s,t).toString()}}rangeListToCfiList(t,e){for(var i,n=[],s=0;s<e.length;s++)i=this.rangePairToCfiPair(t,e[s]),n.push(i);return n}axis(t){return t&&(this.horizontal="horizontal"===t),this.horizontal}}},function(t,e,i){"use strict";var n=i(3),s=i.n(n),r=i(0),o=i(2),a=i(11),h=i(8),l=i(1);const c="undefined"!=typeof navigator,u=c&&/Chrome/.test(navigator.userAgent),d=c&&!u&&/AppleWebKit/.test(navigator.userAgent);class f{constructor(t,e,i,n){this.epubcfi=new o.a,this.document=t,this.documentElement=this.document.documentElement,this.content=e||this.document.body,this.window=this.document.defaultView,this._size={width:0,height:0},this.sectionIndex=n||0,this.cfiBase=i||"",this.epubReadingSystem("epub.js",l.b),this.called=0,this.active=!0,this.listeners()}static get listenedEvents(){return l.a}width(t){var e=this.content;return t&&Object(r.isNumber)(t)&&(t+="px"),t&&(e.style.width=t),parseInt(this.window.getComputedStyle(e).width)}height(t){var e=this.content;return t&&Object(r.isNumber)(t)&&(t+="px"),t&&(e.style.height=t),parseInt(this.window.getComputedStyle(e).height)}contentWidth(t){var e=this.content||this.document.body;return t&&Object(r.isNumber)(t)&&(t+="px"),t&&(e.style.width=t),parseInt(this.window.getComputedStyle(e).width)}contentHeight(t){var e=this.content||this.document.body;return t&&Object(r.isNumber)(t)&&(t+="px"),t&&(e.style.height=t),parseInt(this.window.getComputedStyle(e).height)}textWidth(){let t,e,i=this.document.createRange(),n=this.content||this.document.body,s=Object(r.borders)(n);return i.selectNodeContents(n),t=i.getBoundingClientRect(),e=t.width,s&&s.width&&(e+=s.width),Math.round(e)}textHeight(){let t,e,i=this.document.createRange(),n=this.content||this.document.body;return i.selectNodeContents(n),t=i.getBoundingClientRect(),e=t.bottom,Math.round(e)}scrollWidth(){return this.documentElement.scrollWidth}scrollHeight(){return this.documentElement.scrollHeight}overflow(t){return t&&(this.documentElement.style.overflow=t),this.window.getComputedStyle(this.documentElement).overflow}overflowX(t){return t&&(this.documentElement.style.overflowX=t),this.window.getComputedStyle(this.documentElement).overflowX}overflowY(t){return t&&(this.documentElement.style.overflowY=t),this.window.getComputedStyle(this.documentElement).overflowY}css(t,e,i){var n=this.content||this.document.body;return e?n.style.setProperty(t,e,i?"important":""):n.style.removeProperty(t),this.window.getComputedStyle(n)[t]}viewport(t){var e,i=this.document.querySelector("meta[name='viewport']"),n={width:void 0,height:void 0,scale:void 0,minimum:void 0,maximum:void 0,scalable:void 0},s=[];if(i&&i.hasAttribute("content")){let t=i.getAttribute("content"),e=t.match(/width\s*=\s*([^,]*)/),s=t.match(/height\s*=\s*([^,]*)/),r=t.match(/initial-scale\s*=\s*([^,]*)/),o=t.match(/minimum-scale\s*=\s*([^,]*)/),a=t.match(/maximum-scale\s*=\s*([^,]*)/),h=t.match(/user-scalable\s*=\s*([^,]*)/);e&&e.length&&void 0!==e[1]&&(n.width=e[1]),s&&s.length&&void 0!==s[1]&&(n.height=s[1]),r&&r.length&&void 0!==r[1]&&(n.scale=r[1]),o&&o.length&&void 0!==o[1]&&(n.minimum=o[1]),a&&a.length&&void 0!==a[1]&&(n.maximum=a[1]),h&&h.length&&void 0!==h[1]&&(n.scalable=h[1])}return e=Object(r.defaults)(t||{},n),t&&(e.width&&s.push("width="+e.width),e.height&&s.push("height="+e.height),e.scale&&s.push("initial-scale="+e.scale),"no"===e.scalable?(s.push("minimum-scale="+e.scale),s.push("maximum-scale="+e.scale),s.push("user-scalable="+e.scalable)):(e.scalable&&s.push("user-scalable="+e.scalable),e.minimum&&s.push("minimum-scale="+e.minimum),e.maximum&&s.push("minimum-scale="+e.maximum)),i||((i=this.document.createElement("meta")).setAttribute("name","viewport"),this.document.querySelector("head").appendChild(i)),i.setAttribute("content",s.join(", ")),this.window.scrollTo(0,0)),e}expand(){this.emit(l.c.CONTENTS.EXPAND)}listeners(){this.imageLoadListeners(),this.mediaQueryListeners(),this.addEventListeners(),this.addSelectionListeners(),"undefined"==typeof ResizeObserver?(this.resizeListeners(),this.visibilityListeners()):this.resizeObservers(),this.linksHandler()}removeListeners(){this.removeEventListeners(),this.removeSelectionListeners(),this.observer&&this.observer.disconnect(),clearTimeout(this.expanding)}resizeCheck(){let t=this.textWidth(),e=this.textHeight();t==this._size.width&&e==this._size.height||(this._size={width:t,height:e},this.onResize&&this.onResize(this._size),this.emit(l.c.CONTENTS.RESIZE,this._size))}resizeListeners(){clearTimeout(this.expanding),requestAnimationFrame(this.resizeCheck.bind(this)),this.expanding=setTimeout(this.resizeListeners.bind(this),350)}visibilityListeners(){document.addEventListener("visibilitychange",()=>{"visible"===document.visibilityState&&!1===this.active?(this.active=!0,this.resizeListeners()):(this.active=!1,clearTimeout(this.expanding))})}transitionListeners(){let t=this.content;t.style.transitionProperty="font, font-size, font-size-adjust, font-stretch, font-variation-settings, font-weight, width, height",t.style.transitionDuration="0.001ms",t.style.transitionTimingFunction="linear",t.style.transitionDelay="0",this._resizeCheck=this.resizeCheck.bind(this),this.document.addEventListener("transitionend",this._resizeCheck)}mediaQueryListeners(){for(var t=this.document.styleSheets,e=function(t){t.matches&&!this._expanding&&setTimeout(this.expand.bind(this),1)}.bind(this),i=0;i<t.length;i+=1){var n;try{n=t[i].cssRules}catch(t){return}if(!n)return;for(var s=0;s<n.length;s+=1){if(n[s].media)this.window.matchMedia(n[s].media.mediaText).addListener(e)}}}resizeObservers(){this.observer=new ResizeObserver(t=>{requestAnimationFrame(this.resizeCheck.bind(this))}),this.observer.observe(this.document.documentElement)}mutationObservers(){this.observer=new MutationObserver(t=>{this.resizeCheck()});this.observer.observe(this.document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})}imageLoadListeners(){for(var t,e=this.document.querySelectorAll("img"),i=0;i<e.length;i++)void 0!==(t=e[i]).naturalWidth&&0===t.naturalWidth&&(t.onload=this.expand.bind(this))}fontLoadListeners(){this.document&&this.document.fonts&&this.document.fonts.ready.then(function(){this.resizeCheck()}.bind(this))}root(){return this.document?this.document.documentElement:null}locationOf(t,e){var i,n={left:0,top:0};if(!this.document)return n;if(this.epubcfi.isCfiString(t)){let s=new o.a(t).toRange(this.document,e);if(s){try{if(!s.endContainer||s.startContainer==s.endContainer&&s.startOffset==s.endOffset){let t=s.startContainer.textContent.indexOf(" ",s.startOffset);-1==t&&(t=s.startContainer.textContent.length),s.setEnd(s.startContainer,t)}}catch(t){console.error("setting end offset to start container length failed",t)}if(s.startContainer.nodeType===Node.ELEMENT_NODE)i=s.startContainer.getBoundingClientRect(),n.left=i.left,n.top=i.top;else if(d){let t=s.startContainer,e=new Range;try{1===t.nodeType?i=t.getBoundingClientRect():s.startOffset+2<t.length?(e.setStart(t,s.startOffset),e.setEnd(t,s.startOffset+2),i=e.getBoundingClientRect()):s.startOffset-2>0?(e.setStart(t,s.startOffset-2),e.setEnd(t,s.startOffset),i=e.getBoundingClientRect()):i=t.parentNode.getBoundingClientRect()}catch(t){console.error(t,t.stack)}}else i=s.getBoundingClientRect()}}else if("string"==typeof t&&t.indexOf("#")>-1){let e=t.substring(t.indexOf("#")+1),n=this.document.getElementById(e);if(n)if(d){let t=new Range;t.selectNode(n),i=t.getBoundingClientRect()}else i=n.getBoundingClientRect()}return i&&(n.left=i.left,n.top=i.top),n}addStylesheet(t){return new Promise(function(e,i){var n,s=!1;this.document?(n=this.document.querySelector("link[href='"+t+"']"))?e(!0):((n=this.document.createElement("link")).type="text/css",n.rel="stylesheet",n.href=t,n.onload=n.onreadystatechange=function(){s||this.readyState&&"complete"!=this.readyState||(s=!0,setTimeout(()=>{e(!0)},1))},this.document.head.appendChild(n)):e(!1)}.bind(this))}_getStylesheetNode(t){var e;return t="epubjs-inserted-css-"+(t||""),!!this.document&&((e=this.document.getElementById(t))||((e=this.document.createElement("style")).id=t,this.document.head.appendChild(e)),e)}addStylesheetCss(t,e){return!(!this.document||!t)&&(this._getStylesheetNode(e).innerHTML=t,!0)}addStylesheetRules(t,e){var i;if(this.document&&t&&0!==t.length)if(i=this._getStylesheetNode(e).sheet,"[object Array]"===Object.prototype.toString.call(t))for(var n=0,s=t.length;n<s;n++){var r=1,o=t[n],a=t[n][0],h="";"[object Array]"===Object.prototype.toString.call(o[1][0])&&(o=o[1],r=0);for(var l=o.length;r<l;r++){var c=o[r];h+=c[0]+":"+c[1]+(c[2]?" !important":"")+";\n"}i.insertRule(a+"{"+h+"}",i.cssRules.length)}else{Object.keys(t).forEach(e=>{const n=t[e];if(Array.isArray(n))n.forEach(t=>{const n=Object.keys(t).map(e=>`${e}:${t[e]}`).join(";");i.insertRule(`${e}{${n}}`,i.cssRules.length)});else{const t=Object.keys(n).map(t=>`${t}:${n[t]}`).join(";");i.insertRule(`${e}{${t}}`,i.cssRules.length)}})}}addScript(t){return new Promise(function(e,i){var n,s=!1;this.document?((n=this.document.createElement("script")).type="text/javascript",n.async=!0,n.src=t,n.onload=n.onreadystatechange=function(){s||this.readyState&&"complete"!=this.readyState||(s=!0,setTimeout((function(){e(!0)}),1))},this.document.head.appendChild(n)):e(!1)}.bind(this))}addClass(t){var e;this.document&&(e=this.content||this.document.body)&&e.classList.add(t)}removeClass(t){var e;this.document&&(e=this.content||this.document.body)&&e.classList.remove(t)}addEventListeners(){this.document&&(this._triggerEvent=this.triggerEvent.bind(this),l.a.forEach((function(t){this.document.addEventListener(t,this._triggerEvent,{passive:!0})}),this))}removeEventListeners(){this.document&&(l.a.forEach((function(t){this.document.removeEventListener(t,this._triggerEvent,{passive:!0})}),this),this._triggerEvent=void 0)}triggerEvent(t){this.emit(t.type,t)}addSelectionListeners(){this.document&&(this._onSelectionChange=this.onSelectionChange.bind(this),this.document.addEventListener("selectionchange",this._onSelectionChange,{passive:!0}))}removeSelectionListeners(){this.document&&(this.document.removeEventListener("selectionchange",this._onSelectionChange,{passive:!0}),this._onSelectionChange=void 0)}onSelectionChange(t){this.selectionEndTimeout&&clearTimeout(this.selectionEndTimeout),this.selectionEndTimeout=setTimeout(function(){var t=this.window.getSelection();this.triggerSelectedEvent(t)}.bind(this),250)}triggerSelectedEvent(t){var e,i;t&&t.rangeCount>0&&((e=t.getRangeAt(0)).collapsed||(i=new o.a(e,this.cfiBase).toString(),this.emit(l.c.CONTENTS.SELECTED,i),this.emit(l.c.CONTENTS.SELECTED_RANGE,e)))}range(t,e){return new o.a(t).toRange(this.document,e)}cfiFromRange(t,e){return new o.a(t,this.cfiBase,e).toString()}cfiFromNode(t,e){return new o.a(t,this.cfiBase,e).toString()}map(t){return new a.a(t).section()}size(t,e){var i={scale:1,scalable:"no"};this.layoutStyle("scrolling"),t>=0&&(this.width(t),i.width=t,this.css("padding","0 "+t/12+"px")),e>=0&&(this.height(e),i.height=e),this.css("margin","0"),this.css("box-sizing","border-box"),this.viewport(i)}columns(t,e,i,n,s){let o=Object(r.prefixed)("column-axis"),a=Object(r.prefixed)("column-gap"),h=Object(r.prefixed)("column-width"),l=Object(r.prefixed)("column-fill"),c=0===this.writingMode().indexOf("vertical")?"vertical":"horizontal";this.layoutStyle("paginated"),"rtl"===s&&"horizontal"===c&&this.direction(s),this.width(t),this.height(e),this.viewport({width:t,height:e,scale:1,scalable:"no"}),this.css("overflow-y","hidden"),this.css("margin","0",!0),"vertical"===c?(this.css("padding-top",n/2+"px",!0),this.css("padding-bottom",n/2+"px",!0),this.css("padding-left","20px"),this.css("padding-right","20px"),this.css(o,"vertical")):(this.css("padding-top","20px"),this.css("padding-bottom","20px"),this.css("padding-left",n/2+"px",!0),this.css("padding-right",n/2+"px",!0),this.css(o,"horizontal")),this.css("box-sizing","border-box"),this.css("max-width","inherit"),this.css(l,"auto"),this.css(a,n+"px"),this.css(h,i+"px"),this.css("-webkit-line-box-contain","block glyphs replaced")}scaler(t,e,i){var n="scale("+t+")",s="";this.css("transform-origin","top left"),(e>=0||i>=0)&&(s=" translate("+(e||0)+"px, "+(i||0)+"px )"),this.css("transform",n+s)}fit(t,e,i){var n=this.viewport(),s=parseInt(n.width),r=parseInt(n.height),o=t/s,a=e/r,h=o<a?o:a;if(this.layoutStyle("paginated"),this.width(s),this.height(r),this.overflow("hidden"),this.scaler(h,0,0),this.css("background-size",s*h+"px "+r*h+"px"),this.css("background-color","transparent"),i&&i.properties.includes("page-spread-left")){var l=t-s*h;this.css("margin-left",l+"px")}}direction(t){this.documentElement&&(this.documentElement.style.direction=t)}mapPage(t,e,i,n,s){return new a.a(e,s).page(this,t,i,n)}linksHandler(){Object(h.c)(this.content,t=>{this.emit(l.c.CONTENTS.LINK_CLICKED,t)})}writingMode(t){let e=Object(r.prefixed)("writing-mode");return t&&this.documentElement&&(this.documentElement.style[e]=t),this.window.getComputedStyle(this.documentElement)[e]||""}layoutStyle(t){return t&&(this._layoutStyle=t,navigator.epubReadingSystem.layoutStyle=this._layoutStyle),this._layoutStyle||"paginated"}epubReadingSystem(t,e){return navigator.epubReadingSystem={name:t,version:e,layoutStyle:this.layoutStyle(),hasFeature:function(t){switch(t){case"dom-manipulation":case"layout-changes":case"touch-events":case"mouse-events":case"keyboard-events":return!0;case"spine-scripting":default:return!1}}},navigator.epubReadingSystem}destroy(){this.removeListeners()}}s()(f.prototype),e.a=f},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Underline=e.Highlight=e.Mark=e.Pane=void 0;var n=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),s=o(i(49)),r=o(i(50));function o(t){return t&&t.__esModule?t:{default:t}}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function h(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function l(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}e.Pane=function(){function t(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document.body;l(this,t),this.target=e,this.element=s.default.createElement("svg"),this.marks=[],this.element.style.position="absolute",this.element.setAttribute("pointer-events","none"),r.default.proxyMouse(this.target,this.marks),this.container=i,this.container.appendChild(this.element),this.render()}return n(t,[{key:"addMark",value:function(t){var e=s.default.createElement("g");return this.element.appendChild(e),t.bind(e,this.container),this.marks.push(t),t.render(),t}},{key:"removeMark",value:function(t){var e=this.marks.indexOf(t);if(-1!==e){var i=t.unbind();this.element.removeChild(i),this.marks.splice(e,1)}}},{key:"render",value:function(){var t,e,i,n;!function(t,e){t.style.setProperty("top",e.top+"px","important"),t.style.setProperty("left",e.left+"px","important"),t.style.setProperty("height",e.height+"px","important"),t.style.setProperty("width",e.width+"px","important")}(this.element,(t=this.target,e=this.container,i=e.getBoundingClientRect(),n=t.getBoundingClientRect(),{top:n.top-i.top,left:n.left-i.left,height:t.scrollHeight,width:t.scrollWidth}));var s=!0,r=!1,o=void 0;try{for(var a,h=this.marks[Symbol.iterator]();!(s=(a=h.next()).done);s=!0){a.value.render()}}catch(t){r=!0,o=t}finally{try{!s&&h.return&&h.return()}finally{if(r)throw o}}}}]),t}();var c=e.Mark=function(){function t(){l(this,t),this.element=null}return n(t,[{key:"bind",value:function(t,e){this.element=t,this.container=e}},{key:"unbind",value:function(){var t=this.element;return this.element=null,t}},{key:"render",value:function(){}},{key:"dispatchEvent",value:function(t){this.element&&this.element.dispatchEvent(t)}},{key:"getBoundingClientRect",value:function(){return this.element.getBoundingClientRect()}},{key:"getClientRects",value:function(){for(var t=[],e=this.element.firstChild;e;)t.push(e.getBoundingClientRect()),e=e.nextSibling;return t}},{key:"filteredRanges",value:function(){var t=Array.from(this.range.getClientRects());return t.filter((function(e){for(var i=0;i<t.length;i++){if(t[i]===e)return!0;if(n=t[i],(s=e).right<=n.right&&s.left>=n.left&&s.top>=n.top&&s.bottom<=n.bottom)return!1}var n,s;return!0}))}}]),t}(),u=e.Highlight=function(t){function e(t,i,n,s){l(this,e);var r=a(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));return r.range=t,r.className=i,r.data=n||{},r.attributes=s||{},r}return h(e,t),n(e,[{key:"bind",value:function(t,i){for(var n in function t(e,i,n){null===e&&(e=Function.prototype);var s=Object.getOwnPropertyDescriptor(e,i);if(void 0===s){var r=Object.getPrototypeOf(e);return null===r?void 0:t(r,i,n)}if("value"in s)return s.value;var o=s.get;return void 0!==o?o.call(n):void 0}(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"bind",this).call(this,t,i),this.data)this.data.hasOwnProperty(n)&&(this.element.dataset[n]=this.data[n]);for(var n in this.attributes)this.attributes.hasOwnProperty(n)&&this.element.setAttribute(n,this.attributes[n]);this.className&&this.element.classList.add(this.className)}},{key:"render",value:function(){for(;this.element.firstChild;)this.element.removeChild(this.element.firstChild);for(var t=this.element.ownerDocument.createDocumentFragment(),e=this.filteredRanges(),i=this.element.getBoundingClientRect(),n=this.container.getBoundingClientRect(),r=0,o=e.length;r<o;r++){var a=e[r],h=s.default.createElement("rect");h.setAttribute("x",a.left-i.left+n.left),h.setAttribute("y",a.top-i.top+n.top),h.setAttribute("height",a.height),h.setAttribute("width",a.width),t.appendChild(h)}this.element.appendChild(t)}}]),e}(c);e.Underline=function(t){function e(t,i,n,s){return l(this,e),a(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,i,n,s))}return h(e,t),n(e,[{key:"render",value:function(){for(;this.element.firstChild;)this.element.removeChild(this.element.firstChild);for(var t=this.element.ownerDocument.createDocumentFragment(),e=this.filteredRanges(),i=this.element.getBoundingClientRect(),n=this.container.getBoundingClientRect(),r=0,o=e.length;r<o;r++){var a=e[r],h=s.default.createElement("rect");h.setAttribute("x",a.left-i.left+n.left),h.setAttribute("y",a.top-i.top+n.top),h.setAttribute("height",a.height),h.setAttribute("width",a.width),h.setAttribute("fill","none");var l=s.default.createElement("line");l.setAttribute("x1",a.left-i.left+n.left),l.setAttribute("x2",a.left-i.left+n.left+a.width),l.setAttribute("y1",a.top-i.top+n.top+a.height-1),l.setAttribute("y2",a.top-i.top+n.top+a.height-1),l.setAttribute("stroke-width",1),l.setAttribute("stroke","black"),l.setAttribute("stroke-linecap","square"),t.appendChild(h),t.appendChild(l)}this.element.appendChild(t)}}]),e}(u)},function(t,e,i){"use strict";function n(t,e){return void 0===e&&(e=Object),e&&"function"==typeof e.freeze?e.freeze(t):t}var s=n({HTML:"text/html",isHTML:function(t){return t===s.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),r=n({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(t){return t===r.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});e.freeze=n,e.MIME_TYPE=s,e.NAMESPACE=r},function(t,e,i){var n=i(25);e.DOMImplementation=n.DOMImplementation,e.XMLSerializer=n.XMLSerializer,e.DOMParser=i(46).DOMParser},function(t,e,i){"use strict";var n=i(3),s=i.n(n),r=i(0),o=i(6),a=i(2),h=i(9),l=i(1);class c{constructor(t){this.settings=t,this.name=t.layout||"reflowable",this._spread="none"!==t.spread,this._minSpreadWidth=t.minSpreadWidth||800,this._evenSpreads=t.evenSpreads||!1,"scrolled"===t.flow||"scrolled-continuous"===t.flow||"scrolled-doc"===t.flow?this._flow="scrolled":this._flow="paginated",this.width=0,this.height=0,this.spreadWidth=0,this.delta=0,this.columnWidth=0,this.gap=0,this.divisor=1,this.props={name:this.name,spread:this._spread,flow:this._flow,width:0,height:0,spreadWidth:0,delta:0,columnWidth:0,gap:0,divisor:1}}flow(t){return void 0!==t&&(this._flow="scrolled"===t||"scrolled-continuous"===t||"scrolled-doc"===t?"scrolled":"paginated",this.update({flow:this._flow})),this._flow}spread(t,e){return t&&(this._spread="none"!==t,this.update({spread:this._spread})),e>=0&&(this._minSpreadWidth=e),this._spread}calculate(t,e,i){var n,s,r,o,a=1,h=i||0,l=t,c=e,u=Math.floor(l/12);a=this._spread&&l>=this._minSpreadWidth?2:1,"reflowable"!==this.name||"paginated"!==this._flow||i>=0||(h=u%2==0?u:u-1),"pre-paginated"===this.name&&(h=0),a>1?r=(n=l/a-h)+h:(n=l,r=l),"pre-paginated"===this.name&&a>1&&(l=n),s=n*a+h,o=l,this.width=l,this.height=c,this.spreadWidth=s,this.pageWidth=r,this.delta=o,this.columnWidth=n,this.gap=h,this.divisor=a,this.update({width:l,height:c,spreadWidth:s,pageWidth:r,delta:o,columnWidth:n,gap:h,divisor:a})}format(t,e,i){return"pre-paginated"===this.name?t.fit(this.columnWidth,this.height,e):"paginated"===this._flow?t.columns(this.width,this.height,this.columnWidth,this.gap,this.settings.direction):i&&"horizontal"===i?t.size(null,this.height):t.size(this.width,null)}count(t,e){let i,n;return"pre-paginated"===this.name?(i=1,n=1):"paginated"===this._flow?(e=e||this.delta,i=Math.ceil(t/e),n=i*this.divisor):(e=e||this.height,i=Math.ceil(t/e),n=i),{spreads:i,pages:n}}update(t){if(Object.keys(t).forEach(e=>{this.props[e]===t[e]&&delete t[e]}),Object.keys(t).length>0){let e=Object(r.extend)(this.props,t);this.emit(l.c.LAYOUT.UPDATED,e,t)}}}s()(c.prototype);var u=c,d=i(5);var f=class{constructor(t){this.rendition=t,this._themes={default:{rules:{},url:"",serialized:""}},this._overrides={},this._current="default",this._injected=[],this.rendition.hooks.content.register(this.inject.bind(this)),this.rendition.hooks.content.register(this.overrides.bind(this))}register(){if(0!==arguments.length)return 1===arguments.length&&"object"==typeof arguments[0]?this.registerThemes(arguments[0]):1===arguments.length&&"string"==typeof arguments[0]?this.default(arguments[0]):2===arguments.length&&"string"==typeof arguments[1]?this.registerUrl(arguments[0],arguments[1]):2===arguments.length&&"object"==typeof arguments[1]?this.registerRules(arguments[0],arguments[1]):void 0}default(t){if(t)return"string"==typeof t?this.registerUrl("default",t):"object"==typeof t?this.registerRules("default",t):void 0}registerThemes(t){for(var e in t)t.hasOwnProperty(e)&&("string"==typeof t[e]?this.registerUrl(e,t[e]):this.registerRules(e,t[e]))}registerCss(t,e){this._themes[t]={serialized:e},(this._injected[t]||"default"==t)&&this.update(t)}registerUrl(t,e){var i=new d.a(e);this._themes[t]={url:i.toString()},(this._injected[t]||"default"==t)&&this.update(t)}registerRules(t,e){this._themes[t]={rules:e},(this._injected[t]||"default"==t)&&this.update(t)}select(t){var e=this._current;this._current=t,this.update(t),this.rendition.getContents().forEach(i=>{i.removeClass(e),i.addClass(t)})}update(t){this.rendition.getContents().forEach(e=>{this.add(t,e)})}inject(t){var e,i=[],n=this._themes;for(var s in n)!n.hasOwnProperty(s)||s!==this._current&&"default"!==s||(((e=n[s]).rules&&Object.keys(e.rules).length>0||e.url&&-1===i.indexOf(e.url))&&this.add(s,t),this._injected.push(s));"default"!=this._current&&t.addClass(this._current)}add(t,e){var i=this._themes[t];i&&e&&(i.url?e.addStylesheet(i.url):i.serialized?(e.addStylesheetCss(i.serialized,t),i.injected=!0):i.rules&&(e.addStylesheetRules(i.rules,t),i.injected=!0))}override(t,e,i){var n=this.rendition.getContents();this._overrides[t]={value:e,priority:!0===i},n.forEach(e=>{e.css(t,this._overrides[t].value,this._overrides[t].priority)})}removeOverride(t){var e=this.rendition.getContents();delete this._overrides[t],e.forEach(e=>{e.css(t)})}overrides(t){var e=this._overrides;for(var i in e)e.hasOwnProperty(i)&&t.css(i,e[i].value,e[i].priority)}fontSize(t){this.override("font-size",t)}font(t){this.override("font-family",t,!0)}destroy(){this.rendition=void 0,this._themes=void 0,this._overrides=void 0,this._current=void 0,this._injected=void 0}};i(12);class p{constructor({type:t,cfiRange:e,data:i,sectionIndex:n,cb:s,className:r,styles:o}){this.type=t,this.cfiRange=e,this.data=i,this.sectionIndex=n,this.mark=void 0,this.cb=s,this.className=r,this.styles=o}update(t){this.data=t}attach(t){let e,{cfiRange:i,data:n,type:s,mark:r,cb:o,className:a,styles:h}=this;return"highlight"===s?e=t.highlight(i,n,o,a,h):"underline"===s?e=t.underline(i,n,o,a,h):"mark"===s&&(e=t.mark(i,n,o)),this.mark=e,this.emit(l.c.ANNOTATION.ATTACH,e),e}detach(t){let e,{cfiRange:i,type:n}=this;return t&&("highlight"===n?e=t.unhighlight(i):"underline"===n?e=t.ununderline(i):"mark"===n&&(e=t.unmark(i))),this.mark=void 0,this.emit(l.c.ANNOTATION.DETACH,e),e}text(){}}s()(p.prototype);var g=class{constructor(t){this.rendition=t,this.highlights=[],this.underlines=[],this.marks=[],this._annotations={},this._annotationsBySectionIndex={},this.rendition.hooks.render.register(this.inject.bind(this)),this.rendition.hooks.unloaded.register(this.clear.bind(this))}add(t,e,i,n,s,r){let o=encodeURI(e+t),h=new a.a(e).spinePos,l=new p({type:t,cfiRange:e,data:i,sectionIndex:h,cb:n,className:s,styles:r});return this._annotations[o]=l,h in this._annotationsBySectionIndex?this._annotationsBySectionIndex[h].push(o):this._annotationsBySectionIndex[h]=[o],this.rendition.views().forEach(t=>{l.sectionIndex===t.index&&l.attach(t)}),l}remove(t,e){let i=encodeURI(t+e);if(i in this._annotations){let t=this._annotations[i];if(e&&t.type!==e)return;this.rendition.views().forEach(e=>{this._removeFromAnnotationBySectionIndex(t.sectionIndex,i),t.sectionIndex===e.index&&t.detach(e)}),delete this._annotations[i]}}_removeFromAnnotationBySectionIndex(t,e){this._annotationsBySectionIndex[t]=this._annotationsAt(t).filter(t=>t!==e)}_annotationsAt(t){return this._annotationsBySectionIndex[t]}highlight(t,e,i,n,s){return this.add("highlight",t,e,i,n,s)}underline(t,e,i,n,s){return this.add("underline",t,e,i,n,s)}mark(t,e,i){return this.add("mark",t,e,i)}each(){return this._annotations.forEach.apply(this._annotations,arguments)}inject(t){let e=t.index;if(e in this._annotationsBySectionIndex){this._annotationsBySectionIndex[e].forEach(e=>{this._annotations[e].attach(t)})}}clear(t){let e=t.index;if(e in this._annotationsBySectionIndex){this._annotationsBySectionIndex[e].forEach(e=>{this._annotations[e].detach(t)})}}show(){}hide(){}},m=i(20),v=i(10),y=i(22);class b{constructor(t,e){this.settings=Object(r.extend)(this.settings||{},{width:null,height:null,ignoreClass:"",manager:"default",view:"iframe",flow:null,layout:null,spread:null,minSpreadWidth:800,stylesheet:null,resizeOnOrientationChange:!0,script:null,snap:!1,defaultDirection:"ltr",allowScriptedContent:!1,allowPopups:!1}),Object(r.extend)(this.settings,e),"object"==typeof this.settings.manager&&(this.manager=this.settings.manager),this.book=t,this.hooks={},this.hooks.display=new o.a(this),this.hooks.serialize=new o.a(this),this.hooks.content=new o.a(this),this.hooks.unloaded=new o.a(this),this.hooks.layout=new o.a(this),this.hooks.render=new o.a(this),this.hooks.show=new o.a(this),this.hooks.content.register(this.handleLinks.bind(this)),this.hooks.content.register(this.passEvents.bind(this)),this.hooks.content.register(this.adjustImages.bind(this)),this.book.spine.hooks.content.register(this.injectIdentifier.bind(this)),this.settings.stylesheet&&this.book.spine.hooks.content.register(this.injectStylesheet.bind(this)),this.settings.script&&this.book.spine.hooks.content.register(this.injectScript.bind(this)),this.themes=new f(this),this.annotations=new g(this),this.epubcfi=new a.a,this.q=new h.a(this),this.location=void 0,this.q.enqueue(this.book.opened),this.starting=new r.defer,this.started=this.starting.promise,this.q.enqueue(this.start)}setManager(t){this.manager=t}requireManager(t){return"string"==typeof t&&"default"===t?v.a:"string"==typeof t&&"continuous"===t?y.a:t}requireView(t){return"string"==typeof t&&"iframe"===t?m.a:t}start(){switch(this.settings.layout||"pre-paginated"!==this.book.package.metadata.layout&&"true"!==this.book.displayOptions.fixedLayout||(this.settings.layout="pre-paginated"),this.book.package.metadata.spread){case"none":this.settings.spread="none";break;case"both":this.settings.spread=!0}this.manager||(this.ViewManager=this.requireManager(this.settings.manager),this.View=this.requireView(this.settings.view),this.manager=new this.ViewManager({view:this.View,queue:this.q,request:this.book.load.bind(this.book),settings:this.settings})),this.direction(this.book.package.metadata.direction||this.settings.defaultDirection),this.settings.globalLayoutProperties=this.determineLayoutProperties(this.book.package.metadata),this.flow(this.settings.globalLayoutProperties.flow),this.layout(this.settings.globalLayoutProperties),this.manager.on(l.c.MANAGERS.ADDED,this.afterDisplayed.bind(this)),this.manager.on(l.c.MANAGERS.REMOVED,this.afterRemoved.bind(this)),this.manager.on(l.c.MANAGERS.RESIZED,this.onResized.bind(this)),this.manager.on(l.c.MANAGERS.ORIENTATION_CHANGE,this.onOrientationChange.bind(this)),this.manager.on(l.c.MANAGERS.SCROLLED,this.reportLocation.bind(this)),this.emit(l.c.RENDITION.STARTED),this.starting.resolve()}attachTo(t){return this.q.enqueue(function(){this.manager.render(t,{width:this.settings.width,height:this.settings.height}),this.emit(l.c.RENDITION.ATTACHED)}.bind(this))}display(t){return this.displaying&&this.displaying.resolve(),this.q.enqueue(this._display,t)}_display(t){if(this.book){this.epubcfi.isCfiString(t);var e,i=new r.defer,n=i.promise;return this.displaying=i,this.book.locations.length()&&Object(r.isFloat)(t)&&(t=this.book.locations.cfiFromPercentage(parseFloat(t))),(e=this.book.spine.get(t))?(this.manager.display(e,t).then(()=>{i.resolve(e),this.displaying=void 0,this.emit(l.c.RENDITION.DISPLAYED,e),this.reportLocation()},t=>{this.emit(l.c.RENDITION.DISPLAY_ERROR,t)}),n):(i.reject(new Error("No Section Found")),n)}}afterDisplayed(t){t.on(l.c.VIEWS.MARK_CLICKED,(e,i)=>this.triggerMarkEvent(e,i,t.contents)),this.hooks.render.trigger(t,this).then(()=>{t.contents?this.hooks.content.trigger(t.contents,this).then(()=>{this.emit(l.c.RENDITION.RENDERED,t.section,t)}):this.emit(l.c.RENDITION.RENDERED,t.section,t)})}afterRemoved(t){this.hooks.unloaded.trigger(t,this).then(()=>{this.emit(l.c.RENDITION.REMOVED,t.section,t)})}onResized(t,e){this.emit(l.c.RENDITION.RESIZED,{width:t.width,height:t.height},e),this.location&&this.location.start&&this.display(e||this.location.start.cfi)}onOrientationChange(t){this.emit(l.c.RENDITION.ORIENTATION_CHANGE,t)}moveTo(t){this.manager.moveTo(t)}resize(t,e,i){t&&(this.settings.width=t),e&&(this.settings.height=e),this.manager.resize(t,e,i)}clear(){this.manager.clear()}next(){return this.q.enqueue(this.manager.next.bind(this.manager)).then(this.reportLocation.bind(this))}prev(){return this.q.enqueue(this.manager.prev.bind(this.manager)).then(this.reportLocation.bind(this))}determineLayoutProperties(t){var e=this.settings.layout||t.layout||"reflowable",i=this.settings.spread||t.spread||"auto",n=this.settings.orientation||t.orientation||"auto",s=this.settings.flow||t.flow||"auto",r=t.viewport||"",o=this.settings.minSpreadWidth||t.minSpreadWidth||800,a=this.settings.direction||t.direction||"ltr";return(0===this.settings.width||this.settings.width>0)&&(0===this.settings.height||this.settings.height),{layout:e,spread:i,orientation:n,flow:s,viewport:r,minSpreadWidth:o,direction:a}}flow(t){var e=t;"scrolled"!==t&&"scrolled-doc"!==t&&"scrolled-continuous"!==t||(e="scrolled"),"auto"!==t&&"paginated"!==t||(e="paginated"),this.settings.flow=t,this._layout&&this._layout.flow(e),this.manager&&this._layout&&this.manager.applyLayout(this._layout),this.manager&&this.manager.updateFlow(e),this.manager&&this.manager.isRendered()&&this.location&&(this.manager.clear(),this.display(this.location.start.cfi))}layout(t){return t&&(this._layout=new u(t),this._layout.spread(t.spread,this.settings.minSpreadWidth),this._layout.on(l.c.LAYOUT.UPDATED,(t,e)=>{this.emit(l.c.RENDITION.LAYOUT,t,e)})),this.manager&&this._layout&&this.manager.applyLayout(this._layout),this._layout}spread(t,e){this.settings.spread=t,e&&(this.settings.minSpreadWidth=e),this._layout&&this._layout.spread(t,e),this.manager&&this.manager.isRendered()&&this.manager.updateLayout()}direction(t){this.settings.direction=t||"ltr",this.manager&&this.manager.direction(this.settings.direction),this.manager&&this.manager.isRendered()&&this.location&&(this.manager.clear(),this.display(this.location.start.cfi))}reportLocation(){return this.q.enqueue(function(){requestAnimationFrame(function(){var t=this.manager.currentLocation();if(t&&t.then&&"function"==typeof t.then)t.then(function(t){let e=this.located(t);e&&e.start&&e.end&&(this.location=e,this.emit(l.c.RENDITION.LOCATION_CHANGED,{index:this.location.start.index,href:this.location.start.href,start:this.location.start.cfi,end:this.location.end.cfi,percentage:this.location.start.percentage}),this.emit(l.c.RENDITION.RELOCATED,this.location))}.bind(this));else if(t){let e=this.located(t);if(!e||!e.start||!e.end)return;this.location=e,this.emit(l.c.RENDITION.LOCATION_CHANGED,{index:this.location.start.index,href:this.location.start.href,start:this.location.start.cfi,end:this.location.end.cfi,percentage:this.location.start.percentage}),this.emit(l.c.RENDITION.RELOCATED,this.location)}}.bind(this))}.bind(this))}currentLocation(){var t=this.manager.currentLocation();if(t&&t.then&&"function"==typeof t.then)t.then(function(t){return this.located(t)}.bind(this));else if(t){return this.located(t)}}located(t){if(!t.length)return{};let e=t[0],i=t[t.length-1],n={start:{index:e.index,href:e.href,cfi:e.mapping.start,displayed:{page:e.pages[0]||1,total:e.totalPages}},end:{index:i.index,href:i.href,cfi:i.mapping.end,displayed:{page:i.pages[i.pages.length-1]||1,total:i.totalPages}}},s=this.book.locations.locationFromCfi(e.mapping.start),r=this.book.locations.locationFromCfi(i.mapping.end);null!=s&&(n.start.location=s,n.start.percentage=this.book.locations.percentageFromLocation(s)),null!=r&&(n.end.location=r,n.end.percentage=this.book.locations.percentageFromLocation(r));let o=this.book.pageList.pageFromCfi(e.mapping.start),a=this.book.pageList.pageFromCfi(i.mapping.end);return-1!=o&&(n.start.page=o),-1!=a&&(n.end.page=a),i.index===this.book.spine.last().index&&n.end.displayed.page>=n.end.displayed.total&&(n.atEnd=!0),e.index===this.book.spine.first().index&&1===n.start.displayed.page&&(n.atStart=!0),n}destroy(){this.manager&&this.manager.destroy(),this.book=void 0}passEvents(t){l.a.forEach(e=>{t.on(e,e=>this.triggerViewEvent(e,t))}),t.on(l.c.CONTENTS.SELECTED,e=>this.triggerSelectedEvent(e,t))}triggerViewEvent(t,e){this.emit(t.type,t,e)}triggerSelectedEvent(t,e){this.emit(l.c.RENDITION.SELECTED,t,e)}triggerMarkEvent(t,e,i){this.emit(l.c.RENDITION.MARK_CLICKED,t,e,i)}getRange(t,e){var i=new a.a(t),n=this.manager.visible().filter((function(t){if(i.spinePos===t.index)return!0}));if(n.length)return n[0].contents.range(i,e)}adjustImages(t){if("pre-paginated"===this._layout.name)return new Promise((function(t){t()}));let e=t.window.getComputedStyle(t.content,null),i=.95*(t.content.offsetHeight-(parseFloat(e.paddingTop)+parseFloat(e.paddingBottom))),n=parseFloat(e.paddingLeft)+parseFloat(e.paddingRight);return t.addStylesheetRules({img:{"max-width":(this._layout.columnWidth?this._layout.columnWidth-n+"px":"100%")+"!important","max-height":i+"px!important","object-fit":"contain","page-break-inside":"avoid","break-inside":"avoid","box-sizing":"border-box"},svg:{"max-width":(this._layout.columnWidth?this._layout.columnWidth-n+"px":"100%")+"!important","max-height":i+"px!important","page-break-inside":"avoid","break-inside":"avoid"}}),new Promise((function(t,e){setTimeout((function(){t()}),1)}))}getContents(){return this.manager?this.manager.getContents():[]}views(){return(this.manager?this.manager.views:void 0)||[]}handleLinks(t){t&&t.on(l.c.CONTENTS.LINK_CLICKED,t=>{let e=this.book.path.relative(t);this.display(e)})}injectStylesheet(t,e){let i=t.createElement("link");i.setAttribute("type","text/css"),i.setAttribute("rel","stylesheet"),i.setAttribute("href",this.settings.stylesheet),t.getElementsByTagName("head")[0].appendChild(i)}injectScript(t,e){let i=t.createElement("script");i.setAttribute("type","text/javascript"),i.setAttribute("src",this.settings.script),i.textContent=" ",t.getElementsByTagName("head")[0].appendChild(i)}injectIdentifier(t,e){let i=this.book.packaging.metadata.identifier,n=t.createElement("meta");n.setAttribute("name","dc.relation.ispartof"),i&&n.setAttribute("content",i),t.getElementsByTagName("head")[0].appendChild(n)}}s()(b.prototype);e.a=b},function(t,e){var i;i=function(){return this}();try{i=i||new Function("return this")()}catch(t){"object"==typeof window&&(i=window)}t.exports=i},function(t,e,i){"use strict";var n=i(38)();t.exports=function(t){return t!==n&&null!==t}},function(t,e){t.exports=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}},function(t,e,i){"use strict";var n=i(3),s=i.n(n),r=i(0),o=i(2),a=i(12),h=i(1),l=i(13);class c{constructor(t,e){this.settings=Object(r.extend)({ignoreClass:"",axis:void 0,direction:void 0,width:0,height:0,layout:void 0,globalLayoutProperties:{},method:void 0,forceRight:!1,allowScriptedContent:!1,allowPopups:!1},e||{}),this.id="epubjs-view-"+Object(r.uuid)(),this.section=t,this.index=t.index,this.element=this.container(this.settings.axis),this.added=!1,this.displayed=!1,this.rendered=!1,this.fixedWidth=0,this.fixedHeight=0,this.epubcfi=new o.a,this.layout=this.settings.layout,this.pane=void 0,this.highlights={},this.underlines={},this.marks={}}container(t){var e=document.createElement("div");return e.classList.add("epub-view"),e.style.height="0px",e.style.width="0px",e.style.overflow="hidden",e.style.position="relative",e.style.display="block",e.style.flex=t&&"horizontal"==t?"none":"initial",e}create(){return this.iframe||(this.element||(this.element=this.createContainer()),this.iframe=document.createElement("iframe"),this.iframe.id=this.id,this.iframe.scrolling="no",this.iframe.style.overflow="hidden",this.iframe.seamless="seamless",this.iframe.style.border="none",this.iframe.sandbox="allow-same-origin",this.settings.allowScriptedContent&&(this.iframe.sandbox+=" allow-scripts"),this.settings.allowPopups&&(this.iframe.sandbox+=" allow-popups"),this.iframe.setAttribute("enable-annotation","true"),this.resizing=!0,this.element.style.visibility="hidden",this.iframe.style.visibility="hidden",this.iframe.style.width="0",this.iframe.style.height="0",this._width=0,this._height=0,this.element.setAttribute("ref",this.index),this.added=!0,this.elementBounds=Object(r.bounds)(this.element),"srcdoc"in this.iframe?this.supportsSrcdoc=!0:this.supportsSrcdoc=!1,this.settings.method||(this.settings.method=this.supportsSrcdoc?"srcdoc":"write")),this.iframe}render(t,e){return this.create(),this.size(),this.sectionRender||(this.sectionRender=this.section.render(t)),this.sectionRender.then(function(t){return this.load(t)}.bind(this)).then(function(){let t,e=this.contents.writingMode();return t="scrolled"===this.settings.flow?0===e.indexOf("vertical")?"horizontal":"vertical":0===e.indexOf("vertical")?"vertical":"horizontal",0===e.indexOf("vertical")&&"paginated"===this.settings.flow&&(this.layout.delta=this.layout.height),this.setAxis(t),this.emit(h.c.VIEWS.AXIS,t),this.setWritingMode(e),this.emit(h.c.VIEWS.WRITING_MODE,e),this.layout.format(this.contents,this.section,this.axis),this.addListeners(),new Promise((t,e)=>{this.expand(),this.settings.forceRight&&(this.element.style.marginLeft=this.width()+"px"),t()})}.bind(this),function(t){return this.emit(h.c.VIEWS.LOAD_ERROR,t),new Promise((e,i)=>{i(t)})}.bind(this)).then(function(){this.emit(h.c.VIEWS.RENDERED,this.section)}.bind(this))}reset(){this.iframe&&(this.iframe.style.width="0",this.iframe.style.height="0",this._width=0,this._height=0,this._textWidth=void 0,this._contentWidth=void 0,this._textHeight=void 0,this._contentHeight=void 0),this._needsReframe=!0}size(t,e){var i=t||this.settings.width,n=e||this.settings.height;"pre-paginated"===this.layout.name?this.lock("both",i,n):"horizontal"===this.settings.axis?this.lock("height",i,n):this.lock("width",i,n),this.settings.width=i,this.settings.height=n}lock(t,e,i){var n,s=Object(r.borders)(this.element);n=this.iframe?Object(r.borders)(this.iframe):{width:0,height:0},"width"==t&&Object(r.isNumber)(e)&&(this.lockedWidth=e-s.width-n.width),"height"==t&&Object(r.isNumber)(i)&&(this.lockedHeight=i-s.height-n.height),"both"===t&&Object(r.isNumber)(e)&&Object(r.isNumber)(i)&&(this.lockedWidth=e-s.width-n.width,this.lockedHeight=i-s.height-n.height),this.displayed&&this.iframe&&this.expand()}expand(t){var e,i=this.lockedWidth,n=this.lockedHeight;this.iframe&&!this._expanding&&(this._expanding=!0,"pre-paginated"===this.layout.name?(i=this.layout.columnWidth,n=this.layout.height):"horizontal"===this.settings.axis?((i=this.contents.textWidth())%this.layout.pageWidth>0&&(i=Math.ceil(i/this.layout.pageWidth)*this.layout.pageWidth),this.settings.forceEvenPages&&(e=i/this.layout.pageWidth,this.layout.divisor>1&&"reflowable"===this.layout.name&&e%2>0&&(i+=this.layout.pageWidth))):"vertical"===this.settings.axis&&(n=this.contents.textHeight(),"paginated"===this.settings.flow&&n%this.layout.height>0&&(n=Math.ceil(n/this.layout.height)*this.layout.height)),(this._needsReframe||i!=this._width||n!=this._height)&&this.reframe(i,n),this._expanding=!1)}reframe(t,e){var i;Object(r.isNumber)(t)&&(this.element.style.width=t+"px",this.iframe.style.width=t+"px",this._width=t),Object(r.isNumber)(e)&&(this.element.style.height=e+"px",this.iframe.style.height=e+"px",this._height=e),i={width:t,height:e,widthDelta:this.prevBounds?t-this.prevBounds.width:t,heightDelta:this.prevBounds?e-this.prevBounds.height:e},this.pane&&this.pane.render(),requestAnimationFrame(()=>{let t;for(let e in this.marks)this.marks.hasOwnProperty(e)&&(t=this.marks[e],this.placeMark(t.element,t.range))}),this.onResize(this,i),this.emit(h.c.VIEWS.RESIZED,i),this.prevBounds=i,this.elementBounds=Object(r.bounds)(this.element)}load(t){var e=new r.defer,i=e.promise;if(!this.iframe)return e.reject(new Error("No Iframe Available")),i;if(this.iframe.onload=function(t){this.onLoad(t,e)}.bind(this),"blobUrl"===this.settings.method)this.blobUrl=Object(r.createBlobUrl)(t,"application/xhtml+xml"),this.iframe.src=this.blobUrl,this.element.appendChild(this.iframe);else if("srcdoc"===this.settings.method)this.iframe.srcdoc=t,this.element.appendChild(this.iframe);else{if(this.element.appendChild(this.iframe),this.document=this.iframe.contentDocument,!this.document)return e.reject(new Error("No Document Available")),i;if(this.iframe.contentDocument.open(),window.MSApp&&MSApp.execUnsafeLocalFunction){var n=this;MSApp.execUnsafeLocalFunction((function(){n.iframe.contentDocument.write(t)}))}else this.iframe.contentDocument.write(t);this.iframe.contentDocument.close()}return i}onLoad(t,e){this.window=this.iframe.contentWindow,this.document=this.iframe.contentDocument,this.contents=new a.a(this.document,this.document.body,this.section.cfiBase,this.section.index),this.rendering=!1;var i=this.document.querySelector("link[rel='canonical']");i?i.setAttribute("href",this.section.canonical):((i=this.document.createElement("link")).setAttribute("rel","canonical"),i.setAttribute("href",this.section.canonical),this.document.querySelector("head").appendChild(i)),this.contents.on(h.c.CONTENTS.EXPAND,()=>{this.displayed&&this.iframe&&(this.expand(),this.contents&&this.layout.format(this.contents))}),this.contents.on(h.c.CONTENTS.RESIZE,t=>{this.displayed&&this.iframe&&(this.expand(),this.contents&&this.layout.format(this.contents))}),e.resolve(this.contents)}setLayout(t){this.layout=t,this.contents&&(this.layout.format(this.contents),this.expand())}setAxis(t){this.settings.axis=t,this.element.style.flex="horizontal"==t?"none":"initial",this.size()}setWritingMode(t){this.writingMode=t}addListeners(){}removeListeners(t){}display(t){var e=new r.defer;return this.displayed?e.resolve(this):this.render(t).then(function(){this.emit(h.c.VIEWS.DISPLAYED,this),this.onDisplayed(this),this.displayed=!0,e.resolve(this)}.bind(this),(function(t){e.reject(t,this)})),e.promise}show(){this.element.style.visibility="visible",this.iframe&&(this.iframe.style.visibility="visible",this.iframe.style.transform="translateZ(0)",this.iframe.offsetWidth,this.iframe.style.transform=null),this.emit(h.c.VIEWS.SHOWN,this)}hide(){this.element.style.visibility="hidden",this.iframe.style.visibility="hidden",this.stopExpanding=!0,this.emit(h.c.VIEWS.HIDDEN,this)}offset(){return{top:this.element.offsetTop,left:this.element.offsetLeft}}width(){return this._width}height(){return this._height}position(){return this.element.getBoundingClientRect()}locationOf(t){this.iframe.getBoundingClientRect();var e=this.contents.locationOf(t,this.settings.ignoreClass);return{left:e.left,top:e.top}}onDisplayed(t){}onResize(t,e){}bounds(t){return!t&&this.elementBounds||(this.elementBounds=Object(r.bounds)(this.element)),this.elementBounds}highlight(t,e={},i,n="epubjs-hl",s={}){if(!this.contents)return;const r=Object.assign({fill:"yellow","fill-opacity":"0.3","mix-blend-mode":"multiply"},s);let o=this.contents.range(t),a=()=>{this.emit(h.c.VIEWS.MARK_CLICKED,t,e)};e.epubcfi=t,this.pane||(this.pane=new l.Pane(this.iframe,this.element));let c=new l.Highlight(o,n,e,r),u=this.pane.addMark(c);return this.highlights[t]={mark:u,element:u.element,listeners:[a,i]},u.element.setAttribute("ref",n),u.element.addEventListener("click",a),u.element.addEventListener("touchstart",a),i&&(u.element.addEventListener("click",i),u.element.addEventListener("touchstart",i)),u}underline(t,e={},i,n="epubjs-ul",s={}){if(!this.contents)return;const r=Object.assign({stroke:"black","stroke-opacity":"0.3","mix-blend-mode":"multiply"},s);let o=this.contents.range(t),a=()=>{this.emit(h.c.VIEWS.MARK_CLICKED,t,e)};e.epubcfi=t,this.pane||(this.pane=new l.Pane(this.iframe,this.element));let c=new l.Underline(o,n,e,r),u=this.pane.addMark(c);return this.underlines[t]={mark:u,element:u.element,listeners:[a,i]},u.element.setAttribute("ref",n),u.element.addEventListener("click",a),u.element.addEventListener("touchstart",a),i&&(u.element.addEventListener("click",i),u.element.addEventListener("touchstart",i)),u}mark(t,e={},i){if(!this.contents)return;if(t in this.marks){return this.marks[t]}let n=this.contents.range(t);if(!n)return;let s=n.commonAncestorContainer,r=1===s.nodeType?s:s.parentNode,o=i=>{this.emit(h.c.VIEWS.MARK_CLICKED,t,e)};n.collapsed&&1===s.nodeType?(n=new Range,n.selectNodeContents(s)):n.collapsed&&(n=new Range,n.selectNodeContents(r));let a=this.document.createElement("a");return a.setAttribute("ref","epubjs-mk"),a.style.position="absolute",a.dataset.epubcfi=t,e&&Object.keys(e).forEach(t=>{a.dataset[t]=e[t]}),i&&(a.addEventListener("click",i),a.addEventListener("touchstart",i)),a.addEventListener("click",o),a.addEventListener("touchstart",o),this.placeMark(a,n),this.element.appendChild(a),this.marks[t]={element:a,range:n,listeners:[o,i]},r}placeMark(t,e){let i,n,s;if("pre-paginated"===this.layout.name||"horizontal"!==this.settings.axis){let t=e.getBoundingClientRect();i=t.top,n=t.right}else{let t,o=e.getClientRects();for(var r=0;r!=o.length;r++)t=o[r],(!s||t.left<s)&&(s=t.left,n=Math.ceil(s/this.layout.props.pageWidth)*this.layout.props.pageWidth-this.layout.gap/2,i=t.top)}t.style.top=i+"px",t.style.left=n+"px"}unhighlight(t){let e;t in this.highlights&&(e=this.highlights[t],this.pane.removeMark(e.mark),e.listeners.forEach(t=>{t&&(e.element.removeEventListener("click",t),e.element.removeEventListener("touchstart",t))}),delete this.highlights[t])}ununderline(t){let e;t in this.underlines&&(e=this.underlines[t],this.pane.removeMark(e.mark),e.listeners.forEach(t=>{t&&(e.element.removeEventListener("click",t),e.element.removeEventListener("touchstart",t))}),delete this.underlines[t])}unmark(t){let e;t in this.marks&&(e=this.marks[t],this.element.removeChild(e.element),e.listeners.forEach(t=>{t&&(e.element.removeEventListener("click",t),e.element.removeEventListener("touchstart",t))}),delete this.marks[t])}destroy(){for(let t in this.highlights)this.unhighlight(t);for(let t in this.underlines)this.ununderline(t);for(let t in this.marks)this.unmark(t);this.blobUrl&&Object(r.revokeBlobUrl)(this.blobUrl),this.displayed&&(this.displayed=!1,this.removeListeners(),this.contents.destroy(),this.stopExpanding=!0,this.element.removeChild(this.iframe),this.pane&&(this.pane.element.remove(),this.pane=void 0),this.iframe=void 0,this.contents=void 0,this._textWidth=null,this._textHeight=null,this._width=null,this._height=null)}}s()(c.prototype),e.a=c},function(t,e,i){var n=i(19),s=i(51),r=i(53),o=Math.max,a=Math.min;t.exports=function(t,e,i){var h,l,c,u,d,f,p=0,g=!1,m=!1,v=!0;if("function"!=typeof t)throw new TypeError("Expected a function");function y(e){var i=h,n=l;return h=l=void 0,p=e,u=t.apply(n,i)}function b(t){return p=t,d=setTimeout(x,e),g?y(t):u}function w(t){var i=t-f;return void 0===f||i>=e||i<0||m&&t-p>=c}function x(){var t=s();if(w(t))return E(t);d=setTimeout(x,function(t){var i=e-(t-f);return m?a(i,c-(t-p)):i}(t))}function E(t){return d=void 0,v&&h?y(t):(h=l=void 0,u)}function S(){var t=s(),i=w(t);if(h=arguments,l=this,f=t,i){if(void 0===d)return b(f);if(m)return clearTimeout(d),d=setTimeout(x,e),y(f)}return void 0===d&&(d=setTimeout(x,e)),u}return e=r(e)||0,n(i)&&(g=!!i.leading,c=(m="maxWait"in i)?o(r(i.maxWait)||0,e):c,v="trailing"in i?!!i.trailing:v),S.cancel=function(){void 0!==d&&clearTimeout(d),p=0,h=f=l=d=void 0},S.flush=function(){return void 0===d?u:E(s())},S}},function(t,e,i){"use strict";var n=i(0),s=i(10),r=i(1),o=i(3),a=i.n(o);const h=Math.PI/2,l={easeOutSine:function(t){return Math.sin(t*h)},easeInOutSine:function(t){return-.5*(Math.cos(Math.PI*t)-1)},easeInOutQuint:function(t){return(t/=.5)<1?.5*Math.pow(t,5):.5*(Math.pow(t-2,5)+2)},easeInCubic:function(t){return Math.pow(t,3)}};class c{constructor(t,e){this.settings=Object(n.extend)({duration:80,minVelocity:.2,minDistance:10,easing:l.easeInCubic},e||{}),this.supportsTouch=this.supportsTouch(),this.supportsTouch&&this.setup(t)}setup(t){this.manager=t,this.layout=this.manager.layout,this.fullsize=this.manager.settings.fullsize,this.fullsize?(this.element=this.manager.stage.element,this.scroller=window,this.disableScroll()):(this.element=this.manager.stage.container,this.scroller=this.element,this.element.style.WebkitOverflowScrolling="touch"),this.manager.settings.offset=this.layout.width,this.manager.settings.afterScrolledTimeout=2*this.settings.duration,this.isVertical="vertical"===this.manager.settings.axis,this.manager.isPaginated&&!this.isVertical&&(this.touchCanceler=!1,this.resizeCanceler=!1,this.snapping=!1,this.scrollLeft,this.scrollTop,this.startTouchX=void 0,this.startTouchY=void 0,this.startTime=void 0,this.endTouchX=void 0,this.endTouchY=void 0,this.endTime=void 0,this.addListeners())}supportsTouch(){return!!("ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch)}disableScroll(){this.element.style.overflow="hidden"}enableScroll(){this.element.style.overflow=""}addListeners(){this._onResize=this.onResize.bind(this),window.addEventListener("resize",this._onResize),this._onScroll=this.onScroll.bind(this),this.scroller.addEventListener("scroll",this._onScroll),this._onTouchStart=this.onTouchStart.bind(this),this.scroller.addEventListener("touchstart",this._onTouchStart,{passive:!0}),this.on("touchstart",this._onTouchStart),this._onTouchMove=this.onTouchMove.bind(this),this.scroller.addEventListener("touchmove",this._onTouchMove,{passive:!0}),this.on("touchmove",this._onTouchMove),this._onTouchEnd=this.onTouchEnd.bind(this),this.scroller.addEventListener("touchend",this._onTouchEnd,{passive:!0}),this.on("touchend",this._onTouchEnd),this._afterDisplayed=this.afterDisplayed.bind(this),this.manager.on(r.c.MANAGERS.ADDED,this._afterDisplayed)}removeListeners(){window.removeEventListener("resize",this._onResize),this._onResize=void 0,this.scroller.removeEventListener("scroll",this._onScroll),this._onScroll=void 0,this.scroller.removeEventListener("touchstart",this._onTouchStart,{passive:!0}),this.off("touchstart",this._onTouchStart),this._onTouchStart=void 0,this.scroller.removeEventListener("touchmove",this._onTouchMove,{passive:!0}),this.off("touchmove",this._onTouchMove),this._onTouchMove=void 0,this.scroller.removeEventListener("touchend",this._onTouchEnd,{passive:!0}),this.off("touchend",this._onTouchEnd),this._onTouchEnd=void 0,this.manager.off(r.c.MANAGERS.ADDED,this._afterDisplayed),this._afterDisplayed=void 0}afterDisplayed(t){let e=t.contents;["touchstart","touchmove","touchend"].forEach(t=>{e.on(t,t=>this.triggerViewEvent(t,e))})}triggerViewEvent(t,e){this.emit(t.type,t,e)}onScroll(t){this.scrollLeft=this.fullsize?window.scrollX:this.scroller.scrollLeft,this.scrollTop=this.fullsize?window.scrollY:this.scroller.scrollTop}onResize(t){this.resizeCanceler=!0}onTouchStart(t){let{screenX:e,screenY:i}=t.touches[0];this.fullsize&&this.enableScroll(),this.touchCanceler=!0,this.startTouchX||(this.startTouchX=e,this.startTouchY=i,this.startTime=this.now()),this.endTouchX=e,this.endTouchY=i,this.endTime=this.now()}onTouchMove(t){let{screenX:e,screenY:i}=t.touches[0],n=Math.abs(i-this.endTouchY);this.touchCanceler=!0,!this.fullsize&&n<10&&(this.element.scrollLeft-=e-this.endTouchX),this.endTouchX=e,this.endTouchY=i,this.endTime=this.now()}onTouchEnd(t){this.fullsize&&this.disableScroll(),this.touchCanceler=!1;let e=this.wasSwiped();0!==e?this.snap(e):this.snap(),this.startTouchX=void 0,this.startTouchY=void 0,this.startTime=void 0,this.endTouchX=void 0,this.endTouchY=void 0,this.endTime=void 0}wasSwiped(){let t=this.layout.pageWidth*this.layout.divisor,e=this.endTouchX-this.startTouchX,i=Math.abs(e),n=e/(this.endTime-this.startTime),s=this.settings.minVelocity;return i<=this.settings.minDistance||i>=t?0:n>s?-1:n<-s?1:void 0}needsSnap(){return this.scrollLeft%(this.layout.pageWidth*this.layout.divisor)!=0}snap(t=0){let e=this.scrollLeft,i=this.layout.pageWidth*this.layout.divisor,n=Math.round(e/i)*i;return t&&(n+=t*i),this.smoothScrollTo(n)}smoothScrollTo(t){const e=new n.defer,i=this.scrollLeft,s=this.now(),r=this.settings.duration,o=this.settings.easing;return this.snapping=!0,function n(){const a=this.now(),h=Math.min(1,(a-s)/r);if(o(h),this.touchCanceler||this.resizeCanceler)return this.resizeCanceler=!1,this.snapping=!1,void e.resolve();h<1?(window.requestAnimationFrame(n.bind(this)),this.scrollTo(i+(t-i)*h,0)):(this.scrollTo(t,0),this.snapping=!1,e.resolve())}.call(this),e.promise}scrollTo(t=0,e=0){this.fullsize?window.scroll(t,e):(this.scroller.scrollLeft=t,this.scroller.scrollTop=e)}now(){return"now"in window.performance?performance.now():(new Date).getTime()}destroy(){this.scroller&&(this.fullsize&&this.enableScroll(),this.removeListeners(),this.scroller=void 0)}}a()(c.prototype);var u=c,d=i(21),f=i.n(d);class p extends s.a{constructor(t){super(t),this.name="continuous",this.settings=Object(n.extend)(this.settings||{},{infinite:!0,overflow:void 0,axis:void 0,writingMode:void 0,flow:"scrolled",offset:500,offsetDelta:250,width:void 0,height:void 0,snap:!1,afterScrolledTimeout:10,allowScriptedContent:!1,allowPopups:!1}),Object(n.extend)(this.settings,t.settings||{}),"undefined"!=t.settings.gap&&0===t.settings.gap&&(this.settings.gap=t.settings.gap),this.viewSettings={ignoreClass:this.settings.ignoreClass,axis:this.settings.axis,flow:this.settings.flow,layout:this.layout,width:0,height:0,forceEvenPages:!1,allowScriptedContent:this.settings.allowScriptedContent,allowPopups:this.settings.allowPopups},this.scrollTop=0,this.scrollLeft=0}display(t,e){return s.a.prototype.display.call(this,t,e).then(function(){return this.fill()}.bind(this))}fill(t){var e=t||new n.defer;return this.q.enqueue(()=>this.check()).then(t=>{t?this.fill(e):e.resolve()}),e.promise}moveTo(t){var e=0,i=0;this.isPaginated?(e=Math.floor(t.left/this.layout.delta)*this.layout.delta,this.settings.offsetDelta):(i=t.top,t.top,this.settings.offsetDelta),(e>0||i>0)&&this.scrollBy(e,i,!0)}afterResized(t){this.emit(r.c.MANAGERS.RESIZE,t.section)}removeShownListeners(t){t.onDisplayed=function(){}}add(t){var e=this.createView(t);return this.views.append(e),e.on(r.c.VIEWS.RESIZED,t=>{e.expanded=!0}),e.on(r.c.VIEWS.AXIS,t=>{this.updateAxis(t)}),e.on(r.c.VIEWS.WRITING_MODE,t=>{this.updateWritingMode(t)}),e.onDisplayed=this.afterDisplayed.bind(this),e.onResize=this.afterResized.bind(this),e.display(this.request)}append(t){var e=this.createView(t);return e.on(r.c.VIEWS.RESIZED,t=>{e.expanded=!0}),e.on(r.c.VIEWS.AXIS,t=>{this.updateAxis(t)}),e.on(r.c.VIEWS.WRITING_MODE,t=>{this.updateWritingMode(t)}),this.views.append(e),e.onDisplayed=this.afterDisplayed.bind(this),e}prepend(t){var e=this.createView(t);return e.on(r.c.VIEWS.RESIZED,t=>{this.counter(t),e.expanded=!0}),e.on(r.c.VIEWS.AXIS,t=>{this.updateAxis(t)}),e.on(r.c.VIEWS.WRITING_MODE,t=>{this.updateWritingMode(t)}),this.views.prepend(e),e.onDisplayed=this.afterDisplayed.bind(this),e}counter(t){"vertical"===this.settings.axis?this.scrollBy(0,t.heightDelta,!0):this.scrollBy(t.widthDelta,0,!0)}update(t){for(var e,i=this.bounds(),s=this.views.all(),r=s.length,o=[],a=void 0!==t?t:this.settings.offset||0,h=new n.defer,l=[],c=0;c<r;c++)if(e=s[c],!0===this.isVisible(e,a,a,i)){if(e.displayed)e.show();else{let t=e.display(this.request).then((function(t){t.show()}),t=>{e.hide()});l.push(t)}o.push(e)}else this.q.enqueue(e.destroy.bind(e)),clearTimeout(this.trimTimeout),this.trimTimeout=setTimeout(function(){this.q.enqueue(this.trim.bind(this))}.bind(this),250);return l.length?Promise.all(l).catch(t=>{h.reject(t)}):(h.resolve(),h.promise)}check(t,e){var i=new n.defer,s=[],r="horizontal"===this.settings.axis,o=this.settings.offset||0;t&&r&&(o=t),e&&!r&&(o=e);var a=this._bounds;let h=r?this.scrollLeft:this.scrollTop,l=r?Math.floor(a.width):a.height,c=r?this.container.scrollWidth:this.container.scrollHeight,u=this.writingMode&&0===this.writingMode.indexOf("vertical")?"vertical":"horizontal",d=this.settings.rtlScrollType,f="rtl"===this.settings.direction;this.settings.fullsize?(r&&f&&"negative"===d||!r&&f&&"default"===d)&&(h*=-1):(f&&"default"===d&&"horizontal"===u&&(h=c-l-h),f&&"negative"===d&&"horizontal"===u&&(h*=-1));let p=()=>{let t=this.views.first(),e=t&&t.section.prev();e&&s.push(this.prepend(e))},g=h-o;h+l+o>=c&&(()=>{let t=this.views.last(),e=t&&t.section.next();e&&s.push(this.append(e))})(),g<0&&p();let m=s.map(t=>t.display(this.request));return s.length?Promise.all(m).then(()=>this.check()).then(()=>this.update(o),t=>t):(this.q.enqueue(function(){this.update()}.bind(this)),i.resolve(!1),i.promise)}trim(){for(var t=new n.defer,e=this.views.displayed(),i=e[0],s=e[e.length-1],r=this.views.indexOf(i),o=this.views.indexOf(s),a=this.views.slice(0,r),h=this.views.slice(o+1),l=0;l<a.length-1;l++)this.erase(a[l],a);for(var c=1;c<h.length;c++)this.erase(h[c]);return t.resolve(),t.promise}erase(t,e){var i,n;this.settings.fullsize?(i=window.scrollY,n=window.scrollX):(i=this.container.scrollTop,n=this.container.scrollLeft);var s=t.bounds();this.views.remove(t),e&&("vertical"===this.settings.axis?this.scrollTo(0,i-s.height,!0):"rtl"===this.settings.direction?this.settings.fullsize?this.scrollTo(n+Math.floor(s.width),0,!0):this.scrollTo(n,0,!0):this.scrollTo(n-Math.floor(s.width),0,!0))}addEventListeners(t){window.addEventListener("unload",function(t){this.ignore=!0,this.destroy()}.bind(this)),this.addScrollListeners(),this.isPaginated&&this.settings.snap&&(this.snapper=new u(this,this.settings.snap&&"object"==typeof this.settings.snap&&this.settings.snap))}addScrollListeners(){var t;this.tick=n.requestAnimationFrame;let e="rtl"===this.settings.direction&&"default"===this.settings.rtlScrollType?-1:1;this.scrollDeltaVert=0,this.scrollDeltaHorz=0,this.settings.fullsize?(t=window,this.scrollTop=window.scrollY*e,this.scrollLeft=window.scrollX*e):(t=this.container,this.scrollTop=this.container.scrollTop,this.scrollLeft=this.container.scrollLeft),this._onScroll=this.onScroll.bind(this),t.addEventListener("scroll",this._onScroll),this._scrolled=f()(this.scrolled.bind(this),30),this.didScroll=!1}removeEventListeners(){(this.settings.fullsize?window:this.container).removeEventListener("scroll",this._onScroll),this._onScroll=void 0}onScroll(){let t,e,i="rtl"===this.settings.direction&&"default"===this.settings.rtlScrollType?-1:1;this.settings.fullsize?(t=window.scrollY*i,e=window.scrollX*i):(t=this.container.scrollTop,e=this.container.scrollLeft),this.scrollTop=t,this.scrollLeft=e,this.ignore?this.ignore=!1:this._scrolled(),this.scrollDeltaVert+=Math.abs(t-this.prevScrollTop),this.scrollDeltaHorz+=Math.abs(e-this.prevScrollLeft),this.prevScrollTop=t,this.prevScrollLeft=e,clearTimeout(this.scrollTimeout),this.scrollTimeout=setTimeout(function(){this.scrollDeltaVert=0,this.scrollDeltaHorz=0}.bind(this),150),clearTimeout(this.afterScrolled),this.didScroll=!1}scrolled(){this.q.enqueue(function(){return this.check()}.bind(this)),this.emit(r.c.MANAGERS.SCROLL,{top:this.scrollTop,left:this.scrollLeft}),clearTimeout(this.afterScrolled),this.afterScrolled=setTimeout(function(){this.snapper&&this.snapper.supportsTouch&&this.snapper.needsSnap()||this.emit(r.c.MANAGERS.SCROLLED,{top:this.scrollTop,left:this.scrollLeft})}.bind(this),this.settings.afterScrolledTimeout)}next(){let t="pre-paginated"===this.layout.props.name&&this.layout.props.spread?2*this.layout.props.delta:this.layout.props.delta;this.views.length&&(this.isPaginated&&"horizontal"===this.settings.axis?this.scrollBy(t,0,!0):this.scrollBy(0,this.layout.height,!0),this.q.enqueue(function(){return this.check()}.bind(this)))}prev(){let t="pre-paginated"===this.layout.props.name&&this.layout.props.spread?2*this.layout.props.delta:this.layout.props.delta;this.views.length&&(this.isPaginated&&"horizontal"===this.settings.axis?this.scrollBy(-t,0,!0):this.scrollBy(0,-this.layout.height,!0),this.q.enqueue(function(){return this.check()}.bind(this)))}updateFlow(t){this.rendered&&this.snapper&&(this.snapper.destroy(),this.snapper=void 0),super.updateFlow(t,"scroll"),this.rendered&&this.isPaginated&&this.settings.snap&&(this.snapper=new u(this,this.settings.snap&&"object"==typeof this.settings.snap&&this.settings.snap))}destroy(){super.destroy(),this.snapper&&this.snapper.destroy()}}e.a=p},function(t,e,i){(function(e){t.exports=function t(e,i,n){function s(o,a){if(!i[o]){if(!e[o]){if(r)return r(o,!0);var h=new Error("Cannot find module '"+o+"'");throw h.code="MODULE_NOT_FOUND",h}var l=i[o]={exports:{}};e[o][0].call(l.exports,(function(t){var i=e[o][1][t];return s(i||t)}),l,l.exports,t,e,i,n)}return i[o].exports}for(var r=!1,o=0;o<n.length;o++)s(n[o]);return s}({1:[function(t,i,n){(function(t){"use strict";var e,n,s=t.MutationObserver||t.WebKitMutationObserver;if(s){var r=0,o=new s(c),a=t.document.createTextNode("");o.observe(a,{characterData:!0}),e=function(){a.data=r=++r%2}}else if(t.setImmediate||void 0===t.MessageChannel)e="document"in t&&"onreadystatechange"in t.document.createElement("script")?function(){var e=t.document.createElement("script");e.onreadystatechange=function(){c(),e.onreadystatechange=null,e.parentNode.removeChild(e),e=null},t.document.documentElement.appendChild(e)}:function(){setTimeout(c,0)};else{var h=new t.MessageChannel;h.port1.onmessage=c,e=function(){h.port2.postMessage(0)}}var l=[];function c(){var t,e;n=!0;for(var i=l.length;i;){for(e=l,l=[],t=-1;++t<i;)e[t]();i=l.length}n=!1}i.exports=function(t){1!==l.push(t)||n||e()}}).call(this,void 0!==e?e:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(t,e,i){"use strict";var n=t(1);function s(){}var r={},o=["REJECTED"],a=["FULFILLED"],h=["PENDING"];function l(t){if("function"!=typeof t)throw new TypeError("resolver must be a function");this.state=h,this.queue=[],this.outcome=void 0,t!==s&&f(this,t)}function c(t,e,i){this.promise=t,"function"==typeof e&&(this.onFulfilled=e,this.callFulfilled=this.otherCallFulfilled),"function"==typeof i&&(this.onRejected=i,this.callRejected=this.otherCallRejected)}function u(t,e,i){n((function(){var n;try{n=e(i)}catch(e){return r.reject(t,e)}n===t?r.reject(t,new TypeError("Cannot resolve promise with itself")):r.resolve(t,n)}))}function d(t){var e=t&&t.then;if(t&&("object"==typeof t||"function"==typeof t)&&"function"==typeof e)return function(){e.apply(t,arguments)}}function f(t,e){var i=!1;function n(e){i||(i=!0,r.reject(t,e))}function s(e){i||(i=!0,r.resolve(t,e))}var o=p((function(){e(s,n)}));"error"===o.status&&n(o.value)}function p(t,e){var i={};try{i.value=t(e),i.status="success"}catch(t){i.status="error",i.value=t}return i}e.exports=l,l.prototype.catch=function(t){return this.then(null,t)},l.prototype.then=function(t,e){if("function"!=typeof t&&this.state===a||"function"!=typeof e&&this.state===o)return this;var i=new this.constructor(s);return this.state!==h?u(i,this.state===a?t:e,this.outcome):this.queue.push(new c(i,t,e)),i},c.prototype.callFulfilled=function(t){r.resolve(this.promise,t)},c.prototype.otherCallFulfilled=function(t){u(this.promise,this.onFulfilled,t)},c.prototype.callRejected=function(t){r.reject(this.promise,t)},c.prototype.otherCallRejected=function(t){u(this.promise,this.onRejected,t)},r.resolve=function(t,e){var i=p(d,e);if("error"===i.status)return r.reject(t,i.value);var n=i.value;if(n)f(t,n);else{t.state=a,t.outcome=e;for(var s=-1,o=t.queue.length;++s<o;)t.queue[s].callFulfilled(e)}return t},r.reject=function(t,e){t.state=o,t.outcome=e;for(var i=-1,n=t.queue.length;++i<n;)t.queue[i].callRejected(e);return t},l.resolve=function(t){return t instanceof this?t:r.resolve(new this(s),t)},l.reject=function(t){var e=new this(s);return r.reject(e,t)},l.all=function(t){var e=this;if("[object Array]"!==Object.prototype.toString.call(t))return this.reject(new TypeError("must be an array"));var i=t.length,n=!1;if(!i)return this.resolve([]);for(var o=new Array(i),a=0,h=-1,l=new this(s);++h<i;)c(t[h],h);return l;function c(t,s){e.resolve(t).then((function(t){o[s]=t,++a!==i||n||(n=!0,r.resolve(l,o))}),(function(t){n||(n=!0,r.reject(l,t))}))}},l.race=function(t){var e=this;if("[object Array]"!==Object.prototype.toString.call(t))return this.reject(new TypeError("must be an array"));var i=t.length,n=!1;if(!i)return this.resolve([]);for(var o,a=-1,h=new this(s);++a<i;)o=t[a],e.resolve(o).then((function(t){n||(n=!0,r.resolve(h,t))}),(function(t){n||(n=!0,r.reject(h,t))}));return h}},{1:1}],3:[function(t,i,n){(function(e){"use strict";"function"!=typeof e.Promise&&(e.Promise=t(2))}).call(this,void 0!==e?e:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{2:2}],4:[function(t,e,i){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},s=function(){try{if("undefined"!=typeof indexedDB)return indexedDB;if("undefined"!=typeof webkitIndexedDB)return webkitIndexedDB;if("undefined"!=typeof mozIndexedDB)return mozIndexedDB;if("undefined"!=typeof OIndexedDB)return OIndexedDB;if("undefined"!=typeof msIndexedDB)return msIndexedDB}catch(t){return}}();function r(t,e){t=t||[],e=e||{};try{return new Blob(t,e)}catch(s){if("TypeError"!==s.name)throw s;for(var i=new("undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder?MozBlobBuilder:WebKitBlobBuilder),n=0;n<t.length;n+=1)i.append(t[n]);return i.getBlob(e.type)}}"undefined"==typeof Promise&&t(3);var o=Promise;function a(t,e){e&&t.then((function(t){e(null,t)}),(function(t){e(t)}))}function h(t,e,i){"function"==typeof e&&t.then(e),"function"==typeof i&&t.catch(i)}function l(t){return"string"!=typeof t&&(console.warn(t+" used as a key, but it is not a string."),t=String(t)),t}function c(){if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}var u=void 0,d={},f=Object.prototype.toString;function p(t){return"boolean"==typeof u?o.resolve(u):function(t){return new o((function(e){var i=t.transaction("local-forage-detect-blob-support","readwrite"),n=r([""]);i.objectStore("local-forage-detect-blob-support").put(n,"key"),i.onabort=function(t){t.preventDefault(),t.stopPropagation(),e(!1)},i.oncomplete=function(){var t=navigator.userAgent.match(/Chrome\/(\d+)/),i=navigator.userAgent.match(/Edge\//);e(i||!t||parseInt(t[1],10)>=43)}})).catch((function(){return!1}))}(t).then((function(t){return u=t}))}function g(t){var e=d[t.name],i={};i.promise=new o((function(t,e){i.resolve=t,i.reject=e})),e.deferredOperations.push(i),e.dbReady?e.dbReady=e.dbReady.then((function(){return i.promise})):e.dbReady=i.promise}function m(t){var e=d[t.name].deferredOperations.pop();if(e)return e.resolve(),e.promise}function v(t,e){var i=d[t.name].deferredOperations.pop();if(i)return i.reject(e),i.promise}function y(t,e){return new o((function(i,n){if(d[t.name]=d[t.name]||{forages:[],db:null,dbReady:null,deferredOperations:[]},t.db){if(!e)return i(t.db);g(t),t.db.close()}var r=[t.name];e&&r.push(t.version);var o=s.open.apply(s,r);e&&(o.onupgradeneeded=function(e){var i=o.result;try{i.createObjectStore(t.storeName),e.oldVersion<=1&&i.createObjectStore("local-forage-detect-blob-support")}catch(i){if("ConstraintError"!==i.name)throw i;console.warn('The database "'+t.name+'" has been upgraded from version '+e.oldVersion+" to version "+e.newVersion+', but the storage "'+t.storeName+'" already exists.')}}),o.onerror=function(t){t.preventDefault(),n(o.error)},o.onsuccess=function(){var e=o.result;e.onversionchange=function(t){t.target.close()},i(e),m(t)}}))}function b(t){return y(t,!1)}function w(t){return y(t,!0)}function x(t,e){if(!t.db)return!0;var i=!t.db.objectStoreNames.contains(t.storeName),n=t.version<t.db.version,s=t.version>t.db.version;if(n&&(t.version!==e&&console.warn('The database "'+t.name+"\" can't be downgraded from version "+t.db.version+" to version "+t.version+"."),t.version=t.db.version),s||i){if(i){var r=t.db.version+1;r>t.version&&(t.version=r)}return!0}return!1}function E(t){return r([function(t){for(var e=t.length,i=new ArrayBuffer(e),n=new Uint8Array(i),s=0;s<e;s++)n[s]=t.charCodeAt(s);return i}(atob(t.data))],{type:t.type})}function S(t){return t&&t.__local_forage_encoded_blob}function N(t){var e=this,i=e._initReady().then((function(){var t=d[e._dbInfo.name];if(t&&t.dbReady)return t.dbReady}));return h(i,t,t),i}function _(t,e,i,n){void 0===n&&(n=1);try{var s=t.db.transaction(t.storeName,e);i(null,s)}catch(s){if(n>0&&(!t.db||"InvalidStateError"===s.name||"NotFoundError"===s.name))return o.resolve().then((function(){if(!t.db||"NotFoundError"===s.name&&!t.db.objectStoreNames.contains(t.storeName)&&t.version<=t.db.version)return t.db&&(t.version=t.db.version+1),w(t)})).then((function(){return function(t){g(t);for(var e=d[t.name],i=e.forages,n=0;n<i.length;n++){var s=i[n];s._dbInfo.db&&(s._dbInfo.db.close(),s._dbInfo.db=null)}return t.db=null,b(t).then((function(e){return t.db=e,x(t)?w(t):e})).then((function(n){t.db=e.db=n;for(var s=0;s<i.length;s++)i[s]._dbInfo.db=n})).catch((function(e){throw v(t,e),e}))}(t).then((function(){_(t,e,i,n-1)}))})).catch(i);i(s)}}var T={_driver:"asyncStorage",_initStorage:function(t){var e=this,i={db:null};if(t)for(var n in t)i[n]=t[n];var s=d[i.name];s||(s={forages:[],db:null,dbReady:null,deferredOperations:[]},d[i.name]=s),s.forages.push(e),e._initReady||(e._initReady=e.ready,e.ready=N);var r=[];function a(){return o.resolve()}for(var h=0;h<s.forages.length;h++){var l=s.forages[h];l!==e&&r.push(l._initReady().catch(a))}var c=s.forages.slice(0);return o.all(r).then((function(){return i.db=s.db,b(i)})).then((function(t){return i.db=t,x(i,e._defaultConfig.version)?w(i):t})).then((function(t){i.db=s.db=t,e._dbInfo=i;for(var n=0;n<c.length;n++){var r=c[n];r!==e&&(r._dbInfo.db=i.db,r._dbInfo.version=i.version)}}))},_support:function(){try{if(!s||!s.open)return!1;var t="undefined"!=typeof openDatabase&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),e="function"==typeof fetch&&-1!==fetch.toString().indexOf("[native code");return(!t||e)&&"undefined"!=typeof indexedDB&&"undefined"!=typeof IDBKeyRange}catch(t){return!1}}(),iterate:function(t,e){var i=this,n=new o((function(e,n){i.ready().then((function(){_(i._dbInfo,"readonly",(function(s,r){if(s)return n(s);try{var o=r.objectStore(i._dbInfo.storeName).openCursor(),a=1;o.onsuccess=function(){var i=o.result;if(i){var n=i.value;S(n)&&(n=E(n));var s=t(n,i.key,a++);void 0!==s?e(s):i.continue()}else e()},o.onerror=function(){n(o.error)}}catch(t){n(t)}}))})).catch(n)}));return a(n,e),n},getItem:function(t,e){var i=this;t=l(t);var n=new o((function(e,n){i.ready().then((function(){_(i._dbInfo,"readonly",(function(s,r){if(s)return n(s);try{var o=r.objectStore(i._dbInfo.storeName).get(t);o.onsuccess=function(){var t=o.result;void 0===t&&(t=null),S(t)&&(t=E(t)),e(t)},o.onerror=function(){n(o.error)}}catch(t){n(t)}}))})).catch(n)}));return a(n,e),n},setItem:function(t,e,i){var n=this;t=l(t);var s=new o((function(i,s){var r;n.ready().then((function(){return r=n._dbInfo,"[object Blob]"===f.call(e)?p(r.db).then((function(t){return t?e:(i=e,new o((function(t,e){var n=new FileReader;n.onerror=e,n.onloadend=function(e){var n=btoa(e.target.result||"");t({__local_forage_encoded_blob:!0,data:n,type:i.type})},n.readAsBinaryString(i)})));var i})):e})).then((function(e){_(n._dbInfo,"readwrite",(function(r,o){if(r)return s(r);try{var a=o.objectStore(n._dbInfo.storeName);null===e&&(e=void 0);var h=a.put(e,t);o.oncomplete=function(){void 0===e&&(e=null),i(e)},o.onabort=o.onerror=function(){var t=h.error?h.error:h.transaction.error;s(t)}}catch(t){s(t)}}))})).catch(s)}));return a(s,i),s},removeItem:function(t,e){var i=this;t=l(t);var n=new o((function(e,n){i.ready().then((function(){_(i._dbInfo,"readwrite",(function(s,r){if(s)return n(s);try{var o=r.objectStore(i._dbInfo.storeName).delete(t);r.oncomplete=function(){e()},r.onerror=function(){n(o.error)},r.onabort=function(){var t=o.error?o.error:o.transaction.error;n(t)}}catch(t){n(t)}}))})).catch(n)}));return a(n,e),n},clear:function(t){var e=this,i=new o((function(t,i){e.ready().then((function(){_(e._dbInfo,"readwrite",(function(n,s){if(n)return i(n);try{var r=s.objectStore(e._dbInfo.storeName).clear();s.oncomplete=function(){t()},s.onabort=s.onerror=function(){var t=r.error?r.error:r.transaction.error;i(t)}}catch(t){i(t)}}))})).catch(i)}));return a(i,t),i},length:function(t){var e=this,i=new o((function(t,i){e.ready().then((function(){_(e._dbInfo,"readonly",(function(n,s){if(n)return i(n);try{var r=s.objectStore(e._dbInfo.storeName).count();r.onsuccess=function(){t(r.result)},r.onerror=function(){i(r.error)}}catch(t){i(t)}}))})).catch(i)}));return a(i,t),i},key:function(t,e){var i=this,n=new o((function(e,n){t<0?e(null):i.ready().then((function(){_(i._dbInfo,"readonly",(function(s,r){if(s)return n(s);try{var o=r.objectStore(i._dbInfo.storeName),a=!1,h=o.openKeyCursor();h.onsuccess=function(){var i=h.result;i?0===t||a?e(i.key):(a=!0,i.advance(t)):e(null)},h.onerror=function(){n(h.error)}}catch(t){n(t)}}))})).catch(n)}));return a(n,e),n},keys:function(t){var e=this,i=new o((function(t,i){e.ready().then((function(){_(e._dbInfo,"readonly",(function(n,s){if(n)return i(n);try{var r=s.objectStore(e._dbInfo.storeName).openKeyCursor(),o=[];r.onsuccess=function(){var e=r.result;e?(o.push(e.key),e.continue()):t(o)},r.onerror=function(){i(r.error)}}catch(t){i(t)}}))})).catch(i)}));return a(i,t),i},dropInstance:function(t,e){e=c.apply(this,arguments);var i=this.config();(t="function"!=typeof t&&t||{}).name||(t.name=t.name||i.name,t.storeName=t.storeName||i.storeName);var n,r=this;if(t.name){var h=t.name===i.name&&r._dbInfo.db,l=h?o.resolve(r._dbInfo.db):b(t).then((function(e){var i=d[t.name],n=i.forages;i.db=e;for(var s=0;s<n.length;s++)n[s]._dbInfo.db=e;return e}));n=t.storeName?l.then((function(e){if(e.objectStoreNames.contains(t.storeName)){var i=e.version+1;g(t);var n=d[t.name],r=n.forages;e.close();for(var a=0;a<r.length;a++){var h=r[a];h._dbInfo.db=null,h._dbInfo.version=i}return new o((function(e,n){var r=s.open(t.name,i);r.onerror=function(t){r.result.close(),n(t)},r.onupgradeneeded=function(){r.result.deleteObjectStore(t.storeName)},r.onsuccess=function(){var t=r.result;t.close(),e(t)}})).then((function(t){n.db=t;for(var e=0;e<r.length;e++){var i=r[e];i._dbInfo.db=t,m(i._dbInfo)}})).catch((function(e){throw(v(t,e)||o.resolve()).catch((function(){})),e}))}})):l.then((function(e){g(t);var i=d[t.name],n=i.forages;e.close();for(var r=0;r<n.length;r++)n[r]._dbInfo.db=null;return new o((function(e,i){var n=s.deleteDatabase(t.name);n.onerror=function(){var t=n.result;t&&t.close(),i(n.error)},n.onblocked=function(){console.warn('dropInstance blocked for database "'+t.name+'" until all open connections are closed')},n.onsuccess=function(){var t=n.result;t&&t.close(),e(t)}})).then((function(t){i.db=t;for(var e=0;e<n.length;e++)m(n[e]._dbInfo)})).catch((function(e){throw(v(t,e)||o.resolve()).catch((function(){})),e}))}))}else n=o.reject("Invalid arguments");return a(n,e),n}},C="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",O=/^~~local_forage_type~([^~]+)~/,I="__lfsc__:".length,R=I+"arbf".length,k=Object.prototype.toString;function A(t){var e,i,n,s,r,o=.75*t.length,a=t.length,h=0;"="===t[t.length-1]&&(o--,"="===t[t.length-2]&&o--);var l=new ArrayBuffer(o),c=new Uint8Array(l);for(e=0;e<a;e+=4)i=C.indexOf(t[e]),n=C.indexOf(t[e+1]),s=C.indexOf(t[e+2]),r=C.indexOf(t[e+3]),c[h++]=i<<2|n>>4,c[h++]=(15&n)<<4|s>>2,c[h++]=(3&s)<<6|63&r;return l}function L(t){var e,i=new Uint8Array(t),n="";for(e=0;e<i.length;e+=3)n+=C[i[e]>>2],n+=C[(3&i[e])<<4|i[e+1]>>4],n+=C[(15&i[e+1])<<2|i[e+2]>>6],n+=C[63&i[e+2]];return i.length%3==2?n=n.substring(0,n.length-1)+"=":i.length%3==1&&(n=n.substring(0,n.length-2)+"=="),n}var j={serialize:function(t,e){var i="";if(t&&(i=k.call(t)),t&&("[object ArrayBuffer]"===i||t.buffer&&"[object ArrayBuffer]"===k.call(t.buffer))){var n,s="__lfsc__:";t instanceof ArrayBuffer?(n=t,s+="arbf"):(n=t.buffer,"[object Int8Array]"===i?s+="si08":"[object Uint8Array]"===i?s+="ui08":"[object Uint8ClampedArray]"===i?s+="uic8":"[object Int16Array]"===i?s+="si16":"[object Uint16Array]"===i?s+="ur16":"[object Int32Array]"===i?s+="si32":"[object Uint32Array]"===i?s+="ui32":"[object Float32Array]"===i?s+="fl32":"[object Float64Array]"===i?s+="fl64":e(new Error("Failed to get type for BinaryArray"))),e(s+L(n))}else if("[object Blob]"===i){var r=new FileReader;r.onload=function(){var i="~~local_forage_type~"+t.type+"~"+L(this.result);e("__lfsc__:blob"+i)},r.readAsArrayBuffer(t)}else try{e(JSON.stringify(t))}catch(i){console.error("Couldn't convert value into a JSON string: ",t),e(null,i)}},deserialize:function(t){if("__lfsc__:"!==t.substring(0,I))return JSON.parse(t);var e,i=t.substring(R),n=t.substring(I,R);if("blob"===n&&O.test(i)){var s=i.match(O);e=s[1],i=i.substring(s[0].length)}var o=A(i);switch(n){case"arbf":return o;case"blob":return r([o],{type:e});case"si08":return new Int8Array(o);case"ui08":return new Uint8Array(o);case"uic8":return new Uint8ClampedArray(o);case"si16":return new Int16Array(o);case"ur16":return new Uint16Array(o);case"si32":return new Int32Array(o);case"ui32":return new Uint32Array(o);case"fl32":return new Float32Array(o);case"fl64":return new Float64Array(o);default:throw new Error("Unkown type: "+n)}},stringToBuffer:A,bufferToString:L};function D(t,e,i,n){t.executeSql("CREATE TABLE IF NOT EXISTS "+e.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],i,n)}function P(t,e,i,n,s,r){t.executeSql(i,n,s,(function(t,o){o.code===o.SYNTAX_ERR?t.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[e.storeName],(function(t,a){a.rows.length?r(t,o):D(t,e,(function(){t.executeSql(i,n,s,r)}),r)}),r):r(t,o)}),r)}function M(t,e,i,n){var s=this;t=l(t);var r=new o((function(r,o){s.ready().then((function(){void 0===e&&(e=null);var a=e,h=s._dbInfo;h.serializer.serialize(e,(function(e,l){l?o(l):h.db.transaction((function(i){P(i,h,"INSERT OR REPLACE INTO "+h.storeName+" (key, value) VALUES (?, ?)",[t,e],(function(){r(a)}),(function(t,e){o(e)}))}),(function(e){if(e.code===e.QUOTA_ERR){if(n>0)return void r(M.apply(s,[t,a,i,n-1]));o(e)}}))}))})).catch(o)}));return a(r,i),r}function z(t){return new o((function(e,i){t.transaction((function(n){n.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],(function(i,n){for(var s=[],r=0;r<n.rows.length;r++)s.push(n.rows.item(r).name);e({db:t,storeNames:s})}),(function(t,e){i(e)}))}),(function(t){i(t)}))}))}var B={_driver:"webSQLStorage",_initStorage:function(t){var e=this,i={db:null};if(t)for(var n in t)i[n]="string"!=typeof t[n]?t[n].toString():t[n];var s=new o((function(t,n){try{i.db=openDatabase(i.name,String(i.version),i.description,i.size)}catch(t){return n(t)}i.db.transaction((function(s){D(s,i,(function(){e._dbInfo=i,t()}),(function(t,e){n(e)}))}),n)}));return i.serializer=j,s},_support:"function"==typeof openDatabase,iterate:function(t,e){var i=this,n=new o((function(e,n){i.ready().then((function(){var s=i._dbInfo;s.db.transaction((function(i){P(i,s,"SELECT * FROM "+s.storeName,[],(function(i,n){for(var r=n.rows,o=r.length,a=0;a<o;a++){var h=r.item(a),l=h.value;if(l&&(l=s.serializer.deserialize(l)),void 0!==(l=t(l,h.key,a+1)))return void e(l)}e()}),(function(t,e){n(e)}))}))})).catch(n)}));return a(n,e),n},getItem:function(t,e){var i=this;t=l(t);var n=new o((function(e,n){i.ready().then((function(){var s=i._dbInfo;s.db.transaction((function(i){P(i,s,"SELECT * FROM "+s.storeName+" WHERE key = ? LIMIT 1",[t],(function(t,i){var n=i.rows.length?i.rows.item(0).value:null;n&&(n=s.serializer.deserialize(n)),e(n)}),(function(t,e){n(e)}))}))})).catch(n)}));return a(n,e),n},setItem:function(t,e,i){return M.apply(this,[t,e,i,1])},removeItem:function(t,e){var i=this;t=l(t);var n=new o((function(e,n){i.ready().then((function(){var s=i._dbInfo;s.db.transaction((function(i){P(i,s,"DELETE FROM "+s.storeName+" WHERE key = ?",[t],(function(){e()}),(function(t,e){n(e)}))}))})).catch(n)}));return a(n,e),n},clear:function(t){var e=this,i=new o((function(t,i){e.ready().then((function(){var n=e._dbInfo;n.db.transaction((function(e){P(e,n,"DELETE FROM "+n.storeName,[],(function(){t()}),(function(t,e){i(e)}))}))})).catch(i)}));return a(i,t),i},length:function(t){var e=this,i=new o((function(t,i){e.ready().then((function(){var n=e._dbInfo;n.db.transaction((function(e){P(e,n,"SELECT COUNT(key) as c FROM "+n.storeName,[],(function(e,i){var n=i.rows.item(0).c;t(n)}),(function(t,e){i(e)}))}))})).catch(i)}));return a(i,t),i},key:function(t,e){var i=this,n=new o((function(e,n){i.ready().then((function(){var s=i._dbInfo;s.db.transaction((function(i){P(i,s,"SELECT key FROM "+s.storeName+" WHERE id = ? LIMIT 1",[t+1],(function(t,i){var n=i.rows.length?i.rows.item(0).key:null;e(n)}),(function(t,e){n(e)}))}))})).catch(n)}));return a(n,e),n},keys:function(t){var e=this,i=new o((function(t,i){e.ready().then((function(){var n=e._dbInfo;n.db.transaction((function(e){P(e,n,"SELECT key FROM "+n.storeName,[],(function(e,i){for(var n=[],s=0;s<i.rows.length;s++)n.push(i.rows.item(s).key);t(n)}),(function(t,e){i(e)}))}))})).catch(i)}));return a(i,t),i},dropInstance:function(t,e){e=c.apply(this,arguments);var i=this.config();(t="function"!=typeof t&&t||{}).name||(t.name=t.name||i.name,t.storeName=t.storeName||i.storeName);var n,s=this;return a(n=t.name?new o((function(e){var n;n=t.name===i.name?s._dbInfo.db:openDatabase(t.name,"","",0),t.storeName?e({db:n,storeNames:[t.storeName]}):e(z(n))})).then((function(t){return new o((function(e,i){t.db.transaction((function(n){function s(t){return new o((function(e,i){n.executeSql("DROP TABLE IF EXISTS "+t,[],(function(){e()}),(function(t,e){i(e)}))}))}for(var r=[],a=0,h=t.storeNames.length;a<h;a++)r.push(s(t.storeNames[a]));o.all(r).then((function(){e()})).catch((function(t){i(t)}))}),(function(t){i(t)}))}))})):o.reject("Invalid arguments"),e),n}};function q(t,e){var i=t.name+"/";return t.storeName!==e.storeName&&(i+=t.storeName+"/"),i}function F(){return!function(){try{return localStorage.setItem("_localforage_support_test",!0),localStorage.removeItem("_localforage_support_test"),!1}catch(t){return!0}}()||localStorage.length>0}var U={_driver:"localStorageWrapper",_initStorage:function(t){var e={};if(t)for(var i in t)e[i]=t[i];return e.keyPrefix=q(t,this._defaultConfig),F()?(this._dbInfo=e,e.serializer=j,o.resolve()):o.reject()},_support:function(){try{return"undefined"!=typeof localStorage&&"setItem"in localStorage&&!!localStorage.setItem}catch(t){return!1}}(),iterate:function(t,e){var i=this,n=i.ready().then((function(){for(var e=i._dbInfo,n=e.keyPrefix,s=n.length,r=localStorage.length,o=1,a=0;a<r;a++){var h=localStorage.key(a);if(0===h.indexOf(n)){var l=localStorage.getItem(h);if(l&&(l=e.serializer.deserialize(l)),void 0!==(l=t(l,h.substring(s),o++)))return l}}}));return a(n,e),n},getItem:function(t,e){var i=this;t=l(t);var n=i.ready().then((function(){var e=i._dbInfo,n=localStorage.getItem(e.keyPrefix+t);return n&&(n=e.serializer.deserialize(n)),n}));return a(n,e),n},setItem:function(t,e,i){var n=this;t=l(t);var s=n.ready().then((function(){void 0===e&&(e=null);var i=e;return new o((function(s,r){var o=n._dbInfo;o.serializer.serialize(e,(function(e,n){if(n)r(n);else try{localStorage.setItem(o.keyPrefix+t,e),s(i)}catch(t){"QuotaExceededError"!==t.name&&"NS_ERROR_DOM_QUOTA_REACHED"!==t.name||r(t),r(t)}}))}))}));return a(s,i),s},removeItem:function(t,e){var i=this;t=l(t);var n=i.ready().then((function(){var e=i._dbInfo;localStorage.removeItem(e.keyPrefix+t)}));return a(n,e),n},clear:function(t){var e=this,i=e.ready().then((function(){for(var t=e._dbInfo.keyPrefix,i=localStorage.length-1;i>=0;i--){var n=localStorage.key(i);0===n.indexOf(t)&&localStorage.removeItem(n)}}));return a(i,t),i},length:function(t){var e=this.keys().then((function(t){return t.length}));return a(e,t),e},key:function(t,e){var i=this,n=i.ready().then((function(){var e,n=i._dbInfo;try{e=localStorage.key(t)}catch(t){e=null}return e&&(e=e.substring(n.keyPrefix.length)),e}));return a(n,e),n},keys:function(t){var e=this,i=e.ready().then((function(){for(var t=e._dbInfo,i=localStorage.length,n=[],s=0;s<i;s++){var r=localStorage.key(s);0===r.indexOf(t.keyPrefix)&&n.push(r.substring(t.keyPrefix.length))}return n}));return a(i,t),i},dropInstance:function(t,e){if(e=c.apply(this,arguments),!(t="function"!=typeof t&&t||{}).name){var i=this.config();t.name=t.name||i.name,t.storeName=t.storeName||i.storeName}var n,s=this;return a(n=t.name?new o((function(e){t.storeName?e(q(t,s._defaultConfig)):e(t.name+"/")})).then((function(t){for(var e=localStorage.length-1;e>=0;e--){var i=localStorage.key(e);0===i.indexOf(t)&&localStorage.removeItem(i)}})):o.reject("Invalid arguments"),e),n}},W=function(t,e){for(var i,n,s=t.length,r=0;r<s;){if((i=t[r])===(n=e)||"number"==typeof i&&"number"==typeof n&&isNaN(i)&&isNaN(n))return!0;r++}return!1},H=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},V={},X={},G={INDEXEDDB:T,WEBSQL:B,LOCALSTORAGE:U},Y=[G.INDEXEDDB._driver,G.WEBSQL._driver,G.LOCALSTORAGE._driver],$=["dropInstance"],K=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat($),Z={description:"",driver:Y.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function J(t,e){t[e]=function(){var i=arguments;return t.ready().then((function(){return t[e].apply(t,i)}))}}function Q(){for(var t=1;t<arguments.length;t++){var e=arguments[t];if(e)for(var i in e)e.hasOwnProperty(i)&&(H(e[i])?arguments[0][i]=e[i].slice():arguments[0][i]=e[i])}return arguments[0]}var tt=new(function(){function t(e){for(var i in function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),G)if(G.hasOwnProperty(i)){var n=G[i],s=n._driver;this[i]=s,V[s]||this.defineDriver(n)}this._defaultConfig=Q({},Z),this._config=Q({},this._defaultConfig,e),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch((function(){}))}return t.prototype.config=function(t){if("object"===(void 0===t?"undefined":n(t))){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var e in t){if("storeName"===e&&(t[e]=t[e].replace(/\W/g,"_")),"version"===e&&"number"!=typeof t[e])return new Error("Database version must be a number.");this._config[e]=t[e]}return!("driver"in t)||!t.driver||this.setDriver(this._config.driver)}return"string"==typeof t?this._config[t]:this._config},t.prototype.defineDriver=function(t,e,i){var n=new o((function(e,i){try{var n=t._driver,s=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!t._driver)return void i(s);for(var r=K.concat("_initStorage"),h=0,l=r.length;h<l;h++){var c=r[h];if((!W($,c)||t[c])&&"function"!=typeof t[c])return void i(s)}!function(){for(var e=function(t){return function(){var e=new Error("Method "+t+" is not implemented by the current driver"),i=o.reject(e);return a(i,arguments[arguments.length-1]),i}},i=0,n=$.length;i<n;i++){var s=$[i];t[s]||(t[s]=e(s))}}();var u=function(i){V[n]&&console.info("Redefining LocalForage driver: "+n),V[n]=t,X[n]=i,e()};"_support"in t?t._support&&"function"==typeof t._support?t._support().then(u,i):u(!!t._support):u(!0)}catch(t){i(t)}}));return h(n,e,i),n},t.prototype.driver=function(){return this._driver||null},t.prototype.getDriver=function(t,e,i){var n=V[t]?o.resolve(V[t]):o.reject(new Error("Driver not found."));return h(n,e,i),n},t.prototype.getSerializer=function(t){var e=o.resolve(j);return h(e,t),e},t.prototype.ready=function(t){var e=this,i=e._driverSet.then((function(){return null===e._ready&&(e._ready=e._initDriver()),e._ready}));return h(i,t,t),i},t.prototype.setDriver=function(t,e,i){var n=this;H(t)||(t=[t]);var s=this._getSupportedDrivers(t);function r(){n._config.driver=n.driver()}function a(t){return n._extend(t),r(),n._ready=n._initStorage(n._config),n._ready}var l=null!==this._driverSet?this._driverSet.catch((function(){return o.resolve()})):o.resolve();return this._driverSet=l.then((function(){var t=s[0];return n._dbInfo=null,n._ready=null,n.getDriver(t).then((function(t){n._driver=t._driver,r(),n._wrapLibraryMethodsWithReady(),n._initDriver=function(t){return function(){var e=0;return function i(){for(;e<t.length;){var s=t[e];return e++,n._dbInfo=null,n._ready=null,n.getDriver(s).then(a).catch(i)}r();var h=new Error("No available storage method found.");return n._driverSet=o.reject(h),n._driverSet}()}}(s)}))})).catch((function(){r();var t=new Error("No available storage method found.");return n._driverSet=o.reject(t),n._driverSet})),h(this._driverSet,e,i),this._driverSet},t.prototype.supports=function(t){return!!X[t]},t.prototype._extend=function(t){Q(this,t)},t.prototype._getSupportedDrivers=function(t){for(var e=[],i=0,n=t.length;i<n;i++){var s=t[i];this.supports(s)&&e.push(s)}return e},t.prototype._wrapLibraryMethodsWithReady=function(){for(var t=0,e=K.length;t<e;t++)J(this,K[t])},t.prototype.createInstance=function(e){return new t(e)},t}());e.exports=tt},{3:3}]},{},[4])(4)}).call(this,i(17))},function(t,e,i){"use strict";var n=i(3),s=i.n(n),r=i(0),o=i(5),a=i(4),h=i(2),l=i(6),c=i(8);var u=function(t,e,i,n){var s,o="undefined"!=typeof window&&window.URL,h=o?"blob":"arraybuffer",l=new r.defer,c=new XMLHttpRequest,u=XMLHttpRequest.prototype;for(s in"overrideMimeType"in u||Object.defineProperty(u,"overrideMimeType",{value:function(){}}),i&&(c.withCredentials=!0),c.onreadystatechange=function(){if(this.readyState===XMLHttpRequest.DONE){var t=!1;if(""!==this.responseType&&"document"!==this.responseType||(t=this.responseXML),200===this.status||0===this.status||t){var i;if(!this.response&&!t)return l.reject({status:this.status,message:"Empty Response",stack:(new Error).stack}),l.promise;if(403===this.status)return l.reject({status:this.status,response:this.response,message:"Forbidden",stack:(new Error).stack}),l.promise;i=t?this.responseXML:Object(r.isXml)(e)?Object(r.parse)(this.response,"text/xml"):"xhtml"==e?Object(r.parse)(this.response,"application/xhtml+xml"):"html"==e||"htm"==e?Object(r.parse)(this.response,"text/html"):"json"==e?JSON.parse(this.response):"blob"==e?o?this.response:new Blob([this.response]):this.response,l.resolve(i)}else l.reject({status:this.status,message:this.response,stack:(new Error).stack})}},c.onerror=function(t){l.reject(t)},c.open("GET",t,!0),n)c.setRequestHeader(s,n[s]);return"json"==e&&c.setRequestHeader("Accept","application/json"),e||(e=new a.a(t).extension),"blob"==e&&(c.responseType=h),Object(r.isXml)(e)&&c.overrideMimeType("text/xml"),"binary"==e&&(c.responseType="arraybuffer"),c.send(),l.promise},d=i(15);var f=class{constructor(t,e){this.idref=t.idref,this.linear="yes"===t.linear,this.properties=t.properties,this.index=t.index,this.href=t.href,this.url=t.url,this.canonical=t.canonical,this.next=t.next,this.prev=t.prev,this.cfiBase=t.cfiBase,e?this.hooks=e:(this.hooks={},this.hooks.serialize=new l.a(this),this.hooks.content=new l.a(this)),this.document=void 0,this.contents=void 0,this.output=void 0}load(t){var e=t||this.request||u,i=new r.defer,n=i.promise;return this.contents?i.resolve(this.contents):e(this.url).then(function(t){return this.document=t,this.contents=t.documentElement,this.hooks.content.trigger(this.document,this)}.bind(this)).then(function(){i.resolve(this.contents)}.bind(this)).catch((function(t){i.reject(t)})),n}base(){return Object(c.a)(this.document,this)}render(t){var e=new r.defer,i=e.promise;return this.output,this.load(t).then(function(t){var e=("undefined"!=typeof navigator&&navigator.userAgent||"").indexOf("Trident")>=0,i=new("undefined"==typeof XMLSerializer||e?d.DOMParser:XMLSerializer);return this.output=i.serializeToString(t),this.output}.bind(this)).then(function(){return this.hooks.serialize.trigger(this.output,this)}.bind(this)).then(function(){e.resolve(this.output)}.bind(this)).catch((function(t){e.reject(t)})),i}find(t){var e=this,i=[],n=t.toLowerCase();return Object(r.sprint)(e.document,(function(t){!function(t){for(var s,r,o,a=t.textContent.toLowerCase(),h=e.document.createRange(),l=-1;-1!=r;)-1!=(r=a.indexOf(n,l+1))&&((h=e.document.createRange()).setStart(t,r),h.setEnd(t,r+n.length),s=e.cfiFromRange(h),o=t.textContent.length<150?t.textContent:"..."+(o=t.textContent.substring(r-75,r+75))+"...",i.push({cfi:s,excerpt:o})),l=r}(t)})),i}search(t,e=5){if(void 0===document.createTreeWalker)return this.find(t);let i=[];const n=this,s=t.toLowerCase(),r=function(t){const e=t.reduce((t,e)=>t+e.textContent,"").toLowerCase().indexOf(s);if(-1!=e){const r=0,o=e+s.length;let a=0,h=0;if(e<t[r].length){let s;for(;a<t.length-1&&(h+=t[a].length,!(o<=h));)a+=1;let l=t[r],c=t[a],u=n.document.createRange();u.setStart(l,e);let d=t.slice(0,a).reduce((t,e)=>t+e.textContent.length,0);u.setEnd(c,d>o?o:o-d),s=n.cfiFromRange(u);let f=t.slice(0,a+1).reduce((t,e)=>t+e.textContent,"");f.length>150&&(f=f.substring(e-75,e+75),f="..."+f+"..."),i.push({cfi:s,excerpt:f})}}},o=document.createTreeWalker(n.document,NodeFilter.SHOW_TEXT,null,!1);let a,h=[];for(;a=o.nextNode();)h.push(a),h.length==e&&(r(h.slice(0,e)),h=h.slice(1,e));return h.length>0&&r(h),i}reconcileLayoutSettings(t){var e={layout:t.layout,spread:t.spread,orientation:t.orientation};return this.properties.forEach((function(t){var i,n,s=t.replace("rendition:",""),r=s.indexOf("-");-1!=r&&(i=s.slice(0,r),n=s.slice(r+1),e[i]=n)})),e}cfiFromRange(t){return new h.a(t,this.cfiBase).toString()}cfiFromElement(t){return new h.a(t,this.cfiBase).toString()}unload(){this.document=void 0,this.contents=void 0,this.output=void 0}destroy(){this.unload(),this.hooks.serialize.clear(),this.hooks.content.clear(),this.hooks=void 0,this.idref=void 0,this.linear=void 0,this.properties=void 0,this.index=void 0,this.href=void 0,this.url=void 0,this.next=void 0,this.prev=void 0,this.cfiBase=void 0}};var p=class{constructor(){this.spineItems=[],this.spineByHref={},this.spineById={},this.hooks={},this.hooks.serialize=new l.a,this.hooks.content=new l.a,this.hooks.content.register(c.a),this.hooks.content.register(c.b),this.hooks.content.register(c.d),this.epubcfi=new h.a,this.loaded=!1,this.items=void 0,this.manifest=void 0,this.spineNodeIndex=void 0,this.baseUrl=void 0,this.length=void 0}unpack(t,e,i){this.items=t.spine,this.manifest=t.manifest,this.spineNodeIndex=t.spineNodeIndex,this.baseUrl=t.baseUrl||t.basePath||"",this.length=this.items.length,this.items.forEach((t,n)=>{var s,r=this.manifest[t.idref];t.index=n,t.cfiBase=this.epubcfi.generateChapterComponent(this.spineNodeIndex,t.index,t.id),t.href&&(t.url=e(t.href,!0),t.canonical=i(t.href)),r&&(t.href=r.href,t.url=e(t.href,!0),t.canonical=i(t.href),r.properties.length&&t.properties.push.apply(t.properties,r.properties)),"yes"===t.linear?(t.prev=function(){let e=t.index;for(;e>0;){let t=this.get(e-1);if(t&&t.linear)return t;e-=1}}.bind(this),t.next=function(){let e=t.index;for(;e<this.spineItems.length-1;){let t=this.get(e+1);if(t&&t.linear)return t;e+=1}}.bind(this)):(t.prev=function(){},t.next=function(){}),s=new f(t,this.hooks),this.append(s)}),this.loaded=!0}get(t){var e=0;if(void 0===t)for(;e<this.spineItems.length;){let t=this.spineItems[e];if(t&&t.linear)break;e+=1}else if(this.epubcfi.isCfiString(t)){e=new h.a(t).spinePos}else"number"==typeof t||!1===isNaN(t)?e=t:"string"==typeof t&&0===t.indexOf("#")?e=this.spineById[t.substring(1)]:"string"==typeof t&&(t=t.split("#")[0],e=this.spineByHref[t]||this.spineByHref[encodeURI(t)]);return this.spineItems[e]||null}append(t){var e=this.spineItems.length;return t.index=e,this.spineItems.push(t),this.spineByHref[decodeURI(t.href)]=e,this.spineByHref[encodeURI(t.href)]=e,this.spineByHref[t.href]=e,this.spineById[t.idref]=e,e}prepend(t){return this.spineByHref[t.href]=0,this.spineById[t.idref]=0,this.spineItems.forEach((function(t,e){t.index=e})),0}remove(t){var e=this.spineItems.indexOf(t);if(e>-1)return delete this.spineByHref[t.href],delete this.spineById[t.idref],this.spineItems.splice(e,1)}each(){return this.spineItems.forEach.apply(this.spineItems,arguments)}first(){let t=0;do{let e=this.get(t);if(e&&e.linear)return e;t+=1}while(t<this.spineItems.length)}last(){let t=this.spineItems.length-1;do{let e=this.get(t);if(e&&e.linear)return e;t-=1}while(t>=0)}destroy(){this.each(t=>t.destroy()),this.spineItems=void 0,this.spineByHref=void 0,this.spineById=void 0,this.hooks.serialize.clear(),this.hooks.content.clear(),this.hooks=void 0,this.epubcfi=void 0,this.loaded=!1,this.items=void 0,this.manifest=void 0,this.spineNodeIndex=void 0,this.baseUrl=void 0,this.length=void 0}},g=i(9),m=i(1);class v{constructor(t,e,i){this.spine=t,this.request=e,this.pause=i||100,this.q=new g.a(this),this.epubcfi=new h.a,this._locations=[],this._locationsWords=[],this.total=0,this.break=150,this._current=0,this._wordCounter=0,this.currentLocation="",this._currentCfi="",this.processingTimeout=void 0}generate(t){return t&&(this.break=t),this.q.pause(),this.spine.each(function(t){t.linear&&this.q.enqueue(this.process.bind(this),t)}.bind(this)),this.q.run().then(function(){return this.total=this._locations.length-1,this._currentCfi&&(this.currentLocation=this._currentCfi),this._locations}.bind(this))}createRange(){return{startContainer:void 0,startOffset:void 0,endContainer:void 0,endOffset:void 0}}process(t){return t.load(this.request).then(function(e){var i=new r.defer,n=this.parse(e,t.cfiBase);return this._locations=this._locations.concat(n),t.unload(),this.processingTimeout=setTimeout(()=>i.resolve(n),this.pause),i.promise}.bind(this))}parse(t,e,i){var n,s,o=[],a=t.ownerDocument,l=Object(r.qs)(a,"body"),c=0,u=i||this.break;if(Object(r.sprint)(l,function(t){var i,r=t.length,a=0;if(0===t.textContent.trim().length)return!1;for(0==c&&((n=this.createRange()).startContainer=t,n.startOffset=0),(i=u-c)>r&&(c+=r,a=r);a<r;)if(i=u-c,0===c&&(a+=1,(n=this.createRange()).startContainer=t,n.startOffset=a),a+i>=r)c+=r-a,a=r;else{a+=i,n.endContainer=t,n.endOffset=a;let s=new h.a(n,e).toString();o.push(s),c=0}s=t}.bind(this)),n&&n.startContainer&&s){n.endContainer=s,n.endOffset=s.length;let t=new h.a(n,e).toString();o.push(t),c=0}return o}generateFromWords(t,e,i){var n=t?new h.a(t):void 0;return this.q.pause(),this._locationsWords=[],this._wordCounter=0,this.spine.each(function(t){t.linear&&(n?t.index>=n.spinePos&&this.q.enqueue(this.processWords.bind(this),t,e,n,i):this.q.enqueue(this.processWords.bind(this),t,e,n,i))}.bind(this)),this.q.run().then(function(){return this._currentCfi&&(this.currentLocation=this._currentCfi),this._locationsWords}.bind(this))}processWords(t,e,i,n){return n&&this._locationsWords.length>=n?Promise.resolve():t.load(this.request).then(function(s){var o=new r.defer,a=this.parseWords(s,t,e,i),h=n-this._locationsWords.length;return this._locationsWords=this._locationsWords.concat(a.length>=n?a.slice(0,h):a),t.unload(),this.processingTimeout=setTimeout(()=>o.resolve(a),this.pause),o.promise}.bind(this))}countWords(t){return(t=(t=(t=t.replace(/(^\s*)|(\s*$)/gi,"")).replace(/[ ]{2,}/gi," ")).replace(/\n /,"\n")).split(" ").length}parseWords(t,e,i,n){var s,o=e.cfiBase,a=[],l=t.ownerDocument,c=Object(r.qs)(l,"body"),u=i,d=!n||n.spinePos!==e.index;n&&e.index===n.spinePos&&(s=n.findNode(n.range?n.path.steps.concat(n.start.steps):n.path.steps,t.ownerDocument));return Object(r.sprint)(c,function(t){if(!d){if(t!==s)return!1;d=!0}if(t.textContent.length<10&&0===t.textContent.trim().length)return!1;var e,i=this.countWords(t.textContent),n=0;if(0===i)return!1;for((e=u-this._wordCounter)>i&&(this._wordCounter+=i,n=i);n<i;)if(n+(e=u-this._wordCounter)>=i)this._wordCounter+=i-n,n=i;else{n+=e;let i=new h.a(t,o);a.push({cfi:i.toString(),wordCount:this._wordCounter}),this._wordCounter=0}t}.bind(this)),a}locationFromCfi(t){let e;return h.a.prototype.isCfiString(t)&&(t=new h.a(t)),0===this._locations.length?-1:(e=Object(r.locationOf)(t,this._locations,this.epubcfi.compare),e>this.total?this.total:e)}percentageFromCfi(t){if(0===this._locations.length)return null;var e=this.locationFromCfi(t);return this.percentageFromLocation(e)}percentageFromLocation(t){return t&&this.total?t/this.total:0}cfiFromLocation(t){var e=-1;return"number"!=typeof t&&(t=parseInt(t)),t>=0&&t<this._locations.length&&(e=this._locations[t]),e}cfiFromPercentage(t){let e;if(t>1&&console.warn("Normalize cfiFromPercentage value to between 0 - 1"),t>=1){let t=new h.a(this._locations[this.total]);return t.collapse(),t.toString()}return e=Math.ceil(this.total*t),this.cfiFromLocation(e)}load(t){return this._locations="string"==typeof t?JSON.parse(t):t,this.total=this._locations.length-1,this._locations}save(){return JSON.stringify(this._locations)}getCurrent(){return this._current}setCurrent(t){var e;if("string"==typeof t)this._currentCfi=t;else{if("number"!=typeof t)return;this._current=t}0!==this._locations.length&&("string"==typeof t?(e=this.locationFromCfi(t),this._current=e):e=t,this.emit(m.c.LOCATIONS.CHANGED,{percentage:this.percentageFromLocation(e)}))}get currentLocation(){return this._current}set currentLocation(t){this.setCurrent(t)}length(){return this._locations.length}destroy(){this.spine=void 0,this.request=void 0,this.pause=void 0,this.q.stop(),this.q=void 0,this.epubcfi=void 0,this._locations=void 0,this.total=void 0,this.break=void 0,this._current=void 0,this.currentLocation=void 0,this._currentCfi=void 0,clearTimeout(this.processingTimeout)}}s()(v.prototype);var y=v,b=i(7),w=i.n(b);var x=class{constructor(t){this.packagePath="",this.directory="",this.encoding="",t&&this.parse(t)}parse(t){var e;if(!t)throw new Error("Container File Not Found");if(!(e=Object(r.qs)(t,"rootfile")))throw new Error("No RootFile Found");this.packagePath=e.getAttribute("full-path"),this.directory=w.a.dirname(this.packagePath),this.encoding=t.xmlEncoding}destroy(){this.packagePath=void 0,this.directory=void 0,this.encoding=void 0}};var E=class{constructor(t){this.manifest={},this.navPath="",this.ncxPath="",this.coverPath="",this.spineNodeIndex=0,this.spine=[],this.metadata={},t&&this.parse(t)}parse(t){var e,i,n;if(!t)throw new Error("Package File Not Found");if(!(e=Object(r.qs)(t,"metadata")))throw new Error("No Metadata Found");if(!(i=Object(r.qs)(t,"manifest")))throw new Error("No Manifest Found");if(!(n=Object(r.qs)(t,"spine")))throw new Error("No Spine Found");return this.manifest=this.parseManifest(i),this.navPath=this.findNavPath(i),this.ncxPath=this.findNcxPath(i,n),this.coverPath=this.findCoverPath(t),this.spineNodeIndex=Object(r.indexOfElementNode)(n),this.spine=this.parseSpine(n,this.manifest),this.uniqueIdentifier=this.findUniqueIdentifier(t),this.metadata=this.parseMetadata(e),this.metadata.direction=n.getAttribute("page-progression-direction"),{metadata:this.metadata,spine:this.spine,manifest:this.manifest,navPath:this.navPath,ncxPath:this.ncxPath,coverPath:this.coverPath,spineNodeIndex:this.spineNodeIndex}}parseMetadata(t){var e={};return e.title=this.getElementText(t,"title"),e.creator=this.getElementText(t,"creator"),e.description=this.getElementText(t,"description"),e.pubdate=this.getElementText(t,"date"),e.publisher=this.getElementText(t,"publisher"),e.identifier=this.getElementText(t,"identifier"),e.language=this.getElementText(t,"language"),e.rights=this.getElementText(t,"rights"),e.modified_date=this.getPropertyText(t,"dcterms:modified"),e.layout=this.getPropertyText(t,"rendition:layout"),e.orientation=this.getPropertyText(t,"rendition:orientation"),e.flow=this.getPropertyText(t,"rendition:flow"),e.viewport=this.getPropertyText(t,"rendition:viewport"),e.media_active_class=this.getPropertyText(t,"media:active-class"),e.spread=this.getPropertyText(t,"rendition:spread"),e}parseManifest(t){var e={},i=Object(r.qsa)(t,"item");return Array.prototype.slice.call(i).forEach((function(t){var i=t.getAttribute("id"),n=t.getAttribute("href")||"",s=t.getAttribute("media-type")||"",r=t.getAttribute("media-overlay")||"",o=t.getAttribute("properties")||"";e[i]={href:n,type:s,overlay:r,properties:o.length?o.split(" "):[]}})),e}parseSpine(t,e){var i=[],n=Object(r.qsa)(t,"itemref");return Array.prototype.slice.call(n).forEach((function(t,e){var n=t.getAttribute("idref"),s=t.getAttribute("properties")||"",r=s.length?s.split(" "):[],o={id:t.getAttribute("id"),idref:n,linear:t.getAttribute("linear")||"yes",properties:r,index:e};i.push(o)})),i}findUniqueIdentifier(t){var e=t.documentElement.getAttribute("unique-identifier");if(!e)return"";var i=t.getElementById(e);return i&&"identifier"===i.localName&&"http://purl.org/dc/elements/1.1/"===i.namespaceURI&&i.childNodes.length>0?i.childNodes[0].nodeValue.trim():""}findNavPath(t){var e=Object(r.qsp)(t,"item",{properties:"nav"});return!!e&&e.getAttribute("href")}findNcxPath(t,e){var i,n=Object(r.qsp)(t,"item",{"media-type":"application/x-dtbncx+xml"});return n||(i=e.getAttribute("toc"))&&(n=t.querySelector("#"+i)),!!n&&n.getAttribute("href")}findCoverPath(t){Object(r.qs)(t,"package").getAttribute("version");var e=Object(r.qsp)(t,"item",{properties:"cover-image"});if(e)return e.getAttribute("href");var i=Object(r.qsp)(t,"meta",{name:"cover"});if(i){var n=i.getAttribute("content"),s=t.getElementById(n);return s?s.getAttribute("href"):""}return!1}getElementText(t,e){var i,n=t.getElementsByTagNameNS("http://purl.org/dc/elements/1.1/",e);return n&&0!==n.length&&(i=n[0]).childNodes.length?i.childNodes[0].nodeValue:""}getPropertyText(t,e){var i=Object(r.qsp)(t,"meta",{property:e});return i&&i.childNodes.length?i.childNodes[0].nodeValue:""}load(t){this.metadata=t.metadata;let e=t.readingOrder||t.spine;return this.spine=e.map((t,e)=>(t.index=e,t.linear=t.linear||"yes",t)),t.resources.forEach((t,e)=>{this.manifest[e]=t,t.rel&&"cover"===t.rel[0]&&(this.coverPath=t.href)}),this.spineNodeIndex=0,this.toc=t.toc.map((t,e)=>(t.label=t.title,t)),{metadata:this.metadata,spine:this.spine,manifest:this.manifest,navPath:this.navPath,ncxPath:this.ncxPath,coverPath:this.coverPath,spineNodeIndex:this.spineNodeIndex,toc:this.toc}}destroy(){this.manifest=void 0,this.navPath=void 0,this.ncxPath=void 0,this.coverPath=void 0,this.spineNodeIndex=void 0,this.spine=void 0,this.metadata=void 0}};var S=class{constructor(t){this.toc=[],this.tocByHref={},this.tocById={},this.landmarks=[],this.landmarksByType={},this.length=0,t&&this.parse(t)}parse(t){let e,i,n=t.nodeType;n&&(e=Object(r.qs)(t,"html"),i=Object(r.qs)(t,"ncx")),n?e?(this.toc=this.parseNav(t),this.landmarks=this.parseLandmarks(t)):i&&(this.toc=this.parseNcx(t)):this.toc=this.load(t),this.length=0,this.unpack(this.toc)}unpack(t){for(var e,i=0;i<t.length;i++)(e=t[i]).href&&(this.tocByHref[e.href]=i),e.id&&(this.tocById[e.id]=i),this.length++,e.subitems.length&&this.unpack(e.subitems)}get(t){var e;return t?(0===t.indexOf("#")?e=this.tocById[t.substring(1)]:t in this.tocByHref&&(e=this.tocByHref[t]),this.getByIndex(t,e,this.toc)):this.toc}getByIndex(t,e,i){if(0===i.length)return;const n=i[e];if(!n||t!==n.id&&t!==n.href){let n;for(let s=0;s<i.length&&(n=this.getByIndex(t,e,i[s].subitems),!n);++s);return n}return n}landmark(t){var e;return t?(e=this.landmarksByType[t],this.landmarks[e]):this.landmarks}parseNav(t){var e=Object(r.querySelectorByType)(t,"nav","toc"),i=[];if(!e)return i;let n=Object(r.filterChildren)(e,"ol",!0);return n?i=this.parseNavList(n):i}parseNavList(t,e){const i=[];if(!t)return i;if(!t.children)return i;for(let n=0;n<t.children.length;n++){const s=this.navItem(t.children[n],e);s&&i.push(s)}return i}navItem(t,e){let i=t.getAttribute("id")||void 0,n=Object(r.filterChildren)(t,"a",!0)||Object(r.filterChildren)(t,"span",!0);if(!n)return;let s=n.getAttribute("href")||"";i||(i=s);let o=n.textContent||"",a=[],h=Object(r.filterChildren)(t,"ol",!0);return h&&(a=this.parseNavList(h,i)),{id:i,href:s,label:o,subitems:a,parent:e}}parseLandmarks(t){var e,i,n=Object(r.querySelectorByType)(t,"nav","landmarks"),s=n?Object(r.qsa)(n,"li"):[],o=s.length,a=[];if(!s||0===o)return a;for(e=0;e<o;++e)(i=this.landmarkItem(s[e]))&&(a.push(i),this.landmarksByType[i.type]=e);return a}landmarkItem(t){let e=Object(r.filterChildren)(t,"a",!0);if(!e)return;let i=e.getAttributeNS("http://www.idpf.org/2007/ops","type")||void 0;return{href:e.getAttribute("href")||"",label:e.textContent||"",type:i}}parseNcx(t){var e,i,n=Object(r.qsa)(t,"navPoint"),s=n.length,o={},a=[];if(!n||0===s)return a;for(e=0;e<s;++e)o[(i=this.ncxItem(n[e])).id]=i,i.parent?o[i.parent].subitems.push(i):a.push(i);return a}ncxItem(t){var e,i=t.getAttribute("id")||!1,n=Object(r.qs)(t,"content").getAttribute("src"),s=Object(r.qs)(t,"navLabel"),o=s.textContent?s.textContent:"",a=t.parentNode;return!a||"navPoint"!==a.nodeName&&"navPoint"!==a.nodeName.split(":").slice(-1)[0]||(e=a.getAttribute("id")),{id:i,href:n,label:o,subitems:[],parent:e}}load(t){return t.map(t=>(t.label=t.title,t.subitems=t.children?this.load(t.children):[],t))}forEach(t){return this.toc.forEach(t)}},N={application:{ecmascript:["es","ecma"],javascript:"js",ogg:"ogx",pdf:"pdf",postscript:["ps","ai","eps","epsi","epsf","eps2","eps3"],"rdf+xml":"rdf",smil:["smi","smil"],"xhtml+xml":["xhtml","xht"],xml:["xml","xsl","xsd","opf","ncx"],zip:"zip","x-httpd-eruby":"rhtml","x-latex":"latex","x-maker":["frm","maker","frame","fm","fb","book","fbdoc"],"x-object":"o","x-shockwave-flash":["swf","swfl"],"x-silverlight":"scr","epub+zip":"epub","font-tdpfr":"pfr","inkml+xml":["ink","inkml"],json:"json","jsonml+json":"jsonml","mathml+xml":"mathml","metalink+xml":"metalink",mp4:"mp4s","omdoc+xml":"omdoc",oxps:"oxps","vnd.amazon.ebook":"azw",widget:"wgt","x-dtbook+xml":"dtb","x-dtbresource+xml":"res","x-font-bdf":"bdf","x-font-ghostscript":"gsf","x-font-linux-psf":"psf","x-font-otf":"otf","x-font-pcf":"pcf","x-font-snf":"snf","x-font-ttf":["ttf","ttc"],"x-font-type1":["pfa","pfb","pfm","afm"],"x-font-woff":"woff","x-mobipocket-ebook":["prc","mobi"],"x-mspublisher":"pub","x-nzb":"nzb","x-tgif":"obj","xaml+xml":"xaml","xml-dtd":"dtd","xproc+xml":"xpl","xslt+xml":"xslt","internet-property-stream":"acx","x-compress":"z","x-compressed":"tgz","x-gzip":"gz"},audio:{flac:"flac",midi:["mid","midi","kar","rmi"],mpeg:["mpga","mpega","mp2","mp3","m4a","mp2a","m2a","m3a"],mpegurl:"m3u",ogg:["oga","ogg","spx"],"x-aiff":["aif","aiff","aifc"],"x-ms-wma":"wma","x-wav":"wav",adpcm:"adp",mp4:"mp4a",webm:"weba","x-aac":"aac","x-caf":"caf","x-matroska":"mka","x-pn-realaudio-plugin":"rmp",xm:"xm",mid:["mid","rmi"]},image:{gif:"gif",ief:"ief",jpeg:["jpeg","jpg","jpe"],pcx:"pcx",png:"png","svg+xml":["svg","svgz"],tiff:["tiff","tif"],"x-icon":"ico",bmp:"bmp",webp:"webp","x-pict":["pic","pct"],"x-tga":"tga","cis-cod":"cod"},text:{"cache-manifest":["manifest","appcache"],css:"css",csv:"csv",html:["html","htm","shtml","stm"],mathml:"mml",plain:["txt","text","brf","conf","def","list","log","in","bas"],richtext:"rtx","tab-separated-values":"tsv","x-bibtex":"bib"},video:{mpeg:["mpeg","mpg","mpe","m1v","m2v","mp2","mpa","mpv2"],mp4:["mp4","mp4v","mpg4"],quicktime:["qt","mov"],ogg:"ogv","vnd.mpegurl":["mxu","m4u"],"x-flv":"flv","x-la-asf":["lsf","lsx"],"x-mng":"mng","x-ms-asf":["asf","asx","asr"],"x-ms-wm":"wm","x-ms-wmv":"wmv","x-ms-wmx":"wmx","x-ms-wvx":"wvx","x-msvideo":"avi","x-sgi-movie":"movie","x-matroska":["mpv","mkv","mk3d","mks"],"3gpp2":"3g2",h261:"h261",h263:"h263",h264:"h264",jpeg:"jpgv",jpm:["jpm","jpgm"],mj2:["mj2","mjp2"],"vnd.ms-playready.media.pyv":"pyv","vnd.uvvu.mp4":["uvu","uvvu"],"vnd.vivo":"viv",webm:"webm","x-f4v":"f4v","x-m4v":"m4v","x-ms-vob":"vob","x-smv":"smv"}},_=function(){var t,e,i,n,s={};for(t in N)if(N.hasOwnProperty(t))for(e in N[t])if(N[t].hasOwnProperty(e))if("string"==typeof(i=N[t][e]))s[i]=t+"/"+e;else for(n=0;n<i.length;n++)s[i[n]]=t+"/"+e;return s}();var T={lookup:function(t){return t&&_[t.split(".").pop().toLowerCase()]||"text/plain"}};var C=class{constructor(t,e){this.settings={replacements:e&&e.replacements||"base64",archive:e&&e.archive,resolver:e&&e.resolver,request:e&&e.request},this.process(t)}process(t){this.manifest=t,this.resources=Object.keys(t).map((function(e){return t[e]})),this.replacementUrls=[],this.html=[],this.assets=[],this.css=[],this.urls=[],this.cssUrls=[],this.split(),this.splitUrls()}split(){this.html=this.resources.filter((function(t){if("application/xhtml+xml"===t.type||"text/html"===t.type)return!0})),this.assets=this.resources.filter((function(t){if("application/xhtml+xml"!==t.type&&"text/html"!==t.type)return!0})),this.css=this.resources.filter((function(t){if("text/css"===t.type)return!0}))}splitUrls(){this.urls=this.assets.map(function(t){return t.href}.bind(this)),this.cssUrls=this.css.map((function(t){return t.href}))}createUrl(t){var e=new o.a(t),i=T.lookup(e.filename);return this.settings.archive?this.settings.archive.createUrl(t,{base64:"base64"===this.settings.replacements}):"base64"===this.settings.replacements?this.settings.request(t,"blob").then(t=>Object(r.blob2base64)(t)).then(t=>Object(r.createBase64Url)(t,i)):this.settings.request(t,"blob").then(t=>Object(r.createBlobUrl)(t,i))}replacements(){if("none"===this.settings.replacements)return new Promise(function(t){t(this.urls)}.bind(this));var t=this.urls.map(t=>{var e=this.settings.resolver(t);return this.createUrl(e).catch(t=>(console.error(t),null))});return Promise.all(t).then(t=>(this.replacementUrls=t.filter(t=>"string"==typeof t),t))}replaceCss(t,e){var i=[];return t=t||this.settings.archive,e=e||this.settings.resolver,this.cssUrls.forEach(function(n){var s=this.createCssFile(n,t,e).then(function(t){var e=this.urls.indexOf(n);e>-1&&(this.replacementUrls[e]=t)}.bind(this));i.push(s)}.bind(this)),Promise.all(i)}createCssFile(t){if(w.a.isAbsolute(t))return new Promise((function(t){t()}));var e,i=this.settings.resolver(t);e=this.settings.archive?this.settings.archive.getText(i):this.settings.request(i,"text");var n=this.urls.map(t=>{var e=this.settings.resolver(t);return new a.a(i).relative(e)});return e?e.then(t=>(t=Object(c.e)(t,n,this.replacementUrls),"base64"===this.settings.replacements?Object(r.createBase64Url)(t,"text/css"):Object(r.createBlobUrl)(t,"text/css")),t=>new Promise((function(t){t()}))):new Promise((function(t){t()}))}relativeTo(t,e){return e=e||this.settings.resolver,this.urls.map(function(i){var n=e(i);return new a.a(t).relative(n)}.bind(this))}get(t){var e=this.urls.indexOf(t);if(-1!==e)return this.replacementUrls.length?new Promise(function(t,i){t(this.replacementUrls[e])}.bind(this)):this.createUrl(t)}substitute(t,e){var i;return i=e?this.relativeTo(e):this.urls,Object(c.e)(t,i,this.replacementUrls)}destroy(){this.settings=void 0,this.manifest=void 0,this.resources=void 0,this.replacementUrls=void 0,this.html=void 0,this.assets=void 0,this.css=void 0,this.urls=void 0,this.cssUrls=void 0}};var O=class{constructor(t){this.pages=[],this.locations=[],this.epubcfi=new h.a,this.firstPage=0,this.lastPage=0,this.totalPages=0,this.toc=void 0,this.ncx=void 0,t&&(this.pageList=this.parse(t)),this.pageList&&this.pageList.length&&this.process(this.pageList)}parse(t){var e=Object(r.qs)(t,"html"),i=Object(r.qs)(t,"ncx");return e?this.parseNav(t):i?this.parseNcx(t):void 0}parseNav(t){var e,i,n=Object(r.querySelectorByType)(t,"nav","page-list"),s=n?Object(r.qsa)(n,"li"):[],o=s.length,a=[];if(!s||0===o)return a;for(e=0;e<o;++e)i=this.item(s[e]),a.push(i);return a}parseNcx(t){var e,i,n,s,o=[],a=0;if(!(i=Object(r.qs)(t,"pageList")))return o;if(s=(n=Object(r.qsa)(i,"pageTarget")).length,!n||0===n.length)return o;for(a=0;a<s;++a)e=this.ncxItem(n[a]),o.push(e);return o}ncxItem(t){var e=Object(r.qs)(t,"navLabel"),i=Object(r.qs)(e,"text").textContent;return{href:Object(r.qs)(t,"content").getAttribute("src"),page:parseInt(i,10)}}item(t){var e,i,n=Object(r.qs)(t,"a"),s=n.getAttribute("href")||"",o=n.textContent||"",a=parseInt(o);return-1!=s.indexOf("epubcfi")?(i=(e=s.split("#"))[0],{cfi:e.length>1&&e[1],href:s,packageUrl:i,page:a}):{href:s,page:a}}process(t){t.forEach((function(t){this.pages.push(t.page),t.cfi&&this.locations.push(t.cfi)}),this),this.firstPage=parseInt(this.pages[0]),this.lastPage=parseInt(this.pages[this.pages.length-1]),this.totalPages=this.lastPage-this.firstPage}pageFromCfi(t){var e=-1;if(0===this.locations.length)return-1;var i=Object(r.indexOfSorted)(t,this.locations,this.epubcfi.compare);return-1!=i?e=this.pages[i]:void 0!==(e=(i=Object(r.locationOf)(t,this.locations,this.epubcfi.compare))-1>=0?this.pages[i-1]:this.pages[0])||(e=-1),e}cfiFromPage(t){var e=-1;"number"!=typeof t&&(t=parseInt(t));var i=this.pages.indexOf(t);return-1!=i&&(e=this.locations[i]),e}pageFromPercentage(t){return Math.round(this.totalPages*t)}percentageFromPage(t){var e=(t-this.firstPage)/this.totalPages;return Math.round(1e3*e)/1e3}percentageFromCfi(t){var e=this.pageFromCfi(t);return this.percentageFromPage(e)}destroy(){this.pages=void 0,this.locations=void 0,this.epubcfi=void 0,this.pageList=void 0,this.toc=void 0,this.ncx=void 0}},I=i(16),R=i(29),k=i.n(R);var A=class{constructor(){this.zip=void 0,this.urlCache={},this.checkRequirements()}checkRequirements(){try{this.zip=new k.a}catch(t){throw new Error("JSZip lib not loaded")}}open(t,e){return this.zip.loadAsync(t,{base64:e})}openUrl(t,e){return u(t,"binary").then(function(t){return this.zip.loadAsync(t,{base64:e})}.bind(this))}request(t,e){var i,n=new r.defer,s=new a.a(t);return e||(e=s.extension),(i="blob"==e?this.getBlob(t):this.getText(t))?i.then(function(t){let i=this.handleResponse(t,e);n.resolve(i)}.bind(this)):n.reject({message:"File not found in the epub: "+t,stack:(new Error).stack}),n.promise}handleResponse(t,e){return"json"==e?JSON.parse(t):Object(r.isXml)(e)?Object(r.parse)(t,"text/xml"):"xhtml"==e?Object(r.parse)(t,"application/xhtml+xml"):"html"==e||"htm"==e?Object(r.parse)(t,"text/html"):t}getBlob(t,e){var i=window.decodeURIComponent(t.substr(1)),n=this.zip.file(i);if(n)return e=e||T.lookup(n.name),n.async("uint8array").then((function(t){return new Blob([t],{type:e})}))}getText(t,e){var i=window.decodeURIComponent(t.substr(1)),n=this.zip.file(i);if(n)return n.async("string").then((function(t){return t}))}getBase64(t,e){var i=window.decodeURIComponent(t.substr(1)),n=this.zip.file(i);if(n)return e=e||T.lookup(n.name),n.async("base64").then((function(t){return"data:"+e+";base64,"+t}))}createUrl(t,e){var i,n,s=new r.defer,o=window.URL||window.webkitURL||window.mozURL,a=e&&e.base64;return t in this.urlCache?(s.resolve(this.urlCache[t]),s.promise):(a?(n=this.getBase64(t))&&n.then(function(e){this.urlCache[t]=e,s.resolve(e)}.bind(this)):(n=this.getBlob(t))&&n.then(function(e){i=o.createObjectURL(e),this.urlCache[t]=i,s.resolve(i)}.bind(this)),n||s.reject({message:"File not found in the epub: "+t,stack:(new Error).stack}),s.promise)}revokeUrl(t){var e=window.URL||window.webkitURL||window.mozURL,i=this.urlCache[t];i&&e.revokeObjectURL(i)}destroy(){var t=window.URL||window.webkitURL||window.mozURL;for(let e in this.urlCache)t.revokeObjectURL(e);this.zip=void 0,this.urlCache={}}},L=i(23),j=i.n(L);class D{constructor(t,e,i){this.urlCache={},this.storage=void 0,this.name=t,this.requester=e||u,this.resolver=i,this.online=!0,this.checkRequirements(),this.addListeners()}checkRequirements(){try{let t;void 0===j.a&&(t=j.a),this.storage=t.createInstance({name:this.name})}catch(t){throw new Error("localForage lib not loaded")}}addListeners(){this._status=this.status.bind(this),window.addEventListener("online",this._status),window.addEventListener("offline",this._status)}removeListeners(){window.removeEventListener("online",this._status),window.removeEventListener("offline",this._status),this._status=void 0}status(t){let e=navigator.onLine;this.online=e,e?this.emit("online",this):this.emit("offline",this)}add(t,e){let i=t.resources.map(t=>{let{href:i}=t,n=this.resolver(i),s=window.encodeURIComponent(n);return this.storage.getItem(s).then(t=>!t||e?this.requester(n,"binary").then(t=>this.storage.setItem(s,t)):t)});return Promise.all(i)}put(t,e,i){let n=window.encodeURIComponent(t);return this.storage.getItem(n).then(s=>s||this.requester(t,"binary",e,i).then(t=>this.storage.setItem(n,t)))}request(t,e,i,n){return this.online?this.requester(t,e,i,n).then(e=>(this.put(t),e)):this.retrieve(t,e)}retrieve(t,e){new r.defer;var i=new a.a(t);return e||(e=i.extension),("blob"==e?this.getBlob(t):this.getText(t)).then(i=>{var n,s=new r.defer;return i?(n=this.handleResponse(i,e),s.resolve(n)):s.reject({message:"File not found in storage: "+t,stack:(new Error).stack}),s.promise})}handleResponse(t,e){return"json"==e?JSON.parse(t):Object(r.isXml)(e)?Object(r.parse)(t,"text/xml"):"xhtml"==e?Object(r.parse)(t,"application/xhtml+xml"):"html"==e||"htm"==e?Object(r.parse)(t,"text/html"):t}getBlob(t,e){let i=window.encodeURIComponent(t);return this.storage.getItem(i).then((function(i){if(i)return e=e||T.lookup(t),new Blob([i],{type:e})}))}getText(t,e){let i=window.encodeURIComponent(t);return e=e||T.lookup(t),this.storage.getItem(i).then((function(t){var i,n=new r.defer,s=new FileReader;if(t)return i=new Blob([t],{type:e}),s.addEventListener("loadend",()=>{n.resolve(s.result)}),s.readAsText(i,e),n.promise}))}getBase64(t,e){let i=window.encodeURIComponent(t);return e=e||T.lookup(t),this.storage.getItem(i).then(t=>{var i,n=new r.defer,s=new FileReader;if(t)return i=new Blob([t],{type:e}),s.addEventListener("loadend",()=>{n.resolve(s.result)}),s.readAsDataURL(i,e),n.promise})}createUrl(t,e){var i,n,s=new r.defer,o=window.URL||window.webkitURL||window.mozURL,a=e&&e.base64;return t in this.urlCache?(s.resolve(this.urlCache[t]),s.promise):(a?(n=this.getBase64(t))&&n.then(function(e){this.urlCache[t]=e,s.resolve(e)}.bind(this)):(n=this.getBlob(t))&&n.then(function(e){i=o.createObjectURL(e),this.urlCache[t]=i,s.resolve(i)}.bind(this)),n||s.reject({message:"File not found in storage: "+t,stack:(new Error).stack}),s.promise)}revokeUrl(t){var e=window.URL||window.webkitURL||window.mozURL,i=this.urlCache[t];i&&e.revokeObjectURL(i)}destroy(){var t=window.URL||window.webkitURL||window.mozURL;for(let e in this.urlCache)t.revokeObjectURL(e);this.urlCache={},this.removeListeners()}}s()(D.prototype);var P=D;var M=class{constructor(t){this.interactive="",this.fixedLayout="",this.openToSpread="",this.orientationLock="",t&&this.parse(t)}parse(t){if(!t)return this;const e=Object(r.qs)(t,"display_options");if(!e)return this;return Object(r.qsa)(e,"option").forEach(t=>{let e="";switch(t.childNodes.length&&(e=t.childNodes[0].nodeValue),t.attributes.name.value){case"interactive":this.interactive=e;break;case"fixed-layout":this.fixedLayout=e;break;case"open-to-spread":this.openToSpread=e;break;case"orientation-lock":this.orientationLock=e}}),this}destroy(){this.interactive=void 0,this.fixedLayout=void 0,this.openToSpread=void 0,this.orientationLock=void 0}};const z="binary",B="base64",q="epub",F="opf",U="json",W="directory";class H{constructor(t,e){void 0===e&&"string"!=typeof t&&t instanceof Blob==!1&&t instanceof ArrayBuffer==!1&&(e=t,t=void 0),this.settings=Object(r.extend)(this.settings||{},{requestMethod:void 0,requestCredentials:void 0,requestHeaders:void 0,encoding:void 0,replacements:void 0,canonical:void 0,openAs:void 0,store:void 0}),Object(r.extend)(this.settings,e),this.opening=new r.defer,this.opened=this.opening.promise,this.isOpen=!1,this.loading={manifest:new r.defer,spine:new r.defer,metadata:new r.defer,cover:new r.defer,navigation:new r.defer,pageList:new r.defer,resources:new r.defer,displayOptions:new r.defer},this.loaded={manifest:this.loading.manifest.promise,spine:this.loading.spine.promise,metadata:this.loading.metadata.promise,cover:this.loading.cover.promise,navigation:this.loading.navigation.promise,pageList:this.loading.pageList.promise,resources:this.loading.resources.promise,displayOptions:this.loading.displayOptions.promise},this.ready=Promise.all([this.loaded.manifest,this.loaded.spine,this.loaded.metadata,this.loaded.cover,this.loaded.navigation,this.loaded.resources,this.loaded.displayOptions]),this.isRendered=!1,this.request=this.settings.requestMethod||u,this.spine=new p,this.locations=new y(this.spine,this.load.bind(this)),this.navigation=void 0,this.pageList=void 0,this.url=void 0,this.path=void 0,this.archived=!1,this.archive=void 0,this.storage=void 0,this.resources=void 0,this.rendition=void 0,this.container=void 0,this.packaging=void 0,this.displayOptions=void 0,this.settings.store&&this.store(this.settings.store),t&&this.open(t,this.settings.openAs).catch(e=>{var i=new Error("Cannot load book at "+t);this.emit(m.c.BOOK.OPEN_FAILED,i)})}open(t,e){var i,n=e||this.determineType(t);return n===z?(this.archived=!0,this.url=new o.a("/",""),i=this.openEpub(t)):n===B?(this.archived=!0,this.url=new o.a("/",""),i=this.openEpub(t,n)):n===q?(this.archived=!0,this.url=new o.a("/",""),i=this.request(t,"binary",this.settings.requestCredentials,this.settings.requestHeaders).then(this.openEpub.bind(this))):n==F?(this.url=new o.a(t),i=this.openPackaging(this.url.Path.toString())):n==U?(this.url=new o.a(t),i=this.openManifest(this.url.Path.toString())):(this.url=new o.a(t),i=this.openContainer("META-INF/container.xml").then(this.openPackaging.bind(this))),i}openEpub(t,e){return this.unarchive(t,e||this.settings.encoding).then(()=>this.openContainer("META-INF/container.xml")).then(t=>this.openPackaging(t))}openContainer(t){return this.load(t).then(t=>(this.container=new x(t),this.resolve(this.container.packagePath)))}openPackaging(t){return this.path=new a.a(t),this.load(t).then(t=>(this.packaging=new E(t),this.unpack(this.packaging)))}openManifest(t){return this.path=new a.a(t),this.load(t).then(t=>(this.packaging=new E,this.packaging.load(t),this.unpack(this.packaging)))}load(t){var e=this.resolve(t);return this.archived?this.archive.request(e):this.request(e,null,this.settings.requestCredentials,this.settings.requestHeaders)}resolve(t,e){if(t){var i=t;return t.indexOf("://")>-1?t:(this.path&&(i=this.path.resolve(t)),0!=e&&this.url&&(i=this.url.resolve(i)),i)}}canonical(t){return t?this.settings.canonical?this.settings.canonical(t):this.resolve(t,!0):""}determineType(t){var e;return"base64"===this.settings.encoding?B:"string"!=typeof t?z:((e=new o.a(t).path().extension)&&(e=e.replace(/\?.*$/,"")),e?"epub"===e?q:"opf"===e?F:"json"===e?U:void 0:W)}unpack(t){this.package=t,""===this.packaging.metadata.layout?this.load(this.url.resolve("META-INF/com.apple.ibooks.display-options.xml")).then(t=>{this.displayOptions=new M(t),this.loading.displayOptions.resolve(this.displayOptions)}).catch(t=>{this.displayOptions=new M,this.loading.displayOptions.resolve(this.displayOptions)}):(this.displayOptions=new M,this.loading.displayOptions.resolve(this.displayOptions)),this.spine.unpack(this.packaging,this.resolve.bind(this),this.canonical.bind(this)),this.resources=new C(this.packaging.manifest,{archive:this.archive,resolver:this.resolve.bind(this),request:this.request.bind(this),replacements:this.settings.replacements||(this.archived?"blobUrl":"base64")}),this.loadNavigation(this.packaging).then(()=>{this.loading.navigation.resolve(this.navigation)}),this.packaging.coverPath&&(this.cover=this.resolve(this.packaging.coverPath)),this.loading.manifest.resolve(this.packaging.manifest),this.loading.metadata.resolve(this.packaging.metadata),this.loading.spine.resolve(this.spine),this.loading.cover.resolve(this.cover),this.loading.resources.resolve(this.resources),this.loading.pageList.resolve(this.pageList),this.isOpen=!0,this.archived||this.settings.replacements&&"none"!=this.settings.replacements?this.replacements().then(()=>{this.loaded.displayOptions.then(()=>{this.opening.resolve(this)})}).catch(t=>{console.error(t)}):this.loaded.displayOptions.then(()=>{this.opening.resolve(this)})}loadNavigation(t){let e=t.navPath||t.ncxPath,i=t.toc;return i?new Promise((e,n)=>{this.navigation=new S(i),t.pageList&&(this.pageList=new O(t.pageList)),e(this.navigation)}):e?this.load(e,"xml").then(t=>(this.navigation=new S(t),this.pageList=new O(t),this.navigation)):new Promise((t,e)=>{this.navigation=new S,this.pageList=new O,t(this.navigation)})}section(t){return this.spine.get(t)}renderTo(t,e){return this.rendition=new I.a(this,e),this.rendition.attachTo(t),this.rendition}setRequestCredentials(t){this.settings.requestCredentials=t}setRequestHeaders(t){this.settings.requestHeaders=t}unarchive(t,e){return this.archive=new A,this.archive.open(t,e)}store(t){let e=this.settings.replacements&&"none"!==this.settings.replacements,i=this.url,n=this.settings.requestMethod||u.bind(this);return this.storage=new P(t,n,this.resolve.bind(this)),this.request=this.storage.request.bind(this.storage),this.opened.then(()=>{this.archived&&(this.storage.requester=this.archive.request.bind(this.archive));let t=(t,e)=>{e.output=this.resources.substitute(t,e.url)};this.resources.settings.replacements=e||"blobUrl",this.resources.replacements().then(()=>this.resources.replaceCss()),this.storage.on("offline",()=>{this.url=new o.a("/",""),this.spine.hooks.serialize.register(t)}),this.storage.on("online",()=>{this.url=i,this.spine.hooks.serialize.deregister(t)})}),this.storage}coverUrl(){return this.loaded.cover.then(()=>this.cover?this.archived?this.archive.createUrl(this.cover):this.cover:null)}replacements(){return this.spine.hooks.serialize.register((t,e)=>{e.output=this.resources.substitute(t,e.url)}),this.resources.replacements().then(()=>this.resources.replaceCss())}getRange(t){var e=new h.a(t),i=this.spine.get(e.spinePos),n=this.load.bind(this);return i?i.load(n).then((function(t){return e.toRange(i.document)})):new Promise((t,e)=>{e("CFI could not be found")})}key(t){var e=t||this.packaging.metadata.identifier||this.url.filename;return`epubjs:${m.b}:${e}`}destroy(){this.opened=void 0,this.loading=void 0,this.loaded=void 0,this.ready=void 0,this.isOpen=!1,this.isRendered=!1,this.spine&&this.spine.destroy(),this.locations&&this.locations.destroy(),this.pageList&&this.pageList.destroy(),this.archive&&this.archive.destroy(),this.resources&&this.resources.destroy(),this.container&&this.container.destroy(),this.packaging&&this.packaging.destroy(),this.rendition&&this.rendition.destroy(),this.displayOptions&&this.displayOptions.destroy(),this.spine=void 0,this.locations=void 0,this.pageList=void 0,this.archive=void 0,this.resources=void 0,this.container=void 0,this.packaging=void 0,this.rendition=void 0,this.navigation=void 0,this.url=void 0,this.path=void 0,this.archived=!1}}s()(H.prototype);e.a=H},function(t,e,i){var n=i(14).NAMESPACE;function s(t){return""!==t}function r(t,e){return t.hasOwnProperty(e)||(t[e]=!0),t}function o(t){if(!t)return[];var e=function(t){return t?t.split(/[\t\n\f\r ]+/).filter(s):[]}(t);return Object.keys(e.reduce(r,{}))}function a(t,e){for(var i in t)e[i]=t[i]}function h(t,e){var i=t.prototype;if(!(i instanceof e)){function n(){}n.prototype=e.prototype,a(i,n=new n),t.prototype=i=n}i.constructor!=t&&("function"!=typeof t&&console.error("unknown Class:"+t),i.constructor=t)}var l={},c=l.ELEMENT_NODE=1,u=l.ATTRIBUTE_NODE=2,d=l.TEXT_NODE=3,f=l.CDATA_SECTION_NODE=4,p=l.ENTITY_REFERENCE_NODE=5,g=l.ENTITY_NODE=6,m=l.PROCESSING_INSTRUCTION_NODE=7,v=l.COMMENT_NODE=8,y=l.DOCUMENT_NODE=9,b=l.DOCUMENT_TYPE_NODE=10,w=l.DOCUMENT_FRAGMENT_NODE=11,x=l.NOTATION_NODE=12,E={},S={},N=(E.INDEX_SIZE_ERR=(S[1]="Index size error",1),E.DOMSTRING_SIZE_ERR=(S[2]="DOMString size error",2),E.HIERARCHY_REQUEST_ERR=(S[3]="Hierarchy request error",3)),_=(E.WRONG_DOCUMENT_ERR=(S[4]="Wrong document",4),E.INVALID_CHARACTER_ERR=(S[5]="Invalid character",5),E.NO_DATA_ALLOWED_ERR=(S[6]="No data allowed",6),E.NO_MODIFICATION_ALLOWED_ERR=(S[7]="No modification allowed",7),E.NOT_FOUND_ERR=(S[8]="Not found",8)),T=(E.NOT_SUPPORTED_ERR=(S[9]="Not supported",9),E.INUSE_ATTRIBUTE_ERR=(S[10]="Attribute in use",10));E.INVALID_STATE_ERR=(S[11]="Invalid state",11),E.SYNTAX_ERR=(S[12]="Syntax error",12),E.INVALID_MODIFICATION_ERR=(S[13]="Invalid modification",13),E.NAMESPACE_ERR=(S[14]="Invalid namespace",14),E.INVALID_ACCESS_ERR=(S[15]="Invalid access",15);function C(t,e){if(e instanceof Error)var i=e;else i=this,Error.call(this,S[t]),this.message=S[t],Error.captureStackTrace&&Error.captureStackTrace(this,C);return i.code=t,e&&(this.message=this.message+": "+e),i}function O(){}function I(t,e){this._node=t,this._refresh=e,R(this)}function R(t){var e=t._node._inc||t._node.ownerDocument._inc;if(t._inc!=e){var i=t._refresh(t._node);at(t,"length",i.length),a(i,t),t._inc=e}}function k(){}function A(t,e){for(var i=t.length;i--;)if(t[i]===e)return i}function L(t,e,i,s){if(s?e[A(e,s)]=i:e[e.length++]=i,t){i.ownerElement=t;var r=t.ownerDocument;r&&(s&&q(r,t,s),function(t,e,i){t&&t._inc++,i.namespaceURI===n.XMLNS&&(e._nsMap[i.prefix?i.localName:""]=i.value)}(r,t,i))}}function j(t,e,i){var n=A(e,i);if(!(n>=0))throw C(_,new Error(t.tagName+"@"+i));for(var s=e.length-1;n<s;)e[n]=e[++n];if(e.length=s,t){var r=t.ownerDocument;r&&(q(r,t,i),i.ownerElement=null)}}function D(){}function P(){}function M(t){return("<"==t?"<":">"==t&&">")||"&"==t&&"&"||'"'==t&&"""||"&#"+t.charCodeAt()+";"}function z(t,e){if(e(t))return!0;if(t=t.firstChild)do{if(z(t,e))return!0}while(t=t.nextSibling)}function B(){}function q(t,e,i,s){t&&t._inc++,i.namespaceURI===n.XMLNS&&delete e._nsMap[i.prefix?i.localName:""]}function F(t,e,i){if(t&&t._inc){t._inc++;var n=e.childNodes;if(i)n[n.length++]=i;else{for(var s=e.firstChild,r=0;s;)n[r++]=s,s=s.nextSibling;n.length=r}}}function U(t,e){var i=e.previousSibling,n=e.nextSibling;return i?i.nextSibling=n:t.firstChild=n,n?n.previousSibling=i:t.lastChild=i,F(t.ownerDocument,t),e}function W(t,e,i){var n=e.parentNode;if(n&&n.removeChild(e),e.nodeType===w){var s=e.firstChild;if(null==s)return e;var r=e.lastChild}else s=r=e;var o=i?i.previousSibling:t.lastChild;s.previousSibling=o,r.nextSibling=i,o?o.nextSibling=s:t.firstChild=s,null==i?t.lastChild=r:i.previousSibling=r;do{s.parentNode=t}while(s!==r&&(s=s.nextSibling));return F(t.ownerDocument||t,t),e.nodeType==w&&(e.firstChild=e.lastChild=null),e}function H(){this._nsMap={}}function V(){}function X(){}function G(){}function Y(){}function $(){}function K(){}function Z(){}function J(){}function Q(){}function tt(){}function et(){}function it(){}function nt(t,e){var i=[],n=9==this.nodeType&&this.documentElement||this,s=n.prefix,r=n.namespaceURI;if(r&&null==s&&null==(s=n.lookupPrefix(r)))var o=[{namespace:r,prefix:null}];return ot(this,i,t,e,o),i.join("")}function st(t,e,i){var s=t.prefix||"",r=t.namespaceURI;if(!r)return!1;if("xml"===s&&r===n.XML||r===n.XMLNS)return!1;for(var o=i.length;o--;){var a=i[o];if(a.prefix===s)return a.namespace!==r}return!0}function rt(t,e,i){t.push(" ",e,'="',i.replace(/[<&"]/g,M),'"')}function ot(t,e,i,s,r){if(r||(r=[]),s){if(!(t=s(t)))return;if("string"==typeof t)return void e.push(t)}switch(t.nodeType){case c:var o=t.attributes,a=o.length,h=t.firstChild,l=t.tagName,g=l;if(!(i=n.isHTML(t.namespaceURI)||i)&&!t.prefix&&t.namespaceURI){for(var x,E=0;E<o.length;E++)if("xmlns"===o.item(E).name){x=o.item(E).value;break}if(!x)for(var S=r.length-1;S>=0;S--){if(""===(N=r[S]).prefix&&N.namespace===t.namespaceURI){x=N.namespace;break}}if(x!==t.namespaceURI)for(S=r.length-1;S>=0;S--){var N;if((N=r[S]).namespace===t.namespaceURI){N.prefix&&(g=N.prefix+":"+l);break}}}e.push("<",g);for(var _=0;_<a;_++){"xmlns"==(T=o.item(_)).prefix?r.push({prefix:T.localName,namespace:T.value}):"xmlns"==T.nodeName&&r.push({prefix:"",namespace:T.value})}for(_=0;_<a;_++){var T,C,O;if(st(T=o.item(_),0,r))rt(e,(C=T.prefix||"")?"xmlns:"+C:"xmlns",O=T.namespaceURI),r.push({prefix:C,namespace:O});ot(T,e,i,s,r)}if(l===g&&st(t,0,r))rt(e,(C=t.prefix||"")?"xmlns:"+C:"xmlns",O=t.namespaceURI),r.push({prefix:C,namespace:O});if(h||i&&!/^(?:meta|link|img|br|hr|input)$/i.test(l)){if(e.push(">"),i&&/^script$/i.test(l))for(;h;)h.data?e.push(h.data):ot(h,e,i,s,r.slice()),h=h.nextSibling;else for(;h;)ot(h,e,i,s,r.slice()),h=h.nextSibling;e.push("</",g,">")}else e.push("/>");return;case y:case w:for(h=t.firstChild;h;)ot(h,e,i,s,r.slice()),h=h.nextSibling;return;case u:return rt(e,t.name,t.value);case d:return e.push(t.data.replace(/[<&]/g,M).replace(/]]>/g,"]]>"));case f:return e.push("<![CDATA[",t.data,"]]>");case v:return e.push("\x3c!--",t.data,"--\x3e");case b:var I=t.publicId,R=t.systemId;if(e.push("<!DOCTYPE ",t.name),I)e.push(" PUBLIC ",I),R&&"."!=R&&e.push(" ",R),e.push(">");else if(R&&"."!=R)e.push(" SYSTEM ",R,">");else{var k=t.internalSubset;k&&e.push(" [",k,"]"),e.push(">")}return;case m:return e.push("<?",t.target," ",t.data,"?>");case p:return e.push("&",t.nodeName,";");default:e.push("??",t.nodeName)}}function at(t,e,i){t[e]=i}C.prototype=Error.prototype,a(E,C),O.prototype={length:0,item:function(t){return this[t]||null},toString:function(t,e){for(var i=[],n=0;n<this.length;n++)ot(this[n],i,t,e);return i.join("")}},I.prototype.item=function(t){return R(this),this[t]},h(I,O),k.prototype={length:0,item:O.prototype.item,getNamedItem:function(t){for(var e=this.length;e--;){var i=this[e];if(i.nodeName==t)return i}},setNamedItem:function(t){var e=t.ownerElement;if(e&&e!=this._ownerElement)throw new C(T);var i=this.getNamedItem(t.nodeName);return L(this._ownerElement,this,t,i),i},setNamedItemNS:function(t){var e,i=t.ownerElement;if(i&&i!=this._ownerElement)throw new C(T);return e=this.getNamedItemNS(t.namespaceURI,t.localName),L(this._ownerElement,this,t,e),e},removeNamedItem:function(t){var e=this.getNamedItem(t);return j(this._ownerElement,this,e),e},removeNamedItemNS:function(t,e){var i=this.getNamedItemNS(t,e);return j(this._ownerElement,this,i),i},getNamedItemNS:function(t,e){for(var i=this.length;i--;){var n=this[i];if(n.localName==e&&n.namespaceURI==t)return n}return null}},D.prototype={hasFeature:function(t,e){return!0},createDocument:function(t,e,i){var n=new B;if(n.implementation=this,n.childNodes=new O,n.doctype=i||null,i&&n.appendChild(i),e){var s=n.createElementNS(t,e);n.appendChild(s)}return n},createDocumentType:function(t,e,i){var n=new K;return n.name=t,n.nodeName=t,n.publicId=e||"",n.systemId=i||"",n}},P.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,attributes:null,parentNode:null,childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,insertBefore:function(t,e){return W(this,t,e)},replaceChild:function(t,e){this.insertBefore(t,e),e&&this.removeChild(e)},removeChild:function(t){return U(this,t)},appendChild:function(t){return this.insertBefore(t,null)},hasChildNodes:function(){return null!=this.firstChild},cloneNode:function(t){return function t(e,i,n){var s=new i.constructor;for(var r in i){var o=i[r];"object"!=typeof o&&o!=s[r]&&(s[r]=o)}i.childNodes&&(s.childNodes=new O);switch(s.ownerDocument=e,s.nodeType){case c:var a=i.attributes,h=s.attributes=new k,l=a.length;h._ownerElement=s;for(var d=0;d<l;d++)s.setAttributeNode(t(e,a.item(d),!0));break;case u:n=!0}if(n)for(var f=i.firstChild;f;)s.appendChild(t(e,f,n)),f=f.nextSibling;return s}(this.ownerDocument||this,this,t)},normalize:function(){for(var t=this.firstChild;t;){var e=t.nextSibling;e&&e.nodeType==d&&t.nodeType==d?(this.removeChild(e),t.appendData(e.data)):(t.normalize(),t=e)}},isSupported:function(t,e){return this.ownerDocument.implementation.hasFeature(t,e)},hasAttributes:function(){return this.attributes.length>0},lookupPrefix:function(t){for(var e=this;e;){var i=e._nsMap;if(i)for(var n in i)if(i[n]==t)return n;e=e.nodeType==u?e.ownerDocument:e.parentNode}return null},lookupNamespaceURI:function(t){for(var e=this;e;){var i=e._nsMap;if(i&&t in i)return i[t];e=e.nodeType==u?e.ownerDocument:e.parentNode}return null},isDefaultNamespace:function(t){return null==this.lookupPrefix(t)}},a(l,P),a(l,P.prototype),B.prototype={nodeName:"#document",nodeType:y,doctype:null,documentElement:null,_inc:1,insertBefore:function(t,e){if(t.nodeType==w){for(var i=t.firstChild;i;){var n=i.nextSibling;this.insertBefore(i,e),i=n}return t}return null==this.documentElement&&t.nodeType==c&&(this.documentElement=t),W(this,t,e),t.ownerDocument=this,t},removeChild:function(t){return this.documentElement==t&&(this.documentElement=null),U(this,t)},importNode:function(t,e){return function t(e,i,n){var s;switch(i.nodeType){case c:(s=i.cloneNode(!1)).ownerDocument=e;case w:break;case u:n=!0}s||(s=i.cloneNode(!1));if(s.ownerDocument=e,s.parentNode=null,n)for(var r=i.firstChild;r;)s.appendChild(t(e,r,n)),r=r.nextSibling;return s}(this,t,e)},getElementById:function(t){var e=null;return z(this.documentElement,(function(i){if(i.nodeType==c&&i.getAttribute("id")==t)return e=i,!0})),e},getElementsByClassName:function(t){var e=o(t);return new I(this,(function(i){var n=[];return e.length>0&&z(i.documentElement,(function(s){if(s!==i&&s.nodeType===c){var r=s.getAttribute("class");if(r){var a=t===r;if(!a){var h=o(r);a=e.every((l=h,function(t){return l&&-1!==l.indexOf(t)}))}a&&n.push(s)}}var l})),n}))},createElement:function(t){var e=new H;return e.ownerDocument=this,e.nodeName=t,e.tagName=t,e.localName=t,e.childNodes=new O,(e.attributes=new k)._ownerElement=e,e},createDocumentFragment:function(){var t=new tt;return t.ownerDocument=this,t.childNodes=new O,t},createTextNode:function(t){var e=new G;return e.ownerDocument=this,e.appendData(t),e},createComment:function(t){var e=new Y;return e.ownerDocument=this,e.appendData(t),e},createCDATASection:function(t){var e=new $;return e.ownerDocument=this,e.appendData(t),e},createProcessingInstruction:function(t,e){var i=new et;return i.ownerDocument=this,i.tagName=i.target=t,i.nodeValue=i.data=e,i},createAttribute:function(t){var e=new V;return e.ownerDocument=this,e.name=t,e.nodeName=t,e.localName=t,e.specified=!0,e},createEntityReference:function(t){var e=new Q;return e.ownerDocument=this,e.nodeName=t,e},createElementNS:function(t,e){var i=new H,n=e.split(":"),s=i.attributes=new k;return i.childNodes=new O,i.ownerDocument=this,i.nodeName=e,i.tagName=e,i.namespaceURI=t,2==n.length?(i.prefix=n[0],i.localName=n[1]):i.localName=e,s._ownerElement=i,i},createAttributeNS:function(t,e){var i=new V,n=e.split(":");return i.ownerDocument=this,i.nodeName=e,i.name=e,i.namespaceURI=t,i.specified=!0,2==n.length?(i.prefix=n[0],i.localName=n[1]):i.localName=e,i}},h(B,P),H.prototype={nodeType:c,hasAttribute:function(t){return null!=this.getAttributeNode(t)},getAttribute:function(t){var e=this.getAttributeNode(t);return e&&e.value||""},getAttributeNode:function(t){return this.attributes.getNamedItem(t)},setAttribute:function(t,e){var i=this.ownerDocument.createAttribute(t);i.value=i.nodeValue=""+e,this.setAttributeNode(i)},removeAttribute:function(t){var e=this.getAttributeNode(t);e&&this.removeAttributeNode(e)},appendChild:function(t){return t.nodeType===w?this.insertBefore(t,null):function(t,e){var i=e.parentNode;if(i){var n=t.lastChild;i.removeChild(e);n=t.lastChild}return n=t.lastChild,e.parentNode=t,e.previousSibling=n,e.nextSibling=null,n?n.nextSibling=e:t.firstChild=e,t.lastChild=e,F(t.ownerDocument,t,e),e}(this,t)},setAttributeNode:function(t){return this.attributes.setNamedItem(t)},setAttributeNodeNS:function(t){return this.attributes.setNamedItemNS(t)},removeAttributeNode:function(t){return this.attributes.removeNamedItem(t.nodeName)},removeAttributeNS:function(t,e){var i=this.getAttributeNodeNS(t,e);i&&this.removeAttributeNode(i)},hasAttributeNS:function(t,e){return null!=this.getAttributeNodeNS(t,e)},getAttributeNS:function(t,e){var i=this.getAttributeNodeNS(t,e);return i&&i.value||""},setAttributeNS:function(t,e,i){var n=this.ownerDocument.createAttributeNS(t,e);n.value=n.nodeValue=""+i,this.setAttributeNode(n)},getAttributeNodeNS:function(t,e){return this.attributes.getNamedItemNS(t,e)},getElementsByTagName:function(t){return new I(this,(function(e){var i=[];return z(e,(function(n){n===e||n.nodeType!=c||"*"!==t&&n.tagName!=t||i.push(n)})),i}))},getElementsByTagNameNS:function(t,e){return new I(this,(function(i){var n=[];return z(i,(function(s){s===i||s.nodeType!==c||"*"!==t&&s.namespaceURI!==t||"*"!==e&&s.localName!=e||n.push(s)})),n}))}},B.prototype.getElementsByTagName=H.prototype.getElementsByTagName,B.prototype.getElementsByTagNameNS=H.prototype.getElementsByTagNameNS,h(H,P),V.prototype.nodeType=u,h(V,P),X.prototype={data:"",substringData:function(t,e){return this.data.substring(t,t+e)},appendData:function(t){t=this.data+t,this.nodeValue=this.data=t,this.length=t.length},insertData:function(t,e){this.replaceData(t,0,e)},appendChild:function(t){throw new Error(S[N])},deleteData:function(t,e){this.replaceData(t,e,"")},replaceData:function(t,e,i){i=this.data.substring(0,t)+i+this.data.substring(t+e),this.nodeValue=this.data=i,this.length=i.length}},h(X,P),G.prototype={nodeName:"#text",nodeType:d,splitText:function(t){var e=this.data,i=e.substring(t);e=e.substring(0,t),this.data=this.nodeValue=e,this.length=e.length;var n=this.ownerDocument.createTextNode(i);return this.parentNode&&this.parentNode.insertBefore(n,this.nextSibling),n}},h(G,X),Y.prototype={nodeName:"#comment",nodeType:v},h(Y,X),$.prototype={nodeName:"#cdata-section",nodeType:f},h($,X),K.prototype.nodeType=b,h(K,P),Z.prototype.nodeType=x,h(Z,P),J.prototype.nodeType=g,h(J,P),Q.prototype.nodeType=p,h(Q,P),tt.prototype.nodeName="#document-fragment",tt.prototype.nodeType=w,h(tt,P),et.prototype.nodeType=m,h(et,P),it.prototype.serializeToString=function(t,e,i){return nt.call(t,e,i)},P.prototype.toString=nt;try{if(Object.defineProperty){Object.defineProperty(I.prototype,"length",{get:function(){return R(this),this.$$length}}),Object.defineProperty(P.prototype,"textContent",{get:function(){return function t(e){switch(e.nodeType){case c:case w:var i=[];for(e=e.firstChild;e;)7!==e.nodeType&&8!==e.nodeType&&i.push(t(e)),e=e.nextSibling;return i.join("");default:return e.nodeValue}}(this)},set:function(t){switch(this.nodeType){case c:case w:for(;this.firstChild;)this.removeChild(this.firstChild);(t||String(t))&&this.appendChild(this.ownerDocument.createTextNode(t));break;default:this.data=t,this.value=t,this.nodeValue=t}}}),at=function(t,e,i){t["$$"+e]=i}}}catch(t){}e.DocumentType=K,e.DOMException=C,e.DOMImplementation=D,e.Element=H,e.Node=P,e.NodeList=O,e.XMLSerializer=it},function(t,e,i){var n=i(52),s="object"==typeof self&&self&&self.Object===Object&&self,r=n||s||Function("return this")();t.exports=r},function(t,e,i){var n=i(26).Symbol;t.exports=n},function(t,e,i){var n=i(21),s=i(19);t.exports=function(t,e,i){var r=!0,o=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return s(i)&&(r="leading"in i?!!i.leading:r,o="trailing"in i?!!i.trailing:o),n(t,e,{leading:r,maxWait:e,trailing:o})}},function(e,i){e.exports=t},function(t,e,i){"use strict";i.r(e),function(t){var n=i(24),s=i(16),r=i(2),o=i(12),a=i(0),h=i(1);i(20),i(10),i(22);function l(t,e){return new n.a(t,e)}l.VERSION=h.b,void 0!==t&&(t.EPUBJS_VERSION=h.b),l.Book=n.a,l.Rendition=s.a,l.Contents=o.a,l.CFI=r.a,l.utils=a,e.default=l}.call(this,i(17))},function(t,e,i){"use strict";var n=i(32),s=i(40),r=i(41),o=i(42);(t.exports=function(t,e){var i,r,a,h,l;return arguments.length<2||"string"!=typeof t?(h=e,e=t,t=null):h=arguments[2],null==t?(i=a=!0,r=!1):(i=o.call(t,"c"),r=o.call(t,"e"),a=o.call(t,"w")),l={value:e,configurable:i,enumerable:r,writable:a},h?n(s(h),l):l}).gs=function(t,e,i){var a,h,l,c;return"string"!=typeof t?(l=i,i=e,e=t,t=null):l=arguments[3],null==e?e=void 0:r(e)?null==i?i=void 0:r(i)||(l=i,i=void 0):(l=e,e=i=void 0),null==t?(a=!0,h=!1):(a=o.call(t,"c"),h=o.call(t,"e")),c={get:e,set:i,configurable:a,enumerable:h},l?n(s(l),c):c}},function(t,e,i){"use strict";t.exports=i(33)()?Object.assign:i(34)},function(t,e,i){"use strict";t.exports=function(){var t,e=Object.assign;return"function"==typeof e&&(e(t={foo:"raz"},{bar:"dwa"},{trzy:"trzy"}),t.foo+t.bar+t.trzy==="razdwatrzy")}},function(t,e,i){"use strict";var n=i(35),s=i(39),r=Math.max;t.exports=function(t,e){var i,o,a,h=r(arguments.length,2);for(t=Object(s(t)),a=function(n){try{t[n]=e[n]}catch(t){i||(i=t)}},o=1;o<h;++o)n(e=arguments[o]).forEach(a);if(void 0!==i)throw i;return t}},function(t,e,i){"use strict";t.exports=i(36)()?Object.keys:i(37)},function(t,e,i){"use strict";t.exports=function(){try{return Object.keys("primitive"),!0}catch(t){return!1}}},function(t,e,i){"use strict";var n=i(18),s=Object.keys;t.exports=function(t){return s(n(t)?Object(t):t)}},function(t,e,i){"use strict";t.exports=function(){}},function(t,e,i){"use strict";var n=i(18);t.exports=function(t){if(!n(t))throw new TypeError("Cannot use null or undefined");return t}},function(t,e,i){"use strict";var n=i(18),s=Array.prototype.forEach,r=Object.create,o=function(t,e){var i;for(i in t)e[i]=t[i]};t.exports=function(t){var e=r(null);return s.call(arguments,(function(t){n(t)&&o(Object(t),e)})),e}},function(t,e,i){"use strict";t.exports=function(t){return"function"==typeof t}},function(t,e,i){"use strict";t.exports=i(43)()?String.prototype.contains:i(44)},function(t,e,i){"use strict";var n="razdwatrzy";t.exports=function(){return"function"==typeof n.contains&&(!0===n.contains("dwa")&&!1===n.contains("foo"))}},function(t,e,i){"use strict";var n=String.prototype.indexOf;t.exports=function(t){return n.call(this,t,arguments[1])>-1}},function(t,e,i){"use strict";t.exports=function(t){if("function"!=typeof t)throw new TypeError(t+" is not a function");return t}},function(t,e,i){var n=i(14),s=i(25),r=i(47),o=i(48),a=s.DOMImplementation,h=n.NAMESPACE,l=o.ParseError,c=o.XMLReader;function u(t){this.options=t||{locator:{}}}function d(){this.cdata=!1}function f(t,e){e.lineNumber=t.lineNumber,e.columnNumber=t.columnNumber}function p(t){if(t)return"\n@"+(t.systemId||"")+"#[line:"+t.lineNumber+",col:"+t.columnNumber+"]"}function g(t,e,i){return"string"==typeof t?t.substr(e,i):t.length>=e+i||e?new java.lang.String(t,e,i)+"":t}function m(t,e){t.currentElement?t.currentElement.appendChild(e):t.doc.appendChild(e)}u.prototype.parseFromString=function(t,e){var i=this.options,n=new c,s=i.domBuilder||new d,o=i.errorHandler,a=i.locator,l=i.xmlns||{},u=/\/x?html?$/.test(e),f=u?r.HTML_ENTITIES:r.XML_ENTITIES;return a&&s.setDocumentLocator(a),n.errorHandler=function(t,e,i){if(!t){if(e instanceof d)return e;t=e}var n={},s=t instanceof Function;function r(e){var r=t[e];!r&&s&&(r=2==t.length?function(i){t(e,i)}:t),n[e]=r&&function(t){r("[xmldom "+e+"]\t"+t+p(i))}||function(){}}return i=i||{},r("warning"),r("error"),r("fatalError"),n}(o,s,a),n.domBuilder=i.domBuilder||s,u&&(l[""]=h.HTML),l.xml=l.xml||h.XML,t&&"string"==typeof t?n.parse(t,l,f):n.errorHandler.error("invalid doc source"),s.doc},d.prototype={startDocument:function(){this.doc=(new a).createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(t,e,i,n){var s=this.doc,r=s.createElementNS(t,i||e),o=n.length;m(this,r),this.currentElement=r,this.locator&&f(this.locator,r);for(var a=0;a<o;a++){t=n.getURI(a);var h=n.getValue(a),l=(i=n.getQName(a),s.createAttributeNS(t,i));this.locator&&f(n.getLocator(a),l),l.value=l.nodeValue=h,r.setAttributeNode(l)}},endElement:function(t,e,i){var n=this.currentElement;n.tagName;this.currentElement=n.parentNode},startPrefixMapping:function(t,e){},endPrefixMapping:function(t){},processingInstruction:function(t,e){var i=this.doc.createProcessingInstruction(t,e);this.locator&&f(this.locator,i),m(this,i)},ignorableWhitespace:function(t,e,i){},characters:function(t,e,i){if(t=g.apply(this,arguments)){if(this.cdata)var n=this.doc.createCDATASection(t);else n=this.doc.createTextNode(t);this.currentElement?this.currentElement.appendChild(n):/^\s*$/.test(t)&&this.doc.appendChild(n),this.locator&&f(this.locator,n)}},skippedEntity:function(t){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(t){(this.locator=t)&&(t.lineNumber=0)},comment:function(t,e,i){t=g.apply(this,arguments);var n=this.doc.createComment(t);this.locator&&f(this.locator,n),m(this,n)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(t,e,i){var n=this.doc.implementation;if(n&&n.createDocumentType){var s=n.createDocumentType(t,e,i);this.locator&&f(this.locator,s),m(this,s),this.doc.doctype=s}},warning:function(t){console.warn("[xmldom warning]\t"+t,p(this.locator))},error:function(t){console.error("[xmldom error]\t"+t,p(this.locator))},fatalError:function(t){throw new l(t,this.locator)}},"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,(function(t){d.prototype[t]=function(){return null}})),e.__DOMHandler=d,e.DOMParser=u,e.DOMImplementation=s.DOMImplementation,e.XMLSerializer=s.XMLSerializer},function(t,e,i){var n=i(14).freeze;e.XML_ENTITIES=n({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'}),e.HTML_ENTITIES=n({lt:"<",gt:">",amp:"&",quot:'"',apos:"'",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",times:"×",divide:"÷",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",fnof:"ƒ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"",zwj:"",lrm:"",rlm:"",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",bull:"•",hellip:"…",permil:"‰",prime:"′",Prime:"″",lsaquo:"‹",rsaquo:"›",oline:"‾",euro:"€",trade:"™",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦"}),e.entityMap=e.HTML_ENTITIES},function(t,e,i){var n=i(14).NAMESPACE,s=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,r=new RegExp("[\\-\\.0-9"+s.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),o=new RegExp("^"+s.source+r.source+"*(?::"+s.source+r.source+"*)?$");function a(t,e){this.message=t,this.locator=e,Error.captureStackTrace&&Error.captureStackTrace(this,a)}function h(){}function l(t,e){return e.lineNumber=t.lineNumber,e.columnNumber=t.columnNumber,e}function c(t,e,i,s,r,o){function a(t,e,n){i.attributeNames.hasOwnProperty(t)&&o.fatalError("Attribute "+t+" redefined"),i.addValue(t,e,n)}for(var h,l=++e,c=0;;){var u=t.charAt(l);switch(u){case"=":if(1===c)h=t.slice(e,l),c=3;else{if(2!==c)throw new Error("attribute equal must after attrName");c=3}break;case"'":case'"':if(3===c||1===c){if(1===c&&(o.warning('attribute value must after "="'),h=t.slice(e,l)),e=l+1,!((l=t.indexOf(u,e))>0))throw new Error("attribute value no end '"+u+"' match");a(h,d=t.slice(e,l).replace(/&#?\w+;/g,r),e-1),c=5}else{if(4!=c)throw new Error('attribute value must after "="');a(h,d=t.slice(e,l).replace(/&#?\w+;/g,r),e),o.warning('attribute "'+h+'" missed start quot('+u+")!!"),e=l+1,c=5}break;case"/":switch(c){case 0:i.setTagName(t.slice(e,l));case 5:case 6:case 7:c=7,i.closed=!0;case 4:case 1:case 2:break;default:throw new Error("attribute invalid close char('/')")}break;case"":return o.error("unexpected end of input"),0==c&&i.setTagName(t.slice(e,l)),l;case">":switch(c){case 0:i.setTagName(t.slice(e,l));case 5:case 6:case 7:break;case 4:case 1:"/"===(d=t.slice(e,l)).slice(-1)&&(i.closed=!0,d=d.slice(0,-1));case 2:2===c&&(d=h),4==c?(o.warning('attribute "'+d+'" missed quot(")!'),a(h,d.replace(/&#?\w+;/g,r),e)):(n.isHTML(s[""])&&d.match(/^(?:disabled|checked|selected)$/i)||o.warning('attribute "'+d+'" missed value!! "'+d+'" instead!!'),a(d,d,e));break;case 3:throw new Error("attribute value missed!!")}return l;case"":u=" ";default:if(u<=" ")switch(c){case 0:i.setTagName(t.slice(e,l)),c=6;break;case 1:h=t.slice(e,l),c=2;break;case 4:var d=t.slice(e,l).replace(/&#?\w+;/g,r);o.warning('attribute "'+d+'" missed quot(")!!'),a(h,d,e);case 5:c=6}else switch(c){case 2:i.tagName;n.isHTML(s[""])&&h.match(/^(?:disabled|checked|selected)$/i)||o.warning('attribute "'+h+'" missed value!! "'+h+'" instead2!!'),a(h,h,e),e=l,c=1;break;case 5:o.warning('attribute space is required"'+h+'"!!');case 6:c=1,e=l;break;case 3:c=4,e=l;break;case 7:throw new Error("elements closed character '/' and '>' must be connected to")}}l++}}function u(t,e,i){for(var s=t.tagName,r=null,o=t.length;o--;){var a=t[o],h=a.qName,l=a.value;if((f=h.indexOf(":"))>0)var c=a.prefix=h.slice(0,f),u=h.slice(f+1),d="xmlns"===c&&u;else u=h,c=null,d="xmlns"===h&&"";a.localName=u,!1!==d&&(null==r&&(r={},p(i,i={})),i[d]=r[d]=l,a.uri=n.XMLNS,e.startPrefixMapping(d,l))}for(o=t.length;o--;){(c=(a=t[o]).prefix)&&("xml"===c&&(a.uri=n.XML),"xmlns"!==c&&(a.uri=i[c||""]))}var f;(f=s.indexOf(":"))>0?(c=t.prefix=s.slice(0,f),u=t.localName=s.slice(f+1)):(c=null,u=t.localName=s);var g=t.uri=i[c||""];if(e.startElement(g,u,s,t),!t.closed)return t.currentNSMap=i,t.localNSMap=r,!0;if(e.endElement(g,u,s),r)for(c in r)e.endPrefixMapping(c)}function d(t,e,i,n,s){if(/^(?:script|textarea)$/i.test(i)){var r=t.indexOf("</"+i+">",e),o=t.substring(e+1,r);if(/[&<]/.test(o))return/^script$/i.test(i)?(s.characters(o,0,o.length),r):(o=o.replace(/&#?\w+;/g,n),s.characters(o,0,o.length),r)}return e+1}function f(t,e,i,n){var s=n[i];return null==s&&((s=t.lastIndexOf("</"+i+">"))<e&&(s=t.lastIndexOf("</"+i)),n[i]=s),s<e}function p(t,e){for(var i in t)e[i]=t[i]}function g(t,e,i,n){switch(t.charAt(e+2)){case"-":return"-"===t.charAt(e+3)?(s=t.indexOf("--\x3e",e+4))>e?(i.comment(t,e+4,s-e-4),s+3):(n.error("Unclosed comment"),-1):-1;default:if("CDATA["==t.substr(e+3,6)){var s=t.indexOf("]]>",e+9);return i.startCDATA(),i.characters(t,e+9,s-e-9),i.endCDATA(),s+3}var r=function(t,e){var i,n=[],s=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;s.lastIndex=e,s.exec(t);for(;i=s.exec(t);)if(n.push(i),i[1])return n}(t,e),o=r.length;if(o>1&&/!doctype/i.test(r[0][0])){var a=r[1][0],h=!1,l=!1;o>3&&(/^public$/i.test(r[2][0])?(h=r[3][0],l=o>4&&r[4][0]):/^system$/i.test(r[2][0])&&(l=r[3][0]));var c=r[o-1];return i.startDTD(a,h,l),i.endDTD(),c.index+c[0].length}}return-1}function m(t,e,i){var n=t.indexOf("?>",e);if(n){var s=t.substring(e,n).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);if(s){s[0].length;return i.processingInstruction(s[1],s[2]),n+2}return-1}return-1}function v(){this.attributeNames={}}a.prototype=new Error,a.prototype.name=a.name,h.prototype={parse:function(t,e,i){var s=this.domBuilder;s.startDocument(),p(e,e={}),function(t,e,i,s,r){function o(t){var e=t.slice(1,-1);return e in i?i[e]:"#"===e.charAt(0)?function(t){if(t>65535){var e=55296+((t-=65536)>>10),i=56320+(1023&t);return String.fromCharCode(e,i)}return String.fromCharCode(t)}(parseInt(e.substr(1).replace("x","0x"))):(r.error("entity not found:"+t),t)}function h(e){if(e>N){var i=t.substring(N,e).replace(/&#?\w+;/g,o);x&&p(N),s.characters(i,0,e-N),N=e}}function p(e,i){for(;e>=b&&(i=w.exec(t));)y=i.index,b=y+i[0].length,x.lineNumber++;x.columnNumber=e-y+1}var y=0,b=0,w=/.*(?:\r\n?|\n)|.*$/g,x=s.locator,E=[{currentNSMap:e}],S={},N=0;for(;;){try{var _=t.indexOf("<",N);if(_<0){if(!t.substr(N).match(/^\s*$/)){var T=s.doc,C=T.createTextNode(t.substr(N));T.appendChild(C),s.currentElement=C}return}switch(_>N&&h(_),t.charAt(_+1)){case"/":var O=t.indexOf(">",_+3),I=t.substring(_+2,O).replace(/[ \t\n\r]+$/g,""),R=E.pop();O<0?(I=t.substring(_+2).replace(/[\s<].*/,""),r.error("end tag name: "+I+" is not complete:"+R.tagName),O=_+1+I.length):I.match(/\s</)&&(I=I.replace(/[\s<].*/,""),r.error("end tag name: "+I+" maybe not complete"),O=_+1+I.length);var k=R.localNSMap,A=R.tagName==I;if(A||R.tagName&&R.tagName.toLowerCase()==I.toLowerCase()){if(s.endElement(R.uri,R.localName,I),k)for(var L in k)s.endPrefixMapping(L);A||r.fatalError("end tag name: "+I+" is not match the current start tagName:"+R.tagName)}else E.push(R);O++;break;case"?":x&&p(_),O=m(t,_,s);break;case"!":x&&p(_),O=g(t,_,s,r);break;default:x&&p(_);var j=new v,D=E[E.length-1].currentNSMap,P=(O=c(t,_,j,D,o,r),j.length);if(!j.closed&&f(t,O,j.tagName,S)&&(j.closed=!0,i.nbsp||r.warning("unclosed xml attribute")),x&&P){for(var M=l(x,{}),z=0;z<P;z++){var B=j[z];p(B.offset),B.locator=l(x,{})}s.locator=M,u(j,s,D)&&E.push(j),s.locator=x}else u(j,s,D)&&E.push(j);n.isHTML(j.uri)&&!j.closed?O=d(t,O,j.tagName,o,s):O++}}catch(t){if(t instanceof a)throw t;r.error("element parse error: "+t),O=-1}O>N?N=O:h(Math.max(_,N)+1)}}(t,e,i,s,this.errorHandler),s.endDocument()}},v.prototype={setTagName:function(t){if(!o.test(t))throw new Error("invalid tagName:"+t);this.tagName=t},addValue:function(t,e,i){if(!o.test(t))throw new Error("invalid attribute:"+t);this.attributeNames[t]=this.length,this[this.length++]={qName:t,value:e,offset:i}},length:0,getLocalName:function(t){return this[t].localName},getLocator:function(t){return this[t].locator},getQName:function(t){return this[t].qName},getURI:function(t){return this[t].uri},getValue:function(t){return this[t].value}},e.XMLReader=h,e.ParseError=a},function(t,e,i){"use strict";function n(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}Object.defineProperty(e,"__esModule",{value:!0}),e.createElement=n,e.default={createElement:n}},function(t,e,i){"use strict";function n(t,e){function i(i){for(var n=e.length-1;n>=0;n--){var o=e[n],a=i.clientX,h=i.clientY;if(i.touches&&i.touches.length&&(a=i.touches[0].clientX,h=i.touches[0].clientY),r(o,t,a,h)){o.dispatchEvent(s(i));break}}}if("iframe"===t.nodeName||"IFRAME"===t.nodeName)try{this.target=t.contentDocument}catch(e){this.target=t}else this.target=t;for(var n=["mouseup","mousedown","click","touchstart"],o=0;o<n.length;o++){var a=n[o];this.target.addEventListener(a,(function(t){return i(t)}),!1)}}function s(t){var e=Object.assign({},t,{bubbles:!1});try{return new MouseEvent(t.type,e)}catch(n){var i=document.createEvent("MouseEvents");return i.initMouseEvent(t.type,!1,e.cancelable,e.view,e.detail,e.screenX,e.screenY,e.clientX,e.clientY,e.ctrlKey,e.altKey,e.shiftKey,e.metaKey,e.button,e.relatedTarget),i}}function r(t,e,i,n){var s=e.getBoundingClientRect();function r(t,e,i){var n=t.top-s.top,r=t.left-s.left,o=n+t.height,a=r+t.width;return n<=i&&r<=e&&o>i&&a>e}if(!r(t.getBoundingClientRect(),i,n))return!1;for(var o=t.getClientRects(),a=0,h=o.length;a<h;a++)if(r(o[a],i,n))return!0;return!1}Object.defineProperty(e,"__esModule",{value:!0}),e.proxyMouse=n,e.clone=s,e.default={proxyMouse:n}},function(t,e,i){var n=i(26);t.exports=function(){return n.Date.now()}},function(t,e,i){(function(e){var i="object"==typeof e&&e&&e.Object===Object&&e;t.exports=i}).call(this,i(17))},function(t,e,i){var n=i(54),s=i(19),r=i(56),o=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,h=/^0o[0-7]+$/i,l=parseInt;t.exports=function(t){if("number"==typeof t)return t;if(r(t))return NaN;if(s(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=s(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=n(t);var i=a.test(t);return i||h.test(t)?l(t.slice(2),i?2:8):o.test(t)?NaN:+t}},function(t,e,i){var n=i(55),s=/^\s+/;t.exports=function(t){return t?t.slice(0,n(t)+1).replace(s,""):t}},function(t,e){var i=/\s/;t.exports=function(t){for(var e=t.length;e--&&i.test(t.charAt(e)););return e}},function(t,e,i){var n=i(57),s=i(60);t.exports=function(t){return"symbol"==typeof t||s(t)&&"[object Symbol]"==n(t)}},function(t,e,i){var n=i(27),s=i(58),r=i(59),o=n?n.toStringTag:void 0;t.exports=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":o&&o in Object(t)?s(t):r(t)}},function(t,e,i){var n=i(27),s=Object.prototype,r=s.hasOwnProperty,o=s.toString,a=n?n.toStringTag:void 0;t.exports=function(t){var e=r.call(t,a),i=t[a];try{t[a]=void 0;var n=!0}catch(t){}var s=o.call(t);return n&&(e?t[a]=i:delete t[a]),s}},function(t,e){var i=Object.prototype.toString;t.exports=function(t){return i.call(t)}},function(t,e){t.exports=function(t){return null!=t&&"object"==typeof t}}]).default})); | ||
| \ No newline at end of file | 1 | \ No newline at end of file | |
| @@ -1,2240 +0,0 @@ | |||
| 1 | /** | ||
| 2 | * Fuse.js v6.6.2 - Lightweight fuzzy-search (http://fusejs.io) | ||
| 3 | * | ||
| 4 | * Copyright (c) 2022 Kiro Risk (http://kiro.me) | ||
| 5 | * All Rights Reserved. Apache Software License 2.0 | ||
| 6 | * | ||
| 7 | * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 8 | */ | ||
| 9 | |||
| 10 | (function (global, factory) { | ||
| 11 | typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : | ||
| 12 | typeof define === 'function' && define.amd ? define(factory) : | ||
| 13 | (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Fuse = factory()); | ||
| 14 | })(this, (function () { 'use strict'; | ||
| 15 | |||
| 16 | function ownKeys(object, enumerableOnly) { | ||
| 17 | var keys = Object.keys(object); | ||
| 18 | |||
| 19 | if (Object.getOwnPropertySymbols) { | ||
| 20 | var symbols = Object.getOwnPropertySymbols(object); | ||
| 21 | enumerableOnly && (symbols = symbols.filter(function (sym) { | ||
| 22 | return Object.getOwnPropertyDescriptor(object, sym).enumerable; | ||
| 23 | })), keys.push.apply(keys, symbols); | ||
| 24 | } | ||
| 25 | |||
| 26 | return keys; | ||
| 27 | } | ||
| 28 | |||
| 29 | function _objectSpread2(target) { | ||
| 30 | for (var i = 1; i < arguments.length; i++) { | ||
| 31 | var source = null != arguments[i] ? arguments[i] : {}; | ||
| 32 | i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { | ||
| 33 | _defineProperty(target, key, source[key]); | ||
| 34 | }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { | ||
| 35 | Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); | ||
| 36 | }); | ||
| 37 | } | ||
| 38 | |||
| 39 | return target; | ||
| 40 | } | ||
| 41 | |||
| 42 | function _typeof(obj) { | ||
| 43 | "@babel/helpers - typeof"; | ||
| 44 | |||
| 45 | return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { | ||
| 46 | return typeof obj; | ||
| 47 | } : function (obj) { | ||
| 48 | return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; | ||
| 49 | }, _typeof(obj); | ||
| 50 | } | ||
| 51 | |||
| 52 | function _classCallCheck(instance, Constructor) { | ||
| 53 | if (!(instance instanceof Constructor)) { | ||
| 54 | throw new TypeError("Cannot call a class as a function"); | ||
| 55 | } | ||
| 56 | } | ||
| 57 | |||
| 58 | function _defineProperties(target, props) { | ||
| 59 | for (var i = 0; i < props.length; i++) { | ||
| 60 | var descriptor = props[i]; | ||
| 61 | descriptor.enumerable = descriptor.enumerable || false; | ||
| 62 | descriptor.configurable = true; | ||
| 63 | if ("value" in descriptor) descriptor.writable = true; | ||
| 64 | Object.defineProperty(target, descriptor.key, descriptor); | ||
| 65 | } | ||
| 66 | } | ||
| 67 | |||
| 68 | function _createClass(Constructor, protoProps, staticProps) { | ||
| 69 | if (protoProps) _defineProperties(Constructor.prototype, protoProps); | ||
| 70 | if (staticProps) _defineProperties(Constructor, staticProps); | ||
| 71 | Object.defineProperty(Constructor, "prototype", { | ||
| 72 | writable: false | ||
| 73 | }); | ||
| 74 | return Constructor; | ||
| 75 | } | ||
| 76 | |||
| 77 | function _defineProperty(obj, key, value) { | ||
| 78 | if (key in obj) { | ||
| 79 | Object.defineProperty(obj, key, { | ||
| 80 | value: value, | ||
| 81 | enumerable: true, | ||
| 82 | configurable: true, | ||
| 83 | writable: true | ||
| 84 | }); | ||
| 85 | } else { | ||
| 86 | obj[key] = value; | ||
| 87 | } | ||
| 88 | |||
| 89 | return obj; | ||
| 90 | } | ||
| 91 | |||
| 92 | function _inherits(subClass, superClass) { | ||
| 93 | if (typeof superClass !== "function" && superClass !== null) { | ||
| 94 | throw new TypeError("Super expression must either be null or a function"); | ||
| 95 | } | ||
| 96 | |||
| 97 | Object.defineProperty(subClass, "prototype", { | ||
| 98 | value: Object.create(superClass && superClass.prototype, { | ||
| 99 | constructor: { | ||
| 100 | value: subClass, | ||
| 101 | writable: true, | ||
| 102 | configurable: true | ||
| 103 | } | ||
| 104 | }), | ||
| 105 | writable: false | ||
| 106 | }); | ||
| 107 | if (superClass) _setPrototypeOf(subClass, superClass); | ||
| 108 | } | ||
| 109 | |||
| 110 | function _getPrototypeOf(o) { | ||
| 111 | _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { | ||
| 112 | return o.__proto__ || Object.getPrototypeOf(o); | ||
| 113 | }; | ||
| 114 | return _getPrototypeOf(o); | ||
| 115 | } | ||
| 116 | |||
| 117 | function _setPrototypeOf(o, p) { | ||
| 118 | _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { | ||
| 119 | o.__proto__ = p; | ||
| 120 | return o; | ||
| 121 | }; | ||
| 122 | |||
| 123 | return _setPrototypeOf(o, p); | ||
| 124 | } | ||
| 125 | |||
| 126 | function _isNativeReflectConstruct() { | ||
| 127 | if (typeof Reflect === "undefined" || !Reflect.construct) return false; | ||
| 128 | if (Reflect.construct.sham) return false; | ||
| 129 | if (typeof Proxy === "function") return true; | ||
| 130 | |||
| 131 | try { | ||
| 132 | Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); | ||
| 133 | return true; | ||
| 134 | } catch (e) { | ||
| 135 | return false; | ||
| 136 | } | ||
| 137 | } | ||
| 138 | |||
| 139 | function _assertThisInitialized(self) { | ||
| 140 | if (self === void 0) { | ||
| 141 | throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); | ||
| 142 | } | ||
| 143 | |||
| 144 | return self; | ||
| 145 | } | ||
| 146 | |||
| 147 | function _possibleConstructorReturn(self, call) { | ||
| 148 | if (call && (typeof call === "object" || typeof call === "function")) { | ||
| 149 | return call; | ||
| 150 | } else if (call !== void 0) { | ||
| 151 | throw new TypeError("Derived constructors may only return object or undefined"); | ||
| 152 | } | ||
| 153 | |||
| 154 | return _assertThisInitialized(self); | ||
| 155 | } | ||
| 156 | |||
| 157 | function _createSuper(Derived) { | ||
| 158 | var hasNativeReflectConstruct = _isNativeReflectConstruct(); | ||
| 159 | |||
| 160 | return function _createSuperInternal() { | ||
| 161 | var Super = _getPrototypeOf(Derived), | ||
| 162 | result; | ||
| 163 | |||
| 164 | if (hasNativeReflectConstruct) { | ||
| 165 | var NewTarget = _getPrototypeOf(this).constructor; | ||
| 166 | |||
| 167 | result = Reflect.construct(Super, arguments, NewTarget); | ||
| 168 | } else { | ||
| 169 | result = Super.apply(this, arguments); | ||
| 170 | } | ||
| 171 | |||
| 172 | return _possibleConstructorReturn(this, result); | ||
| 173 | }; | ||
| 174 | } | ||
| 175 | |||
| 176 | function _toConsumableArray(arr) { | ||
| 177 | return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); | ||
| 178 | } | ||
| 179 | |||
| 180 | function _arrayWithoutHoles(arr) { | ||
| 181 | if (Array.isArray(arr)) return _arrayLikeToArray(arr); | ||
| 182 | } | ||
| 183 | |||
| 184 | function _iterableToArray(iter) { | ||
| 185 | if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); | ||
| 186 | } | ||
| 187 | |||
| 188 | function _unsupportedIterableToArray(o, minLen) { | ||
| 189 | if (!o) return; | ||
| 190 | if (typeof o === "string") return _arrayLikeToArray(o, minLen); | ||
| 191 | var n = Object.prototype.toString.call(o).slice(8, -1); | ||
| 192 | if (n === "Object" && o.constructor) n = o.constructor.name; | ||
| 193 | if (n === "Map" || n === "Set") return Array.from(o); | ||
| 194 | if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); | ||
| 195 | } | ||
| 196 | |||
| 197 | function _arrayLikeToArray(arr, len) { | ||
| 198 | if (len == null || len > arr.length) len = arr.length; | ||
| 199 | |||
| 200 | for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; | ||
| 201 | |||
| 202 | return arr2; | ||
| 203 | } | ||
| 204 | |||
| 205 | function _nonIterableSpread() { | ||
| 206 | throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); | ||
| 207 | } | ||
| 208 | |||
| 209 | function isArray(value) { | ||
| 210 | return !Array.isArray ? getTag(value) === '[object Array]' : Array.isArray(value); | ||
| 211 | } // Adapted from: https://github.com/lodash/lodash/blob/master/.internal/baseToString.js | ||
| 212 | |||
| 213 | var INFINITY = 1 / 0; | ||
| 214 | function baseToString(value) { | ||
| 215 | // Exit early for strings to avoid a performance hit in some environments. | ||
| 216 | if (typeof value == 'string') { | ||
| 217 | return value; | ||
| 218 | } | ||
| 219 | |||
| 220 | var result = value + ''; | ||
| 221 | return result == '0' && 1 / value == -INFINITY ? '-0' : result; | ||
| 222 | } | ||
| 223 | function toString(value) { | ||
| 224 | return value == null ? '' : baseToString(value); | ||
| 225 | } | ||
| 226 | function isString(value) { | ||
| 227 | return typeof value === 'string'; | ||
| 228 | } | ||
| 229 | function isNumber(value) { | ||
| 230 | return typeof value === 'number'; | ||
| 231 | } // Adapted from: https://github.com/lodash/lodash/blob/master/isBoolean.js | ||
| 232 | |||
| 233 | function isBoolean(value) { | ||
| 234 | return value === true || value === false || isObjectLike(value) && getTag(value) == '[object Boolean]'; | ||
| 235 | } | ||
| 236 | function isObject(value) { | ||
| 237 | return _typeof(value) === 'object'; | ||
| 238 | } // Checks if `value` is object-like. | ||
| 239 | |||
| 240 | function isObjectLike(value) { | ||
| 241 | return isObject(value) && value !== null; | ||
| 242 | } | ||
| 243 | function isDefined(value) { | ||
| 244 | return value !== undefined && value !== null; | ||
| 245 | } | ||
| 246 | function isBlank(value) { | ||
| 247 | return !value.trim().length; | ||
| 248 | } // Gets the `toStringTag` of `value`. | ||
| 249 | // Adapted from: https://github.com/lodash/lodash/blob/master/.internal/getTag.js | ||
| 250 | |||
| 251 | function getTag(value) { | ||
| 252 | return value == null ? value === undefined ? '[object Undefined]' : '[object Null]' : Object.prototype.toString.call(value); | ||
| 253 | } | ||
| 254 | |||
| 255 | var EXTENDED_SEARCH_UNAVAILABLE = 'Extended search is not available'; | ||
| 256 | var INCORRECT_INDEX_TYPE = "Incorrect 'index' type"; | ||
| 257 | var LOGICAL_SEARCH_INVALID_QUERY_FOR_KEY = function LOGICAL_SEARCH_INVALID_QUERY_FOR_KEY(key) { | ||
| 258 | return "Invalid value for key ".concat(key); | ||
| 259 | }; | ||
| 260 | var PATTERN_LENGTH_TOO_LARGE = function PATTERN_LENGTH_TOO_LARGE(max) { | ||
| 261 | return "Pattern length exceeds max of ".concat(max, "."); | ||
| 262 | }; | ||
| 263 | var MISSING_KEY_PROPERTY = function MISSING_KEY_PROPERTY(name) { | ||
| 264 | return "Missing ".concat(name, " property in key"); | ||
| 265 | }; | ||
| 266 | var INVALID_KEY_WEIGHT_VALUE = function INVALID_KEY_WEIGHT_VALUE(key) { | ||
| 267 | return "Property 'weight' in key '".concat(key, "' must be a positive integer"); | ||
| 268 | }; | ||
| 269 | |||
| 270 | var hasOwn = Object.prototype.hasOwnProperty; | ||
| 271 | |||
| 272 | var KeyStore = /*#__PURE__*/function () { | ||
| 273 | function KeyStore(keys) { | ||
| 274 | var _this = this; | ||
| 275 | |||
| 276 | _classCallCheck(this, KeyStore); | ||
| 277 | |||
| 278 | this._keys = []; | ||
| 279 | this._keyMap = {}; | ||
| 280 | var totalWeight = 0; | ||
| 281 | keys.forEach(function (key) { | ||
| 282 | var obj = createKey(key); | ||
| 283 | totalWeight += obj.weight; | ||
| 284 | |||
| 285 | _this._keys.push(obj); | ||
| 286 | |||
| 287 | _this._keyMap[obj.id] = obj; | ||
| 288 | totalWeight += obj.weight; | ||
| 289 | }); // Normalize weights so that their sum is equal to 1 | ||
| 290 | |||
| 291 | this._keys.forEach(function (key) { | ||
| 292 | key.weight /= totalWeight; | ||
| 293 | }); | ||
| 294 | } | ||
| 295 | |||
| 296 | _createClass(KeyStore, [{ | ||
| 297 | key: "get", | ||
| 298 | value: function get(keyId) { | ||
| 299 | return this._keyMap[keyId]; | ||
| 300 | } | ||
| 301 | }, { | ||
| 302 | key: "keys", | ||
| 303 | value: function keys() { | ||
| 304 | return this._keys; | ||
| 305 | } | ||
| 306 | }, { | ||
| 307 | key: "toJSON", | ||
| 308 | value: function toJSON() { | ||
| 309 | return JSON.stringify(this._keys); | ||
| 310 | } | ||
| 311 | }]); | ||
| 312 | |||
| 313 | return KeyStore; | ||
| 314 | }(); | ||
| 315 | function createKey(key) { | ||
| 316 | var path = null; | ||
| 317 | var id = null; | ||
| 318 | var src = null; | ||
| 319 | var weight = 1; | ||
| 320 | var getFn = null; | ||
| 321 | |||
| 322 | if (isString(key) || isArray(key)) { | ||
| 323 | src = key; | ||
| 324 | path = createKeyPath(key); | ||
| 325 | id = createKeyId(key); | ||
| 326 | } else { | ||
| 327 | if (!hasOwn.call(key, 'name')) { | ||
| 328 | throw new Error(MISSING_KEY_PROPERTY('name')); | ||
| 329 | } | ||
| 330 | |||
| 331 | var name = key.name; | ||
| 332 | src = name; | ||
| 333 | |||
| 334 | if (hasOwn.call(key, 'weight')) { | ||
| 335 | weight = key.weight; | ||
| 336 | |||
| 337 | if (weight <= 0) { | ||
| 338 | throw new Error(INVALID_KEY_WEIGHT_VALUE(name)); | ||
| 339 | } | ||
| 340 | } | ||
| 341 | |||
| 342 | path = createKeyPath(name); | ||
| 343 | id = createKeyId(name); | ||
| 344 | getFn = key.getFn; | ||
| 345 | } | ||
| 346 | |||
| 347 | return { | ||
| 348 | path: path, | ||
| 349 | id: id, | ||
| 350 | weight: weight, | ||
| 351 | src: src, | ||
| 352 | getFn: getFn | ||
| 353 | }; | ||
| 354 | } | ||
| 355 | function createKeyPath(key) { | ||
| 356 | return isArray(key) ? key : key.split('.'); | ||
| 357 | } | ||
| 358 | function createKeyId(key) { | ||
| 359 | return isArray(key) ? key.join('.') : key; | ||
| 360 | } | ||
| 361 | |||
| 362 | function get(obj, path) { | ||
| 363 | var list = []; | ||
| 364 | var arr = false; | ||
| 365 | |||
| 366 | var deepGet = function deepGet(obj, path, index) { | ||
| 367 | if (!isDefined(obj)) { | ||
| 368 | return; | ||
| 369 | } | ||
| 370 | |||
| 371 | if (!path[index]) { | ||
| 372 | // If there's no path left, we've arrived at the object we care about. | ||
| 373 | list.push(obj); | ||
| 374 | } else { | ||
| 375 | var key = path[index]; | ||
| 376 | var value = obj[key]; | ||
| 377 | |||
| 378 | if (!isDefined(value)) { | ||
| 379 | return; | ||
| 380 | } // If we're at the last value in the path, and if it's a string/number/bool, | ||
| 381 | // add it to the list | ||
| 382 | |||
| 383 | |||
| 384 | if (index === path.length - 1 && (isString(value) || isNumber(value) || isBoolean(value))) { | ||
| 385 | list.push(toString(value)); | ||
| 386 | } else if (isArray(value)) { | ||
| 387 | arr = true; // Search each item in the array. | ||
| 388 | |||
| 389 | for (var i = 0, len = value.length; i < len; i += 1) { | ||
| 390 | deepGet(value[i], path, index + 1); | ||
| 391 | } | ||
| 392 | } else if (path.length) { | ||
| 393 | // An object. Recurse further. | ||
| 394 | deepGet(value, path, index + 1); | ||
| 395 | } | ||
| 396 | } | ||
| 397 | }; // Backwards compatibility (since path used to be a string) | ||
| 398 | |||
| 399 | |||
| 400 | deepGet(obj, isString(path) ? path.split('.') : path, 0); | ||
| 401 | return arr ? list : list[0]; | ||
| 402 | } | ||
| 403 | |||
| 404 | var MatchOptions = { | ||
| 405 | // Whether the matches should be included in the result set. When `true`, each record in the result | ||
| 406 | // set will include the indices of the matched characters. | ||
| 407 | // These can consequently be used for highlighting purposes. | ||
| 408 | includeMatches: false, | ||
| 409 | // When `true`, the matching function will continue to the end of a search pattern even if | ||
| 410 | // a perfect match has already been located in the string. | ||
| 411 | findAllMatches: false, | ||
| 412 | // Minimum number of characters that must be matched before a result is considered a match | ||
| 413 | minMatchCharLength: 1 | ||
| 414 | }; | ||
| 415 | var BasicOptions = { | ||
| 416 | // When `true`, the algorithm continues searching to the end of the input even if a perfect | ||
| 417 | // match is found before the end of the same input. | ||
| 418 | isCaseSensitive: false, | ||
| 419 | // When true, the matching function will continue to the end of a search pattern even if | ||
| 420 | includeScore: false, | ||
| 421 | // List of properties that will be searched. This also supports nested properties. | ||
| 422 | keys: [], | ||
| 423 | // Whether to sort the result list, by score | ||
| 424 | shouldSort: true, | ||
| 425 | // Default sort function: sort by ascending score, ascending index | ||
| 426 | sortFn: function sortFn(a, b) { | ||
| 427 | return a.score === b.score ? a.idx < b.idx ? -1 : 1 : a.score < b.score ? -1 : 1; | ||
| 428 | } | ||
| 429 | }; | ||
| 430 | var FuzzyOptions = { | ||
| 431 | // Approximately where in the text is the pattern expected to be found? | ||
| 432 | location: 0, | ||
| 433 | // At what point does the match algorithm give up. A threshold of '0.0' requires a perfect match | ||
| 434 | // (of both letters and location), a threshold of '1.0' would match anything. | ||
| 435 | threshold: 0.6, | ||
| 436 | // Determines how close the match must be to the fuzzy location (specified above). | ||
| 437 | // An exact letter match which is 'distance' characters away from the fuzzy location | ||
| 438 | // would score as a complete mismatch. A distance of '0' requires the match be at | ||
| 439 | // the exact location specified, a threshold of '1000' would require a perfect match | ||
| 440 | // to be within 800 characters of the fuzzy location to be found using a 0.8 threshold. | ||
| 441 | distance: 100 | ||
| 442 | }; | ||
| 443 | var AdvancedOptions = { | ||
| 444 | // When `true`, it enables the use of unix-like search commands | ||
| 445 | useExtendedSearch: false, | ||
| 446 | // The get function to use when fetching an object's properties. | ||
| 447 | // The default will search nested paths *ie foo.bar.baz* | ||
| 448 | getFn: get, | ||
| 449 | // When `true`, search will ignore `location` and `distance`, so it won't matter | ||
| 450 | // where in the string the pattern appears. | ||
| 451 | // More info: https://fusejs.io/concepts/scoring-theory.html#fuzziness-score | ||
| 452 | ignoreLocation: false, | ||
| 453 | // When `true`, the calculation for the relevance score (used for sorting) will | ||
| 454 | // ignore the field-length norm. | ||
| 455 | // More info: https://fusejs.io/concepts/scoring-theory.html#field-length-norm | ||
| 456 | ignoreFieldNorm: false, | ||
| 457 | // The weight to determine how much field length norm effects scoring. | ||
| 458 | fieldNormWeight: 1 | ||
| 459 | }; | ||
| 460 | var Config = _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, BasicOptions), MatchOptions), FuzzyOptions), AdvancedOptions); | ||
| 461 | |||
| 462 | var SPACE = /[^ ]+/g; // Field-length norm: the shorter the field, the higher the weight. | ||
| 463 | // Set to 3 decimals to reduce index size. | ||
| 464 | |||
| 465 | function norm() { | ||
| 466 | var weight = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1; | ||
| 467 | var mantissa = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 3; | ||
| 468 | var cache = new Map(); | ||
| 469 | var m = Math.pow(10, mantissa); | ||
| 470 | return { | ||
| 471 | get: function get(value) { | ||
| 472 | var numTokens = value.match(SPACE).length; | ||
| 473 | |||
| 474 | if (cache.has(numTokens)) { | ||
| 475 | return cache.get(numTokens); | ||
| 476 | } // Default function is 1/sqrt(x), weight makes that variable | ||
| 477 | |||
| 478 | |||
| 479 | var norm = 1 / Math.pow(numTokens, 0.5 * weight); // In place of `toFixed(mantissa)`, for faster computation | ||
| 480 | |||
| 481 | var n = parseFloat(Math.round(norm * m) / m); | ||
| 482 | cache.set(numTokens, n); | ||
| 483 | return n; | ||
| 484 | }, | ||
| 485 | clear: function clear() { | ||
| 486 | cache.clear(); | ||
| 487 | } | ||
| 488 | }; | ||
| 489 | } | ||
| 490 | |||
| 491 | var FuseIndex = /*#__PURE__*/function () { | ||
| 492 | function FuseIndex() { | ||
| 493 | var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, | ||
| 494 | _ref$getFn = _ref.getFn, | ||
| 495 | getFn = _ref$getFn === void 0 ? Config.getFn : _ref$getFn, | ||
| 496 | _ref$fieldNormWeight = _ref.fieldNormWeight, | ||
| 497 | fieldNormWeight = _ref$fieldNormWeight === void 0 ? Config.fieldNormWeight : _ref$fieldNormWeight; | ||
| 498 | |||
| 499 | _classCallCheck(this, FuseIndex); | ||
| 500 | |||
| 501 | this.norm = norm(fieldNormWeight, 3); | ||
| 502 | this.getFn = getFn; | ||
| 503 | this.isCreated = false; | ||
| 504 | this.setIndexRecords(); | ||
| 505 | } | ||
| 506 | |||
| 507 | _createClass(FuseIndex, [{ | ||
| 508 | key: "setSources", | ||
| 509 | value: function setSources() { | ||
| 510 | var docs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; | ||
| 511 | this.docs = docs; | ||
| 512 | } | ||
| 513 | }, { | ||
| 514 | key: "setIndexRecords", | ||
| 515 | value: function setIndexRecords() { | ||
| 516 | var records = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; | ||
| 517 | this.records = records; | ||
| 518 | } | ||
| 519 | }, { | ||
| 520 | key: "setKeys", | ||
| 521 | value: function setKeys() { | ||
| 522 | var _this = this; | ||
| 523 | |||
| 524 | var keys = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; | ||
| 525 | this.keys = keys; | ||
| 526 | this._keysMap = {}; | ||
| 527 | keys.forEach(function (key, idx) { | ||
| 528 | _this._keysMap[key.id] = idx; | ||
| 529 | }); | ||
| 530 | } | ||
| 531 | }, { | ||
| 532 | key: "create", | ||
| 533 | value: function create() { | ||
| 534 | var _this2 = this; | ||
| 535 | |||
| 536 | if (this.isCreated || !this.docs.length) { | ||
| 537 | return; | ||
| 538 | } | ||
| 539 | |||
| 540 | this.isCreated = true; // List is Array<String> | ||
| 541 | |||
| 542 | if (isString(this.docs[0])) { | ||
| 543 | this.docs.forEach(function (doc, docIndex) { | ||
| 544 | _this2._addString(doc, docIndex); | ||
| 545 | }); | ||
| 546 | } else { | ||
| 547 | // List is Array<Object> | ||
| 548 | this.docs.forEach(function (doc, docIndex) { | ||
| 549 | _this2._addObject(doc, docIndex); | ||
| 550 | }); | ||
| 551 | } | ||
| 552 | |||
| 553 | this.norm.clear(); | ||
| 554 | } // Adds a doc to the end of the index | ||
| 555 | |||
| 556 | }, { | ||
| 557 | key: "add", | ||
| 558 | value: function add(doc) { | ||
| 559 | var idx = this.size(); | ||
| 560 | |||
| 561 | if (isString(doc)) { | ||
| 562 | this._addString(doc, idx); | ||
| 563 | } else { | ||
| 564 | this._addObject(doc, idx); | ||
| 565 | } | ||
| 566 | } // Removes the doc at the specified index of the index | ||
| 567 | |||
| 568 | }, { | ||
| 569 | key: "removeAt", | ||
| 570 | value: function removeAt(idx) { | ||
| 571 | this.records.splice(idx, 1); // Change ref index of every subsquent doc | ||
| 572 | |||
| 573 | for (var i = idx, len = this.size(); i < len; i += 1) { | ||
| 574 | this.records[i].i -= 1; | ||
| 575 | } | ||
| 576 | } | ||
| 577 | }, { | ||
| 578 | key: "getValueForItemAtKeyId", | ||
| 579 | value: function getValueForItemAtKeyId(item, keyId) { | ||
| 580 | return item[this._keysMap[keyId]]; | ||
| 581 | } | ||
| 582 | }, { | ||
| 583 | key: "size", | ||
| 584 | value: function size() { | ||
| 585 | return this.records.length; | ||
| 586 | } | ||
| 587 | }, { | ||
| 588 | key: "_addString", | ||
| 589 | value: function _addString(doc, docIndex) { | ||
| 590 | if (!isDefined(doc) || isBlank(doc)) { | ||
| 591 | return; | ||
| 592 | } | ||
| 593 | |||
| 594 | var record = { | ||
| 595 | v: doc, | ||
| 596 | i: docIndex, | ||
| 597 | n: this.norm.get(doc) | ||
| 598 | }; | ||
| 599 | this.records.push(record); | ||
| 600 | } | ||
| 601 | }, { | ||
| 602 | key: "_addObject", | ||
| 603 | value: function _addObject(doc, docIndex) { | ||
| 604 | var _this3 = this; | ||
| 605 | |||
| 606 | var record = { | ||
| 607 | i: docIndex, | ||
| 608 | $: {} | ||
| 609 | }; // Iterate over every key (i.e, path), and fetch the value at that key | ||
| 610 | |||
| 611 | this.keys.forEach(function (key, keyIndex) { | ||
| 612 | var value = key.getFn ? key.getFn(doc) : _this3.getFn(doc, key.path); | ||
| 613 | |||
| 614 | if (!isDefined(value)) { | ||
| 615 | return; | ||
| 616 | } | ||
| 617 | |||
| 618 | if (isArray(value)) { | ||
| 619 | (function () { | ||
| 620 | var subRecords = []; | ||
| 621 | var stack = [{ | ||
| 622 | nestedArrIndex: -1, | ||
| 623 | value: value | ||
| 624 | }]; | ||
| 625 | |||
| 626 | while (stack.length) { | ||
| 627 | var _stack$pop = stack.pop(), | ||
| 628 | nestedArrIndex = _stack$pop.nestedArrIndex, | ||
| 629 | _value = _stack$pop.value; | ||
| 630 | |||
| 631 | if (!isDefined(_value)) { | ||
| 632 | continue; | ||
| 633 | } | ||
| 634 | |||
| 635 | if (isString(_value) && !isBlank(_value)) { | ||
| 636 | var subRecord = { | ||
| 637 | v: _value, | ||
| 638 | i: nestedArrIndex, | ||
| 639 | n: _this3.norm.get(_value) | ||
| 640 | }; | ||
| 641 | subRecords.push(subRecord); | ||
| 642 | } else if (isArray(_value)) { | ||
| 643 | _value.forEach(function (item, k) { | ||
| 644 | stack.push({ | ||
| 645 | nestedArrIndex: k, | ||
| 646 | value: item | ||
| 647 | }); | ||
| 648 | }); | ||
| 649 | } else ; | ||
| 650 | } | ||
| 651 | |||
| 652 | record.$[keyIndex] = subRecords; | ||
| 653 | })(); | ||
| 654 | } else if (isString(value) && !isBlank(value)) { | ||
| 655 | var subRecord = { | ||
| 656 | v: value, | ||
| 657 | n: _this3.norm.get(value) | ||
| 658 | }; | ||
| 659 | record.$[keyIndex] = subRecord; | ||
| 660 | } | ||
| 661 | }); | ||
| 662 | this.records.push(record); | ||
| 663 | } | ||
| 664 | }, { | ||
| 665 | key: "toJSON", | ||
| 666 | value: function toJSON() { | ||
| 667 | return { | ||
| 668 | keys: this.keys, | ||
| 669 | records: this.records | ||
| 670 | }; | ||
| 671 | } | ||
| 672 | }]); | ||
| 673 | |||
| 674 | return FuseIndex; | ||
| 675 | }(); | ||
| 676 | function createIndex(keys, docs) { | ||
| 677 | var _ref2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}, | ||
| 678 | _ref2$getFn = _ref2.getFn, | ||
| 679 | getFn = _ref2$getFn === void 0 ? Config.getFn : _ref2$getFn, | ||
| 680 | _ref2$fieldNormWeight = _ref2.fieldNormWeight, | ||
| 681 | fieldNormWeight = _ref2$fieldNormWeight === void 0 ? Config.fieldNormWeight : _ref2$fieldNormWeight; | ||
| 682 | |||
| 683 | var myIndex = new FuseIndex({ | ||
| 684 | getFn: getFn, | ||
| 685 | fieldNormWeight: fieldNormWeight | ||
| 686 | }); | ||
| 687 | myIndex.setKeys(keys.map(createKey)); | ||
| 688 | myIndex.setSources(docs); | ||
| 689 | myIndex.create(); | ||
| 690 | return myIndex; | ||
| 691 | } | ||
| 692 | function parseIndex(data) { | ||
| 693 | var _ref3 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, | ||
| 694 | _ref3$getFn = _ref3.getFn, | ||
| 695 | getFn = _ref3$getFn === void 0 ? Config.getFn : _ref3$getFn, | ||
| 696 | _ref3$fieldNormWeight = _ref3.fieldNormWeight, | ||
| 697 | fieldNormWeight = _ref3$fieldNormWeight === void 0 ? Config.fieldNormWeight : _ref3$fieldNormWeight; | ||
| 698 | |||
| 699 | var keys = data.keys, | ||
| 700 | records = data.records; | ||
| 701 | var myIndex = new FuseIndex({ | ||
| 702 | getFn: getFn, | ||
| 703 | fieldNormWeight: fieldNormWeight | ||
| 704 | }); | ||
| 705 | myIndex.setKeys(keys); | ||
| 706 | myIndex.setIndexRecords(records); | ||
| 707 | return myIndex; | ||
| 708 | } | ||
| 709 | |||
| 710 | function computeScore$1(pattern) { | ||
| 711 | var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, | ||
| 712 | _ref$errors = _ref.errors, | ||
| 713 | errors = _ref$errors === void 0 ? 0 : _ref$errors, | ||
| 714 | _ref$currentLocation = _ref.currentLocation, | ||
| 715 | currentLocation = _ref$currentLocation === void 0 ? 0 : _ref$currentLocation, | ||
| 716 | _ref$expectedLocation = _ref.expectedLocation, | ||
| 717 | expectedLocation = _ref$expectedLocation === void 0 ? 0 : _ref$expectedLocation, | ||
| 718 | _ref$distance = _ref.distance, | ||
| 719 | distance = _ref$distance === void 0 ? Config.distance : _ref$distance, | ||
| 720 | _ref$ignoreLocation = _ref.ignoreLocation, | ||
| 721 | ignoreLocation = _ref$ignoreLocation === void 0 ? Config.ignoreLocation : _ref$ignoreLocation; | ||
| 722 | |||
| 723 | var accuracy = errors / pattern.length; | ||
| 724 | |||
| 725 | if (ignoreLocation) { | ||
| 726 | return accuracy; | ||
| 727 | } | ||
| 728 | |||
| 729 | var proximity = Math.abs(expectedLocation - currentLocation); | ||
| 730 | |||
| 731 | if (!distance) { | ||
| 732 | // Dodge divide by zero error. | ||
| 733 | return proximity ? 1.0 : accuracy; | ||
| 734 | } | ||
| 735 | |||
| 736 | return accuracy + proximity / distance; | ||
| 737 | } | ||
| 738 | |||
| 739 | function convertMaskToIndices() { | ||
| 740 | var matchmask = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; | ||
| 741 | var minMatchCharLength = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Config.minMatchCharLength; | ||
| 742 | var indices = []; | ||
| 743 | var start = -1; | ||
| 744 | var end = -1; | ||
| 745 | var i = 0; | ||
| 746 | |||
| 747 | for (var len = matchmask.length; i < len; i += 1) { | ||
| 748 | var match = matchmask[i]; | ||
| 749 | |||
| 750 | if (match && start === -1) { | ||
| 751 | start = i; | ||
| 752 | } else if (!match && start !== -1) { | ||
| 753 | end = i - 1; | ||
| 754 | |||
| 755 | if (end - start + 1 >= minMatchCharLength) { | ||
| 756 | indices.push([start, end]); | ||
| 757 | } | ||
| 758 | |||
| 759 | start = -1; | ||
| 760 | } | ||
| 761 | } // (i-1 - start) + 1 => i - start | ||
| 762 | |||
| 763 | |||
| 764 | if (matchmask[i - 1] && i - start >= minMatchCharLength) { | ||
| 765 | indices.push([start, i - 1]); | ||
| 766 | } | ||
| 767 | |||
| 768 | return indices; | ||
| 769 | } | ||
| 770 | |||
| 771 | // Machine word size | ||
| 772 | var MAX_BITS = 32; | ||
| 773 | |||
| 774 | function search(text, pattern, patternAlphabet) { | ||
| 775 | var _ref = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}, | ||
| 776 | _ref$location = _ref.location, | ||
| 777 | location = _ref$location === void 0 ? Config.location : _ref$location, | ||
| 778 | _ref$distance = _ref.distance, | ||
| 779 | distance = _ref$distance === void 0 ? Config.distance : _ref$distance, | ||
| 780 | _ref$threshold = _ref.threshold, | ||
| 781 | threshold = _ref$threshold === void 0 ? Config.threshold : _ref$threshold, | ||
| 782 | _ref$findAllMatches = _ref.findAllMatches, | ||
| 783 | findAllMatches = _ref$findAllMatches === void 0 ? Config.findAllMatches : _ref$findAllMatches, | ||
| 784 | _ref$minMatchCharLeng = _ref.minMatchCharLength, | ||
| 785 | minMatchCharLength = _ref$minMatchCharLeng === void 0 ? Config.minMatchCharLength : _ref$minMatchCharLeng, | ||
| 786 | _ref$includeMatches = _ref.includeMatches, | ||
| 787 | includeMatches = _ref$includeMatches === void 0 ? Config.includeMatches : _ref$includeMatches, | ||
| 788 | _ref$ignoreLocation = _ref.ignoreLocation, | ||
| 789 | ignoreLocation = _ref$ignoreLocation === void 0 ? Config.ignoreLocation : _ref$ignoreLocation; | ||
| 790 | |||
| 791 | if (pattern.length > MAX_BITS) { | ||
| 792 | throw new Error(PATTERN_LENGTH_TOO_LARGE(MAX_BITS)); | ||
| 793 | } | ||
| 794 | |||
| 795 | var patternLen = pattern.length; // Set starting location at beginning text and initialize the alphabet. | ||
| 796 | |||
| 797 | var textLen = text.length; // Handle the case when location > text.length | ||
| 798 | |||
| 799 | var expectedLocation = Math.max(0, Math.min(location, textLen)); // Highest score beyond which we give up. | ||
| 800 | |||
| 801 | var currentThreshold = threshold; // Is there a nearby exact match? (speedup) | ||
| 802 | |||
| 803 | var bestLocation = expectedLocation; // Performance: only computer matches when the minMatchCharLength > 1 | ||
| 804 | // OR if `includeMatches` is true. | ||
| 805 | |||
| 806 | var computeMatches = minMatchCharLength > 1 || includeMatches; // A mask of the matches, used for building the indices | ||
| 807 | |||
| 808 | var matchMask = computeMatches ? Array(textLen) : []; | ||
| 809 | var index; // Get all exact matches, here for speed up | ||
| 810 | |||
| 811 | while ((index = text.indexOf(pattern, bestLocation)) > -1) { | ||
| 812 | var score = computeScore$1(pattern, { | ||
| 813 | currentLocation: index, | ||
| 814 | expectedLocation: expectedLocation, | ||
| 815 | distance: distance, | ||
| 816 | ignoreLocation: ignoreLocation | ||
| 817 | }); | ||
| 818 | currentThreshold = Math.min(score, currentThreshold); | ||
| 819 | bestLocation = index + patternLen; | ||
| 820 | |||
| 821 | if (computeMatches) { | ||
| 822 | var i = 0; | ||
| 823 | |||
| 824 | while (i < patternLen) { | ||
| 825 | matchMask[index + i] = 1; | ||
| 826 | i += 1; | ||
| 827 | } | ||
| 828 | } | ||
| 829 | } // Reset the best location | ||
| 830 | |||
| 831 | |||
| 832 | bestLocation = -1; | ||
| 833 | var lastBitArr = []; | ||
| 834 | var finalScore = 1; | ||
| 835 | var binMax = patternLen + textLen; | ||
| 836 | var mask = 1 << patternLen - 1; | ||
| 837 | |||
| 838 | for (var _i = 0; _i < patternLen; _i += 1) { | ||
| 839 | // Scan for the best match; each iteration allows for one more error. | ||
| 840 | // Run a binary search to determine how far from the match location we can stray | ||
| 841 | // at this error level. | ||
| 842 | var binMin = 0; | ||
| 843 | var binMid = binMax; | ||
| 844 | |||
| 845 | while (binMin < binMid) { | ||
| 846 | var _score2 = computeScore$1(pattern, { | ||
| 847 | errors: _i, | ||
| 848 | currentLocation: expectedLocation + binMid, | ||
| 849 | expectedLocation: expectedLocation, | ||
| 850 | distance: distance, | ||
| 851 | ignoreLocation: ignoreLocation | ||
| 852 | }); | ||
| 853 | |||
| 854 | if (_score2 <= currentThreshold) { | ||
| 855 | binMin = binMid; | ||
| 856 | } else { | ||
| 857 | binMax = binMid; | ||
| 858 | } | ||
| 859 | |||
| 860 | binMid = Math.floor((binMax - binMin) / 2 + binMin); | ||
| 861 | } // Use the result from this iteration as the maximum for the next. | ||
| 862 | |||
| 863 | |||
| 864 | binMax = binMid; | ||
| 865 | var start = Math.max(1, expectedLocation - binMid + 1); | ||
| 866 | var finish = findAllMatches ? textLen : Math.min(expectedLocation + binMid, textLen) + patternLen; // Initialize the bit array | ||
| 867 | |||
| 868 | var bitArr = Array(finish + 2); | ||
| 869 | bitArr[finish + 1] = (1 << _i) - 1; | ||
| 870 | |||
| 871 | for (var j = finish; j >= start; j -= 1) { | ||
| 872 | var currentLocation = j - 1; | ||
| 873 | var charMatch = patternAlphabet[text.charAt(currentLocation)]; | ||
| 874 | |||
| 875 | if (computeMatches) { | ||
| 876 | // Speed up: quick bool to int conversion (i.e, `charMatch ? 1 : 0`) | ||
| 877 | matchMask[currentLocation] = +!!charMatch; | ||
| 878 | } // First pass: exact match | ||
| 879 | |||
| 880 | |||
| 881 | bitArr[j] = (bitArr[j + 1] << 1 | 1) & charMatch; // Subsequent passes: fuzzy match | ||
| 882 | |||
| 883 | if (_i) { | ||
| 884 | bitArr[j] |= (lastBitArr[j + 1] | lastBitArr[j]) << 1 | 1 | lastBitArr[j + 1]; | ||
| 885 | } | ||
| 886 | |||
| 887 | if (bitArr[j] & mask) { | ||
| 888 | finalScore = computeScore$1(pattern, { | ||
| 889 | errors: _i, | ||
| 890 | currentLocation: currentLocation, | ||
| 891 | expectedLocation: expectedLocation, | ||
| 892 | distance: distance, | ||
| 893 | ignoreLocation: ignoreLocation | ||
| 894 | }); // This match will almost certainly be better than any existing match. | ||
| 895 | // But check anyway. | ||
| 896 | |||
| 897 | if (finalScore <= currentThreshold) { | ||
| 898 | // Indeed it is | ||
| 899 | currentThreshold = finalScore; | ||
| 900 | bestLocation = currentLocation; // Already passed `loc`, downhill from here on in. | ||
| 901 | |||
| 902 | if (bestLocation <= expectedLocation) { | ||
| 903 | break; | ||
| 904 | } // When passing `bestLocation`, don't exceed our current distance from `expectedLocation`. | ||
| 905 | |||
| 906 | |||
| 907 | start = Math.max(1, 2 * expectedLocation - bestLocation); | ||
| 908 | } | ||
| 909 | } | ||
| 910 | } // No hope for a (better) match at greater error levels. | ||
| 911 | |||
| 912 | |||
| 913 | var _score = computeScore$1(pattern, { | ||
| 914 | errors: _i + 1, | ||
| 915 | currentLocation: expectedLocation, | ||
| 916 | expectedLocation: expectedLocation, | ||
| 917 | distance: distance, | ||
| 918 | ignoreLocation: ignoreLocation | ||
| 919 | }); | ||
| 920 | |||
| 921 | if (_score > currentThreshold) { | ||
| 922 | break; | ||
| 923 | } | ||
| 924 | |||
| 925 | lastBitArr = bitArr; | ||
| 926 | } | ||
| 927 | |||
| 928 | var result = { | ||
| 929 | isMatch: bestLocation >= 0, | ||
| 930 | // Count exact matches (those with a score of 0) to be "almost" exact | ||
| 931 | score: Math.max(0.001, finalScore) | ||
| 932 | }; | ||
| 933 | |||
| 934 | if (computeMatches) { | ||
| 935 | var indices = convertMaskToIndices(matchMask, minMatchCharLength); | ||
| 936 | |||
| 937 | if (!indices.length) { | ||
| 938 | result.isMatch = false; | ||
| 939 | } else if (includeMatches) { | ||
| 940 | result.indices = indices; | ||
| 941 | } | ||
| 942 | } | ||
| 943 | |||
| 944 | return result; | ||
| 945 | } | ||
| 946 | |||
| 947 | function createPatternAlphabet(pattern) { | ||
| 948 | var mask = {}; | ||
| 949 | |||
| 950 | for (var i = 0, len = pattern.length; i < len; i += 1) { | ||
| 951 | var _char = pattern.charAt(i); | ||
| 952 | |||
| 953 | mask[_char] = (mask[_char] || 0) | 1 << len - i - 1; | ||
| 954 | } | ||
| 955 | |||
| 956 | return mask; | ||
| 957 | } | ||
| 958 | |||
| 959 | var BitapSearch = /*#__PURE__*/function () { | ||
| 960 | function BitapSearch(pattern) { | ||
| 961 | var _this = this; | ||
| 962 | |||
| 963 | var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, | ||
| 964 | _ref$location = _ref.location, | ||
| 965 | location = _ref$location === void 0 ? Config.location : _ref$location, | ||
| 966 | _ref$threshold = _ref.threshold, | ||
| 967 | threshold = _ref$threshold === void 0 ? Config.threshold : _ref$threshold, | ||
| 968 | _ref$distance = _ref.distance, | ||
| 969 | distance = _ref$distance === void 0 ? Config.distance : _ref$distance, | ||
| 970 | _ref$includeMatches = _ref.includeMatches, | ||
| 971 | includeMatches = _ref$includeMatches === void 0 ? Config.includeMatches : _ref$includeMatches, | ||
| 972 | _ref$findAllMatches = _ref.findAllMatches, | ||
| 973 | findAllMatches = _ref$findAllMatches === void 0 ? Config.findAllMatches : _ref$findAllMatches, | ||
| 974 | _ref$minMatchCharLeng = _ref.minMatchCharLength, | ||
| 975 | minMatchCharLength = _ref$minMatchCharLeng === void 0 ? Config.minMatchCharLength : _ref$minMatchCharLeng, | ||
| 976 | _ref$isCaseSensitive = _ref.isCaseSensitive, | ||
| 977 | isCaseSensitive = _ref$isCaseSensitive === void 0 ? Config.isCaseSensitive : _ref$isCaseSensitive, | ||
| 978 | _ref$ignoreLocation = _ref.ignoreLocation, | ||
| 979 | ignoreLocation = _ref$ignoreLocation === void 0 ? Config.ignoreLocation : _ref$ignoreLocation; | ||
| 980 | |||
| 981 | _classCallCheck(this, BitapSearch); | ||
| 982 | |||
| 983 | this.options = { | ||
| 984 | location: location, | ||
| 985 | threshold: threshold, | ||
| 986 | distance: distance, | ||
| 987 | includeMatches: includeMatches, | ||
| 988 | findAllMatches: findAllMatches, | ||
| 989 | minMatchCharLength: minMatchCharLength, | ||
| 990 | isCaseSensitive: isCaseSensitive, | ||
| 991 | ignoreLocation: ignoreLocation | ||
| 992 | }; | ||
| 993 | this.pattern = isCaseSensitive ? pattern : pattern.toLowerCase(); | ||
| 994 | this.chunks = []; | ||
| 995 | |||
| 996 | if (!this.pattern.length) { | ||
| 997 | return; | ||
| 998 | } | ||
| 999 | |||
| 1000 | var addChunk = function addChunk(pattern, startIndex) { | ||
| 1001 | _this.chunks.push({ | ||
| 1002 | pattern: pattern, | ||
| 1003 | alphabet: createPatternAlphabet(pattern), | ||
| 1004 | startIndex: startIndex | ||
| 1005 | }); | ||
| 1006 | }; | ||
| 1007 | |||
| 1008 | var len = this.pattern.length; | ||
| 1009 | |||
| 1010 | if (len > MAX_BITS) { | ||
| 1011 | var i = 0; | ||
| 1012 | var remainder = len % MAX_BITS; | ||
| 1013 | var end = len - remainder; | ||
| 1014 | |||
| 1015 | while (i < end) { | ||
| 1016 | addChunk(this.pattern.substr(i, MAX_BITS), i); | ||
| 1017 | i += MAX_BITS; | ||
| 1018 | } | ||
| 1019 | |||
| 1020 | if (remainder) { | ||
| 1021 | var startIndex = len - MAX_BITS; | ||
| 1022 | addChunk(this.pattern.substr(startIndex), startIndex); | ||
| 1023 | } | ||
| 1024 | } else { | ||
| 1025 | addChunk(this.pattern, 0); | ||
| 1026 | } | ||
| 1027 | } | ||
| 1028 | |||
| 1029 | _createClass(BitapSearch, [{ | ||
| 1030 | key: "searchIn", | ||
| 1031 | value: function searchIn(text) { | ||
| 1032 | var _this$options = this.options, | ||
| 1033 | isCaseSensitive = _this$options.isCaseSensitive, | ||
| 1034 | includeMatches = _this$options.includeMatches; | ||
| 1035 | |||
| 1036 | if (!isCaseSensitive) { | ||
| 1037 | text = text.toLowerCase(); | ||
| 1038 | } // Exact match | ||
| 1039 | |||
| 1040 | |||
| 1041 | if (this.pattern === text) { | ||
| 1042 | var _result = { | ||
| 1043 | isMatch: true, | ||
| 1044 | score: 0 | ||
| 1045 | }; | ||
| 1046 | |||
| 1047 | if (includeMatches) { | ||
| 1048 | _result.indices = [[0, text.length - 1]]; | ||
| 1049 | } | ||
| 1050 | |||
| 1051 | return _result; | ||
| 1052 | } // Otherwise, use Bitap algorithm | ||
| 1053 | |||
| 1054 | |||
| 1055 | var _this$options2 = this.options, | ||
| 1056 | location = _this$options2.location, | ||
| 1057 | distance = _this$options2.distance, | ||
| 1058 | threshold = _this$options2.threshold, | ||
| 1059 | findAllMatches = _this$options2.findAllMatches, | ||
| 1060 | minMatchCharLength = _this$options2.minMatchCharLength, | ||
| 1061 | ignoreLocation = _this$options2.ignoreLocation; | ||
| 1062 | var allIndices = []; | ||
| 1063 | var totalScore = 0; | ||
| 1064 | var hasMatches = false; | ||
| 1065 | this.chunks.forEach(function (_ref2) { | ||
| 1066 | var pattern = _ref2.pattern, | ||
| 1067 | alphabet = _ref2.alphabet, | ||
| 1068 | startIndex = _ref2.startIndex; | ||
| 1069 | |||
| 1070 | var _search = search(text, pattern, alphabet, { | ||
| 1071 | location: location + startIndex, | ||
| 1072 | distance: distance, | ||
| 1073 | threshold: threshold, | ||
| 1074 | findAllMatches: findAllMatches, | ||
| 1075 | minMatchCharLength: minMatchCharLength, | ||
| 1076 | includeMatches: includeMatches, | ||
| 1077 | ignoreLocation: ignoreLocation | ||
| 1078 | }), | ||
| 1079 | isMatch = _search.isMatch, | ||
| 1080 | score = _search.score, | ||
| 1081 | indices = _search.indices; | ||
| 1082 | |||
| 1083 | if (isMatch) { | ||
| 1084 | hasMatches = true; | ||
| 1085 | } | ||
| 1086 | |||
| 1087 | totalScore += score; | ||
| 1088 | |||
| 1089 | if (isMatch && indices) { | ||
| 1090 | allIndices = [].concat(_toConsumableArray(allIndices), _toConsumableArray(indices)); | ||
| 1091 | } | ||
| 1092 | }); | ||
| 1093 | var result = { | ||
| 1094 | isMatch: hasMatches, | ||
| 1095 | score: hasMatches ? totalScore / this.chunks.length : 1 | ||
| 1096 | }; | ||
| 1097 | |||
| 1098 | if (hasMatches && includeMatches) { | ||
| 1099 | result.indices = allIndices; | ||
| 1100 | } | ||
| 1101 | |||
| 1102 | return result; | ||
| 1103 | } | ||
| 1104 | }]); | ||
| 1105 | |||
| 1106 | return BitapSearch; | ||
| 1107 | }(); | ||
| 1108 | |||
| 1109 | var BaseMatch = /*#__PURE__*/function () { | ||
| 1110 | function BaseMatch(pattern) { | ||
| 1111 | _classCallCheck(this, BaseMatch); | ||
| 1112 | |||
| 1113 | this.pattern = pattern; | ||
| 1114 | } | ||
| 1115 | |||
| 1116 | _createClass(BaseMatch, [{ | ||
| 1117 | key: "search", | ||
| 1118 | value: function | ||
| 1119 | /*text*/ | ||
| 1120 | search() {} | ||
| 1121 | }], [{ | ||
| 1122 | key: "isMultiMatch", | ||
| 1123 | value: function isMultiMatch(pattern) { | ||
| 1124 | return getMatch(pattern, this.multiRegex); | ||
| 1125 | } | ||
| 1126 | }, { | ||
| 1127 | key: "isSingleMatch", | ||
| 1128 | value: function isSingleMatch(pattern) { | ||
| 1129 | return getMatch(pattern, this.singleRegex); | ||
| 1130 | } | ||
| 1131 | }]); | ||
| 1132 | |||
| 1133 | return BaseMatch; | ||
| 1134 | }(); | ||
| 1135 | |||
| 1136 | function getMatch(pattern, exp) { | ||
| 1137 | var matches = pattern.match(exp); | ||
| 1138 | return matches ? matches[1] : null; | ||
| 1139 | } | ||
| 1140 | |||
| 1141 | var ExactMatch = /*#__PURE__*/function (_BaseMatch) { | ||
| 1142 | _inherits(ExactMatch, _BaseMatch); | ||
| 1143 | |||
| 1144 | var _super = _createSuper(ExactMatch); | ||
| 1145 | |||
| 1146 | function ExactMatch(pattern) { | ||
| 1147 | _classCallCheck(this, ExactMatch); | ||
| 1148 | |||
| 1149 | return _super.call(this, pattern); | ||
| 1150 | } | ||
| 1151 | |||
| 1152 | _createClass(ExactMatch, [{ | ||
| 1153 | key: "search", | ||
| 1154 | value: function search(text) { | ||
| 1155 | var isMatch = text === this.pattern; | ||
| 1156 | return { | ||
| 1157 | isMatch: isMatch, | ||
| 1158 | score: isMatch ? 0 : 1, | ||
| 1159 | indices: [0, this.pattern.length - 1] | ||
| 1160 | }; | ||
| 1161 | } | ||
| 1162 | }], [{ | ||
| 1163 | key: "type", | ||
| 1164 | get: function get() { | ||
| 1165 | return 'exact'; | ||
| 1166 | } | ||
| 1167 | }, { | ||
| 1168 | key: "multiRegex", | ||
| 1169 | get: function get() { | ||
| 1170 | return /^="(.*)"$/; | ||
| 1171 | } | ||
| 1172 | }, { | ||
| 1173 | key: "singleRegex", | ||
| 1174 | get: function get() { | ||
| 1175 | return /^=(.*)$/; | ||
| 1176 | } | ||
| 1177 | }]); | ||
| 1178 | |||
| 1179 | return ExactMatch; | ||
| 1180 | }(BaseMatch); | ||
| 1181 | |||
| 1182 | var InverseExactMatch = /*#__PURE__*/function (_BaseMatch) { | ||
| 1183 | _inherits(InverseExactMatch, _BaseMatch); | ||
| 1184 | |||
| 1185 | var _super = _createSuper(InverseExactMatch); | ||
| 1186 | |||
| 1187 | function InverseExactMatch(pattern) { | ||
| 1188 | _classCallCheck(this, InverseExactMatch); | ||
| 1189 | |||
| 1190 | return _super.call(this, pattern); | ||
| 1191 | } | ||
| 1192 | |||
| 1193 | _createClass(InverseExactMatch, [{ | ||
| 1194 | key: "search", | ||
| 1195 | value: function search(text) { | ||
| 1196 | var index = text.indexOf(this.pattern); | ||
| 1197 | var isMatch = index === -1; | ||
| 1198 | return { | ||
| 1199 | isMatch: isMatch, | ||
| 1200 | score: isMatch ? 0 : 1, | ||
| 1201 | indices: [0, text.length - 1] | ||
| 1202 | }; | ||
| 1203 | } | ||
| 1204 | }], [{ | ||
| 1205 | key: "type", | ||
| 1206 | get: function get() { | ||
| 1207 | return 'inverse-exact'; | ||
| 1208 | } | ||
| 1209 | }, { | ||
| 1210 | key: "multiRegex", | ||
| 1211 | get: function get() { | ||
| 1212 | return /^!"(.*)"$/; | ||
| 1213 | } | ||
| 1214 | }, { | ||
| 1215 | key: "singleRegex", | ||
| 1216 | get: function get() { | ||
| 1217 | return /^!(.*)$/; | ||
| 1218 | } | ||
| 1219 | }]); | ||
| 1220 | |||
| 1221 | return InverseExactMatch; | ||
| 1222 | }(BaseMatch); | ||
| 1223 | |||
| 1224 | var PrefixExactMatch = /*#__PURE__*/function (_BaseMatch) { | ||
| 1225 | _inherits(PrefixExactMatch, _BaseMatch); | ||
| 1226 | |||
| 1227 | var _super = _createSuper(PrefixExactMatch); | ||
| 1228 | |||
| 1229 | function PrefixExactMatch(pattern) { | ||
| 1230 | _classCallCheck(this, PrefixExactMatch); | ||
| 1231 | |||
| 1232 | return _super.call(this, pattern); | ||
| 1233 | } | ||
| 1234 | |||
| 1235 | _createClass(PrefixExactMatch, [{ | ||
| 1236 | key: "search", | ||
| 1237 | value: function search(text) { | ||
| 1238 | var isMatch = text.startsWith(this.pattern); | ||
| 1239 | return { | ||
| 1240 | isMatch: isMatch, | ||
| 1241 | score: isMatch ? 0 : 1, | ||
| 1242 | indices: [0, this.pattern.length - 1] | ||
| 1243 | }; | ||
| 1244 | } | ||
| 1245 | }], [{ | ||
| 1246 | key: "type", | ||
| 1247 | get: function get() { | ||
| 1248 | return 'prefix-exact'; | ||
| 1249 | } | ||
| 1250 | }, { | ||
| 1251 | key: "multiRegex", | ||
| 1252 | get: function get() { | ||
| 1253 | return /^\^"(.*)"$/; | ||
| 1254 | } | ||
| 1255 | }, { | ||
| 1256 | key: "singleRegex", | ||
| 1257 | get: function get() { | ||
| 1258 | return /^\^(.*)$/; | ||
| 1259 | } | ||
| 1260 | }]); | ||
| 1261 | |||
| 1262 | return PrefixExactMatch; | ||
| 1263 | }(BaseMatch); | ||
| 1264 | |||
| 1265 | var InversePrefixExactMatch = /*#__PURE__*/function (_BaseMatch) { | ||
| 1266 | _inherits(InversePrefixExactMatch, _BaseMatch); | ||
| 1267 | |||
| 1268 | var _super = _createSuper(InversePrefixExactMatch); | ||
| 1269 | |||
| 1270 | function InversePrefixExactMatch(pattern) { | ||
| 1271 | _classCallCheck(this, InversePrefixExactMatch); | ||
| 1272 | |||
| 1273 | return _super.call(this, pattern); | ||
| 1274 | } | ||
| 1275 | |||
| 1276 | _createClass(InversePrefixExactMatch, [{ | ||
| 1277 | key: "search", | ||
| 1278 | value: function search(text) { | ||
| 1279 | var isMatch = !text.startsWith(this.pattern); | ||
| 1280 | return { | ||
| 1281 | isMatch: isMatch, | ||
| 1282 | score: isMatch ? 0 : 1, | ||
| 1283 | indices: [0, text.length - 1] | ||
| 1284 | }; | ||
| 1285 | } | ||
| 1286 | }], [{ | ||
| 1287 | key: "type", | ||
| 1288 | get: function get() { | ||
| 1289 | return 'inverse-prefix-exact'; | ||
| 1290 | } | ||
| 1291 | }, { | ||
| 1292 | key: "multiRegex", | ||
| 1293 | get: function get() { | ||
| 1294 | return /^!\^"(.*)"$/; | ||
| 1295 | } | ||
| 1296 | }, { | ||
| 1297 | key: "singleRegex", | ||
| 1298 | get: function get() { | ||
| 1299 | return /^!\^(.*)$/; | ||
| 1300 | } | ||
| 1301 | }]); | ||
| 1302 | |||
| 1303 | return InversePrefixExactMatch; | ||
| 1304 | }(BaseMatch); | ||
| 1305 | |||
| 1306 | var SuffixExactMatch = /*#__PURE__*/function (_BaseMatch) { | ||
| 1307 | _inherits(SuffixExactMatch, _BaseMatch); | ||
| 1308 | |||
| 1309 | var _super = _createSuper(SuffixExactMatch); | ||
| 1310 | |||
| 1311 | function SuffixExactMatch(pattern) { | ||
| 1312 | _classCallCheck(this, SuffixExactMatch); | ||
| 1313 | |||
| 1314 | return _super.call(this, pattern); | ||
| 1315 | } | ||
| 1316 | |||
| 1317 | _createClass(SuffixExactMatch, [{ | ||
| 1318 | key: "search", | ||
| 1319 | value: function search(text) { | ||
| 1320 | var isMatch = text.endsWith(this.pattern); | ||
| 1321 | return { | ||
| 1322 | isMatch: isMatch, | ||
| 1323 | score: isMatch ? 0 : 1, | ||
| 1324 | indices: [text.length - this.pattern.length, text.length - 1] | ||
| 1325 | }; | ||
| 1326 | } | ||
| 1327 | }], [{ | ||
| 1328 | key: "type", | ||
| 1329 | get: function get() { | ||
| 1330 | return 'suffix-exact'; | ||
| 1331 | } | ||
| 1332 | }, { | ||
| 1333 | key: "multiRegex", | ||
| 1334 | get: function get() { | ||
| 1335 | return /^"(.*)"\$$/; | ||
| 1336 | } | ||
| 1337 | }, { | ||
| 1338 | key: "singleRegex", | ||
| 1339 | get: function get() { | ||
| 1340 | return /^(.*)\$$/; | ||
| 1341 | } | ||
| 1342 | }]); | ||
| 1343 | |||
| 1344 | return SuffixExactMatch; | ||
| 1345 | }(BaseMatch); | ||
| 1346 | |||
| 1347 | var InverseSuffixExactMatch = /*#__PURE__*/function (_BaseMatch) { | ||
| 1348 | _inherits(InverseSuffixExactMatch, _BaseMatch); | ||
| 1349 | |||
| 1350 | var _super = _createSuper(InverseSuffixExactMatch); | ||
| 1351 | |||
| 1352 | function InverseSuffixExactMatch(pattern) { | ||
| 1353 | _classCallCheck(this, InverseSuffixExactMatch); | ||
| 1354 | |||
| 1355 | return _super.call(this, pattern); | ||
| 1356 | } | ||
| 1357 | |||
| 1358 | _createClass(InverseSuffixExactMatch, [{ | ||
| 1359 | key: "search", | ||
| 1360 | value: function search(text) { | ||
| 1361 | var isMatch = !text.endsWith(this.pattern); | ||
| 1362 | return { | ||
| 1363 | isMatch: isMatch, | ||
| 1364 | score: isMatch ? 0 : 1, | ||
| 1365 | indices: [0, text.length - 1] | ||
| 1366 | }; | ||
| 1367 | } | ||
| 1368 | }], [{ | ||
| 1369 | key: "type", | ||
| 1370 | get: function get() { | ||
| 1371 | return 'inverse-suffix-exact'; | ||
| 1372 | } | ||
| 1373 | }, { | ||
| 1374 | key: "multiRegex", | ||
| 1375 | get: function get() { | ||
| 1376 | return /^!"(.*)"\$$/; | ||
| 1377 | } | ||
| 1378 | }, { | ||
| 1379 | key: "singleRegex", | ||
| 1380 | get: function get() { | ||
| 1381 | return /^!(.*)\$$/; | ||
| 1382 | } | ||
| 1383 | }]); | ||
| 1384 | |||
| 1385 | return InverseSuffixExactMatch; | ||
| 1386 | }(BaseMatch); | ||
| 1387 | |||
| 1388 | var FuzzyMatch = /*#__PURE__*/function (_BaseMatch) { | ||
| 1389 | _inherits(FuzzyMatch, _BaseMatch); | ||
| 1390 | |||
| 1391 | var _super = _createSuper(FuzzyMatch); | ||
| 1392 | |||
| 1393 | function FuzzyMatch(pattern) { | ||
| 1394 | var _this; | ||
| 1395 | |||
| 1396 | var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, | ||
| 1397 | _ref$location = _ref.location, | ||
| 1398 | location = _ref$location === void 0 ? Config.location : _ref$location, | ||
| 1399 | _ref$threshold = _ref.threshold, | ||
| 1400 | threshold = _ref$threshold === void 0 ? Config.threshold : _ref$threshold, | ||
| 1401 | _ref$distance = _ref.distance, | ||
| 1402 | distance = _ref$distance === void 0 ? Config.distance : _ref$distance, | ||
| 1403 | _ref$includeMatches = _ref.includeMatches, | ||
| 1404 | includeMatches = _ref$includeMatches === void 0 ? Config.includeMatches : _ref$includeMatches, | ||
| 1405 | _ref$findAllMatches = _ref.findAllMatches, | ||
| 1406 | findAllMatches = _ref$findAllMatches === void 0 ? Config.findAllMatches : _ref$findAllMatches, | ||
| 1407 | _ref$minMatchCharLeng = _ref.minMatchCharLength, | ||
| 1408 | minMatchCharLength = _ref$minMatchCharLeng === void 0 ? Config.minMatchCharLength : _ref$minMatchCharLeng, | ||
| 1409 | _ref$isCaseSensitive = _ref.isCaseSensitive, | ||
| 1410 | isCaseSensitive = _ref$isCaseSensitive === void 0 ? Config.isCaseSensitive : _ref$isCaseSensitive, | ||
| 1411 | _ref$ignoreLocation = _ref.ignoreLocation, | ||
| 1412 | ignoreLocation = _ref$ignoreLocation === void 0 ? Config.ignoreLocation : _ref$ignoreLocation; | ||
| 1413 | |||
| 1414 | _classCallCheck(this, FuzzyMatch); | ||
| 1415 | |||
| 1416 | _this = _super.call(this, pattern); | ||
| 1417 | _this._bitapSearch = new BitapSearch(pattern, { | ||
| 1418 | location: location, | ||
| 1419 | threshold: threshold, | ||
| 1420 | distance: distance, | ||
| 1421 | includeMatches: includeMatches, | ||
| 1422 | findAllMatches: findAllMatches, | ||
| 1423 | minMatchCharLength: minMatchCharLength, | ||
| 1424 | isCaseSensitive: isCaseSensitive, | ||
| 1425 | ignoreLocation: ignoreLocation | ||
| 1426 | }); | ||
| 1427 | return _this; | ||
| 1428 | } | ||
| 1429 | |||
| 1430 | _createClass(FuzzyMatch, [{ | ||
| 1431 | key: "search", | ||
| 1432 | value: function search(text) { | ||
| 1433 | return this._bitapSearch.searchIn(text); | ||
| 1434 | } | ||
| 1435 | }], [{ | ||
| 1436 | key: "type", | ||
| 1437 | get: function get() { | ||
| 1438 | return 'fuzzy'; | ||
| 1439 | } | ||
| 1440 | }, { | ||
| 1441 | key: "multiRegex", | ||
| 1442 | get: function get() { | ||
| 1443 | return /^"(.*)"$/; | ||
| 1444 | } | ||
| 1445 | }, { | ||
| 1446 | key: "singleRegex", | ||
| 1447 | get: function get() { | ||
| 1448 | return /^(.*)$/; | ||
| 1449 | } | ||
| 1450 | }]); | ||
| 1451 | |||
| 1452 | return FuzzyMatch; | ||
| 1453 | }(BaseMatch); | ||
| 1454 | |||
| 1455 | var IncludeMatch = /*#__PURE__*/function (_BaseMatch) { | ||
| 1456 | _inherits(IncludeMatch, _BaseMatch); | ||
| 1457 | |||
| 1458 | var _super = _createSuper(IncludeMatch); | ||
| 1459 | |||
| 1460 | function IncludeMatch(pattern) { | ||
| 1461 | _classCallCheck(this, IncludeMatch); | ||
| 1462 | |||
| 1463 | return _super.call(this, pattern); | ||
| 1464 | } | ||
| 1465 | |||
| 1466 | _createClass(IncludeMatch, [{ | ||
| 1467 | key: "search", | ||
| 1468 | value: function search(text) { | ||
| 1469 | var location = 0; | ||
| 1470 | var index; | ||
| 1471 | var indices = []; | ||
| 1472 | var patternLen = this.pattern.length; // Get all exact matches | ||
| 1473 | |||
| 1474 | while ((index = text.indexOf(this.pattern, location)) > -1) { | ||
| 1475 | location = index + patternLen; | ||
| 1476 | indices.push([index, location - 1]); | ||
| 1477 | } | ||
| 1478 | |||
| 1479 | var isMatch = !!indices.length; | ||
| 1480 | return { | ||
| 1481 | isMatch: isMatch, | ||
| 1482 | score: isMatch ? 0 : 1, | ||
| 1483 | indices: indices | ||
| 1484 | }; | ||
| 1485 | } | ||
| 1486 | }], [{ | ||
| 1487 | key: "type", | ||
| 1488 | get: function get() { | ||
| 1489 | return 'include'; | ||
| 1490 | } | ||
| 1491 | }, { | ||
| 1492 | key: "multiRegex", | ||
| 1493 | get: function get() { | ||
| 1494 | return /^'"(.*)"$/; | ||
| 1495 | } | ||
| 1496 | }, { | ||
| 1497 | key: "singleRegex", | ||
| 1498 | get: function get() { | ||
| 1499 | return /^'(.*)$/; | ||
| 1500 | } | ||
| 1501 | }]); | ||
| 1502 | |||
| 1503 | return IncludeMatch; | ||
| 1504 | }(BaseMatch); | ||
| 1505 | |||
| 1506 | var searchers = [ExactMatch, IncludeMatch, PrefixExactMatch, InversePrefixExactMatch, InverseSuffixExactMatch, SuffixExactMatch, InverseExactMatch, FuzzyMatch]; | ||
| 1507 | var searchersLen = searchers.length; // Regex to split by spaces, but keep anything in quotes together | ||
| 1508 | |||
| 1509 | var SPACE_RE = / +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/; | ||
| 1510 | var OR_TOKEN = '|'; // Return a 2D array representation of the query, for simpler parsing. | ||
| 1511 | // Example: | ||
| 1512 | // "^core go$ | rb$ | py$ xy$" => [["^core", "go$"], ["rb$"], ["py$", "xy$"]] | ||
| 1513 | |||
| 1514 | function parseQuery(pattern) { | ||
| 1515 | var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
| 1516 | return pattern.split(OR_TOKEN).map(function (item) { | ||
| 1517 | var query = item.trim().split(SPACE_RE).filter(function (item) { | ||
| 1518 | return item && !!item.trim(); | ||
| 1519 | }); | ||
| 1520 | var results = []; | ||
| 1521 | |||
| 1522 | for (var i = 0, len = query.length; i < len; i += 1) { | ||
| 1523 | var queryItem = query[i]; // 1. Handle multiple query match (i.e, once that are quoted, like `"hello world"`) | ||
| 1524 | |||
| 1525 | var found = false; | ||
| 1526 | var idx = -1; | ||
| 1527 | |||
| 1528 | while (!found && ++idx < searchersLen) { | ||
| 1529 | var searcher = searchers[idx]; | ||
| 1530 | var token = searcher.isMultiMatch(queryItem); | ||
| 1531 | |||
| 1532 | if (token) { | ||
| 1533 | results.push(new searcher(token, options)); | ||
| 1534 | found = true; | ||
| 1535 | } | ||
| 1536 | } | ||
| 1537 | |||
| 1538 | if (found) { | ||
| 1539 | continue; | ||
| 1540 | } // 2. Handle single query matches (i.e, once that are *not* quoted) | ||
| 1541 | |||
| 1542 | |||
| 1543 | idx = -1; | ||
| 1544 | |||
| 1545 | while (++idx < searchersLen) { | ||
| 1546 | var _searcher = searchers[idx]; | ||
| 1547 | |||
| 1548 | var _token = _searcher.isSingleMatch(queryItem); | ||
| 1549 | |||
| 1550 | if (_token) { | ||
| 1551 | results.push(new _searcher(_token, options)); | ||
| 1552 | break; | ||
| 1553 | } | ||
| 1554 | } | ||
| 1555 | } | ||
| 1556 | |||
| 1557 | return results; | ||
| 1558 | }); | ||
| 1559 | } | ||
| 1560 | |||
| 1561 | // to a singl match | ||
| 1562 | |||
| 1563 | var MultiMatchSet = new Set([FuzzyMatch.type, IncludeMatch.type]); | ||
| 1564 | /** | ||
| 1565 | * Command-like searching | ||
| 1566 | * ====================== | ||
| 1567 | * | ||
| 1568 | * Given multiple search terms delimited by spaces.e.g. `^jscript .python$ ruby !java`, | ||
| 1569 | * search in a given text. | ||
| 1570 | * | ||
| 1571 | * Search syntax: | ||
| 1572 | * | ||
| 1573 | * | Token | Match type | Description | | ||
| 1574 | * | ----------- | -------------------------- | -------------------------------------- | | ||
| 1575 | * | `jscript` | fuzzy-match | Items that fuzzy match `jscript` | | ||
| 1576 | * | `=scheme` | exact-match | Items that are `scheme` | | ||
| 1577 | * | `'python` | include-match | Items that include `python` | | ||
| 1578 | * | `!ruby` | inverse-exact-match | Items that do not include `ruby` | | ||
| 1579 | * | `^java` | prefix-exact-match | Items that start with `java` | | ||
| 1580 | * | `!^earlang` | inverse-prefix-exact-match | Items that do not start with `earlang` | | ||
| 1581 | * | `.js$` | suffix-exact-match | Items that end with `.js` | | ||
| 1582 | * | `!.go$` | inverse-suffix-exact-match | Items that do not end with `.go` | | ||
| 1583 | * | ||
| 1584 | * A single pipe character acts as an OR operator. For example, the following | ||
| 1585 | * query matches entries that start with `core` and end with either`go`, `rb`, | ||
| 1586 | * or`py`. | ||
| 1587 | * | ||
| 1588 | * ``` | ||
| 1589 | * ^core go$ | rb$ | py$ | ||
| 1590 | * ``` | ||
| 1591 | */ | ||
| 1592 | |||
| 1593 | var ExtendedSearch = /*#__PURE__*/function () { | ||
| 1594 | function ExtendedSearch(pattern) { | ||
| 1595 | var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, | ||
| 1596 | _ref$isCaseSensitive = _ref.isCaseSensitive, | ||
| 1597 | isCaseSensitive = _ref$isCaseSensitive === void 0 ? Config.isCaseSensitive : _ref$isCaseSensitive, | ||
| 1598 | _ref$includeMatches = _ref.includeMatches, | ||
| 1599 | includeMatches = _ref$includeMatches === void 0 ? Config.includeMatches : _ref$includeMatches, | ||
| 1600 | _ref$minMatchCharLeng = _ref.minMatchCharLength, | ||
| 1601 | minMatchCharLength = _ref$minMatchCharLeng === void 0 ? Config.minMatchCharLength : _ref$minMatchCharLeng, | ||
| 1602 | _ref$ignoreLocation = _ref.ignoreLocation, | ||
| 1603 | ignoreLocation = _ref$ignoreLocation === void 0 ? Config.ignoreLocation : _ref$ignoreLocation, | ||
| 1604 | _ref$findAllMatches = _ref.findAllMatches, | ||
| 1605 | findAllMatches = _ref$findAllMatches === void 0 ? Config.findAllMatches : _ref$findAllMatches, | ||
| 1606 | _ref$location = _ref.location, | ||
| 1607 | location = _ref$location === void 0 ? Config.location : _ref$location, | ||
| 1608 | _ref$threshold = _ref.threshold, | ||
| 1609 | threshold = _ref$threshold === void 0 ? Config.threshold : _ref$threshold, | ||
| 1610 | _ref$distance = _ref.distance, | ||
| 1611 | distance = _ref$distance === void 0 ? Config.distance : _ref$distance; | ||
| 1612 | |||
| 1613 | _classCallCheck(this, ExtendedSearch); | ||
| 1614 | |||
| 1615 | this.query = null; | ||
| 1616 | this.options = { | ||
| 1617 | isCaseSensitive: isCaseSensitive, | ||
| 1618 | includeMatches: includeMatches, | ||
| 1619 | minMatchCharLength: minMatchCharLength, | ||
| 1620 | findAllMatches: findAllMatches, | ||
| 1621 | ignoreLocation: ignoreLocation, | ||
| 1622 | location: location, | ||
| 1623 | threshold: threshold, | ||
| 1624 | distance: distance | ||
| 1625 | }; | ||
| 1626 | this.pattern = isCaseSensitive ? pattern : pattern.toLowerCase(); | ||
| 1627 | this.query = parseQuery(this.pattern, this.options); | ||
| 1628 | } | ||
| 1629 | |||
| 1630 | _createClass(ExtendedSearch, [{ | ||
| 1631 | key: "searchIn", | ||
| 1632 | value: function searchIn(text) { | ||
| 1633 | var query = this.query; | ||
| 1634 | |||
| 1635 | if (!query) { | ||
| 1636 | return { | ||
| 1637 | isMatch: false, | ||
| 1638 | score: 1 | ||
| 1639 | }; | ||
| 1640 | } | ||
| 1641 | |||
| 1642 | var _this$options = this.options, | ||
| 1643 | includeMatches = _this$options.includeMatches, | ||
| 1644 | isCaseSensitive = _this$options.isCaseSensitive; | ||
| 1645 | text = isCaseSensitive ? text : text.toLowerCase(); | ||
| 1646 | var numMatches = 0; | ||
| 1647 | var allIndices = []; | ||
| 1648 | var totalScore = 0; // ORs | ||
| 1649 | |||
| 1650 | for (var i = 0, qLen = query.length; i < qLen; i += 1) { | ||
| 1651 | var searchers = query[i]; // Reset indices | ||
| 1652 | |||
| 1653 | allIndices.length = 0; | ||
| 1654 | numMatches = 0; // ANDs | ||
| 1655 | |||
| 1656 | for (var j = 0, pLen = searchers.length; j < pLen; j += 1) { | ||
| 1657 | var searcher = searchers[j]; | ||
| 1658 | |||
| 1659 | var _searcher$search = searcher.search(text), | ||
| 1660 | isMatch = _searcher$search.isMatch, | ||
| 1661 | indices = _searcher$search.indices, | ||
| 1662 | score = _searcher$search.score; | ||
| 1663 | |||
| 1664 | if (isMatch) { | ||
| 1665 | numMatches += 1; | ||
| 1666 | totalScore += score; | ||
| 1667 | |||
| 1668 | if (includeMatches) { | ||
| 1669 | var type = searcher.constructor.type; | ||
| 1670 | |||
| 1671 | if (MultiMatchSet.has(type)) { | ||
| 1672 | allIndices = [].concat(_toConsumableArray(allIndices), _toConsumableArray(indices)); | ||
| 1673 | } else { | ||
| 1674 | allIndices.push(indices); | ||
| 1675 | } | ||
| 1676 | } | ||
| 1677 | } else { | ||
| 1678 | totalScore = 0; | ||
| 1679 | numMatches = 0; | ||
| 1680 | allIndices.length = 0; | ||
| 1681 | break; | ||
| 1682 | } | ||
| 1683 | } // OR condition, so if TRUE, return | ||
| 1684 | |||
| 1685 | |||
| 1686 | if (numMatches) { | ||
| 1687 | var result = { | ||
| 1688 | isMatch: true, | ||
| 1689 | score: totalScore / numMatches | ||
| 1690 | }; | ||
| 1691 | |||
| 1692 | if (includeMatches) { | ||
| 1693 | result.indices = allIndices; | ||
| 1694 | } | ||
| 1695 | |||
| 1696 | return result; | ||
| 1697 | } | ||
| 1698 | } // Nothing was matched | ||
| 1699 | |||
| 1700 | |||
| 1701 | return { | ||
| 1702 | isMatch: false, | ||
| 1703 | score: 1 | ||
| 1704 | }; | ||
| 1705 | } | ||
| 1706 | }], [{ | ||
| 1707 | key: "condition", | ||
| 1708 | value: function condition(_, options) { | ||
| 1709 | return options.useExtendedSearch; | ||
| 1710 | } | ||
| 1711 | }]); | ||
| 1712 | |||
| 1713 | return ExtendedSearch; | ||
| 1714 | }(); | ||
| 1715 | |||
| 1716 | var registeredSearchers = []; | ||
| 1717 | function register() { | ||
| 1718 | registeredSearchers.push.apply(registeredSearchers, arguments); | ||
| 1719 | } | ||
| 1720 | function createSearcher(pattern, options) { | ||
| 1721 | for (var i = 0, len = registeredSearchers.length; i < len; i += 1) { | ||
| 1722 | var searcherClass = registeredSearchers[i]; | ||
| 1723 | |||
| 1724 | if (searcherClass.condition(pattern, options)) { | ||
| 1725 | return new searcherClass(pattern, options); | ||
| 1726 | } | ||
| 1727 | } | ||
| 1728 | |||
| 1729 | return new BitapSearch(pattern, options); | ||
| 1730 | } | ||
| 1731 | |||
| 1732 | var LogicalOperator = { | ||
| 1733 | AND: '$and', | ||
| 1734 | OR: '$or' | ||
| 1735 | }; | ||
| 1736 | var KeyType = { | ||
| 1737 | PATH: '$path', | ||
| 1738 | PATTERN: '$val' | ||
| 1739 | }; | ||
| 1740 | |||
| 1741 | var isExpression = function isExpression(query) { | ||
| 1742 | return !!(query[LogicalOperator.AND] || query[LogicalOperator.OR]); | ||
| 1743 | }; | ||
| 1744 | |||
| 1745 | var isPath = function isPath(query) { | ||
| 1746 | return !!query[KeyType.PATH]; | ||
| 1747 | }; | ||
| 1748 | |||
| 1749 | var isLeaf = function isLeaf(query) { | ||
| 1750 | return !isArray(query) && isObject(query) && !isExpression(query); | ||
| 1751 | }; | ||
| 1752 | |||
| 1753 | var convertToExplicit = function convertToExplicit(query) { | ||
| 1754 | return _defineProperty({}, LogicalOperator.AND, Object.keys(query).map(function (key) { | ||
| 1755 | return _defineProperty({}, key, query[key]); | ||
| 1756 | })); | ||
| 1757 | }; // When `auto` is `true`, the parse function will infer and initialize and add | ||
| 1758 | // the appropriate `Searcher` instance | ||
| 1759 | |||
| 1760 | |||
| 1761 | function parse(query, options) { | ||
| 1762 | var _ref3 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}, | ||
| 1763 | _ref3$auto = _ref3.auto, | ||
| 1764 | auto = _ref3$auto === void 0 ? true : _ref3$auto; | ||
| 1765 | |||
| 1766 | var next = function next(query) { | ||
| 1767 | var keys = Object.keys(query); | ||
| 1768 | var isQueryPath = isPath(query); | ||
| 1769 | |||
| 1770 | if (!isQueryPath && keys.length > 1 && !isExpression(query)) { | ||
| 1771 | return next(convertToExplicit(query)); | ||
| 1772 | } | ||
| 1773 | |||
| 1774 | if (isLeaf(query)) { | ||
| 1775 | var key = isQueryPath ? query[KeyType.PATH] : keys[0]; | ||
| 1776 | var pattern = isQueryPath ? query[KeyType.PATTERN] : query[key]; | ||
| 1777 | |||
| 1778 | if (!isString(pattern)) { | ||
| 1779 | throw new Error(LOGICAL_SEARCH_INVALID_QUERY_FOR_KEY(key)); | ||
| 1780 | } | ||
| 1781 | |||
| 1782 | var obj = { | ||
| 1783 | keyId: createKeyId(key), | ||
| 1784 | pattern: pattern | ||
| 1785 | }; | ||
| 1786 | |||
| 1787 | if (auto) { | ||
| 1788 | obj.searcher = createSearcher(pattern, options); | ||
| 1789 | } | ||
| 1790 | |||
| 1791 | return obj; | ||
| 1792 | } | ||
| 1793 | |||
| 1794 | var node = { | ||
| 1795 | children: [], | ||
| 1796 | operator: keys[0] | ||
| 1797 | }; | ||
| 1798 | keys.forEach(function (key) { | ||
| 1799 | var value = query[key]; | ||
| 1800 | |||
| 1801 | if (isArray(value)) { | ||
| 1802 | value.forEach(function (item) { | ||
| 1803 | node.children.push(next(item)); | ||
| 1804 | }); | ||
| 1805 | } | ||
| 1806 | }); | ||
| 1807 | return node; | ||
| 1808 | }; | ||
| 1809 | |||
| 1810 | if (!isExpression(query)) { | ||
| 1811 | query = convertToExplicit(query); | ||
| 1812 | } | ||
| 1813 | |||
| 1814 | return next(query); | ||
| 1815 | } | ||
| 1816 | |||
| 1817 | function computeScore(results, _ref) { | ||
| 1818 | var _ref$ignoreFieldNorm = _ref.ignoreFieldNorm, | ||
| 1819 | ignoreFieldNorm = _ref$ignoreFieldNorm === void 0 ? Config.ignoreFieldNorm : _ref$ignoreFieldNorm; | ||
| 1820 | results.forEach(function (result) { | ||
| 1821 | var totalScore = 1; | ||
| 1822 | result.matches.forEach(function (_ref2) { | ||
| 1823 | var key = _ref2.key, | ||
| 1824 | norm = _ref2.norm, | ||
| 1825 | score = _ref2.score; | ||
| 1826 | var weight = key ? key.weight : null; | ||
| 1827 | totalScore *= Math.pow(score === 0 && weight ? Number.EPSILON : score, (weight || 1) * (ignoreFieldNorm ? 1 : norm)); | ||
| 1828 | }); | ||
| 1829 | result.score = totalScore; | ||
| 1830 | }); | ||
| 1831 | } | ||
| 1832 | |||
| 1833 | function transformMatches(result, data) { | ||
| 1834 | var matches = result.matches; | ||
| 1835 | data.matches = []; | ||
| 1836 | |||
| 1837 | if (!isDefined(matches)) { | ||
| 1838 | return; | ||
| 1839 | } | ||
| 1840 | |||
| 1841 | matches.forEach(function (match) { | ||
| 1842 | if (!isDefined(match.indices) || !match.indices.length) { | ||
| 1843 | return; | ||
| 1844 | } | ||
| 1845 | |||
| 1846 | var indices = match.indices, | ||
| 1847 | value = match.value; | ||
| 1848 | var obj = { | ||
| 1849 | indices: indices, | ||
| 1850 | value: value | ||
| 1851 | }; | ||
| 1852 | |||
| 1853 | if (match.key) { | ||
| 1854 | obj.key = match.key.src; | ||
| 1855 | } | ||
| 1856 | |||
| 1857 | if (match.idx > -1) { | ||
| 1858 | obj.refIndex = match.idx; | ||
| 1859 | } | ||
| 1860 | |||
| 1861 | data.matches.push(obj); | ||
| 1862 | }); | ||
| 1863 | } | ||
| 1864 | |||
| 1865 | function transformScore(result, data) { | ||
| 1866 | data.score = result.score; | ||
| 1867 | } | ||
| 1868 | |||
| 1869 | function format(results, docs) { | ||
| 1870 | var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}, | ||
| 1871 | _ref$includeMatches = _ref.includeMatches, | ||
| 1872 | includeMatches = _ref$includeMatches === void 0 ? Config.includeMatches : _ref$includeMatches, | ||
| 1873 | _ref$includeScore = _ref.includeScore, | ||
| 1874 | includeScore = _ref$includeScore === void 0 ? Config.includeScore : _ref$includeScore; | ||
| 1875 | |||
| 1876 | var transformers = []; | ||
| 1877 | if (includeMatches) transformers.push(transformMatches); | ||
| 1878 | if (includeScore) transformers.push(transformScore); | ||
| 1879 | return results.map(function (result) { | ||
| 1880 | var idx = result.idx; | ||
| 1881 | var data = { | ||
| 1882 | item: docs[idx], | ||
| 1883 | refIndex: idx | ||
| 1884 | }; | ||
| 1885 | |||
| 1886 | if (transformers.length) { | ||
| 1887 | transformers.forEach(function (transformer) { | ||
| 1888 | transformer(result, data); | ||
| 1889 | }); | ||
| 1890 | } | ||
| 1891 | |||
| 1892 | return data; | ||
| 1893 | }); | ||
| 1894 | } | ||
| 1895 | |||
| 1896 | var Fuse$1 = /*#__PURE__*/function () { | ||
| 1897 | function Fuse(docs) { | ||
| 1898 | var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
| 1899 | var index = arguments.length > 2 ? arguments[2] : undefined; | ||
| 1900 | |||
| 1901 | _classCallCheck(this, Fuse); | ||
| 1902 | |||
| 1903 | this.options = _objectSpread2(_objectSpread2({}, Config), options); | ||
| 1904 | |||
| 1905 | if (this.options.useExtendedSearch && !true) { | ||
| 1906 | throw new Error(EXTENDED_SEARCH_UNAVAILABLE); | ||
| 1907 | } | ||
| 1908 | |||
| 1909 | this._keyStore = new KeyStore(this.options.keys); | ||
| 1910 | this.setCollection(docs, index); | ||
| 1911 | } | ||
| 1912 | |||
| 1913 | _createClass(Fuse, [{ | ||
| 1914 | key: "setCollection", | ||
| 1915 | value: function setCollection(docs, index) { | ||
| 1916 | this._docs = docs; | ||
| 1917 | |||
| 1918 | if (index && !(index instanceof FuseIndex)) { | ||
| 1919 | throw new Error(INCORRECT_INDEX_TYPE); | ||
| 1920 | } | ||
| 1921 | |||
| 1922 | this._myIndex = index || createIndex(this.options.keys, this._docs, { | ||
| 1923 | getFn: this.options.getFn, | ||
| 1924 | fieldNormWeight: this.options.fieldNormWeight | ||
| 1925 | }); | ||
| 1926 | } | ||
| 1927 | }, { | ||
| 1928 | key: "add", | ||
| 1929 | value: function add(doc) { | ||
| 1930 | if (!isDefined(doc)) { | ||
| 1931 | return; | ||
| 1932 | } | ||
| 1933 | |||
| 1934 | this._docs.push(doc); | ||
| 1935 | |||
| 1936 | this._myIndex.add(doc); | ||
| 1937 | } | ||
| 1938 | }, { | ||
| 1939 | key: "remove", | ||
| 1940 | value: function remove() { | ||
| 1941 | var predicate = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function | ||
| 1942 | /* doc, idx */ | ||
| 1943 | () { | ||
| 1944 | return false; | ||
| 1945 | }; | ||
| 1946 | var results = []; | ||
| 1947 | |||
| 1948 | for (var i = 0, len = this._docs.length; i < len; i += 1) { | ||
| 1949 | var doc = this._docs[i]; | ||
| 1950 | |||
| 1951 | if (predicate(doc, i)) { | ||
| 1952 | this.removeAt(i); | ||
| 1953 | i -= 1; | ||
| 1954 | len -= 1; | ||
| 1955 | results.push(doc); | ||
| 1956 | } | ||
| 1957 | } | ||
| 1958 | |||
| 1959 | return results; | ||
| 1960 | } | ||
| 1961 | }, { | ||
| 1962 | key: "removeAt", | ||
| 1963 | value: function removeAt(idx) { | ||
| 1964 | this._docs.splice(idx, 1); | ||
| 1965 | |||
| 1966 | this._myIndex.removeAt(idx); | ||
| 1967 | } | ||
| 1968 | }, { | ||
| 1969 | key: "getIndex", | ||
| 1970 | value: function getIndex() { | ||
| 1971 | return this._myIndex; | ||
| 1972 | } | ||
| 1973 | }, { | ||
| 1974 | key: "search", | ||
| 1975 | value: function search(query) { | ||
| 1976 | var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, | ||
| 1977 | _ref$limit = _ref.limit, | ||
| 1978 | limit = _ref$limit === void 0 ? -1 : _ref$limit; | ||
| 1979 | |||
| 1980 | var _this$options = this.options, | ||
| 1981 | includeMatches = _this$options.includeMatches, | ||
| 1982 | includeScore = _this$options.includeScore, | ||
| 1983 | shouldSort = _this$options.shouldSort, | ||
| 1984 | sortFn = _this$options.sortFn, | ||
| 1985 | ignoreFieldNorm = _this$options.ignoreFieldNorm; | ||
| 1986 | var results = isString(query) ? isString(this._docs[0]) ? this._searchStringList(query) : this._searchObjectList(query) : this._searchLogical(query); | ||
| 1987 | computeScore(results, { | ||
| 1988 | ignoreFieldNorm: ignoreFieldNorm | ||
| 1989 | }); | ||
| 1990 | |||
| 1991 | if (shouldSort) { | ||
| 1992 | results.sort(sortFn); | ||
| 1993 | } | ||
| 1994 | |||
| 1995 | if (isNumber(limit) && limit > -1) { | ||
| 1996 | results = results.slice(0, limit); | ||
| 1997 | } | ||
| 1998 | |||
| 1999 | return format(results, this._docs, { | ||
| 2000 | includeMatches: includeMatches, | ||
| 2001 | includeScore: includeScore | ||
| 2002 | }); | ||
| 2003 | } | ||
| 2004 | }, { | ||
| 2005 | key: "_searchStringList", | ||
| 2006 | value: function _searchStringList(query) { | ||
| 2007 | var searcher = createSearcher(query, this.options); | ||
| 2008 | var records = this._myIndex.records; | ||
| 2009 | var results = []; // Iterate over every string in the index | ||
| 2010 | |||
| 2011 | records.forEach(function (_ref2) { | ||
| 2012 | var text = _ref2.v, | ||
| 2013 | idx = _ref2.i, | ||
| 2014 | norm = _ref2.n; | ||
| 2015 | |||
| 2016 | if (!isDefined(text)) { | ||
| 2017 | return; | ||
| 2018 | } | ||
| 2019 | |||
| 2020 | var _searcher$searchIn = searcher.searchIn(text), | ||
| 2021 | isMatch = _searcher$searchIn.isMatch, | ||
| 2022 | score = _searcher$searchIn.score, | ||
| 2023 | indices = _searcher$searchIn.indices; | ||
| 2024 | |||
| 2025 | if (isMatch) { | ||
| 2026 | results.push({ | ||
| 2027 | item: text, | ||
| 2028 | idx: idx, | ||
| 2029 | matches: [{ | ||
| 2030 | score: score, | ||
| 2031 | value: text, | ||
| 2032 | norm: norm, | ||
| 2033 | indices: indices | ||
| 2034 | }] | ||
| 2035 | }); | ||
| 2036 | } | ||
| 2037 | }); | ||
| 2038 | return results; | ||
| 2039 | } | ||
| 2040 | }, { | ||
| 2041 | key: "_searchLogical", | ||
| 2042 | value: function _searchLogical(query) { | ||
| 2043 | var _this = this; | ||
| 2044 | |||
| 2045 | var expression = parse(query, this.options); | ||
| 2046 | |||
| 2047 | var evaluate = function evaluate(node, item, idx) { | ||
| 2048 | if (!node.children) { | ||
| 2049 | var keyId = node.keyId, | ||
| 2050 | searcher = node.searcher; | ||
| 2051 | |||
| 2052 | var matches = _this._findMatches({ | ||
| 2053 | key: _this._keyStore.get(keyId), | ||
| 2054 | value: _this._myIndex.getValueForItemAtKeyId(item, keyId), | ||
| 2055 | searcher: searcher | ||
| 2056 | }); | ||
| 2057 | |||
| 2058 | if (matches && matches.length) { | ||
| 2059 | return [{ | ||
| 2060 | idx: idx, | ||
| 2061 | item: item, | ||
| 2062 | matches: matches | ||
| 2063 | }]; | ||
| 2064 | } | ||
| 2065 | |||
| 2066 | return []; | ||
| 2067 | } | ||
| 2068 | |||
| 2069 | var res = []; | ||
| 2070 | |||
| 2071 | for (var i = 0, len = node.children.length; i < len; i += 1) { | ||
| 2072 | var child = node.children[i]; | ||
| 2073 | var result = evaluate(child, item, idx); | ||
| 2074 | |||
| 2075 | if (result.length) { | ||
| 2076 | res.push.apply(res, _toConsumableArray(result)); | ||
| 2077 | } else if (node.operator === LogicalOperator.AND) { | ||
| 2078 | return []; | ||
| 2079 | } | ||
| 2080 | } | ||
| 2081 | |||
| 2082 | return res; | ||
| 2083 | }; | ||
| 2084 | |||
| 2085 | var records = this._myIndex.records; | ||
| 2086 | var resultMap = {}; | ||
| 2087 | var results = []; | ||
| 2088 | records.forEach(function (_ref3) { | ||
| 2089 | var item = _ref3.$, | ||
| 2090 | idx = _ref3.i; | ||
| 2091 | |||
| 2092 | if (isDefined(item)) { | ||
| 2093 | var expResults = evaluate(expression, item, idx); | ||
| 2094 | |||
| 2095 | if (expResults.length) { | ||
| 2096 | // Dedupe when adding | ||
| 2097 | if (!resultMap[idx]) { | ||
| 2098 | resultMap[idx] = { | ||
| 2099 | idx: idx, | ||
| 2100 | item: item, | ||
| 2101 | matches: [] | ||
| 2102 | }; | ||
| 2103 | results.push(resultMap[idx]); | ||
| 2104 | } | ||
| 2105 | |||
| 2106 | expResults.forEach(function (_ref4) { | ||
| 2107 | var _resultMap$idx$matche; | ||
| 2108 | |||
| 2109 | var matches = _ref4.matches; | ||
| 2110 | |||
| 2111 | (_resultMap$idx$matche = resultMap[idx].matches).push.apply(_resultMap$idx$matche, _toConsumableArray(matches)); | ||
| 2112 | }); | ||
| 2113 | } | ||
| 2114 | } | ||
| 2115 | }); | ||
| 2116 | return results; | ||
| 2117 | } | ||
| 2118 | }, { | ||
| 2119 | key: "_searchObjectList", | ||
| 2120 | value: function _searchObjectList(query) { | ||
| 2121 | var _this2 = this; | ||
| 2122 | |||
| 2123 | var searcher = createSearcher(query, this.options); | ||
| 2124 | var _this$_myIndex = this._myIndex, | ||
| 2125 | keys = _this$_myIndex.keys, | ||
| 2126 | records = _this$_myIndex.records; | ||
| 2127 | var results = []; // List is Array<Object> | ||
| 2128 | |||
| 2129 | records.forEach(function (_ref5) { | ||
| 2130 | var item = _ref5.$, | ||
| 2131 | idx = _ref5.i; | ||
| 2132 | |||
| 2133 | if (!isDefined(item)) { | ||
| 2134 | return; | ||
| 2135 | } | ||
| 2136 | |||
| 2137 | var matches = []; // Iterate over every key (i.e, path), and fetch the value at that key | ||
| 2138 | |||
| 2139 | keys.forEach(function (key, keyIndex) { | ||
| 2140 | matches.push.apply(matches, _toConsumableArray(_this2._findMatches({ | ||
| 2141 | key: key, | ||
| 2142 | value: item[keyIndex], | ||
| 2143 | searcher: searcher | ||
| 2144 | }))); | ||
| 2145 | }); | ||
| 2146 | |||
| 2147 | if (matches.length) { | ||
| 2148 | results.push({ | ||
| 2149 | idx: idx, | ||
| 2150 | item: item, | ||
| 2151 | matches: matches | ||
| 2152 | }); | ||
| 2153 | } | ||
| 2154 | }); | ||
| 2155 | return results; | ||
| 2156 | } | ||
| 2157 | }, { | ||
| 2158 | key: "_findMatches", | ||
| 2159 | value: function _findMatches(_ref6) { | ||
| 2160 | var key = _ref6.key, | ||
| 2161 | value = _ref6.value, | ||
| 2162 | searcher = _ref6.searcher; | ||
| 2163 | |||
| 2164 | if (!isDefined(value)) { | ||
| 2165 | return []; | ||
| 2166 | } | ||
| 2167 | |||
| 2168 | var matches = []; | ||
| 2169 | |||
| 2170 | if (isArray(value)) { | ||
| 2171 | value.forEach(function (_ref7) { | ||
| 2172 | var text = _ref7.v, | ||
| 2173 | idx = _ref7.i, | ||
| 2174 | norm = _ref7.n; | ||
| 2175 | |||
| 2176 | if (!isDefined(text)) { | ||
| 2177 | return; | ||
| 2178 | } | ||
| 2179 | |||
| 2180 | var _searcher$searchIn2 = searcher.searchIn(text), | ||
| 2181 | isMatch = _searcher$searchIn2.isMatch, | ||
| 2182 | score = _searcher$searchIn2.score, | ||
| 2183 | indices = _searcher$searchIn2.indices; | ||
| 2184 | |||
| 2185 | if (isMatch) { | ||
| 2186 | matches.push({ | ||
| 2187 | score: score, | ||
| 2188 | key: key, | ||
| 2189 | value: text, | ||
| 2190 | idx: idx, | ||
| 2191 | norm: norm, | ||
| 2192 | indices: indices | ||
| 2193 | }); | ||
| 2194 | } | ||
| 2195 | }); | ||
| 2196 | } else { | ||
| 2197 | var text = value.v, | ||
| 2198 | norm = value.n; | ||
| 2199 | |||
| 2200 | var _searcher$searchIn3 = searcher.searchIn(text), | ||
| 2201 | isMatch = _searcher$searchIn3.isMatch, | ||
| 2202 | score = _searcher$searchIn3.score, | ||
| 2203 | indices = _searcher$searchIn3.indices; | ||
| 2204 | |||
| 2205 | if (isMatch) { | ||
| 2206 | matches.push({ | ||
| 2207 | score: score, | ||
| 2208 | key: key, | ||
| 2209 | value: text, | ||
| 2210 | norm: norm, | ||
| 2211 | indices: indices | ||
| 2212 | }); | ||
| 2213 | } | ||
| 2214 | } | ||
| 2215 | |||
| 2216 | return matches; | ||
| 2217 | } | ||
| 2218 | }]); | ||
| 2219 | |||
| 2220 | return Fuse; | ||
| 2221 | }(); | ||
| 2222 | |||
| 2223 | Fuse$1.version = '6.6.2'; | ||
| 2224 | Fuse$1.createIndex = createIndex; | ||
| 2225 | Fuse$1.parseIndex = parseIndex; | ||
| 2226 | Fuse$1.config = Config; | ||
| 2227 | |||
| 2228 | { | ||
| 2229 | Fuse$1.parseQuery = parse; | ||
| 2230 | } | ||
| 2231 | |||
| 2232 | { | ||
| 2233 | register(ExtendedSearch); | ||
| 2234 | } | ||
| 2235 | |||
| 2236 | var Fuse = Fuse$1; | ||
| 2237 | |||
| 2238 | return Fuse; | ||
| 2239 | |||
| 2240 | })); | ||
| @@ -1,5972 +0,0 @@ | |||
| 1 | /**! | ||
| 2 | |||
| 3 | @license | ||
| 4 | handlebars v4.7.8 | ||
| 5 | |||
| 6 | Copyright (C) 2011-2019 by Yehuda Katz | ||
| 7 | |||
| 8 | Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| 9 | of this software and associated documentation files (the "Software"), to deal | ||
| 10 | in the Software without restriction, including without limitation the rights | ||
| 11 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| 12 | copies of the Software, and to permit persons to whom the Software is | ||
| 13 | furnished to do so, subject to the following conditions: | ||
| 14 | |||
| 15 | The above copyright notice and this permission notice shall be included in | ||
| 16 | all copies or substantial portions of the Software. | ||
| 17 | |||
| 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| 20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| 21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| 22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| 23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
| 24 | THE SOFTWARE. | ||
| 25 | |||
| 26 | */ | ||
| 27 | (function webpackUniversalModuleDefinition(root, factory) { | ||
| 28 | if(typeof exports === 'object' && typeof module === 'object') | ||
| 29 | module.exports = factory(); | ||
| 30 | else if(typeof define === 'function' && define.amd) | ||
| 31 | define([], factory); | ||
| 32 | else if(typeof exports === 'object') | ||
| 33 | exports["Handlebars"] = factory(); | ||
| 34 | else | ||
| 35 | root["Handlebars"] = factory(); | ||
| 36 | })(this, function() { | ||
| 37 | return /******/ (function(modules) { // webpackBootstrap | ||
| 38 | /******/ // The module cache | ||
| 39 | /******/ var installedModules = {}; | ||
| 40 | |||
| 41 | /******/ // The require function | ||
| 42 | /******/ function __webpack_require__(moduleId) { | ||
| 43 | |||
| 44 | /******/ // Check if module is in cache | ||
| 45 | /******/ if(installedModules[moduleId]) | ||
| 46 | /******/ return installedModules[moduleId].exports; | ||
| 47 | |||
| 48 | /******/ // Create a new module (and put it into the cache) | ||
| 49 | /******/ var module = installedModules[moduleId] = { | ||
| 50 | /******/ exports: {}, | ||
| 51 | /******/ id: moduleId, | ||
| 52 | /******/ loaded: false | ||
| 53 | /******/ }; | ||
| 54 | |||
| 55 | /******/ // Execute the module function | ||
| 56 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); | ||
| 57 | |||
| 58 | /******/ // Flag the module as loaded | ||
| 59 | /******/ module.loaded = true; | ||
| 60 | |||
| 61 | /******/ // Return the exports of the module | ||
| 62 | /******/ return module.exports; | ||
| 63 | /******/ } | ||
| 64 | |||
| 65 | |||
| 66 | /******/ // expose the modules object (__webpack_modules__) | ||
| 67 | /******/ __webpack_require__.m = modules; | ||
| 68 | |||
| 69 | /******/ // expose the module cache | ||
| 70 | /******/ __webpack_require__.c = installedModules; | ||
| 71 | |||
| 72 | /******/ // __webpack_public_path__ | ||
| 73 | /******/ __webpack_require__.p = ""; | ||
| 74 | |||
| 75 | /******/ // Load entry module and return exports | ||
| 76 | /******/ return __webpack_require__(0); | ||
| 77 | /******/ }) | ||
| 78 | /************************************************************************/ | ||
| 79 | /******/ ([ | ||
| 80 | /* 0 */ | ||
| 81 | /***/ (function(module, exports, __webpack_require__) { | ||
| 82 | |||
| 83 | 'use strict'; | ||
| 84 | |||
| 85 | var _interopRequireDefault = __webpack_require__(1)['default']; | ||
| 86 | |||
| 87 | exports.__esModule = true; | ||
| 88 | |||
| 89 | var _handlebarsRuntime = __webpack_require__(2); | ||
| 90 | |||
| 91 | var _handlebarsRuntime2 = _interopRequireDefault(_handlebarsRuntime); | ||
| 92 | |||
| 93 | // Compiler imports | ||
| 94 | |||
| 95 | var _handlebarsCompilerAst = __webpack_require__(84); | ||
| 96 | |||
| 97 | var _handlebarsCompilerAst2 = _interopRequireDefault(_handlebarsCompilerAst); | ||
| 98 | |||
| 99 | var _handlebarsCompilerBase = __webpack_require__(85); | ||
| 100 | |||
| 101 | var _handlebarsCompilerCompiler = __webpack_require__(90); | ||
| 102 | |||
| 103 | var _handlebarsCompilerJavascriptCompiler = __webpack_require__(91); | ||
| 104 | |||
| 105 | var _handlebarsCompilerJavascriptCompiler2 = _interopRequireDefault(_handlebarsCompilerJavascriptCompiler); | ||
| 106 | |||
| 107 | var _handlebarsCompilerVisitor = __webpack_require__(88); | ||
| 108 | |||
| 109 | var _handlebarsCompilerVisitor2 = _interopRequireDefault(_handlebarsCompilerVisitor); | ||
| 110 | |||
| 111 | var _handlebarsNoConflict = __webpack_require__(83); | ||
| 112 | |||
| 113 | var _handlebarsNoConflict2 = _interopRequireDefault(_handlebarsNoConflict); | ||
| 114 | |||
| 115 | var _create = _handlebarsRuntime2['default'].create; | ||
| 116 | function create() { | ||
| 117 | var hb = _create(); | ||
| 118 | |||
| 119 | hb.compile = function (input, options) { | ||
| 120 | return _handlebarsCompilerCompiler.compile(input, options, hb); | ||
| 121 | }; | ||
| 122 | hb.precompile = function (input, options) { | ||
| 123 | return _handlebarsCompilerCompiler.precompile(input, options, hb); | ||
| 124 | }; | ||
| 125 | |||
| 126 | hb.AST = _handlebarsCompilerAst2['default']; | ||
| 127 | hb.Compiler = _handlebarsCompilerCompiler.Compiler; | ||
| 128 | hb.JavaScriptCompiler = _handlebarsCompilerJavascriptCompiler2['default']; | ||
| 129 | hb.Parser = _handlebarsCompilerBase.parser; | ||
| 130 | hb.parse = _handlebarsCompilerBase.parse; | ||
| 131 | hb.parseWithoutProcessing = _handlebarsCompilerBase.parseWithoutProcessing; | ||
| 132 | |||
| 133 | return hb; | ||
| 134 | } | ||
| 135 | |||
| 136 | var inst = create(); | ||
| 137 | inst.create = create; | ||
| 138 | |||
| 139 | _handlebarsNoConflict2['default'](inst); | ||
| 140 | |||
| 141 | inst.Visitor = _handlebarsCompilerVisitor2['default']; | ||
| 142 | |||
| 143 | inst['default'] = inst; | ||
| 144 | |||
| 145 | exports['default'] = inst; | ||
| 146 | module.exports = exports['default']; | ||
| 147 | |||
| 148 | /***/ }), | ||
| 149 | /* 1 */ | ||
| 150 | /***/ (function(module, exports) { | ||
| 151 | |||
| 152 | "use strict"; | ||
| 153 | |||
| 154 | exports["default"] = function (obj) { | ||
| 155 | return obj && obj.__esModule ? obj : { | ||
| 156 | "default": obj | ||
| 157 | }; | ||
| 158 | }; | ||
| 159 | |||
| 160 | exports.__esModule = true; | ||
| 161 | |||
| 162 | /***/ }), | ||
| 163 | /* 2 */ | ||
| 164 | /***/ (function(module, exports, __webpack_require__) { | ||
| 165 | |||
| 166 | 'use strict'; | ||
| 167 | |||
| 168 | var _interopRequireWildcard = __webpack_require__(3)['default']; | ||
| 169 | |||
| 170 | var _interopRequireDefault = __webpack_require__(1)['default']; | ||
| 171 | |||
| 172 | exports.__esModule = true; | ||
| 173 | |||
| 174 | var _handlebarsBase = __webpack_require__(4); | ||
| 175 | |||
| 176 | var base = _interopRequireWildcard(_handlebarsBase); | ||
| 177 | |||
| 178 | // Each of these augment the Handlebars object. No need to setup here. | ||
| 179 | // (This is done to easily share code between commonjs and browse envs) | ||
| 180 | |||
| 181 | var _handlebarsSafeString = __webpack_require__(77); | ||
| 182 | |||
| 183 | var _handlebarsSafeString2 = _interopRequireDefault(_handlebarsSafeString); | ||
| 184 | |||
| 185 | var _handlebarsException = __webpack_require__(6); | ||
| 186 | |||
| 187 | var _handlebarsException2 = _interopRequireDefault(_handlebarsException); | ||
| 188 | |||
| 189 | var _handlebarsUtils = __webpack_require__(5); | ||
| 190 | |||
| 191 | var Utils = _interopRequireWildcard(_handlebarsUtils); | ||
| 192 | |||
| 193 | var _handlebarsRuntime = __webpack_require__(78); | ||
| 194 | |||
| 195 | var runtime = _interopRequireWildcard(_handlebarsRuntime); | ||
| 196 | |||
| 197 | var _handlebarsNoConflict = __webpack_require__(83); | ||
| 198 | |||
| 199 | var _handlebarsNoConflict2 = _interopRequireDefault(_handlebarsNoConflict); | ||
| 200 | |||
| 201 | // For compatibility and usage outside of module systems, make the Handlebars object a namespace | ||
| 202 | function create() { | ||
| 203 | var hb = new base.HandlebarsEnvironment(); | ||
| 204 | |||
| 205 | Utils.extend(hb, base); | ||
| 206 | hb.SafeString = _handlebarsSafeString2['default']; | ||
| 207 | hb.Exception = _handlebarsException2['default']; | ||
| 208 | hb.Utils = Utils; | ||
| 209 | hb.escapeExpression = Utils.escapeExpression; | ||
| 210 | |||
| 211 | hb.VM = runtime; | ||
| 212 | hb.template = function (spec) { | ||
| 213 | return runtime.template(spec, hb); | ||
| 214 | }; | ||
| 215 | |||
| 216 | return hb; | ||
| 217 | } | ||
| 218 | |||
| 219 | var inst = create(); | ||
| 220 | inst.create = create; | ||
| 221 | |||
| 222 | _handlebarsNoConflict2['default'](inst); | ||
| 223 | |||
| 224 | inst['default'] = inst; | ||
| 225 | |||
| 226 | exports['default'] = inst; | ||
| 227 | module.exports = exports['default']; | ||
| 228 | |||
| 229 | /***/ }), | ||
| 230 | /* 3 */ | ||
| 231 | /***/ (function(module, exports) { | ||
| 232 | |||
| 233 | "use strict"; | ||
| 234 | |||
| 235 | exports["default"] = function (obj) { | ||
| 236 | if (obj && obj.__esModule) { | ||
| 237 | return obj; | ||
| 238 | } else { | ||
| 239 | var newObj = {}; | ||
| 240 | |||
| 241 | if (obj != null) { | ||
| 242 | for (var key in obj) { | ||
| 243 | if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; | ||
| 244 | } | ||
| 245 | } | ||
| 246 | |||
| 247 | newObj["default"] = obj; | ||
| 248 | return newObj; | ||
| 249 | } | ||
| 250 | }; | ||
| 251 | |||
| 252 | exports.__esModule = true; | ||
| 253 | |||
| 254 | /***/ }), | ||
| 255 | /* 4 */ | ||
| 256 | /***/ (function(module, exports, __webpack_require__) { | ||
| 257 | |||
| 258 | 'use strict'; | ||
| 259 | |||
| 260 | var _interopRequireDefault = __webpack_require__(1)['default']; | ||
| 261 | |||
| 262 | exports.__esModule = true; | ||
| 263 | exports.HandlebarsEnvironment = HandlebarsEnvironment; | ||
| 264 | |||
| 265 | var _utils = __webpack_require__(5); | ||
| 266 | |||
| 267 | var _exception = __webpack_require__(6); | ||
| 268 | |||
| 269 | var _exception2 = _interopRequireDefault(_exception); | ||
| 270 | |||
| 271 | var _helpers = __webpack_require__(10); | ||
| 272 | |||
| 273 | var _decorators = __webpack_require__(70); | ||
| 274 | |||
| 275 | var _logger = __webpack_require__(72); | ||
| 276 | |||
| 277 | var _logger2 = _interopRequireDefault(_logger); | ||
| 278 | |||
| 279 | var _internalProtoAccess = __webpack_require__(73); | ||
| 280 | |||
| 281 | var VERSION = '4.7.8'; | ||
| 282 | exports.VERSION = VERSION; | ||
| 283 | var COMPILER_REVISION = 8; | ||
| 284 | exports.COMPILER_REVISION = COMPILER_REVISION; | ||
| 285 | var LAST_COMPATIBLE_COMPILER_REVISION = 7; | ||
| 286 | |||
| 287 | exports.LAST_COMPATIBLE_COMPILER_REVISION = LAST_COMPATIBLE_COMPILER_REVISION; | ||
| 288 | var REVISION_CHANGES = { | ||
| 289 | 1: '<= 1.0.rc.2', // 1.0.rc.2 is actually rev2 but doesn't report it | ||
| 290 | 2: '== 1.0.0-rc.3', | ||
| 291 | 3: '== 1.0.0-rc.4', | ||
| 292 | 4: '== 1.x.x', | ||
| 293 | 5: '== 2.0.0-alpha.x', | ||
| 294 | 6: '>= 2.0.0-beta.1', | ||
| 295 | 7: '>= 4.0.0 <4.3.0', | ||
| 296 | 8: '>= 4.3.0' | ||
| 297 | }; | ||
| 298 | |||
| 299 | exports.REVISION_CHANGES = REVISION_CHANGES; | ||
| 300 | var objectType = '[object Object]'; | ||
| 301 | |||
| 302 | function HandlebarsEnvironment(helpers, partials, decorators) { | ||
| 303 | this.helpers = helpers || {}; | ||
| 304 | this.partials = partials || {}; | ||
| 305 | this.decorators = decorators || {}; | ||
| 306 | |||
| 307 | _helpers.registerDefaultHelpers(this); | ||
| 308 | _decorators.registerDefaultDecorators(this); | ||
| 309 | } | ||
| 310 | |||
| 311 | HandlebarsEnvironment.prototype = { | ||
| 312 | constructor: HandlebarsEnvironment, | ||
| 313 | |||
| 314 | logger: _logger2['default'], | ||
| 315 | log: _logger2['default'].log, | ||
| 316 | |||
| 317 | registerHelper: function registerHelper(name, fn) { | ||
| 318 | if (_utils.toString.call(name) === objectType) { | ||
| 319 | if (fn) { | ||
| 320 | throw new _exception2['default']('Arg not supported with multiple helpers'); | ||
| 321 | } | ||
| 322 | _utils.extend(this.helpers, name); | ||
| 323 | } else { | ||
| 324 | this.helpers[name] = fn; | ||
| 325 | } | ||
| 326 | }, | ||
| 327 | unregisterHelper: function unregisterHelper(name) { | ||
| 328 | delete this.helpers[name]; | ||
| 329 | }, | ||
| 330 | |||
| 331 | registerPartial: function registerPartial(name, partial) { | ||
| 332 | if (_utils.toString.call(name) === objectType) { | ||
| 333 | _utils.extend(this.partials, name); | ||
| 334 | } else { | ||
| 335 | if (typeof partial === 'undefined') { | ||
| 336 | throw new _exception2['default']('Attempting to register a partial called "' + name + '" as undefined'); | ||
| 337 | } | ||
| 338 | this.partials[name] = partial; | ||
| 339 | } | ||
| 340 | }, | ||
| 341 | unregisterPartial: function unregisterPartial(name) { | ||
| 342 | delete this.partials[name]; | ||
| 343 | }, | ||
| 344 | |||
| 345 | registerDecorator: function registerDecorator(name, fn) { | ||
| 346 | if (_utils.toString.call(name) === objectType) { | ||
| 347 | if (fn) { | ||
| 348 | throw new _exception2['default']('Arg not supported with multiple decorators'); | ||
| 349 | } | ||
| 350 | _utils.extend(this.decorators, name); | ||
| 351 | } else { | ||
| 352 | this.decorators[name] = fn; | ||
| 353 | } | ||
| 354 | }, | ||
| 355 | unregisterDecorator: function unregisterDecorator(name) { | ||
| 356 | delete this.decorators[name]; | ||
| 357 | }, | ||
| 358 | /** | ||
| 359 | * Reset the memory of illegal property accesses that have already been logged. | ||
| 360 | * @deprecated should only be used in handlebars test-cases | ||
| 361 | */ | ||
| 362 | resetLoggedPropertyAccesses: function resetLoggedPropertyAccesses() { | ||
| 363 | _internalProtoAccess.resetLoggedProperties(); | ||
| 364 | } | ||
| 365 | }; | ||
| 366 | |||
| 367 | var log = _logger2['default'].log; | ||
| 368 | |||
| 369 | exports.log = log; | ||
| 370 | exports.createFrame = _utils.createFrame; | ||
| 371 | exports.logger = _logger2['default']; | ||
| 372 | |||
| 373 | /***/ }), | ||
| 374 | /* 5 */ | ||
| 375 | /***/ (function(module, exports) { | ||
| 376 | |||
| 377 | 'use strict'; | ||
| 378 | |||
| 379 | exports.__esModule = true; | ||
| 380 | exports.extend = extend; | ||
| 381 | exports.indexOf = indexOf; | ||
| 382 | exports.escapeExpression = escapeExpression; | ||
| 383 | exports.isEmpty = isEmpty; | ||
| 384 | exports.createFrame = createFrame; | ||
| 385 | exports.blockParams = blockParams; | ||
| 386 | exports.appendContextPath = appendContextPath; | ||
| 387 | var escape = { | ||
| 388 | '&': '&', | ||
| 389 | '<': '<', | ||
| 390 | '>': '>', | ||
| 391 | '"': '"', | ||
| 392 | "'": ''', | ||
| 393 | '`': '`', | ||
| 394 | '=': '=' | ||
| 395 | }; | ||
| 396 | |||
| 397 | var badChars = /[&<>"'`=]/g, | ||
| 398 | possible = /[&<>"'`=]/; | ||
| 399 | |||
| 400 | function escapeChar(chr) { | ||
| 401 | return escape[chr]; | ||
| 402 | } | ||
| 403 | |||
| 404 | function extend(obj /* , ...source */) { | ||
| 405 | for (var i = 1; i < arguments.length; i++) { | ||
| 406 | for (var key in arguments[i]) { | ||
| 407 | if (Object.prototype.hasOwnProperty.call(arguments[i], key)) { | ||
| 408 | obj[key] = arguments[i][key]; | ||
| 409 | } | ||
| 410 | } | ||
| 411 | } | ||
| 412 | |||
| 413 | return obj; | ||
| 414 | } | ||
| 415 | |||
| 416 | var toString = Object.prototype.toString; | ||
| 417 | |||
| 418 | exports.toString = toString; | ||
| 419 | // Sourced from lodash | ||
| 420 | // https://github.com/bestiejs/lodash/blob/master/LICENSE.txt | ||
| 421 | /* eslint-disable func-style */ | ||
| 422 | var isFunction = function isFunction(value) { | ||
| 423 | return typeof value === 'function'; | ||
| 424 | }; | ||
| 425 | // fallback for older versions of Chrome and Safari | ||
| 426 | /* istanbul ignore next */ | ||
| 427 | if (isFunction(/x/)) { | ||
| 428 | exports.isFunction = isFunction = function (value) { | ||
| 429 | return typeof value === 'function' && toString.call(value) === '[object Function]'; | ||
| 430 | }; | ||
| 431 | } | ||
| 432 | exports.isFunction = isFunction; | ||
| 433 | |||
| 434 | /* eslint-enable func-style */ | ||
| 435 | |||
| 436 | /* istanbul ignore next */ | ||
| 437 | var isArray = Array.isArray || function (value) { | ||
| 438 | return value && typeof value === 'object' ? toString.call(value) === '[object Array]' : false; | ||
| 439 | }; | ||
| 440 | |||
| 441 | exports.isArray = isArray; | ||
| 442 | // Older IE versions do not directly support indexOf so we must implement our own, sadly. | ||
| 443 | |||
| 444 | function indexOf(array, value) { | ||
| 445 | for (var i = 0, len = array.length; i < len; i++) { | ||
| 446 | if (array[i] === value) { | ||
| 447 | return i; | ||
| 448 | } | ||
| 449 | } | ||
| 450 | return -1; | ||
| 451 | } | ||
| 452 | |||
| 453 | function escapeExpression(string) { | ||
| 454 | if (typeof string !== 'string') { | ||
| 455 | // don't escape SafeStrings, since they're already safe | ||
| 456 | if (string && string.toHTML) { | ||
| 457 | return string.toHTML(); | ||
| 458 | } else if (string == null) { | ||
| 459 | return ''; | ||
| 460 | } else if (!string) { | ||
| 461 | return string + ''; | ||
| 462 | } | ||
| 463 | |||
| 464 | // Force a string conversion as this will be done by the append regardless and | ||
| 465 | // the regex test will do this transparently behind the scenes, causing issues if | ||
| 466 | // an object's to string has escaped characters in it. | ||
| 467 | string = '' + string; | ||
| 468 | } | ||
| 469 | |||
| 470 | if (!possible.test(string)) { | ||
| 471 | return string; | ||
| 472 | } | ||
| 473 | return string.replace(badChars, escapeChar); | ||
| 474 | } | ||
| 475 | |||
| 476 | function isEmpty(value) { | ||
| 477 | if (!value && value !== 0) { | ||
| 478 | return true; | ||
| 479 | } else if (isArray(value) && value.length === 0) { | ||
| 480 | return true; | ||
| 481 | } else { | ||
| 482 | return false; | ||
| 483 | } | ||
| 484 | } | ||
| 485 | |||
| 486 | function createFrame(object) { | ||
| 487 | var frame = extend({}, object); | ||
| 488 | frame._parent = object; | ||
| 489 | return frame; | ||
| 490 | } | ||
| 491 | |||
| 492 | function blockParams(params, ids) { | ||
| 493 | params.path = ids; | ||
| 494 | return params; | ||
| 495 | } | ||
| 496 | |||
| 497 | function appendContextPath(contextPath, id) { | ||
| 498 | return (contextPath ? contextPath + '.' : '') + id; | ||
| 499 | } | ||
| 500 | |||
| 501 | /***/ }), | ||
| 502 | /* 6 */ | ||
| 503 | /***/ (function(module, exports, __webpack_require__) { | ||
| 504 | |||
| 505 | 'use strict'; | ||
| 506 | |||
| 507 | var _Object$defineProperty = __webpack_require__(7)['default']; | ||
| 508 | |||
| 509 | exports.__esModule = true; | ||
| 510 | var errorProps = ['description', 'fileName', 'lineNumber', 'endLineNumber', 'message', 'name', 'number', 'stack']; | ||
| 511 | |||
| 512 | function Exception(message, node) { | ||
| 513 | var loc = node && node.loc, | ||
| 514 | line = undefined, | ||
| 515 | endLineNumber = undefined, | ||
| 516 | column = undefined, | ||
| 517 | endColumn = undefined; | ||
| 518 | |||
| 519 | if (loc) { | ||
| 520 | line = loc.start.line; | ||
| 521 | endLineNumber = loc.end.line; | ||
| 522 | column = loc.start.column; | ||
| 523 | endColumn = loc.end.column; | ||
| 524 | |||
| 525 | message += ' - ' + line + ':' + column; | ||
| 526 | } | ||
| 527 | |||
| 528 | var tmp = Error.prototype.constructor.call(this, message); | ||
| 529 | |||
| 530 | // Unfortunately errors are not enumerable in Chrome (at least), so `for prop in tmp` doesn't work. | ||
| 531 | for (var idx = 0; idx < errorProps.length; idx++) { | ||
| 532 | this[errorProps[idx]] = tmp[errorProps[idx]]; | ||
| 533 | } | ||
| 534 | |||
| 535 | /* istanbul ignore else */ | ||
| 536 | if (Error.captureStackTrace) { | ||
| 537 | Error.captureStackTrace(this, Exception); | ||
| 538 | } | ||
| 539 | |||
| 540 | try { | ||
| 541 | if (loc) { | ||
| 542 | this.lineNumber = line; | ||
| 543 | this.endLineNumber = endLineNumber; | ||
| 544 | |||
| 545 | // Work around issue under safari where we can't directly set the column value | ||
| 546 | /* istanbul ignore next */ | ||
| 547 | if (_Object$defineProperty) { | ||
| 548 | Object.defineProperty(this, 'column', { | ||
| 549 | value: column, | ||
| 550 | enumerable: true | ||
| 551 | }); | ||
| 552 | Object.defineProperty(this, 'endColumn', { | ||
| 553 | value: endColumn, | ||
| 554 | enumerable: true | ||
| 555 | }); | ||
| 556 | } else { | ||
| 557 | this.column = column; | ||
| 558 | this.endColumn = endColumn; | ||
| 559 | } | ||
| 560 | } | ||
| 561 | } catch (nop) { | ||
| 562 | /* Ignore if the browser is very particular */ | ||
| 563 | } | ||
| 564 | } | ||
| 565 | |||
| 566 | Exception.prototype = new Error(); | ||
| 567 | |||
| 568 | exports['default'] = Exception; | ||
| 569 | module.exports = exports['default']; | ||
| 570 | |||
| 571 | /***/ }), | ||
| 572 | /* 7 */ | ||
| 573 | /***/ (function(module, exports, __webpack_require__) { | ||
| 574 | |||
| 575 | module.exports = { "default": __webpack_require__(8), __esModule: true }; | ||
| 576 | |||
| 577 | /***/ }), | ||
| 578 | /* 8 */ | ||
| 579 | /***/ (function(module, exports, __webpack_require__) { | ||
| 580 | |||
| 581 | var $ = __webpack_require__(9); | ||
| 582 | module.exports = function defineProperty(it, key, desc){ | ||
| 583 | return $.setDesc(it, key, desc); | ||
| 584 | }; | ||
| 585 | |||
| 586 | /***/ }), | ||
| 587 | /* 9 */ | ||
| 588 | /***/ (function(module, exports) { | ||
| 589 | |||
| 590 | var $Object = Object; | ||
| 591 | module.exports = { | ||
| 592 | create: $Object.create, | ||
| 593 | getProto: $Object.getPrototypeOf, | ||
| 594 | isEnum: {}.propertyIsEnumerable, | ||
| 595 | getDesc: $Object.getOwnPropertyDescriptor, | ||
| 596 | setDesc: $Object.defineProperty, | ||
| 597 | setDescs: $Object.defineProperties, | ||
| 598 | getKeys: $Object.keys, | ||
| 599 | getNames: $Object.getOwnPropertyNames, | ||
| 600 | getSymbols: $Object.getOwnPropertySymbols, | ||
| 601 | each: [].forEach | ||
| 602 | }; | ||
| 603 | |||
| 604 | /***/ }), | ||
| 605 | /* 10 */ | ||
| 606 | /***/ (function(module, exports, __webpack_require__) { | ||
| 607 | |||
| 608 | 'use strict'; | ||
| 609 | |||
| 610 | var _interopRequireDefault = __webpack_require__(1)['default']; | ||
| 611 | |||
| 612 | exports.__esModule = true; | ||
| 613 | exports.registerDefaultHelpers = registerDefaultHelpers; | ||
| 614 | exports.moveHelperToHooks = moveHelperToHooks; | ||
| 615 | |||
| 616 | var _helpersBlockHelperMissing = __webpack_require__(11); | ||
| 617 | |||
| 618 | var _helpersBlockHelperMissing2 = _interopRequireDefault(_helpersBlockHelperMissing); | ||
| 619 | |||
| 620 | var _helpersEach = __webpack_require__(12); | ||
| 621 | |||
| 622 | var _helpersEach2 = _interopRequireDefault(_helpersEach); | ||
| 623 | |||
| 624 | var _helpersHelperMissing = __webpack_require__(65); | ||
| 625 | |||
| 626 | var _helpersHelperMissing2 = _interopRequireDefault(_helpersHelperMissing); | ||
| 627 | |||
| 628 | var _helpersIf = __webpack_require__(66); | ||
| 629 | |||
| 630 | var _helpersIf2 = _interopRequireDefault(_helpersIf); | ||
| 631 | |||
| 632 | var _helpersLog = __webpack_require__(67); | ||
| 633 | |||
| 634 | var _helpersLog2 = _interopRequireDefault(_helpersLog); | ||
| 635 | |||
| 636 | var _helpersLookup = __webpack_require__(68); | ||
| 637 | |||
| 638 | var _helpersLookup2 = _interopRequireDefault(_helpersLookup); | ||
| 639 | |||
| 640 | var _helpersWith = __webpack_require__(69); | ||
| 641 | |||
| 642 | var _helpersWith2 = _interopRequireDefault(_helpersWith); | ||
| 643 | |||
| 644 | function registerDefaultHelpers(instance) { | ||
| 645 | _helpersBlockHelperMissing2['default'](instance); | ||
| 646 | _helpersEach2['default'](instance); | ||
| 647 | _helpersHelperMissing2['default'](instance); | ||
| 648 | _helpersIf2['default'](instance); | ||
| 649 | _helpersLog2['default'](instance); | ||
| 650 | _helpersLookup2['default'](instance); | ||
| 651 | _helpersWith2['default'](instance); | ||
| 652 | } | ||
| 653 | |||
| 654 | function moveHelperToHooks(instance, helperName, keepHelper) { | ||
| 655 | if (instance.helpers[helperName]) { | ||
| 656 | instance.hooks[helperName] = instance.helpers[helperName]; | ||
| 657 | if (!keepHelper) { | ||
| 658 | delete instance.helpers[helperName]; | ||
| 659 | } | ||
| 660 | } | ||
| 661 | } | ||
| 662 | |||
| 663 | /***/ }), | ||
| 664 | /* 11 */ | ||
| 665 | /***/ (function(module, exports, __webpack_require__) { | ||
| 666 | |||
| 667 | 'use strict'; | ||
| 668 | |||
| 669 | exports.__esModule = true; | ||
| 670 | |||
| 671 | var _utils = __webpack_require__(5); | ||
| 672 | |||
| 673 | exports['default'] = function (instance) { | ||
| 674 | instance.registerHelper('blockHelperMissing', function (context, options) { | ||
| 675 | var inverse = options.inverse, | ||
| 676 | fn = options.fn; | ||
| 677 | |||
| 678 | if (context === true) { | ||
| 679 | return fn(this); | ||
| 680 | } else if (context === false || context == null) { | ||
| 681 | return inverse(this); | ||
| 682 | } else if (_utils.isArray(context)) { | ||
| 683 | if (context.length > 0) { | ||
| 684 | if (options.ids) { | ||
| 685 | options.ids = [options.name]; | ||
| 686 | } | ||
| 687 | |||
| 688 | return instance.helpers.each(context, options); | ||
| 689 | } else { | ||
| 690 | return inverse(this); | ||
| 691 | } | ||
| 692 | } else { | ||
| 693 | if (options.data && options.ids) { | ||
| 694 | var data = _utils.createFrame(options.data); | ||
| 695 | data.contextPath = _utils.appendContextPath(options.data.contextPath, options.name); | ||
| 696 | options = { data: data }; | ||
| 697 | } | ||
| 698 | |||
| 699 | return fn(context, options); | ||
| 700 | } | ||
| 701 | }); | ||
| 702 | }; | ||
| 703 | |||
| 704 | module.exports = exports['default']; | ||
| 705 | |||
| 706 | /***/ }), | ||
| 707 | /* 12 */ | ||
| 708 | /***/ (function(module, exports, __webpack_require__) { | ||
| 709 | |||
| 710 | 'use strict'; | ||
| 711 | |||
| 712 | var _Symbol = __webpack_require__(13)['default']; | ||
| 713 | |||
| 714 | var _Symbol$iterator = __webpack_require__(43)['default']; | ||
| 715 | |||
| 716 | var _getIterator = __webpack_require__(55)['default']; | ||
| 717 | |||
| 718 | var _Object$keys = __webpack_require__(60)['default']; | ||
| 719 | |||
| 720 | var _interopRequireDefault = __webpack_require__(1)['default']; | ||
| 721 | |||
| 722 | exports.__esModule = true; | ||
| 723 | |||
| 724 | var _utils = __webpack_require__(5); | ||
| 725 | |||
| 726 | var _exception = __webpack_require__(6); | ||
| 727 | |||
| 728 | var _exception2 = _interopRequireDefault(_exception); | ||
| 729 | |||
| 730 | exports['default'] = function (instance) { | ||
| 731 | instance.registerHelper('each', function (context, options) { | ||
| 732 | if (!options) { | ||
| 733 | throw new _exception2['default']('Must pass iterator to #each'); | ||
| 734 | } | ||
| 735 | |||
| 736 | var fn = options.fn, | ||
| 737 | inverse = options.inverse, | ||
| 738 | i = 0, | ||
| 739 | ret = '', | ||
| 740 | data = undefined, | ||
| 741 | contextPath = undefined; | ||
| 742 | |||
| 743 | if (options.data && options.ids) { | ||
| 744 | contextPath = _utils.appendContextPath(options.data.contextPath, options.ids[0]) + '.'; | ||
| 745 | } | ||
| 746 | |||
| 747 | if (_utils.isFunction(context)) { | ||
| 748 | context = context.call(this); | ||
| 749 | } | ||
| 750 | |||
| 751 | if (options.data) { | ||
| 752 | data = _utils.createFrame(options.data); | ||
| 753 | } | ||
| 754 | |||
| 755 | function execIteration(field, index, last) { | ||
| 756 | if (data) { | ||
| 757 | data.key = field; | ||
Diff truncated