From a5979797ff11463e960fd07dc99067a551188815 Mon Sep 17 00:00:00 2001 From: TheodoreChu <22967798+TheodoreChu@users.noreply.github.com> Date: Fri, 4 Dec 2020 01:06:46 -0800 Subject: [PATCH] Intial commit --- .gitignore | 25 + .prettierrc | 3 + LICENSE | 3 + README.md | 108 +- build/CNAME | 1 + build/LICENSE.txt | 664 + build/README.txt | 107 + build/asset-manifest.json | 25 + build/demo.ext.json | 13 + build/icon-16x16.png | Bin 0 -> 303 bytes build/icon-32x32.png | Bin 0 -> 431 bytes build/icon-64x64.png | Bin 0 -> 732 bytes build/icon.png | Bin 0 -> 357 bytes build/icon192.png | Bin 0 -> 1906 bytes build/icon512.png | Bin 0 -> 5483 bytes build/index.html | 1 + build/manifest.json | 40 + build/package.json | 24 + build/robots.txt | 3 + build/sample.ext.json | 13 + build/static/css/2.ee6590b6.chunk.css | 2 + build/static/css/2.ee6590b6.chunk.css.map | 1 + build/static/css/main.8cc0684d.chunk.css | 2 + build/static/css/main.8cc0684d.chunk.css.map | 1 + build/static/js/2.c20f73b8.chunk.js | 3 + .../static/js/2.c20f73b8.chunk.js.LICENSE.txt | 56 + build/static/js/2.c20f73b8.chunk.js.map | 1 + build/static/js/3.343c64f0.chunk.js | 2 + build/static/js/3.343c64f0.chunk.js.map | 1 + build/static/js/main.7e51c466.chunk.js | 2 + build/static/js/main.7e51c466.chunk.js.map | 1 + build/static/js/runtime-main.63a93a4c.js | 2 + build/static/js/runtime-main.63a93a4c.js.map | 1 + package.json | 82 + public/CNAME | 1 + public/LICENSE.txt | 664 + public/README.txt | 107 + public/demo.ext.json | 13 + public/icon-16x16.png | Bin 0 -> 303 bytes public/icon-32x32.png | Bin 0 -> 431 bytes public/icon-64x64.png | Bin 0 -> 732 bytes public/icon.png | Bin 0 -> 357 bytes public/icon192.png | Bin 0 -> 1906 bytes public/icon512.png | Bin 0 -> 5483 bytes public/index.html | 45 + public/manifest.json | 40 + public/package.json | 24 + public/robots.txt | 3 + public/sample.ext.json | 13 + src/App.scss | 38 + src/App.test.tsx | 9 + src/App.tsx | 26 + src/components/MusicEditor.tsx | 372 + src/index.css | 13 + src/index.tsx | 19 + src/logo.svg | 1 + src/react-app-env.d.ts | 1 + src/reportWebVitals.ts | 15 + src/setupTests.ts | 5 + src/stylesheets/main.scss | 171 + src/stylesheets/print.scss | 10 + tsconfig.json | 22 + types/sn-editor-kit/index.d.ts | 1 + types/vextab/index.d.ts | 1 + yarn.lock | 12034 ++++++++++++++++ 65 files changed, 14834 insertions(+), 1 deletion(-) create mode 100644 .prettierrc create mode 100644 build/CNAME create mode 100644 build/LICENSE.txt create mode 100644 build/README.txt create mode 100644 build/asset-manifest.json create mode 100644 build/demo.ext.json create mode 100644 build/icon-16x16.png create mode 100644 build/icon-32x32.png create mode 100644 build/icon-64x64.png create mode 100644 build/icon.png create mode 100644 build/icon192.png create mode 100644 build/icon512.png create mode 100644 build/index.html create mode 100644 build/manifest.json create mode 100644 build/package.json create mode 100644 build/robots.txt create mode 100644 build/sample.ext.json create mode 100644 build/static/css/2.ee6590b6.chunk.css create mode 100644 build/static/css/2.ee6590b6.chunk.css.map create mode 100644 build/static/css/main.8cc0684d.chunk.css create mode 100644 build/static/css/main.8cc0684d.chunk.css.map create mode 100644 build/static/js/2.c20f73b8.chunk.js create mode 100644 build/static/js/2.c20f73b8.chunk.js.LICENSE.txt create mode 100644 build/static/js/2.c20f73b8.chunk.js.map create mode 100644 build/static/js/3.343c64f0.chunk.js create mode 100644 build/static/js/3.343c64f0.chunk.js.map create mode 100644 build/static/js/main.7e51c466.chunk.js create mode 100644 build/static/js/main.7e51c466.chunk.js.map create mode 100644 build/static/js/runtime-main.63a93a4c.js create mode 100644 build/static/js/runtime-main.63a93a4c.js.map create mode 100644 package.json create mode 100644 public/CNAME create mode 100644 public/LICENSE.txt create mode 100644 public/README.txt create mode 100644 public/demo.ext.json create mode 100644 public/icon-16x16.png create mode 100644 public/icon-32x32.png create mode 100644 public/icon-64x64.png create mode 100644 public/icon.png create mode 100644 public/icon192.png create mode 100644 public/icon512.png create mode 100644 public/index.html create mode 100644 public/manifest.json create mode 100644 public/package.json create mode 100644 public/robots.txt create mode 100644 public/sample.ext.json create mode 100644 src/App.scss create mode 100644 src/App.test.tsx create mode 100644 src/App.tsx create mode 100644 src/components/MusicEditor.tsx create mode 100644 src/index.css create mode 100644 src/index.tsx create mode 100644 src/logo.svg create mode 100644 src/react-app-env.d.ts create mode 100644 src/reportWebVitals.ts create mode 100644 src/setupTests.ts create mode 100644 src/stylesheets/main.scss create mode 100644 src/stylesheets/print.scss create mode 100644 tsconfig.json create mode 100644 types/sn-editor-kit/index.d.ts create mode 100644 types/vextab/index.d.ts create mode 100644 yarn.lock diff --git a/.gitignore b/.gitignore index 6704566..e9c77b5 100644 --- a/.gitignore +++ b/.gitignore @@ -102,3 +102,28 @@ dist # TernJS port file .tern-port + +# Copied from Create React App +# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. + +# dependencies +/node_modules +/.pnp +.pnp.js + +# testing +/coverage + +# production +#/build + +# misc +.DS_Store +.env.local +.env.development.local +.env.test.local +.env.production.local + +npm-debug.log* +yarn-debug.log* +yarn-error.log* diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..544138b --- /dev/null +++ b/.prettierrc @@ -0,0 +1,3 @@ +{ + "singleQuote": true +} diff --git a/LICENSE b/LICENSE index 0ad25db..34e2bcf 100644 --- a/LICENSE +++ b/LICENSE @@ -1,3 +1,6 @@ +Music Editor +Copyright (C) 2020, Theodore Chu. All Rights Reserved. + GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007 diff --git a/README.md b/README.md index 91223eb..6f23902 100644 --- a/README.md +++ b/README.md @@ -1 +1,107 @@ -# music-editor \ No newline at end of file +# Music Editor + +
+ +[![Release](https://img.shields.io/github/release/theodorechu/music-editor.svg)](https://github.com/theodorechu/music-editor/releases) +[![License](https://img.shields.io/github/license/theodorechu/music-editor?color=blue)](https://github.com/theodorechu/music-editor/blob/main/LICENSE) +[![Status](https://img.shields.io/badge/status-open%20beta-orange.svg)](https://musiceditor.net/#installation) +[![Cost](https://img.shields.io/badge/cost-free-darkgreen.svg)](https://musiceditor.net/#installation) +[![GitHub issues](https://img.shields.io/github/issues/theodorechu/music-editor.svg)](https://github.com/theodorechu/music-editor/issues/) +[![Slack](https://img.shields.io/badge/slack-standardnotes-CC2B5E.svg?style=flat&logo=slack)](https://standardnotes.org/slack) +[![Downloads](https://img.shields.io/github/downloads/theodorechu/music-editor/total.svg?style=flat)](https://github.com/theodorechu/music-editor/releases) +[![GitHub Stars](https://img.shields.io/github/stars/theodorechu/music-editor?style=social)](https://github.com/theodorechu/music-editor) + +
+ +## Introduction + +The Music Editor is an **unofficial** [editor](https://standardnotes.org/help/77/what-are-editors) for [Standard Notes](https://standardnotes.org), a free, [open-source](https://standardnotes.org/knowledge/5/what-is-free-and-open-source-software), and [end-to-end encrypted](https://standardnotes.org/knowledge/2/what-is-end-to-end-encryption) notes app. + +You can find the demo at [demo.musiceditor.net](https://demo.musiceditor.net). + +The Music Editor is powered by [VexTab](https://github.com/0xfe/vextab) and [VexFlow](https://github.com/0xfe/vexflow). A tutorial on how to use VexTab is available [here](https://vexflow.com/vextab/tutorial.html). + +## Installation + +1. Register for an account at Standard Notes using the [Desktop App](https://standardnotes.org/download) or [Web app](https://app.standardnotes.org). Remember to use a strong and memorable password. +2. In the bottom left corner of the app, click **Extensions**. +3. Click **Import Extension**. +4. Paste this into the input box: + ``` + https://notes.theochu.com/p/Sfq1jJV0X2 + ``` + or paste this into the input box on **desktop**: + ``` + https://raw.githubusercontent.com/TheodoreChu/music-editor/main/public/demo.ext.json + ``` +5. Press Enter or Return on your keyboard. +6. Click **Install**. +7. At the top of your note, click **Editor**, then click **Music Editor**. +8. When prompted to activate the extension, click **Continue**. + +After you have installed the editor on the web or desktop app, it will automatically sync to your [mobile app](https://standardnotes.org/download) after you sign in. + +## Development + +This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). + +### Available Scripts + +In the project directory, you can run: + +#### `yarn start` + +Runs the app in the development mode.
+Open [http://localhost:3000](http://localhost:3000) to view it in the browser. + +The page will reload if you make edits.
+You will also see any lint errors in the console. + +#### `yarn test` + +Launches the test runner in the interactive watch mode.
+See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. + +#### `yarn build` + +Builds the app for production to the `build` folder.
+It correctly bundles React in production mode and optimizes the build for the best performance. + +The build is minified and the filenames include the hashes.
+Your app is ready to be deployed! + +See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. + +#### `yarn eject` + +**Note: this is a one-way operation. Once you `eject`, you can't go back!** + +If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. + +Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own. + +You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it. + +#### Learn More + +You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). + +To learn React, check out the [React documentation](https://reactjs.org/). + +## License + +Copyright (c) Theodore Chu. All Rights Reserved. Licensed under [AGPL-3.0](https://github.com/TheodoreChu/music-editor/blob/main/LICENSE) or later. + +## Acknowledgements + +Early stages of this editor were based heavily on the Standard Notes [Markdown Basic Editor](https://github.com/standardnotes/markdown-basic). The Markdown Basic Editor is licensed under AGPL-3.0 and is available for use through [Standard Notes Extended](https://standardnotes.org/extensions). + +## Further Resources + +- [GitHub](https://github.com/TheodoreChu/music-editor) for the source code of the Music Editor +- [GitHub Issues](https://github.com/TheodoreChu/music-editor/issues) for reporting issues concerning the Music Editor +- [Docs](https://docs.theochu.com/music-editor) for how to use the Music Editor +- [Contact](https://theochu.com/contact) for how to contact the developer of the Music Editor +- [Music Editor To do List](https://github.com/TheodoreChu/music-editor/projects/1) for the roadmap of the Music Editor +- [Standard Notes Slack](https://standardnotes.org/slack) for connecting with the Standard Notes Community +- [Standard Notes Help](https://standardnotes.org/help) for help with issues related to Standard Notes but unrelated to this editor diff --git a/build/CNAME b/build/CNAME new file mode 100644 index 0000000..299928b --- /dev/null +++ b/build/CNAME @@ -0,0 +1 @@ +demo.musiceditor.net \ No newline at end of file diff --git a/build/LICENSE.txt b/build/LICENSE.txt new file mode 100644 index 0000000..34e2bcf --- /dev/null +++ b/build/LICENSE.txt @@ -0,0 +1,664 @@ +Music Editor +Copyright (C) 2020, Theodore Chu. All Rights Reserved. + + GNU AFFERO GENERAL PUBLIC LICENSE + Version 3, 19 November 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU Affero General Public License is a free, copyleft license for +software and other kinds of works, specifically designed to ensure +cooperation with the community in the case of network server software. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +our General Public Licenses are intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + Developers that use our General Public Licenses protect your rights +with two steps: (1) assert copyright on the software, and (2) offer +you this License which gives you legal permission to copy, distribute +and/or modify the software. + + A secondary benefit of defending all users' freedom is that +improvements made in alternate versions of the program, if they +receive widespread use, become available for other developers to +incorporate. Many developers of free software are heartened and +encouraged by the resulting cooperation. However, in the case of +software used on network servers, this result may fail to come about. +The GNU General Public License permits making a modified version and +letting the public access it on a server without ever releasing its +source code to the public. + + The GNU Affero General Public License is designed specifically to +ensure that, in such cases, the modified source code becomes available +to the community. It requires the operator of a network server to +provide the source code of the modified version running there to the +users of that server. Therefore, public use of a modified version, on +a publicly accessible server, gives the public access to the source +code of the modified version. + + An older license, called the Affero General Public License and +published by Affero, was designed to accomplish similar goals. This is +a different license, not a version of the Affero GPL, but Affero has +released a new version of the Affero GPL which permits relicensing under +this license. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU Affero General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Remote Network Interaction; Use with the GNU General Public License. + + Notwithstanding any other provision of this License, if you modify the +Program, your modified version must prominently offer all users +interacting with it remotely through a computer network (if your version +supports such interaction) an opportunity to receive the Corresponding +Source of your version by providing access to the Corresponding Source +from a network server at no charge, through some standard or customary +means of facilitating copying of software. This Corresponding Source +shall include the Corresponding Source for any work covered by version 3 +of the GNU General Public License that is incorporated pursuant to the +following paragraph. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the work with which it is combined will remain governed by version +3 of the GNU General Public License. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU Affero General Public License from time to time. Such new versions +will be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU Affero General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU Affero General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU Affero General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If your software can interact with users remotely through a computer +network, you should also make sure that it provides a way for users to +get its source. For example, if your program is a web application, its +interface could display a "Source" link that leads users to an archive +of the code. There are many ways you could offer source, and different +solutions will be better for different programs; see section 13 for the +specific requirements. + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU AGPL, see +. diff --git a/build/README.txt b/build/README.txt new file mode 100644 index 0000000..6f23902 --- /dev/null +++ b/build/README.txt @@ -0,0 +1,107 @@ +# Music Editor + +
+ +[![Release](https://img.shields.io/github/release/theodorechu/music-editor.svg)](https://github.com/theodorechu/music-editor/releases) +[![License](https://img.shields.io/github/license/theodorechu/music-editor?color=blue)](https://github.com/theodorechu/music-editor/blob/main/LICENSE) +[![Status](https://img.shields.io/badge/status-open%20beta-orange.svg)](https://musiceditor.net/#installation) +[![Cost](https://img.shields.io/badge/cost-free-darkgreen.svg)](https://musiceditor.net/#installation) +[![GitHub issues](https://img.shields.io/github/issues/theodorechu/music-editor.svg)](https://github.com/theodorechu/music-editor/issues/) +[![Slack](https://img.shields.io/badge/slack-standardnotes-CC2B5E.svg?style=flat&logo=slack)](https://standardnotes.org/slack) +[![Downloads](https://img.shields.io/github/downloads/theodorechu/music-editor/total.svg?style=flat)](https://github.com/theodorechu/music-editor/releases) +[![GitHub Stars](https://img.shields.io/github/stars/theodorechu/music-editor?style=social)](https://github.com/theodorechu/music-editor) + +
+ +## Introduction + +The Music Editor is an **unofficial** [editor](https://standardnotes.org/help/77/what-are-editors) for [Standard Notes](https://standardnotes.org), a free, [open-source](https://standardnotes.org/knowledge/5/what-is-free-and-open-source-software), and [end-to-end encrypted](https://standardnotes.org/knowledge/2/what-is-end-to-end-encryption) notes app. + +You can find the demo at [demo.musiceditor.net](https://demo.musiceditor.net). + +The Music Editor is powered by [VexTab](https://github.com/0xfe/vextab) and [VexFlow](https://github.com/0xfe/vexflow). A tutorial on how to use VexTab is available [here](https://vexflow.com/vextab/tutorial.html). + +## Installation + +1. Register for an account at Standard Notes using the [Desktop App](https://standardnotes.org/download) or [Web app](https://app.standardnotes.org). Remember to use a strong and memorable password. +2. In the bottom left corner of the app, click **Extensions**. +3. Click **Import Extension**. +4. Paste this into the input box: + ``` + https://notes.theochu.com/p/Sfq1jJV0X2 + ``` + or paste this into the input box on **desktop**: + ``` + https://raw.githubusercontent.com/TheodoreChu/music-editor/main/public/demo.ext.json + ``` +5. Press Enter or Return on your keyboard. +6. Click **Install**. +7. At the top of your note, click **Editor**, then click **Music Editor**. +8. When prompted to activate the extension, click **Continue**. + +After you have installed the editor on the web or desktop app, it will automatically sync to your [mobile app](https://standardnotes.org/download) after you sign in. + +## Development + +This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). + +### Available Scripts + +In the project directory, you can run: + +#### `yarn start` + +Runs the app in the development mode.
+Open [http://localhost:3000](http://localhost:3000) to view it in the browser. + +The page will reload if you make edits.
+You will also see any lint errors in the console. + +#### `yarn test` + +Launches the test runner in the interactive watch mode.
+See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. + +#### `yarn build` + +Builds the app for production to the `build` folder.
+It correctly bundles React in production mode and optimizes the build for the best performance. + +The build is minified and the filenames include the hashes.
+Your app is ready to be deployed! + +See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. + +#### `yarn eject` + +**Note: this is a one-way operation. Once you `eject`, you can't go back!** + +If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. + +Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own. + +You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it. + +#### Learn More + +You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). + +To learn React, check out the [React documentation](https://reactjs.org/). + +## License + +Copyright (c) Theodore Chu. All Rights Reserved. Licensed under [AGPL-3.0](https://github.com/TheodoreChu/music-editor/blob/main/LICENSE) or later. + +## Acknowledgements + +Early stages of this editor were based heavily on the Standard Notes [Markdown Basic Editor](https://github.com/standardnotes/markdown-basic). The Markdown Basic Editor is licensed under AGPL-3.0 and is available for use through [Standard Notes Extended](https://standardnotes.org/extensions). + +## Further Resources + +- [GitHub](https://github.com/TheodoreChu/music-editor) for the source code of the Music Editor +- [GitHub Issues](https://github.com/TheodoreChu/music-editor/issues) for reporting issues concerning the Music Editor +- [Docs](https://docs.theochu.com/music-editor) for how to use the Music Editor +- [Contact](https://theochu.com/contact) for how to contact the developer of the Music Editor +- [Music Editor To do List](https://github.com/TheodoreChu/music-editor/projects/1) for the roadmap of the Music Editor +- [Standard Notes Slack](https://standardnotes.org/slack) for connecting with the Standard Notes Community +- [Standard Notes Help](https://standardnotes.org/help) for help with issues related to Standard Notes but unrelated to this editor diff --git a/build/asset-manifest.json b/build/asset-manifest.json new file mode 100644 index 0000000..657d0ba --- /dev/null +++ b/build/asset-manifest.json @@ -0,0 +1,25 @@ +{ + "files": { + "main.css": "./static/css/main.8cc0684d.chunk.css", + "main.js": "./static/js/main.7e51c466.chunk.js", + "main.js.map": "./static/js/main.7e51c466.chunk.js.map", + "runtime-main.js": "./static/js/runtime-main.63a93a4c.js", + "runtime-main.js.map": "./static/js/runtime-main.63a93a4c.js.map", + "static/css/2.ee6590b6.chunk.css": "./static/css/2.ee6590b6.chunk.css", + "static/js/2.c20f73b8.chunk.js": "./static/js/2.c20f73b8.chunk.js", + "static/js/2.c20f73b8.chunk.js.map": "./static/js/2.c20f73b8.chunk.js.map", + "static/js/3.343c64f0.chunk.js": "./static/js/3.343c64f0.chunk.js", + "static/js/3.343c64f0.chunk.js.map": "./static/js/3.343c64f0.chunk.js.map", + "index.html": "./index.html", + "static/css/2.ee6590b6.chunk.css.map": "./static/css/2.ee6590b6.chunk.css.map", + "static/css/main.8cc0684d.chunk.css.map": "./static/css/main.8cc0684d.chunk.css.map", + "static/js/2.c20f73b8.chunk.js.LICENSE.txt": "./static/js/2.c20f73b8.chunk.js.LICENSE.txt" + }, + "entrypoints": [ + "static/js/runtime-main.63a93a4c.js", + "static/css/2.ee6590b6.chunk.css", + "static/js/2.c20f73b8.chunk.js", + "static/css/main.8cc0684d.chunk.css", + "static/js/main.7e51c466.chunk.js" + ] +} \ No newline at end of file diff --git a/build/demo.ext.json b/build/demo.ext.json new file mode 100644 index 0000000..2c81055 --- /dev/null +++ b/build/demo.ext.json @@ -0,0 +1,13 @@ +{ + "identifier": "net.musiceditor.demo", + "name": "Music Editor", + "content_type": "SN|Component", + "area": "editor-editor", + "version": "0.1.0", + "description": "Music Editor for Standard Notes. Write music with VexTab and VexFlow", + "url": "https://demo.musiceditor.net", + "download_url": "https://github.com/TheodoreChu/music-editor/releases/download/v0.1.0/music-editor-build-v0.1.0.zip", + "latest_url": "https://raw.githubusercontent.com/TheodoreChu/music-editor/main/public/demo.ext.json", + "marketing_url": "https://musiceditor.net", + "thumbnail_url": "" +} diff --git a/build/icon-16x16.png b/build/icon-16x16.png new file mode 100644 index 0000000000000000000000000000000000000000..5436527d72389a79b850f1aba4fd9d797f0dce91 GIT binary patch literal 303 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`oCO|{#S9GG!XV7ZFl&wkP>``W z$lZxy-8q?;Kn_c~qpu?a!^VE@KZ&eB{t-_X$B+ufwUh1&HW>)CoS)C6(wsXSqFo+Q81g!C!R!k{t}` z1?>I{pERW&3F){P=(MpR=4|C^(+meynKcc5)>ZR2nq_6=t&t6W7IMH}O87zM5ANFH zQhuWieKU4$T-vkbm|eqJ@x1~kJkPf8Qhw4l^XuA~y?h(a=sj!y85}Sb4q9e0BS^W3jhEB literal 0 HcmV?d00001 diff --git a/build/icon-32x32.png b/build/icon-32x32.png new file mode 100644 index 0000000000000000000000000000000000000000..c7aef9e9c80018e1105f3882e35e87d6e03f4b9b GIT binary patch literal 431 zcmV;g0Z{&lP)%MEm$1vT>Cn4$_H`EAjo0b;Fin+x=4aE>Ezi$A5wfNa?um+Y2yiZBc! z6VW{a!u<-wkT=(r&~azn9hf8Sb15{m4owCKSD#8Pv9aS^1F1*^`+~`$3bQN*r1;F! zKYG+jsBXPaWB8e{_Rc){@4ciePw_qCFlxqxP7sGB(pH}g;ePwdT*cp>^ch@&WQ&1J ZoB+K5P^FW&)YSk0002ovPDHLkV1iH@wf6u3 literal 0 HcmV?d00001 diff --git a/build/icon-64x64.png b/build/icon-64x64.png new file mode 100644 index 0000000000000000000000000000000000000000..651424979a54db901ac6c9b0d8b9e832ad81ec84 GIT binary patch literal 732 zcmV<20wev2P)@~0drDELIAGL9O(c600d`2O+f$vv5yPNy^h(5NdWDn4rhTL2ql0{RusxQtewNzhQ0(4I5=FO zr`hd-4*|R+D_?L6Fo)cOli?b?2!w^Iz0%}?)C-{s(&4STZq)sK*B?kp0GeHLP&-?y zdrrhGK!xVnWhEv7$icO`mXHE?CzJp>S!stiU>~^6q0qzkg+;u>5WC1X6 zvH%!3SpW>2EC2>hiv0j;ug!31s0wvozf-&;AWIyMqK=IVIw#n*jB(BykH%730@Q2# z0CR&i6#>ZkIXsYp00lfbPq+v$LO=cf1w3LZKmoZ9cSlAEhR)(=wT;0`fk;k~XuJ7> zUG{a^1r`otcG?BH)B%qO_i2go2M?y4TLQH2E)fm^&s?7w{0(98o@7r6Kzpx1SiHB& zPYF;UJe;RN+oqds0?^tQ2+taPG>X|KfcNa%krF&qZNJqffIu9S;1S^!hAhEXfVdPw zgn<1ku&z>D>EmU{HIrAhJ;9F3_St9f&Hf5Jm^MSGbQiE>0U O0000KU2Qrx_tTKk^24hJ@sE>ksK!fmh0e>L%xWXTfgm*-AO zZF|W*%cZw&ckA-~4d1%2&1=+U`lu^#Mv3c*#Jcpg^*nE%=&J`U+ta;~>C(fFeP6A2 zte<;fl62>m2C0ALmfs44&MO?>;#OE%k#4jr?cBkj17g85xpuTga2d}$7=BJEv1pwv zE6W>|CC106>)k&xY0r@!l_lD3H{%|>uVlVGD{SNCz)35Bp}^qj>gTe~DWM4fmLiR{ literal 0 HcmV?d00001 diff --git a/build/icon192.png b/build/icon192.png new file mode 100644 index 0000000000000000000000000000000000000000..7f05f8ddd78f44c5a492c970c4c563d6205d917d GIT binary patch literal 1906 zcmb_dc{mh$7yiu{j6sczXb>qeQ`c6uvW%sf5Lsqil*#gy!iNwVjV7*3YG|>1%7iR~ zxw0ojbF+0N%e|Il%hp(Cn6ixB<^Fg7|IYKAbDsA-=Q-zj|9bD++YuxYXaoR2((1gW z<8Ei~C0t~;Iu7}Z?l!TY^R6KPh)eG!1U$=-+a)0(js$b?szYIB7r=bXY|Q{DOA_Do z6b3+4)XLI~7y;o8({Byxp?)3HG*)EGqtcbEWt zIbOQ;zJEG zk4nVpj7?Fx;!d!@uNw&_k4fChYn(ouEC*q``5&v68paFoVt4@t4pI*+1QY4g}m1sKSLPV?!A!^2Ev&>$01 z_6z~xtExBVebAMnQ52Kr`^HKp{X;XOK~K)?gI*#WS5xGga9J9nZgH^lQ%^jY#7t|| zUb)|Gd;A57HwP{aS zL6XHVZ#!~%P6tXO{`T};e|CkS4GF!VXDL+|y>z zJJ&THgrPtN$#R0Qy>|8&sgBZ^?-Pr>7D@Zq=29q3|%gpdCqjLn%YK zqM-cXq3cBeV$eyK8)lhBGoMzklI&e$>UD3wU?qdOfAXN(4k z@Ohea*_?ozBK(h3jy{a7c4lWEgx~sYv-qnWGbL?Erwcne)lNzj^8u#OEd;5cU%={E zFk{CM#*TBIc>3JH49v=&Ca;d4faA8Jx*G|PZsz8m{ase=DuphuIUie67UmmEm_pMg z7zBEY6t__P&DMO**1p_gcx;)Tgt^pjF+2GYoi7LHDhVZ{=ORA+**@G%GMDK*v%PGe znVf&GHooM_flJG4+^mF@+KI?OZZ($aUa#;}6WyHtr0a9iqSh9M_rJ}~fY!7gwyNH1 zhP#b#e{bR+PguAOVoxO)TU@v;X3f4NvPcGmMr z52V!aE;6;nyHh$(f?Z`GQxXdEMC+6LkCP&so&S8oyIhfIl^}#BF1*bIlRkag zR@%blg%^>1J>pNB_TiA7ncjx=*Af(Ien&*fE9ULnhTbB|@!h7fN>dij5Rau!f~L|n zQR8a>eMC0=hbJrDOPE&AygkqsM?TezU|%%1TTvppRgk4RLd&3C@R~KktwC(G9Hf*( zjehhzyy#Lgtrd<#23L~m1wxc_h=_;awE3%TBI9*iyzy%4Aby5OLPwsg&8=pnyO}+1 zG7#c(Z#VcOh=a|1y3VDsSz_O`Hq#nK>~~dGSJ8-`>u0_2yC;7&;%-iEw|78FTYe#< z&3Epv+2k3IOV&ay1y6Lbtm2C-QoglslVNY+9r={rZyR6Ky?3|T)A~ev$DAuSWVJP- z2dKoAHjuJ zmo&nP+OjW+TX+9xYdRmk^TPJ_YphGo9sC?>is$|+rsakM^E7YmhG3m!d&2L|{7_rt z5(iT}9u-kTm7}EeJIPNC-sccc$jw!*tmubjQ&=2Pqm8Zob*7`(zwDG2c@2V#3Vq4* z1O>YSbBD|3(NzX7ojaFqZ6 literal 0 HcmV?d00001 diff --git a/build/icon512.png b/build/icon512.png new file mode 100644 index 0000000000000000000000000000000000000000..716028f187a6b1efca09041ab08dc5ef70b326fa GIT binary patch literal 5483 zcmeHLXIN8Nw_Ya+h7t&NKnXGh8-g@JClrkiR&b=F7*Js-f+G}F-fLy;cfD)v+&FGw zE-$Mh3jp$m4(>kzKthiskY0hrM9|wgBxE=T9WDXLtzQ0Okd&f?USgL{nD2w!*Bb}W zfb!$sV|xLf#K|qVNCB*cL;Lqy2VsAA8Q=bq)EofBchnpt1n)?@RA_8Z@uB3N>i%$(Zxa^xyU+8bD3=9Anh9yR7W!CuF-Q zhc=pZiax_q`5Hh}(sglhb0T#yp@U~|3?R+0(mL<2(V;Lk6vrLg^=7-W7n}TaOM0RJ z%#K9rw`2!uqM7H#yGyj^r?c*LjVv!(=d^236&VtqFyO8kNkK;9g+q&fAo<$m&q=)e zX1nB-48X=@w^FH907lQ$V?XRjMf#U=bm?QRLT$sL#4bBC076H9&|n{uNWtJRfb);7 z*@a$j^-3<>L%!yzCruWAi_W#;2WGcAz%!5Q?Z$LPfOlyQapo%l#JyV>jT!)&J-24B zstPVEd=FqBpWG0_s~$@I8Y#T?y6$HD8W}QDHUDBy!+;3VAADj@0^xh3o8|@-z%z78 zGCa{ZEE0tX{XVPRNNHC?h`uENXHA@f44B2)CQ@g0iG&SP^}_?P$PEhtqZ7f$5m_HX z(zC#;rNcm+*j1TIfiw-4{$RykX%w5?H>u{|036ZzV~AmaJbQgWz)1N8Am!?Vp!}UA z;Luo~KB zAWh9}T6mHK&%FK}Y-3IYfVU`{%Df5Sukv9FW0XdMw=Q>sZ)uamUbr+4F@n}%5N|GE zaQsM+!g~-TMCZeCEO9G!dXU;~%vnc*jjhP2kc3_v#eTq=6@eItyw^p(y9%7SNt3vn zG;j>fzu@UIuycbhJO69|-ES|XnHwfgn#8mli_|fkL3@);9aX^a7NeWgd@6>&^JpOl zk&r}V4ocD^ZUJ=8H%RJ!3=y)ch8To9<)5esm1Q91uRX}F=2Z}G4OND9@B1()Mu0Vo zLa6G$h4M!gAt{Z8!02}n07nM{$SA-b6ykrB;y*N4b5q5IR+5XEuTDHfqR#d z`43uACFF6_LWGafHQw%Rm9h;0Dr`JqmY8an-bA(oRWy- zzl@rZdr?)2fU`Ob2LJYH)+>oZS&a9oAiP_f128HNd?%7d==@VjaM}Gfz|g%emN^Cb z?UXy~nnnW*2R&LMVx>VuU;j5;kO7efl5_-Hc?8=B(r{c2jZxYP$6{Wbe%*tz!w3*M ztA1b--%!9PPe?V*%c)e95>Za1Gsl4F(D|KQPl&NWhGV4!|>IAYV;z zIc+NmI`iuL(J@|5+l!tr6xP#4DLg9lqip?Oar1uy*Z(X1&q+8D4WbB_%!H2Cxb%=G zlJV$iu~x5YUe5*gkk6 zM6+|2g?Ww2Lp*WSRL>9M=)W7Q`MVOy6&j?9-=zU2w?_Q!BV_k6$%`hD^-E=wQzOaz zvPAKqG+A_4ZF^Rh@M(7XT(33P(uwz|M4XoxQE_YDNsH*2ZF9_6Ws9m*PW`YcPi*tq zfxEqSWbD&aV}h0B+i_WJ^9Q9(LfstQ#;LsY;)5q6mgZZmN?$LOM@N}AJ4=$aYzMdI~RlIk;1&v4Hrv|g})%hK7(_o#oV<L*ss%%0zoR>0g zIMYPI5Z!;e%~Kbllyo-z6v8%Kc(Y7Ml_os#S0Y995T8H{cbV!#3S-+%5&7fYiIS#oG3amK7K1w%L+vh*LLF*`c(F1tsgxe_A}6jO@6(Uk7mZ3b z9T(4U;4Z3*QX5ICt06uMHAsAu_A5u^9DkE^>rlfIwo| zG~C^LYj@ik1WxriDSPB4hvZ5uh0Zx$yz<+i(5kLH*v{_00ZSZ0&z$r8?XW#&l&U+* zHECY&V9V;^=M+4bN$J@pw4~sbdZRtwYmLeqNelbIC|h@w{fCf#M1Q~HwL&y$@7mqR zma@;Z!O^I%-C!nkrSpJ^{AfIk`eoIdcSnLjkTS6&jvSU`>Softi}JW)_`QQLel1?3 zoIbbBZPoE)8$8e+YhwqSHL}l+MyZ6ZB2-Dju)`17iL>8zQ~g(UzBeuahV6=lr#`)jkHupcY(zFwi`IOdC=q~L*fAN}jE0aJ>5 zl_Dx;gro98T|GO)^w|MApyunIyl*|-QJ+%uD>yf*IqsqqS&d-M%d6dN=)-R=!4@`c z1=qbpk+3kPLfqK3DF+O{JfQ-$U5k07XFk%L3j)k0&g5ftuz`m-?bmAbOT@;~qy)XfTZm~Mp&r$K|XAG#d5|&9r zN;RFoe-I+kdYr(AftWdg))~P;fh}s6)vpCbJ;LQ3iNa!pCMu-3bF@*lg>z z#Dd}UmA9<6M3k?^SI=w0^agT`os%fr7`eJcXP#eeR3I%+`0ZD4BLp9tE;Ki+@|$4v9{bbKfugEBkM zWE#NB>uZ7VEtA<;qp@~*NE7y+Cq>!K9jUf{+ycaq>8Sl27)5$o-g~P8CNjd_I}H37 zk*{UNS0S6VFBM7w^O^}LcpR-VKk7w;6j%~IufutC`rTi7V7BjxYEpSjTq+X;sPKjz}b>)FGYM=y#4*#Hi|T7OT(4K zORLVR6d$c!2O>e8zNo(HmHu<@<*uwrPH0lCA8^<2*m5*Dv;>cb{OAXsT3gWl_0;Jdz3(xOWwHHS5Ax|}%qZvS*i5p0 z_|RVE1?{Gl+Y!y{>@25Gke}sbkDYp`7lKwSN!K4X#cNg+dK`TaDB<#>}LNJ1={R z2F{=+JpN8&kjLDHru**-;EMXC!)FPnL3i2nhZ1Mw2CTg?XIjc@rJ|e;<+EpNo74;k z?7cB!9--RzgO-!_2E*ScF6oChE}3K_XEi4;@^to@<mb1cpn{Fg{m*!Re>Kw?Q-xZDWr{ez|WZyK38~zlKu9 zZK0JtPM$AiXF7ymV!~^-MjVsDQa2UR&VIg|SjWjwA>%(aJh`iVaYQdw99^_)rn9zh zy7kNMFw`p-2FHClwSHhB{)OJQR)fJ;ZLAo~d9~`hjS1cw3ip|2f13I2aXq!AA#70T z>!}liy?BGjDE%0*vzi~Ke3DeN%T3{Al7w-;1)L+Rb-YPY{wuSvniEM{zX^k`I+BGN zoQ=ss-}4{t2-RZ}SvDTU&p!4fmRn9fI6=)Fb0yVGUChjSJK1i3!s+PbSAK)K{-rK9 zsy1c!-di6gULJPh{c@>gkRK^3^%sZqW`1h5Atoa4iLN|e+|#@*-zJ`Wp8S{a>5@h>#w zX}VoqR%`fNwyq^!8x}0j6X-T+^Pcisci_$)*jR^?S}K zqgz|TY{kJ(nWqh>b{yP}IU6@8gx74)GtHKAd@6^ba^1ZsX%h_Vw2~K-l}6X+-G$@b zZFWzx|L8?sLiCtqW~{U|?xLi0_Z4Ev)QurJ63Xozx$r^VJf;1BxQ%L6$A7wcHzker z9MwCmN6OU~SI7M@^=%FK_4EFUUHVPTd!T$vBGK6QwTK^Y3$j@-G^p#gWLD$oh;7Lx z8Jn)9EP8_9{JLTDnn3Km4-06mRRCiNzD7(jheX! zlqmfc15);Lr4!2CTT)EPjX6vQZP(1zBxYXX~n(VBM*7X>^A+n$9UOF^SzG7Bqh?#tBwq{>j7vtNZ zCZtZjC3Bj3bfb7S?yv667MS))Fq5=aIDY>3t@+=&ik7B}{-)!`cXRNhslw*2=d!@u zw_AC%^{qi0KhR4Rf=KFV-Nn+ttW*r7C@o<9e<^OqR&b&C+;`5i$oY+XWiSh>W?rp) z>>vn#aeA1GJ^fUiBz6U(>#5qLcQqP5v{P4g#^t$OIY<$0vye{7($c%|3WN@{l_U!% z#(mD;LifAVcXz99SmvnsC+@L&ko&Ar0aKRk6 Y!noCN>CFc8Cl$b<0~Y&p_c>qvFBU5L{Qv*} literal 0 HcmV?d00001 diff --git a/build/index.html b/build/index.html new file mode 100644 index 0000000..dee24bd --- /dev/null +++ b/build/index.html @@ -0,0 +1 @@ +Music Editor
\ No newline at end of file diff --git a/build/manifest.json b/build/manifest.json new file mode 100644 index 0000000..abf86e9 --- /dev/null +++ b/build/manifest.json @@ -0,0 +1,40 @@ +{ + "short_name": "Music Editor", + "name": "Music Editor for Standard Notes", + "icons": [ + { + "src": "icon-16x16.png", + "sizes": "16x16", + "type": "image/png" + }, + { + "src": "icon-32x32.png", + "sizes": "32x32", + "type": "image/png" + }, + { + "src": "icon.png", + "sizes": "24x24", + "type": "image/png" + }, + { + "src": "icon-64x64.png", + "sizes": "64x64", + "type": "image/png" + }, + { + "src": "icon192.png", + "type": "image/png", + "sizes": "192x192" + }, + { + "src": "icon512.png", + "type": "image/png", + "sizes": "512x512" + } + ], + "start_url": ".", + "display": "standalone", + "theme_color": "#000000", + "background_color": "#ffffff" +} diff --git a/build/package.json b/build/package.json new file mode 100644 index 0000000..c502d0f --- /dev/null +++ b/build/package.json @@ -0,0 +1,24 @@ +{ + "name": "music-editor", + "version": "0.1.0", + "description": "Music Editor for Standard Notes. Write music with VexTab and VexFlow", + "keywords": [ + "Music Editor", + "Standard Notes", + "VexTab", + "VexFlow" + ], + "private": true, + "author": "Theodore Chu", + "license": "AGPL-3.0-or-later", + "repository": { + "type": "git", + "url": "https://github.com/TheodoreChu/music-editor.git" + }, + "bugs": { + "url": "https://github.com/TheodoreChu/music-editor/issues" + }, + "sn": { + "main": "build/index.html" + } +} diff --git a/build/robots.txt b/build/robots.txt new file mode 100644 index 0000000..e9e57dc --- /dev/null +++ b/build/robots.txt @@ -0,0 +1,3 @@ +# https://www.robotstxt.org/robotstxt.html +User-agent: * +Disallow: diff --git a/build/sample.ext.json b/build/sample.ext.json new file mode 100644 index 0000000..3189f53 --- /dev/null +++ b/build/sample.ext.json @@ -0,0 +1,13 @@ +{ + "identifier": "net.musiceditor.develop-local", + "name": "Music Editor - Develop Local", + "content_type": "SN|Component", + "area": "editor-editor", + "version": "0.1.0", + "description": "Music Editor for Standard Notes. Write music with VexTab and VexFlow", + "url": "http://localhost:3000", + "download_url": "", + "latest_url": "", + "marketing_url": "https://musiceditor.net", + "thumbnail_url": "" +} diff --git a/build/static/css/2.ee6590b6.chunk.css b/build/static/css/2.ee6590b6.chunk.css new file mode 100644 index 0000000..c985c99 --- /dev/null +++ b/build/static/css/2.ee6590b6.chunk.css @@ -0,0 +1,2 @@ +:root{--sn-stylekit-base-font-size:13px;--sn-stylekit-font-size-p:1.0rem;--sn-stylekit-font-size-editor:1.21rem;--sn-stylekit-font-size-h6:0.8rem;--sn-stylekit-font-size-h5:0.9rem;--sn-stylekit-font-size-h4:1.0rem;--sn-stylekit-font-size-h3:1.1rem;--sn-stylekit-font-size-h2:1.2rem;--sn-stylekit-font-size-h1:1.3rem;--sn-stylekit-neutral-color:#989898;--sn-stylekit-neutral-contrast-color:#fff;--sn-stylekit-info-color:#086dd6;--sn-stylekit-info-contrast-color:#fff;--sn-stylekit-success-color:#2b9612;--sn-stylekit-success-contrast-color:#fff;--sn-stylekit-warning-color:#f6a200;--sn-stylekit-warning-contrast-color:#fff;--sn-stylekit-danger-color:#f80324;--sn-stylekit-danger-contrast-color:#fff;--sn-stylekit-shadow-color:#c8c8c8;--sn-stylekit-background-color:#fff;--sn-stylekit-border-color:#e3e3e3;--sn-stylekit-foreground-color:#000;--sn-stylekit-contrast-background-color:#f6f6f6;--sn-stylekit-contrast-foreground-color:#2e2e2e;--sn-stylekit-contrast-border-color:#e3e3e3;--sn-stylekit-secondary-background-color:#f6f6f6;--sn-stylekit-secondary-foreground-color:#2e2e2e;--sn-stylekit-secondary-border-color:#e3e3e3;--sn-stylekit-secondary-contrast-background-color:#e3e3e3;--sn-stylekit-secondary-contrast-foreground-color:#2e2e2e;--sn-styleki--secondary-contrast-border-color:#a2a2a2;--sn-stylekit-editor-background-color:var(--sn-stylekit-background-color);--sn-stylekit-editor-foreground-color:var(--sn-stylekit-foreground-color);--sn-stylekit-paragraph-text-color:#454545;--sn-stylekit-input-placeholder-color:#a8a8a8;--sn-stylekit-input-border-color:#e3e3e3;--sn-stylekit-scrollbar-thumb-color:#dfdfdf;--sn-stylekit-scrollbar-track-border-color:#e7e7e7;--sn-stylekit-general-border-radius:2px;--sn-stylekit-simplified-chinese-font:"Microsoft Yahei","微软雅黑体";--sn-stylekit-monospace-font:"Ubuntu Mono",courier,monospace;--sn-stylekit-sans-serif-font:-apple-system,BlinkMacSystemFont,"Segoe UI","Roboto","Oxygen","Ubuntu","Cantarell","Fira Sans","Droid Sans","Helvetica Neue",var(--sn-stylekit-simplified-chinese-font),sans-serif}.sn-component{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Roboto","Oxygen","Ubuntu","Cantarell","Fira Sans","Droid Sans","Helvetica Neue","Microsoft Yahei","微软雅黑体",sans-serif;font-family:var(--sn-stylekit-sans-serif-font);-webkit-font-smoothing:antialiased;color:#000;color:var(--sn-stylekit-foreground-color)}.sn-component .sk-panel{box-shadow:0 2px 5px #c8c8c8;box-shadow:0 2px 5px var(--sn-stylekit-shadow-color);background-color:#fff;background-color:var(--sn-stylekit-background-color);border:1px solid #e3e3e3;border:1px solid var(--sn-stylekit-border-color);border-radius:2px;border-radius:var(--sn-stylekit-general-border-radius);display:flex;flex-direction:column;overflow:auto;flex-grow:1}.sn-component .sk-panel a:hover{text-decoration:underline}.sn-component .sk-panel.static{box-shadow:none;border:none;border-radius:0}.sn-component .sk-panel .sk-panel-header{flex-shrink:0;display:flex;justify-content:space-between;padding:1.1rem 2rem;border-bottom:1px solid #e3e3e3;border-bottom:1px solid var(--sn-stylekit-contrast-border-color);background-color:#f6f6f6;background-color:var(--sn-stylekit-contrast-background-color);color:#2e2e2e;color:var(--sn-stylekit-contrast-foreground-color);align-items:center}.sn-component .sk-panel .sk-panel-header .sk-panel-header-title{font-size:1.3rem;font-size:var(--sn-stylekit-font-size-h1);font-weight:500}.sn-component .sk-panel .sk-panel-header .close-button{font-weight:700}.sn-component .sk-panel .sk-footer,.sn-component .sk-panel .sk-panel-footer{padding:1rem 2rem;border-top:1px solid #e3e3e3;border-top:1px solid var(--sn-stylekit-border-color);box-sizing:border-box}.sn-component .sk-panel .sk-footer.extra-padding,.sn-component .sk-panel .sk-panel-footer.extra-padding{padding:2rem}.sn-component .sk-panel .sk-footer .left,.sn-component .sk-panel .sk-panel-footer .left{text-align:left;display:block}.sn-component .sk-panel .sk-footer .right,.sn-component .sk-panel .sk-panel-footer .right{text-align:right;display:block}.sn-component .sk-panel .sk-panel-content{padding:1.6rem 2rem 0;flex-grow:1;overflow:scroll;height:100%;overflow-y:auto!important;overflow-x:auto!important}.sn-component .sk-panel .sk-panel-content .sk-li,.sn-component .sk-panel .sk-panel-content .sk-p{color:#454545;color:var(--sn-stylekit-paragraph-text-color);line-height:1.3}.sn-component .sk-panel-section{padding-bottom:1.6rem;display:flex;flex-direction:column}.sn-component .sk-panel-section.sk-panel-hero{text-align:center}.sn-component .sk-panel-section .sk-p:last-child{margin-bottom:0}.sn-component .sk-panel-section:not(:last-child){margin-bottom:1.5rem;border-bottom:1px solid #e3e3e3;border-bottom:1px solid var(--sn-stylekit-border-color)}.sn-component .sk-panel-section:not(:last-child).no-border{border-bottom:none}.sn-component .sk-panel-section:last-child{margin-bottom:.5rem}.sn-component .sk-panel-section.no-bottom-pad{padding-bottom:0;margin-bottom:0}.sn-component .sk-panel-section .sk-panel-section-title{margin-bottom:.5rem;font-weight:700;font-size:1.1rem;font-size:var(--sn-stylekit-font-size-h3)}.sn-component .sk-panel-section .sk-panel-section-outer-title{border-bottom:1px solid #e3e3e3;border-bottom:1px solid var(--sn-stylekit-border-color);padding-bottom:.9rem;margin-top:2.1rem;margin-bottom:15px;font-size:1.1rem;font-size:var(--sn-stylekit-font-size-h3)}.sn-component .sk-panel-section .sk-panel-section-subtitle{font-size:.9rem;font-size:var(--sn-stylekit-font-size-h5);margin-bottom:2px}.sn-component .sk-panel-section .sk-panel-section-subtitle.subtle{font-weight:400;opacity:.6}.sn-component .sk-panel-section .text-content .sk-p{margin-bottom:1rem}.sn-component .sk-panel-section .text-content p:first-child{margin-top:.3rem}.sn-component .sk-panel-row{display:flex;justify-content:space-between;align-items:center;padding-top:.4rem}.sn-component .sk-panel-row.centered{justify-content:center}.sn-component .sk-panel-row.justify-right{justify-content:flex-end}.sn-component .sk-panel-row.justify-left{justify-content:flex-start}.sn-component .sk-panel-row.align-top{align-items:flex-start}.sn-component .sk-panel-row .sk-panel-column.stretch{width:100%}.sn-component .sk-panel-row.default-padding,.sn-component .sk-panel-row:not(:last-child){padding-bottom:.4rem}.sn-component .sk-panel-row.condensed{padding-top:.2rem;padding-bottom:.2rem}.sn-component .sk-panel-row .sk-p{margin:0;padding:0}.sn-component .vertical-rule{background-color:#e3e3e3;background-color:var(--sn-stylekit-border-color);height:1.5rem;width:1px}.sn-component .sk-panel-form{width:100%}.sn-component .sk-panel-form.half{width:50%}.sn-component .sk-panel-form .form-submit{margin-top:.15rem}.sn-component .right-aligned{justify-content:flex-end;text-align:right}.sn-component .sk-menu-panel{background-color:#fff;background-color:var(--sn-stylekit-background-color);border:1px solid #e3e3e3;border:1px solid var(--sn-stylekit-contrast-border-color);border-radius:2px;border-radius:var(--sn-stylekit-general-border-radius);overflow:scroll;-webkit-user-select:none;-ms-user-select:none;user-select:none;overflow-y:auto!important;overflow-x:auto!important}.sn-component .sk-menu-panel .sk-menu-panel-header{padding:.8rem 1rem;border-bottom:1px solid #e3e3e3;border-bottom:1px solid var(--sn-stylekit-contrast-border-color);background-color:#f6f6f6;background-color:var(--sn-stylekit-contrast-background-color);color:#2e2e2e;color:var(--sn-stylekit-contrast-foreground-color);display:flex;justify-content:space-between;align-items:center}.sn-component .sk-menu-panel .sk-menu-panel-header-title{font-weight:700;font-size:1rem;font-size:var(--sn-stylekit-font-size-h4)}.sn-component .sk-menu-panel .sk-menu-panel-header-subtitle{margin-top:.2rem;opacity:.6}.sn-component .sk-menu-panel .sk-menu-panel-row{padding:1rem;cursor:pointer;display:flex;flex-direction:row;justify-content:space-between;border-bottom:1px solid #e3e3e3;border-bottom:1px solid var(--sn-stylekit-border-color)}.sn-component .sk-menu-panel .sk-menu-panel-row:hover{background-color:#f6f6f6;background-color:var(--sn-stylekit-contrast-background-color);color:#2e2e2e;color:var(--sn-stylekit-contrast-foreground-color);border-color:#e3e3e3;border-color:var(--sn-stylekit-contrast-border-color)}.sn-component .sk-menu-panel .sk-menu-panel-row .sk-menu-panel-column{display:flex;justify-content:center;flex-direction:column}.sn-component .sk-menu-panel .sk-menu-panel-row .sk-menu-panel-column:not(:first-child){padding-left:1rem;padding-right:.15rem}.sn-component .sk-menu-panel .sk-menu-panel-row .sk-menu-panel-column.stretch{width:100%}.sn-component .sk-menu-panel .sk-menu-panel-row .sk-menu-panel-column .sk-menu-panel-subrows{margin-top:1rem}.sn-component .sk-menu-panel .sk-menu-panel-row .sk-menu-panel-column .sk-menu-panel-row,.sn-component .sk-menu-panel .sk-menu-panel-row .sk-menu-panel-column .sk-menu-panel-subrow{border:1px solid #e3e3e3;border:1px solid var(--sn-stylekit-contrast-border-color);margin-top:-1px}.sn-component .sk-menu-panel .sk-menu-panel-row .sk-menu-panel-column .sk-menu-panel-row:hover,.sn-component .sk-menu-panel .sk-menu-panel-row .sk-menu-panel-column .sk-menu-panel-subrow:hover{background-color:#fff;background-color:var(--sn-stylekit-background-color)}.sn-component .sk-menu-panel .sk-menu-panel-row .sk-menu-panel-column .left{display:flex}.sn-component .sk-menu-panel .sk-menu-panel-row .sk-box .sk-label,.sn-component .sk-menu-panel .sk-menu-panel-row .sk-box .sk-panel-section .sk-panel-section-subtitle,.sn-component .sk-menu-panel .sk-menu-panel-row .sk-button .sk-label,.sn-component .sk-menu-panel .sk-menu-panel-row .sk-button .sk-panel-section .sk-panel-section-subtitle,.sn-component .sk-panel-section .sk-menu-panel .sk-menu-panel-row .sk-box .sk-panel-section-subtitle,.sn-component .sk-panel-section .sk-menu-panel .sk-menu-panel-row .sk-button .sk-panel-section-subtitle{font-size:.8rem;font-size:var(--sn-stylekit-font-size-h6);font-weight:400}.sn-component .sk-menu-panel .sk-menu-panel-row .sk-label,.sn-component .sk-menu-panel .sk-menu-panel-row .sk-panel-section .sk-panel-section-subtitle,.sn-component .sk-panel-section .sk-menu-panel .sk-menu-panel-row .sk-panel-section-subtitle{font-size:1rem;font-size:var(--sn-stylekit-font-size-p);font-weight:700}.sn-component .sk-menu-panel .sk-menu-panel-row .sk-sublabel{font-size:.9rem;font-size:var(--sn-stylekit-font-size-h5);margin-top:.2rem;opacity:.6}.sn-component .red{color:#f80324;color:var(--sn-stylekit-danger-color)}.sn-component .tinted{color:#086dd6;color:var(--sn-stylekit-info-color)}.sn-component .selectable{user-select:text!important;-ms-user-select:text!important;-moz-user-select:text!important;-webkit-user-select:text!important}.sn-component .sk-h1,.sn-component .sk-h2,.sn-component .sk-h3,.sn-component .sk-h4,.sn-component .sk-h5{margin:0;padding:0;font-weight:400}.sn-component .sk-h1{font-weight:500;font-size:1.3rem;font-size:var(--sn-stylekit-font-size-h1);line-height:1.9rem}.sn-component .sk-h2{font-size:1.2rem;font-size:var(--sn-stylekit-font-size-h2);line-height:1.8rem}.sn-component .sk-h3{font-size:1.1rem;font-size:var(--sn-stylekit-font-size-h3);line-height:1.7rem}.sn-component .sk-h4{font-size:1rem;font-size:var(--sn-stylekit-font-size-p);line-height:1.4rem}.sn-component .sk-h5{font-size:.9rem;font-size:var(--sn-stylekit-font-size-h5)}.sn-component .sk-bold{font-weight:700}.sn-component .sk-font-small{font-size:.9rem;font-size:var(--sn-stylekit-font-size-h5)}.sn-component .sk-font-normal{font-size:1rem;font-size:var(--sn-stylekit-font-size-p)}.sn-component .sk-font-large{font-size:1.1rem;font-size:var(--sn-stylekit-font-size-h3)}.sn-component a.sk-a{cursor:pointer;-webkit-user-select:none;-ms-user-select:none;user-select:none}.sn-component a.sk-a.disabled{color:#989898;color:var(--sn-stylekit-neutral-color);opacity:.6}.sn-component a.sk-a.boxed{border-radius:2px;border-radius:var(--sn-stylekit-general-border-radius);padding:.3rem .4rem}.sn-component a.sk-a.boxed:hover{text-decoration:none}.sn-component a.sk-a.boxed.neutral{background-color:#989898;background-color:var(--sn-stylekit-neutral-color);color:#fff;color:var(--sn-stylekit-neutral-contrast-color)}.sn-component a.sk-a.boxed.info{background-color:#086dd6;background-color:var(--sn-stylekit-info-color);color:#fff;color:var(--sn-stylekit-info-contrast-color)}.sn-component a.sk-a.boxed.warning{background-color:#f6a200;background-color:var(--sn-stylekit-warning-color);color:#fff;color:var(--sn-stylekit-warning-contrast-color)}.sn-component a.sk-a.boxed.danger{background-color:#f80324;background-color:var(--sn-stylekit-danger-color);color:#fff;color:var(--sn-stylekit-danger-contrast-color)}.sn-component a.sk-a.boxed.success{background-color:#2b9612;background-color:var(--sn-stylekit-success-color);color:#fff;color:var(--sn-stylekit-success-contrast-color)}.sn-component .wrap{word-wrap:break-word}.sn-component .sk-base{color:#000;color:var(--sn-stylekit-foreground-color)}.sn-component .contrast{color:#2e2e2e;color:var(--sn-stylekit-contrast-foreground-color)}.sn-component .neutral{color:#989898;color:var(--sn-stylekit-neutral-color)}.sn-component .info{color:#086dd6;color:var(--sn-stylekit-info-color)}.sn-component .info-contrast{color:#fff;color:var(--sn-stylekit-info-contrast-color)}.sn-component .warning{color:#f6a200;color:var(--sn-stylekit-warning-color)}.sn-component .danger{color:#f80324;color:var(--sn-stylekit-danger-color)}.sn-component .success{color:#2b9612;color:var(--sn-stylekit-success-color)}.sn-component .info-i{color:#086dd6!important;color:var(--sn-stylekit-info-color)!important}.sn-component .warning-i{color:#f6a200!important;color:var(--sn-stylekit-warning-color)!important}.sn-component .danger-i{color:#f80324!important;color:var(--sn-stylekit-danger-color)!important}.sn-component .success-i{color:#2b9612!important;color:var(--sn-stylekit-success-color)!important}.sn-component .clear{background-color:transparent;border:none}.sn-component .center-text{text-align:center!important;justify-content:center!important}.sn-component p.sk-p{margin:.5rem 0}.sn-component input.sk-input{box-sizing:border-box;padding:.7rem .8rem;margin:.3rem 0;border:none;font-size:1.1rem;font-size:var(--sn-stylekit-font-size-h3);width:100%;outline:0;resize:none}.sn-component input.sk-input.clear{color:#000;color:var(--sn-stylekit-foreground-color);background-color:transparent;border:none}.sn-component input.sk-input.no-border{border:none}.sn-component .sk-label,.sn-component .sk-panel-section .sk-panel-section-subtitle{font-weight:700}.sn-component .sk-label.no-bold,.sn-component .sk-panel-section .no-bold.sk-panel-section-subtitle{font-weight:400}.sn-component .sk-panel-section label.sk-panel-section-subtitle,.sn-component label.sk-label{margin:.7rem 0;display:block}.sn-component .sk-panel-section label.sk-panel-section-subtitle input[type=checkbox],.sn-component input[type=radio],.sn-component label.sk-label input[type=checkbox]{width:auto;margin-right:.45rem;vertical-align:middle}.sn-component .sk-horizontal-group>*,.sn-component .sk-input-group>*{display:inline-block;vertical-align:middle}.sn-component .sk-horizontal-group>:not(:first-child),.sn-component .sk-input-group>:not(:first-child){margin-left:.9rem}.sn-component .sk-border-bottom{border-bottom:1px solid #e3e3e3;border-bottom:1px solid var(--sn-stylekit-border-color)}.sn-component .sk-checkbox-group{padding-top:.5rem;padding-bottom:.3rem}.sn-component ::-webkit-input-placeholder{color:#a8a8a8;color:var(--sn-stylekit-input-placeholder-color)}.sn-component ::placeholder{color:#a8a8a8;color:var(--sn-stylekit-input-placeholder-color)}.sn-component :-ms-input-placeholder{color:#a8a8a8;color:var(--sn-stylekit-input-placeholder-color)}.sn-component ::-ms-input-placeholder{color:#a8a8a8;color:var(--sn-stylekit-input-placeholder-color)}.sn-component .sk-button-group.stretch{display:flex;width:100%}.sn-component .sk-button-group.stretch .sk-box,.sn-component .sk-button-group.stretch .sk-button{display:block;flex-grow:1;text-align:center}.sn-component .sk-button-group .sk-box,.sn-component .sk-button-group .sk-button{display:inline-block;vertical-align:middle}.sn-component .sk-button-group .sk-box:not(:last-child),.sn-component .sk-button-group .sk-button:not(:last-child){margin-right:5px}.sn-component .sk-button-group .sk-box:not(:last-child).featured,.sn-component .sk-button-group .sk-button:not(:last-child).featured{margin-right:8px}.sn-component .sk-segmented-buttons{display:flex;flex-direction:row}.sn-component .sk-segmented-buttons .sk-box,.sn-component .sk-segmented-buttons .sk-button{border-radius:0;white-space:nowrap;margin:0;margin-left:0!important;margin-right:0!important}.sn-component .sk-segmented-buttons .sk-box:not(:last-child),.sn-component .sk-segmented-buttons .sk-button:not(:last-child){border-right:none;border-radius:0}.sn-component .sk-segmented-buttons .sk-box:first-child,.sn-component .sk-segmented-buttons .sk-button:first-child{border-top-left-radius:2px;border-top-left-radius:var(--sn-stylekit-general-border-radius);border-bottom-left-radius:2px;border-bottom-left-radius:var(--sn-stylekit-general-border-radius);border-right:none;border-top-right-radius:0;border-bottom-right-radius:0}.sn-component .sk-segmented-buttons .sk-box:last-child,.sn-component .sk-segmented-buttons .sk-button:last-child{border-top-right-radius:2px;border-top-right-radius:var(--sn-stylekit-general-border-radius);border-bottom-right-radius:2px;border-bottom-right-radius:var(--sn-stylekit-general-border-radius);border-left:none;border-top-left-radius:0;border-bottom-left-radius:0}.sn-component .sk-box-group .sk-box{display:inline-block}.sn-component .sk-box-group .sk-box:not(:last-child){margin-right:5px}.sn-component .sk-a.button{text-decoration:none}.sn-component .sk-box,.sn-component .sk-button{display:table;padding:.5rem .7rem;font-size:.9rem;font-size:var(--sn-stylekit-font-size-h5);cursor:pointer;text-align:center;-webkit-user-select:none;-ms-user-select:none;user-select:none}.sn-component .no-hover-border.sk-box:after,.sn-component .sk-button.no-hover-border:after{color:transparent!important}.sn-component .sk-button.wide,.sn-component .wide.sk-box{padding:.3rem 1.7rem}.sn-component .sk-box>.sk-label,.sn-component .sk-button>.sk-label,.sn-component .sk-panel-section .sk-box>.sk-panel-section-subtitle,.sn-component .sk-panel-section .sk-button>.sk-panel-section-subtitle{font-weight:700;display:block;text-align:center}.sn-component .big.sk-box,.sn-component .sk-button.big{font-size:1.1rem;font-size:var(--sn-stylekit-font-size-h3);padding:.7rem 2.5rem}.sn-component .sk-box{padding:2.5rem 1.5rem}.sn-component .sk-base.sk-box,.sn-component .sk-box.sk-base,.sn-component .sk-button.sk-base,.sn-component .sk-circle.sk-base{color:#000;color:var(--sn-stylekit-foreground-color);position:relative;background-color:#fff;background-color:var(--sn-stylekit-background-color);overflow:hidden;border-radius:2px;border-radius:var(--sn-stylekit-general-border-radius);border-color:#fff;border-color:var(--sn-stylekit-background-color)}.sn-component .sk-base.sk-box *,.sn-component .sk-box.sk-base *,.sn-component .sk-button.sk-base *,.sn-component .sk-circle.sk-base *{position:relative}.sn-component .sk-base.sk-box:before,.sn-component .sk-box.sk-base:before,.sn-component .sk-button.sk-base:before,.sn-component .sk-circle.sk-base:before{content:"";position:absolute;top:0;left:0;width:100%;height:100%;background-color:#fff;background-color:var(--sn-stylekit-background-color);opacity:1;border-radius:2px;border-radius:var(--sn-stylekit-general-border-radius)}.sn-component .sk-base.sk-box:after,.sn-component .sk-box.sk-base:after,.sn-component .sk-button.sk-base:after,.sn-component .sk-circle.sk-base:after{content:"";display:block;height:100%;position:absolute;top:0;left:0;width:100%;border-radius:2px;border-radius:var(--sn-stylekit-general-border-radius);pointer-events:none;box-shadow:inset 0 0 0 1px;color:#fff;color:var(--sn-stylekit-background-color)}.sn-component .sk-base.sk-box:hover:before,.sn-component .sk-box.sk-base:hover:before,.sn-component .sk-button.sk-base:hover:before,.sn-component .sk-circle.sk-base:hover:before{-webkit-filter:brightness(130%);filter:brightness(130%)}.sn-component .sk-base.no-bg.sk-box,.sn-component .sk-box.sk-base.no-bg,.sn-component .sk-button.sk-base.no-bg,.sn-component .sk-circle.sk-base.no-bg{background-color:transparent}.sn-component .sk-base.no-bg.sk-box:before,.sn-component .sk-box.sk-base.no-bg:before,.sn-component .sk-button.sk-base.no-bg:before,.sn-component .sk-circle.sk-base.no-bg:before{content:none}.sn-component .sk-base.featured.sk-box,.sn-component .sk-box.sk-base.featured,.sn-component .sk-button.sk-base.featured,.sn-component .sk-circle.sk-base.featured{border:none;padding:.75rem 1.25rem;font-size:1.1rem;font-size:var(--sn-stylekit-font-size-h3)}.sn-component .sk-base.featured.sk-box:before,.sn-component .sk-box.sk-base.featured:before,.sn-component .sk-button.sk-base.featured:before,.sn-component .sk-circle.sk-base.featured:before{opacity:1}.sn-component .contrast.sk-box,.sn-component .sk-box.contrast,.sn-component .sk-button.contrast,.sn-component .sk-circle.contrast{color:#2e2e2e;color:var(--sn-stylekit-contrast-foreground-color);position:relative;background-color:#f6f6f6;background-color:var(--sn-stylekit-contrast-background-color);overflow:hidden;border-radius:2px;border-radius:var(--sn-stylekit-general-border-radius);border-color:#f6f6f6;border-color:var(--sn-stylekit-contrast-background-color)}.sn-component .contrast.sk-box *,.sn-component .sk-box.contrast *,.sn-component .sk-button.contrast *,.sn-component .sk-circle.contrast *{position:relative}.sn-component .contrast.sk-box:before,.sn-component .sk-box.contrast:before,.sn-component .sk-button.contrast:before,.sn-component .sk-circle.contrast:before{content:"";position:absolute;top:0;left:0;width:100%;height:100%;background-color:#f6f6f6;background-color:var(--sn-stylekit-contrast-background-color);opacity:1;border-radius:2px;border-radius:var(--sn-stylekit-general-border-radius)}.sn-component .contrast.sk-box:after,.sn-component .sk-box.contrast:after,.sn-component .sk-button.contrast:after,.sn-component .sk-circle.contrast:after{content:"";display:block;height:100%;position:absolute;top:0;left:0;width:100%;border-radius:2px;border-radius:var(--sn-stylekit-general-border-radius);pointer-events:none;box-shadow:inset 0 0 0 1px;color:#f6f6f6;color:var(--sn-stylekit-contrast-background-color)}.sn-component .contrast.sk-box:hover:before,.sn-component .sk-box.contrast:hover:before,.sn-component .sk-button.contrast:hover:before,.sn-component .sk-circle.contrast:hover:before{-webkit-filter:brightness(130%);filter:brightness(130%)}.sn-component .contrast.no-bg.sk-box,.sn-component .sk-box.contrast.no-bg,.sn-component .sk-button.contrast.no-bg,.sn-component .sk-circle.contrast.no-bg{background-color:transparent}.sn-component .contrast.no-bg.sk-box:before,.sn-component .sk-box.contrast.no-bg:before,.sn-component .sk-button.contrast.no-bg:before,.sn-component .sk-circle.contrast.no-bg:before{content:none}.sn-component .contrast.featured.sk-box,.sn-component .sk-box.contrast.featured,.sn-component .sk-button.contrast.featured,.sn-component .sk-circle.contrast.featured{border:none;padding:.75rem 1.25rem;font-size:1.1rem;font-size:var(--sn-stylekit-font-size-h3)}.sn-component .contrast.featured.sk-box:before,.sn-component .sk-box.contrast.featured:before,.sn-component .sk-button.contrast.featured:before,.sn-component .sk-circle.contrast.featured:before{opacity:1}.sn-component .sk-box.sk-secondary,.sn-component .sk-button.sk-secondary,.sn-component .sk-circle.sk-secondary,.sn-component .sk-secondary.sk-box{color:#2e2e2e;color:var(--sn-stylekit-secondary-foreground-color);position:relative;background-color:#f6f6f6;background-color:var(--sn-stylekit-secondary-background-color);overflow:hidden;border-radius:2px;border-radius:var(--sn-stylekit-general-border-radius);border-color:#f6f6f6;border-color:var(--sn-stylekit-secondary-background-color)}.sn-component .sk-box.sk-secondary *,.sn-component .sk-button.sk-secondary *,.sn-component .sk-circle.sk-secondary *,.sn-component .sk-secondary.sk-box *{position:relative}.sn-component .sk-box.sk-secondary:before,.sn-component .sk-button.sk-secondary:before,.sn-component .sk-circle.sk-secondary:before,.sn-component .sk-secondary.sk-box:before{content:"";position:absolute;top:0;left:0;width:100%;height:100%;background-color:#f6f6f6;background-color:var(--sn-stylekit-secondary-background-color);opacity:1;border-radius:2px;border-radius:var(--sn-stylekit-general-border-radius)}.sn-component .sk-box.sk-secondary:after,.sn-component .sk-button.sk-secondary:after,.sn-component .sk-circle.sk-secondary:after,.sn-component .sk-secondary.sk-box:after{content:"";display:block;height:100%;position:absolute;top:0;left:0;width:100%;border-radius:2px;border-radius:var(--sn-stylekit-general-border-radius);pointer-events:none;box-shadow:inset 0 0 0 1px;color:#f6f6f6;color:var(--sn-stylekit-secondary-background-color)}.sn-component .sk-box.sk-secondary:hover:before,.sn-component .sk-button.sk-secondary:hover:before,.sn-component .sk-circle.sk-secondary:hover:before,.sn-component .sk-secondary.sk-box:hover:before{-webkit-filter:brightness(130%);filter:brightness(130%)}.sn-component .sk-box.sk-secondary.no-bg,.sn-component .sk-button.sk-secondary.no-bg,.sn-component .sk-circle.sk-secondary.no-bg,.sn-component .sk-secondary.no-bg.sk-box{background-color:transparent}.sn-component .sk-box.sk-secondary.no-bg:before,.sn-component .sk-button.sk-secondary.no-bg:before,.sn-component .sk-circle.sk-secondary.no-bg:before,.sn-component .sk-secondary.no-bg.sk-box:before{content:none}.sn-component .sk-box.sk-secondary.featured,.sn-component .sk-button.sk-secondary.featured,.sn-component .sk-circle.sk-secondary.featured,.sn-component .sk-secondary.featured.sk-box{border:none;padding:.75rem 1.25rem;font-size:1.1rem;font-size:var(--sn-stylekit-font-size-h3)}.sn-component .sk-box.sk-secondary.featured:before,.sn-component .sk-button.sk-secondary.featured:before,.sn-component .sk-circle.sk-secondary.featured:before,.sn-component .sk-secondary.featured.sk-box:before{opacity:1}.sn-component .sk-box.sk-secondary-contrast,.sn-component .sk-button.sk-secondary-contrast,.sn-component .sk-circle.sk-secondary-contrast,.sn-component .sk-secondary-contrast.sk-box{color:#2e2e2e;color:var(--sn-stylekit-secondary-contrast-foreground-color);position:relative;background-color:#e3e3e3;background-color:var(--sn-stylekit-secondary-contrast-background-color);overflow:hidden;border-radius:2px;border-radius:var(--sn-stylekit-general-border-radius);border-color:#e3e3e3;border-color:var(--sn-stylekit-secondary-contrast-background-color)}.sn-component .sk-box.sk-secondary-contrast *,.sn-component .sk-button.sk-secondary-contrast *,.sn-component .sk-circle.sk-secondary-contrast *,.sn-component .sk-secondary-contrast.sk-box *{position:relative}.sn-component .sk-box.sk-secondary-contrast:before,.sn-component .sk-button.sk-secondary-contrast:before,.sn-component .sk-circle.sk-secondary-contrast:before,.sn-component .sk-secondary-contrast.sk-box:before{content:"";position:absolute;top:0;left:0;width:100%;height:100%;background-color:#e3e3e3;background-color:var(--sn-stylekit-secondary-contrast-background-color);opacity:1;border-radius:2px;border-radius:var(--sn-stylekit-general-border-radius)}.sn-component .sk-box.sk-secondary-contrast:after,.sn-component .sk-button.sk-secondary-contrast:after,.sn-component .sk-circle.sk-secondary-contrast:after,.sn-component .sk-secondary-contrast.sk-box:after{content:"";display:block;height:100%;position:absolute;top:0;left:0;width:100%;border-radius:2px;border-radius:var(--sn-stylekit-general-border-radius);pointer-events:none;box-shadow:inset 0 0 0 1px;color:#e3e3e3;color:var(--sn-stylekit-secondary-contrast-background-color)}.sn-component .sk-box.sk-secondary-contrast:hover:before,.sn-component .sk-button.sk-secondary-contrast:hover:before,.sn-component .sk-circle.sk-secondary-contrast:hover:before,.sn-component .sk-secondary-contrast.sk-box:hover:before{-webkit-filter:brightness(130%);filter:brightness(130%)}.sn-component .sk-box.sk-secondary-contrast.no-bg,.sn-component .sk-button.sk-secondary-contrast.no-bg,.sn-component .sk-circle.sk-secondary-contrast.no-bg,.sn-component .sk-secondary-contrast.no-bg.sk-box{background-color:transparent}.sn-component .sk-box.sk-secondary-contrast.no-bg:before,.sn-component .sk-button.sk-secondary-contrast.no-bg:before,.sn-component .sk-circle.sk-secondary-contrast.no-bg:before,.sn-component .sk-secondary-contrast.no-bg.sk-box:before{content:none}.sn-component .sk-box.sk-secondary-contrast.featured,.sn-component .sk-button.sk-secondary-contrast.featured,.sn-component .sk-circle.sk-secondary-contrast.featured,.sn-component .sk-secondary-contrast.featured.sk-box{border:none;padding:.75rem 1.25rem;font-size:1.1rem;font-size:var(--sn-stylekit-font-size-h3)}.sn-component .sk-box.sk-secondary-contrast.featured:before,.sn-component .sk-button.sk-secondary-contrast.featured:before,.sn-component .sk-circle.sk-secondary-contrast.featured:before,.sn-component .sk-secondary-contrast.featured.sk-box:before{opacity:1}.sn-component .neutral.sk-box,.sn-component .sk-box.neutral,.sn-component .sk-button.neutral,.sn-component .sk-circle.neutral{color:#fff;color:var(--sn-stylekit-neutral-contrast-color);position:relative;background-color:#989898;background-color:var(--sn-stylekit-neutral-color);overflow:hidden;border-radius:2px;border-radius:var(--sn-stylekit-general-border-radius);border-color:#989898;border-color:var(--sn-stylekit-neutral-color)}.sn-component .neutral.sk-box *,.sn-component .sk-box.neutral *,.sn-component .sk-button.neutral *,.sn-component .sk-circle.neutral *{position:relative}.sn-component .neutral.sk-box:before,.sn-component .sk-box.neutral:before,.sn-component .sk-button.neutral:before,.sn-component .sk-circle.neutral:before{content:"";position:absolute;top:0;left:0;width:100%;height:100%;background-color:#989898;background-color:var(--sn-stylekit-neutral-color);opacity:1;border-radius:2px;border-radius:var(--sn-stylekit-general-border-radius)}.sn-component .neutral.sk-box:after,.sn-component .sk-box.neutral:after,.sn-component .sk-button.neutral:after,.sn-component .sk-circle.neutral:after{content:"";display:block;height:100%;position:absolute;top:0;left:0;width:100%;border-radius:2px;border-radius:var(--sn-stylekit-general-border-radius);pointer-events:none;box-shadow:inset 0 0 0 1px;color:#989898;color:var(--sn-stylekit-neutral-color)}.sn-component .neutral.sk-box:hover:before,.sn-component .sk-box.neutral:hover:before,.sn-component .sk-button.neutral:hover:before,.sn-component .sk-circle.neutral:hover:before{-webkit-filter:brightness(130%);filter:brightness(130%)}.sn-component .neutral.no-bg.sk-box,.sn-component .sk-box.neutral.no-bg,.sn-component .sk-button.neutral.no-bg,.sn-component .sk-circle.neutral.no-bg{background-color:transparent}.sn-component .neutral.no-bg.sk-box:before,.sn-component .sk-box.neutral.no-bg:before,.sn-component .sk-button.neutral.no-bg:before,.sn-component .sk-circle.neutral.no-bg:before{content:none}.sn-component .neutral.featured.sk-box,.sn-component .sk-box.neutral.featured,.sn-component .sk-button.neutral.featured,.sn-component .sk-circle.neutral.featured{border:none;padding:.75rem 1.25rem;font-size:1.1rem;font-size:var(--sn-stylekit-font-size-h3)}.sn-component .neutral.featured.sk-box:before,.sn-component .sk-box.neutral.featured:before,.sn-component .sk-button.neutral.featured:before,.sn-component .sk-circle.neutral.featured:before{opacity:1}.sn-component .info.sk-box,.sn-component .sk-box.info,.sn-component .sk-button.info,.sn-component .sk-circle.info{color:#fff;color:var(--sn-stylekit-info-contrast-color);position:relative;background-color:#086dd6;background-color:var(--sn-stylekit-info-color);overflow:hidden;border-radius:2px;border-radius:var(--sn-stylekit-general-border-radius);border-color:#086dd6;border-color:var(--sn-stylekit-info-color)}.sn-component .info.sk-box *,.sn-component .sk-box.info *,.sn-component .sk-button.info *,.sn-component .sk-circle.info *{position:relative}.sn-component .info.sk-box:before,.sn-component .sk-box.info:before,.sn-component .sk-button.info:before,.sn-component .sk-circle.info:before{content:"";position:absolute;top:0;left:0;width:100%;height:100%;background-color:#086dd6;background-color:var(--sn-stylekit-info-color);opacity:1;border-radius:2px;border-radius:var(--sn-stylekit-general-border-radius)}.sn-component .info.sk-box:after,.sn-component .sk-box.info:after,.sn-component .sk-button.info:after,.sn-component .sk-circle.info:after{content:"";display:block;height:100%;position:absolute;top:0;left:0;width:100%;border-radius:2px;border-radius:var(--sn-stylekit-general-border-radius);pointer-events:none;box-shadow:inset 0 0 0 1px;color:#086dd6;color:var(--sn-stylekit-info-color)}.sn-component .info.sk-box:hover:before,.sn-component .sk-box.info:hover:before,.sn-component .sk-button.info:hover:before,.sn-component .sk-circle.info:hover:before{-webkit-filter:brightness(130%);filter:brightness(130%)}.sn-component .info.no-bg.sk-box,.sn-component .sk-box.info.no-bg,.sn-component .sk-button.info.no-bg,.sn-component .sk-circle.info.no-bg{background-color:transparent}.sn-component .info.no-bg.sk-box:before,.sn-component .sk-box.info.no-bg:before,.sn-component .sk-button.info.no-bg:before,.sn-component .sk-circle.info.no-bg:before{content:none}.sn-component .info.featured.sk-box,.sn-component .sk-box.info.featured,.sn-component .sk-button.info.featured,.sn-component .sk-circle.info.featured{border:none;padding:.75rem 1.25rem;font-size:1.1rem;font-size:var(--sn-stylekit-font-size-h3)}.sn-component .info.featured.sk-box:before,.sn-component .sk-box.info.featured:before,.sn-component .sk-button.info.featured:before,.sn-component .sk-circle.info.featured:before{opacity:1}.sn-component .sk-box.warning,.sn-component .sk-button.warning,.sn-component .sk-circle.warning,.sn-component .warning.sk-box{color:#fff;color:var(--sn-stylekit-warning-contrast-color);position:relative;background-color:#f6a200;background-color:var(--sn-stylekit-warning-color);overflow:hidden;border-radius:2px;border-radius:var(--sn-stylekit-general-border-radius);border-color:#f6a200;border-color:var(--sn-stylekit-warning-color)}.sn-component .sk-box.warning *,.sn-component .sk-button.warning *,.sn-component .sk-circle.warning *,.sn-component .warning.sk-box *{position:relative}.sn-component .sk-box.warning:before,.sn-component .sk-button.warning:before,.sn-component .sk-circle.warning:before,.sn-component .warning.sk-box:before{content:"";position:absolute;top:0;left:0;width:100%;height:100%;background-color:#f6a200;background-color:var(--sn-stylekit-warning-color);opacity:1;border-radius:2px;border-radius:var(--sn-stylekit-general-border-radius)}.sn-component .sk-box.warning:after,.sn-component .sk-button.warning:after,.sn-component .sk-circle.warning:after,.sn-component .warning.sk-box:after{content:"";display:block;height:100%;position:absolute;top:0;left:0;width:100%;border-radius:2px;border-radius:var(--sn-stylekit-general-border-radius);pointer-events:none;box-shadow:inset 0 0 0 1px;color:#f6a200;color:var(--sn-stylekit-warning-color)}.sn-component .sk-box.warning:hover:before,.sn-component .sk-button.warning:hover:before,.sn-component .sk-circle.warning:hover:before,.sn-component .warning.sk-box:hover:before{-webkit-filter:brightness(130%);filter:brightness(130%)}.sn-component .sk-box.warning.no-bg,.sn-component .sk-button.warning.no-bg,.sn-component .sk-circle.warning.no-bg,.sn-component .warning.no-bg.sk-box{background-color:transparent}.sn-component .sk-box.warning.no-bg:before,.sn-component .sk-button.warning.no-bg:before,.sn-component .sk-circle.warning.no-bg:before,.sn-component .warning.no-bg.sk-box:before{content:none}.sn-component .sk-box.warning.featured,.sn-component .sk-button.warning.featured,.sn-component .sk-circle.warning.featured,.sn-component .warning.featured.sk-box{border:none;padding:.75rem 1.25rem;font-size:1.1rem;font-size:var(--sn-stylekit-font-size-h3)}.sn-component .sk-box.warning.featured:before,.sn-component .sk-button.warning.featured:before,.sn-component .sk-circle.warning.featured:before,.sn-component .warning.featured.sk-box:before{opacity:1}.sn-component .danger.sk-box,.sn-component .sk-box.danger,.sn-component .sk-button.danger,.sn-component .sk-circle.danger{color:#fff;color:var(--sn-stylekit-danger-contrast-color);position:relative;background-color:#f80324;background-color:var(--sn-stylekit-danger-color);overflow:hidden;border-radius:2px;border-radius:var(--sn-stylekit-general-border-radius);border-color:#f80324;border-color:var(--sn-stylekit-danger-color)}.sn-component .danger.sk-box *,.sn-component .sk-box.danger *,.sn-component .sk-button.danger *,.sn-component .sk-circle.danger *{position:relative}.sn-component .danger.sk-box:before,.sn-component .sk-box.danger:before,.sn-component .sk-button.danger:before,.sn-component .sk-circle.danger:before{content:"";position:absolute;top:0;left:0;width:100%;height:100%;background-color:#f80324;background-color:var(--sn-stylekit-danger-color);opacity:1;border-radius:2px;border-radius:var(--sn-stylekit-general-border-radius)}.sn-component .danger.sk-box:after,.sn-component .sk-box.danger:after,.sn-component .sk-button.danger:after,.sn-component .sk-circle.danger:after{content:"";display:block;height:100%;position:absolute;top:0;left:0;width:100%;border-radius:2px;border-radius:var(--sn-stylekit-general-border-radius);pointer-events:none;box-shadow:inset 0 0 0 1px;color:#f80324;color:var(--sn-stylekit-danger-color)}.sn-component .danger.sk-box:hover:before,.sn-component .sk-box.danger:hover:before,.sn-component .sk-button.danger:hover:before,.sn-component .sk-circle.danger:hover:before{-webkit-filter:brightness(130%);filter:brightness(130%)}.sn-component .danger.no-bg.sk-box,.sn-component .sk-box.danger.no-bg,.sn-component .sk-button.danger.no-bg,.sn-component .sk-circle.danger.no-bg{background-color:transparent}.sn-component .danger.no-bg.sk-box:before,.sn-component .sk-box.danger.no-bg:before,.sn-component .sk-button.danger.no-bg:before,.sn-component .sk-circle.danger.no-bg:before{content:none}.sn-component .danger.featured.sk-box,.sn-component .sk-box.danger.featured,.sn-component .sk-button.danger.featured,.sn-component .sk-circle.danger.featured{border:none;padding:.75rem 1.25rem;font-size:1.1rem;font-size:var(--sn-stylekit-font-size-h3)}.sn-component .danger.featured.sk-box:before,.sn-component .sk-box.danger.featured:before,.sn-component .sk-button.danger.featured:before,.sn-component .sk-circle.danger.featured:before{opacity:1}.sn-component .sk-box.success,.sn-component .sk-button.success,.sn-component .sk-circle.success,.sn-component .success.sk-box{color:#fff;color:var(--sn-stylekit-success-contrast-color);position:relative;background-color:#2b9612;background-color:var(--sn-stylekit-success-color);overflow:hidden;border-radius:2px;border-radius:var(--sn-stylekit-general-border-radius);border-color:#2b9612;border-color:var(--sn-stylekit-success-color)}.sn-component .sk-box.success *,.sn-component .sk-button.success *,.sn-component .sk-circle.success *,.sn-component .success.sk-box *{position:relative}.sn-component .sk-box.success:before,.sn-component .sk-button.success:before,.sn-component .sk-circle.success:before,.sn-component .success.sk-box:before{content:"";position:absolute;top:0;left:0;width:100%;height:100%;background-color:#2b9612;background-color:var(--sn-stylekit-success-color);opacity:1;border-radius:2px;border-radius:var(--sn-stylekit-general-border-radius)}.sn-component .sk-box.success:after,.sn-component .sk-button.success:after,.sn-component .sk-circle.success:after,.sn-component .success.sk-box:after{content:"";display:block;height:100%;position:absolute;top:0;left:0;width:100%;border-radius:2px;border-radius:var(--sn-stylekit-general-border-radius);pointer-events:none;box-shadow:inset 0 0 0 1px;color:#2b9612;color:var(--sn-stylekit-success-color)}.sn-component .sk-box.success:hover:before,.sn-component .sk-button.success:hover:before,.sn-component .sk-circle.success:hover:before,.sn-component .success.sk-box:hover:before{-webkit-filter:brightness(130%);filter:brightness(130%)}.sn-component .sk-box.success.no-bg,.sn-component .sk-button.success.no-bg,.sn-component .sk-circle.success.no-bg,.sn-component .success.no-bg.sk-box{background-color:transparent}.sn-component .sk-box.success.no-bg:before,.sn-component .sk-button.success.no-bg:before,.sn-component .sk-circle.success.no-bg:before,.sn-component .success.no-bg.sk-box:before{content:none}.sn-component .sk-box.success.featured,.sn-component .sk-button.success.featured,.sn-component .sk-circle.success.featured,.sn-component .success.featured.sk-box{border:none;padding:.75rem 1.25rem;font-size:1.1rem;font-size:var(--sn-stylekit-font-size-h3)}.sn-component .sk-box.success.featured:before,.sn-component .sk-button.success.featured:before,.sn-component .sk-circle.success.featured:before,.sn-component .success.featured.sk-box:before{opacity:1}.sn-component .sk-input.contrast,.sn-component .sk-notification.contrast{color:#2e2e2e;color:var(--sn-stylekit-contrast-foreground-color);position:relative;background-color:#f6f6f6;background-color:var(--sn-stylekit-contrast-background-color);overflow:hidden;border-radius:2px;border-radius:var(--sn-stylekit-general-border-radius);border:1px solid #e3e3e3;border:1px solid var(--sn-stylekit-contrast-border-color)}.sn-component .sk-input.contrast *,.sn-component .sk-notification.contrast *{position:relative}.sn-component .sk-input.contrast:before,.sn-component .sk-notification.contrast:before{content:"";position:absolute;top:0;left:0;width:100%;height:100%;background-color:#f6f6f6;background-color:var(--sn-stylekit-contrast-background-color);opacity:1;border-radius:2px;border-radius:var(--sn-stylekit-general-border-radius)}.sn-component .sk-input.contrast:after,.sn-component .sk-notification.contrast:after{content:"";display:block;height:100%;position:absolute;top:0;left:0;width:100%;border-radius:2px;border-radius:var(--sn-stylekit-general-border-radius);pointer-events:none;color:#e3e3e3;color:var(--sn-stylekit-contrast-border-color);border-color:#e3e3e3;border-color:var(--sn-stylekit-contrast-border-color)}.sn-component .sk-input.contrast.no-bg,.sn-component .sk-notification.contrast.no-bg{background-color:transparent}.sn-component .sk-input.contrast.no-bg:before,.sn-component .sk-notification.contrast.no-bg:before{content:none}.sn-component .sk-input.contrast.featured,.sn-component .sk-notification.contrast.featured{border:none;padding:.75rem 1.25rem;font-size:1.1rem;font-size:var(--sn-stylekit-font-size-h3)}.sn-component .sk-input.contrast.featured:before,.sn-component .sk-notification.contrast.featured:before{opacity:1}.sn-component .sk-input.sk-secondary,.sn-component .sk-notification.sk-secondary{color:#2e2e2e;color:var(--sn-stylekit-secondary-foreground-color);position:relative;background-color:#f6f6f6;background-color:var(--sn-stylekit-secondary-background-color);overflow:hidden;border-radius:2px;border-radius:var(--sn-stylekit-general-border-radius);border:1px solid #e3e3e3;border:1px solid var(--sn-stylekit-secondary-border-color)}.sn-component .sk-input.sk-secondary *,.sn-component .sk-notification.sk-secondary *{position:relative}.sn-component .sk-input.sk-secondary:before,.sn-component .sk-notification.sk-secondary:before{content:"";position:absolute;top:0;left:0;width:100%;height:100%;background-color:#f6f6f6;background-color:var(--sn-stylekit-secondary-background-color);opacity:1;border-radius:2px;border-radius:var(--sn-stylekit-general-border-radius)}.sn-component .sk-input.sk-secondary:after,.sn-component .sk-notification.sk-secondary:after{content:"";display:block;height:100%;position:absolute;top:0;left:0;width:100%;border-radius:2px;border-radius:var(--sn-stylekit-general-border-radius);pointer-events:none;color:#e3e3e3;color:var(--sn-stylekit-secondary-border-color);border-color:#e3e3e3;border-color:var(--sn-stylekit-secondary-border-color)}.sn-component .sk-input.sk-secondary.no-bg,.sn-component .sk-notification.sk-secondary.no-bg{background-color:transparent}.sn-component .sk-input.sk-secondary.no-bg:before,.sn-component .sk-notification.sk-secondary.no-bg:before{content:none}.sn-component .sk-input.sk-secondary.featured,.sn-component .sk-notification.sk-secondary.featured{border:none;padding:.75rem 1.25rem;font-size:1.1rem;font-size:var(--sn-stylekit-font-size-h3)}.sn-component .sk-input.sk-secondary.featured:before,.sn-component .sk-notification.sk-secondary.featured:before{opacity:1}.sn-component .sk-input.sk-secondary-contrast,.sn-component .sk-notification.sk-secondary-contrast{color:#2e2e2e;color:var(--sn-stylekit-secondary-contrast-foreground-color);position:relative;background-color:#e3e3e3;background-color:var(--sn-stylekit-secondary-contrast-background-color);overflow:hidden;border-radius:2px;border-radius:var(--sn-stylekit-general-border-radius);border-color:var(--sn-stylekit-secondary-contrast-border-color);border:1px solid var(--sn-stylekit-secondary-contrast-border-color)}.sn-component .sk-input.sk-secondary-contrast *,.sn-component .sk-notification.sk-secondary-contrast *{position:relative}.sn-component .sk-input.sk-secondary-contrast:before,.sn-component .sk-notification.sk-secondary-contrast:before{content:"";position:absolute;top:0;left:0;width:100%;height:100%;background-color:#e3e3e3;background-color:var(--sn-stylekit-secondary-contrast-background-color);opacity:1;border-radius:2px;border-radius:var(--sn-stylekit-general-border-radius)}.sn-component .sk-input.sk-secondary-contrast:after,.sn-component .sk-notification.sk-secondary-contrast:after{content:"";display:block;height:100%;position:absolute;top:0;left:0;width:100%;border-radius:2px;border-radius:var(--sn-stylekit-general-border-radius);pointer-events:none;color:var(--sn-stylekit-secondary-contrast-border-color);border-color:var(--sn-stylekit-secondary-contrast-border-color)}.sn-component .sk-input.sk-secondary-contrast.no-bg,.sn-component .sk-notification.sk-secondary-contrast.no-bg{background-color:transparent}.sn-component .sk-input.sk-secondary-contrast.no-bg:before,.sn-component .sk-notification.sk-secondary-contrast.no-bg:before{content:none}.sn-component .sk-input.sk-secondary-contrast.featured,.sn-component .sk-notification.sk-secondary-contrast.featured{border:none;padding:.75rem 1.25rem;font-size:1.1rem;font-size:var(--sn-stylekit-font-size-h3)}.sn-component .sk-input.sk-secondary-contrast.featured:before,.sn-component .sk-notification.sk-secondary-contrast.featured:before{opacity:1}.sn-component .sk-input.sk-base,.sn-component .sk-notification.sk-base{color:#000;color:var(--sn-stylekit-foreground-color);position:relative;background-color:#fff;background-color:var(--sn-stylekit-background-color);overflow:hidden;border-radius:2px;border-radius:var(--sn-stylekit-general-border-radius);border:1px solid #e3e3e3;border:1px solid var(--sn-stylekit-border-color)}.sn-component .sk-input.sk-base *,.sn-component .sk-notification.sk-base *{position:relative}.sn-component .sk-input.sk-base:before,.sn-component .sk-notification.sk-base:before{content:"";position:absolute;top:0;left:0;width:100%;height:100%;background-color:#fff;background-color:var(--sn-stylekit-background-color);opacity:1;border-radius:2px;border-radius:var(--sn-stylekit-general-border-radius)}.sn-component .sk-input.sk-base:after,.sn-component .sk-notification.sk-base:after{content:"";display:block;height:100%;position:absolute;top:0;left:0;width:100%;border-radius:2px;border-radius:var(--sn-stylekit-general-border-radius);pointer-events:none;color:#e3e3e3;color:var(--sn-stylekit-border-color);border-color:#e3e3e3;border-color:var(--sn-stylekit-border-color)}.sn-component .sk-input.sk-base.no-bg,.sn-component .sk-notification.sk-base.no-bg{background-color:transparent}.sn-component .sk-input.sk-base.no-bg:before,.sn-component .sk-notification.sk-base.no-bg:before{content:none}.sn-component .sk-input.sk-base.featured,.sn-component .sk-notification.sk-base.featured{border:none;padding:.75rem 1.25rem;font-size:1.1rem;font-size:var(--sn-stylekit-font-size-h3)}.sn-component .sk-input.sk-base.featured:before,.sn-component .sk-notification.sk-base.featured:before{opacity:1}.sn-component .sk-input.neutral,.sn-component .sk-notification.neutral{color:#fff;color:var(--sn-stylekit-neutral-contrast-color);position:relative;background-color:#989898;background-color:var(--sn-stylekit-neutral-color);overflow:hidden;border-radius:2px;border-radius:var(--sn-stylekit-general-border-radius);border-color:#989898;border-color:var(--sn-stylekit-neutral-color)}.sn-component .sk-input.neutral *,.sn-component .sk-notification.neutral *{position:relative}.sn-component .sk-input.neutral:before,.sn-component .sk-notification.neutral:before{content:"";position:absolute;top:0;left:0;width:100%;height:100%;background-color:#989898;background-color:var(--sn-stylekit-neutral-color);opacity:1;border-radius:2px;border-radius:var(--sn-stylekit-general-border-radius)}.sn-component .sk-input.neutral:after,.sn-component .sk-notification.neutral:after{content:"";display:block;height:100%;position:absolute;top:0;left:0;width:100%;border-radius:2px;border-radius:var(--sn-stylekit-general-border-radius);pointer-events:none;box-shadow:inset 0 0 0 1px;color:#989898;color:var(--sn-stylekit-neutral-color)}.sn-component .sk-input.neutral.no-bg,.sn-component .sk-notification.neutral.no-bg{background-color:transparent}.sn-component .sk-input.neutral.no-bg:before,.sn-component .sk-notification.neutral.no-bg:before{content:none}.sn-component .sk-input.neutral.featured,.sn-component .sk-notification.neutral.featured{border:none;padding:.75rem 1.25rem;font-size:1.1rem;font-size:var(--sn-stylekit-font-size-h3)}.sn-component .sk-input.neutral.featured:before,.sn-component .sk-notification.neutral.featured:before{opacity:1}.sn-component .sk-input.info,.sn-component .sk-notification.info{color:#fff;color:var(--sn-stylekit-info-contrast-color);position:relative;background-color:#086dd6;background-color:var(--sn-stylekit-info-color);overflow:hidden;border-radius:2px;border-radius:var(--sn-stylekit-general-border-radius);border-color:#086dd6;border-color:var(--sn-stylekit-info-color)}.sn-component .sk-input.info *,.sn-component .sk-notification.info *{position:relative}.sn-component .sk-input.info:before,.sn-component .sk-notification.info:before{content:"";position:absolute;top:0;left:0;width:100%;height:100%;background-color:#086dd6;background-color:var(--sn-stylekit-info-color);opacity:1;border-radius:2px;border-radius:var(--sn-stylekit-general-border-radius)}.sn-component .sk-input.info:after,.sn-component .sk-notification.info:after{content:"";display:block;height:100%;position:absolute;top:0;left:0;width:100%;border-radius:2px;border-radius:var(--sn-stylekit-general-border-radius);pointer-events:none;box-shadow:inset 0 0 0 1px;color:#086dd6;color:var(--sn-stylekit-info-color)}.sn-component .sk-input.info.no-bg,.sn-component .sk-notification.info.no-bg{background-color:transparent}.sn-component .sk-input.info.no-bg:before,.sn-component .sk-notification.info.no-bg:before{content:none}.sn-component .sk-input.info.featured,.sn-component .sk-notification.info.featured{border:none;padding:.75rem 1.25rem;font-size:1.1rem;font-size:var(--sn-stylekit-font-size-h3)}.sn-component .sk-input.info.featured:before,.sn-component .sk-notification.info.featured:before{opacity:1}.sn-component .sk-input.warning,.sn-component .sk-notification.warning{color:#fff;color:var(--sn-stylekit-warning-contrast-color);position:relative;background-color:#f6a200;background-color:var(--sn-stylekit-warning-color);overflow:hidden;border-radius:2px;border-radius:var(--sn-stylekit-general-border-radius);border-color:#f6a200;border-color:var(--sn-stylekit-warning-color)}.sn-component .sk-input.warning *,.sn-component .sk-notification.warning *{position:relative}.sn-component .sk-input.warning:before,.sn-component .sk-notification.warning:before{content:"";position:absolute;top:0;left:0;width:100%;height:100%;background-color:#f6a200;background-color:var(--sn-stylekit-warning-color);opacity:1;border-radius:2px;border-radius:var(--sn-stylekit-general-border-radius)}.sn-component .sk-input.warning:after,.sn-component .sk-notification.warning:after{content:"";display:block;height:100%;position:absolute;top:0;left:0;width:100%;border-radius:2px;border-radius:var(--sn-stylekit-general-border-radius);pointer-events:none;box-shadow:inset 0 0 0 1px;color:#f6a200;color:var(--sn-stylekit-warning-color)}.sn-component .sk-input.warning.no-bg,.sn-component .sk-notification.warning.no-bg{background-color:transparent}.sn-component .sk-input.warning.no-bg:before,.sn-component .sk-notification.warning.no-bg:before{content:none}.sn-component .sk-input.warning.featured,.sn-component .sk-notification.warning.featured{border:none;padding:.75rem 1.25rem;font-size:1.1rem;font-size:var(--sn-stylekit-font-size-h3)}.sn-component .sk-input.warning.featured:before,.sn-component .sk-notification.warning.featured:before{opacity:1}.sn-component .sk-input.danger,.sn-component .sk-notification.danger{color:#fff;color:var(--sn-stylekit-danger-contrast-color);position:relative;background-color:#f80324;background-color:var(--sn-stylekit-danger-color);overflow:hidden;border-radius:2px;border-radius:var(--sn-stylekit-general-border-radius);border-color:#f80324;border-color:var(--sn-stylekit-danger-color)}.sn-component .sk-input.danger *,.sn-component .sk-notification.danger *{position:relative}.sn-component .sk-input.danger:before,.sn-component .sk-notification.danger:before{content:"";position:absolute;top:0;left:0;width:100%;height:100%;background-color:#f80324;background-color:var(--sn-stylekit-danger-color);opacity:1;border-radius:2px;border-radius:var(--sn-stylekit-general-border-radius)}.sn-component .sk-input.danger:after,.sn-component .sk-notification.danger:after{content:"";display:block;height:100%;position:absolute;top:0;left:0;width:100%;border-radius:2px;border-radius:var(--sn-stylekit-general-border-radius);pointer-events:none;box-shadow:inset 0 0 0 1px;color:#f80324;color:var(--sn-stylekit-danger-color)}.sn-component .sk-input.danger.no-bg,.sn-component .sk-notification.danger.no-bg{background-color:transparent}.sn-component .sk-input.danger.no-bg:before,.sn-component .sk-notification.danger.no-bg:before{content:none}.sn-component .sk-input.danger.featured,.sn-component .sk-notification.danger.featured{border:none;padding:.75rem 1.25rem;font-size:1.1rem;font-size:var(--sn-stylekit-font-size-h3)}.sn-component .sk-input.danger.featured:before,.sn-component .sk-notification.danger.featured:before{opacity:1}.sn-component .sk-input.success,.sn-component .sk-notification.success{color:#fff;color:var(--sn-stylekit-success-contrast-color);position:relative;background-color:#2b9612;background-color:var(--sn-stylekit-success-color);overflow:hidden;border-radius:2px;border-radius:var(--sn-stylekit-general-border-radius);border-color:#2b9612;border-color:var(--sn-stylekit-success-color)}.sn-component .sk-input.success *,.sn-component .sk-notification.success *{position:relative}.sn-component .sk-input.success:before,.sn-component .sk-notification.success:before{content:"";position:absolute;top:0;left:0;width:100%;height:100%;background-color:#2b9612;background-color:var(--sn-stylekit-success-color);opacity:1;border-radius:2px;border-radius:var(--sn-stylekit-general-border-radius)}.sn-component .sk-input.success:after,.sn-component .sk-notification.success:after{content:"";display:block;height:100%;position:absolute;top:0;left:0;width:100%;border-radius:2px;border-radius:var(--sn-stylekit-general-border-radius);pointer-events:none;box-shadow:inset 0 0 0 1px;color:#2b9612;color:var(--sn-stylekit-success-color)}.sn-component .sk-input.success.no-bg,.sn-component .sk-notification.success.no-bg{background-color:transparent}.sn-component .sk-input.success.no-bg:before,.sn-component .sk-notification.success.no-bg:before{content:none}.sn-component .sk-input.success.featured,.sn-component .sk-notification.success.featured{border:none;padding:.75rem 1.25rem;font-size:1.1rem;font-size:var(--sn-stylekit-font-size-h3)}.sn-component .sk-input.success.featured:before,.sn-component .sk-notification.success.featured:before{opacity:1}.sn-component .sk-notification{padding:1.1rem 1rem;margin:1.4rem 0;text-align:left;cursor:default}.sn-component .sk-notification.one-line{padding:0 .4rem}.sn-component .sk-notification.stretch{width:100%}.sn-component .sk-notification.dashed{border-style:dashed;border-width:2px}.sn-component .sk-notification.dashed:after{box-shadow:none}.sn-component .sk-notification .sk-notification-title{font-size:1.3rem;font-size:var(--sn-stylekit-font-size-h1);font-weight:700;line-height:1.9rem}.sn-component .sk-notification .sk-notification-text{line-height:1.5rem;font-size:1rem;font-size:var(--sn-stylekit-font-size-p);text-align:left;font-weight:400}.sn-component .sk-circle{cursor:pointer;border:1px solid #2e2e2e;border-color:var(--sn-stylekit-contrast-foreground-color);background-color:#f6f6f6;background-color:var(--sn-stylekit-contrast-background-color);padding:0;border-radius:50%!important;flex-shrink:0}.sn-component .sk-circle:after,.sn-component .sk-circle:before{border-radius:50%!important}.sn-component .sk-circle.small{width:11px;height:11px}.sn-component .sk-spinner{border-left:1px solid #989898;border-bottom:1px solid #989898;border-top:1px solid #989898;border:1px solid var(--sn-stylekit-neutral-color);border-radius:50%;animation:rotate .8s linear infinite;border-right:1px solid transparent}.sn-component .sk-spinner.small{width:12px;height:12px}.sn-component .sk-spinner.info-contrast{border-color:#fff;border-color:var(--sn-stylekit-info-contrast-color);border-right-color:transparent}.sn-component .sk-spinner.info{border-color:#086dd6;border-color:var(--sn-stylekit-info-color);border-right-color:transparent}.sn-component .sk-spinner.warning{border-color:#f6a200;border-color:var(--sn-stylekit-warning-color);border-right-color:transparent}.sn-component .sk-spinner.danger{border-color:#f80324;border-color:var(--sn-stylekit-danger-color);border-right-color:transparent}.sn-component .sk-spinner.success{border-color:#2b9612;border-color:var(--sn-stylekit-success-color);border-right-color:transparent}@keyframes rotate{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}.sn-component .sk-app-bar{display:flex;width:100%;height:2rem;padding:0 .8rem;background-color:#f6f6f6;background-color:var(--sn-stylekit-contrast-background-color);color:#2e2e2e;color:var(--sn-stylekit-contrast-foreground-color);justify-content:space-between;align-items:center;border:1px solid #e3e3e3;border:1px solid var(--sn-stylekit-contrast-border-color);-webkit-user-select:none;-ms-user-select:none;user-select:none}.sn-component .sk-app-bar.no-edges{border-left:0;border-right:0}.sn-component .sk-app-bar.no-bottom-edge{border-bottom:0}.sn-component .sk-app-bar .left,.sn-component .sk-app-bar .right{display:flex;height:100%}.sn-component .sk-app-bar .sk-app-bar-item{flex-grow:1;cursor:pointer;display:flex;align-items:center;justify-content:center}.sn-component .sk-app-bar .sk-app-bar-item:not(:first-child){margin-left:1rem}.sn-component .sk-app-bar .sk-app-bar-item.border{border-left:1px solid #e3e3e3;border-left:1px solid var(--sn-stylekit-contrast-border-color)}.sn-component .sk-app-bar .sk-app-bar-item>.sk-app-bar-item-column{height:100%;display:flex;align-items:center}.sn-component .sk-app-bar .sk-app-bar-item>.sk-app-bar-item-column:not(:first-child){margin-left:.5rem}.sn-component .sk-app-bar .sk-app-bar-item>.sk-app-bar-item-column.underline{border-bottom:2px solid #086dd6;border-bottom:2px solid var(--sn-stylekit-info-color)}.sn-component .sk-app-bar .sk-app-bar-item.no-pointer{cursor:default}.sn-component .sk-app-bar .sk-app-bar-item:hover>.sk-app-bar-item-column>.sk-label:not(.subtle),.sn-component .sk-app-bar .sk-app-bar-item:hover>.sk-app-bar-item-column>.sk-sublabel:not(.subtle),.sn-component .sk-app-bar .sk-app-bar-item:hover>.sk-label:not(.subtle),.sn-component .sk-app-bar .sk-app-bar-item:hover>.sk-sublabel:not(.subtle),.sn-component .sk-app-bar .sk-panel-section .sk-app-bar-item:hover>.sk-app-bar-item-column>.sk-panel-section-subtitle:not(.subtle),.sn-component .sk-app-bar .sk-panel-section .sk-app-bar-item:hover>.sk-panel-section-subtitle:not(.subtle),.sn-component .sk-panel-section .sk-app-bar .sk-app-bar-item:hover>.sk-app-bar-item-column>.sk-panel-section-subtitle:not(.subtle),.sn-component .sk-panel-section .sk-app-bar .sk-app-bar-item:hover>.sk-panel-section-subtitle:not(.subtle){color:#086dd6;color:var(--sn-stylekit-info-color)}.sn-component .sk-app-bar .sk-app-bar-item>.sk-app-bar-item-column>.sk-label,.sn-component .sk-app-bar .sk-app-bar-item>.sk-label,.sn-component .sk-app-bar .sk-panel-section .sk-app-bar-item>.sk-app-bar-item-column>.sk-panel-section-subtitle,.sn-component .sk-app-bar .sk-panel-section .sk-app-bar-item>.sk-panel-section-subtitle,.sn-component .sk-panel-section .sk-app-bar .sk-app-bar-item>.sk-app-bar-item-column>.sk-panel-section-subtitle,.sn-component .sk-panel-section .sk-app-bar .sk-app-bar-item>.sk-panel-section-subtitle{font-weight:700;font-size:.9rem;font-size:var(--sn-stylekit-font-size-h5);white-space:nowrap}.sn-component .sk-app-bar .sk-app-bar-item>.sk-app-bar-item-column>.sk-sublabel,.sn-component .sk-app-bar .sk-app-bar-item>.sk-sublabel{font-size:.9rem;font-size:var(--sn-stylekit-font-size-h5);font-weight:400;white-space:nowrap}.sn-component .sk-app-bar .sk-app-bar-item .subtle{font-weight:400;opacity:.6}.sn-component .sk-panel-table{display:flex;flex-wrap:wrap;padding-left:1px;padding-top:1px}.sn-component .sk-panel-table .sk-panel-table-item{flex:45% 1;flex-flow:wrap;border:1px solid #e3e3e3;border:1px solid var(--sn-stylekit-border-color);padding:1rem;margin-left:-1px;margin-top:-1px;display:flex;flex-direction:column;justify-content:space-between}.sn-component .sk-panel-table .sk-panel-table-item img{max-width:100%;margin-bottom:1rem}.sn-component .sk-panel-table .sk-panel-table-item .sk-panel-table-item-content{display:flex;flex-direction:row}.sn-component .sk-panel-table .sk-panel-table-item .sk-panel-table-item-column{align-items:center}.sn-component .sk-panel-table .sk-panel-table-item .sk-panel-table-item-column.stretch{width:100%}.sn-component .sk-panel-table .sk-panel-table-item .sk-panel-table-item-column:not(:first-child){padding-left:.75rem}.sn-component .sk-panel-table .sk-panel-table-item .sk-panel-table-item-column.quarter{flex-basis:25%}.sn-component .sk-panel-table .sk-panel-table-item .sk-panel-table-item-column.three-quarters{flex-basis:75%}.sn-component .sk-panel-table .sk-panel-table-item .sk-panel-table-item-footer{margin-top:1.25rem}.sn-component .sk-panel-table .sk-panel-table-item.no-border{border:none}.sn-component .sk-modal{position:fixed;margin-left:auto;margin-right:auto;left:0;right:0;top:0;bottom:0;z-index:10000;width:100vw;height:100vh;background-color:transparent;color:#2e2e2e;color:var(--sn-stylekit-contrast-foreground-color);display:flex;align-items:center;justify-content:center}.sn-component .sk-modal .sn-component,.sn-component .sk-modal .sn-component .sk-panel{height:100%}.sn-component .sk-modal.auto-height>.sk-modal-content{height:auto!important}.sn-component .sk-modal.large>.sk-modal-content{width:900px;height:600px}.sn-component .sk-modal.medium>.sk-modal-content{width:700px;height:500px}.sn-component .sk-modal.small>.sk-modal-content{width:700px;height:344px}.sn-component .sk-modal .sk-modal-background{position:absolute;z-index:-1;width:100%;height:100%;background-color:#f6f6f6;background-color:var(--sn-stylekit-contrast-background-color);opacity:.7}.sn-component .sk-modal>.sk-modal-content{overflow-y:auto;width:auto;padding:0;min-width:300px;box-shadow:0 2px 35px 0 rgba(0,0,0,.19)}.sn-component.no-select{-webkit-user-select:none;-ms-user-select:none;user-select:none}[contenteditable],input,textarea{caret-color:#000;caret-color:var(--sn-stylekit-editor-foreground-color)}.linux-desktop,.linux-web,.windows-desktop,.windows-web{scrollbar-width:thin}.linux-desktop ::-webkit-scrollbar,.linux-web ::-webkit-scrollbar,.windows-desktop ::-webkit-scrollbar,.windows-web ::-webkit-scrollbar{width:17px;height:18px;border-left:.5px solid var(--sn-stylekit-scrollbar-track-border-color-color)}.linux-desktop ::-webkit-scrollbar-thumb,.linux-web ::-webkit-scrollbar-thumb,.windows-desktop ::-webkit-scrollbar-thumb,.windows-web ::-webkit-scrollbar-thumb{border:4px solid transparent;background-clip:padding-box;-webkit-border-radius:10px;background-color:#dfdfdf;background-color:var(--sn-stylekit-scrollbar-thumb-color);-webkit-box-shadow:inset -1px -1px 0 rgba(0,0,0,.05),inset 1px 1px 0 rgba(0,0,0,.05)}.linux-desktop ::-webkit-scrollbar-button,.linux-web ::-webkit-scrollbar-button,.windows-desktop ::-webkit-scrollbar-button,.windows-web ::-webkit-scrollbar-button{width:0;height:0;display:none}.linux-desktop ::-webkit-scrollbar-corner,.linux-web ::-webkit-scrollbar-corner,.windows-desktop ::-webkit-scrollbar-corner,.windows-web ::-webkit-scrollbar-corner{background-color:transparent} +/*# sourceMappingURL=2.ee6590b6.chunk.css.map */ \ No newline at end of file diff --git a/build/static/css/2.ee6590b6.chunk.css.map b/build/static/css/2.ee6590b6.chunk.css.map new file mode 100644 index 0000000..47426c4 --- /dev/null +++ b/build/static/css/2.ee6590b6.chunk.css.map @@ -0,0 +1 @@ +{"version":3,"sources":["webpack://node_modules/sn-stylekit/dist/stylekit.css"],"names":[],"mappings":"AAAA,MAAM,iCAA6B,CAAM,gCAA0B,CAAQ,sCAA+B,CAAS,iCAA2B,CAAQ,iCAA2B,CAAQ,iCAA2B,CAAQ,iCAA2B,CAAQ,iCAA2B,CAAQ,iCAA2B,CAAQ,mCAA4B,CAAS,yCAAqC,CAAO,gCAAyB,CAAS,sCAAkC,CAAO,mCAA4B,CAAS,yCAAqC,CAAO,mCAA4B,CAAS,yCAAqC,CAAO,kCAA2B,CAAS,wCAAoC,CAAO,kCAA2B,CAAS,mCAA+B,CAAO,kCAA2B,CAAS,mCAA+B,CAAO,+CAAwC,CAAS,+CAAwC,CAAS,2CAAoC,CAAS,gDAAyC,CAAS,gDAAyC,CAAS,4CAAqC,CAAS,yDAAkD,CAAS,yDAAkD,CAAS,qDAA8C,CAAS,yEAAsC,CAAqC,yEAAsC,CAAqC,0CAAmC,CAAS,6CAAsC,CAAoB,wCAAiC,CAAS,2CAAoC,CAAS,kDAA2C,CAAS,uCAAoC,CAAK,+DAAqC,CAAA,4DAA8D,CAAA,gNAAkE,CAE5zD,cAAc,6KAA8C,CAA9C,8CAA8C,CAAC,kCAAkC,CAAC,UAAA,CAAA,yCAAyC,CAAC,wBAAwB,4BAAsD,CAAtD,oDAAsD,CAAC,qBAAoD,CAApD,oDAAoD,CAAC,wBAAgD,CAAhD,gDAAgD,CAAC,iBAAsD,CAAtD,sDAAsD,CAAC,YAAY,CAAC,qBAAqB,CAAC,aAAa,CAAC,WAAW,CAAC,gCAAgC,yBAAyB,CAAC,+BAA+B,eAAe,CAAC,WAAW,CAAC,eAAe,CAAC,yCAAyC,aAAa,CAAC,YAAY,CAAC,6BAA6B,CAAC,mBAAmB,CAAC,+BAAgE,CAAhE,gEAAgE,CAAC,wBAA6D,CAA7D,6DAA6D,CAAC,aAAkD,CAAlD,kDAAkD,CAAC,kBAAkB,CAAC,gEAAgE,gBAAyC,CAAzC,yCAAyC,CAAC,eAAe,CAAC,uDAAuD,eAAgB,CAAC,4EAA4E,iBAAiB,CAAC,4BAAoD,CAApD,oDAAoD,CAAC,qBAAqB,CAAC,wGAAwG,YAAiB,CAAC,wFAAwF,eAAe,CAAC,aAAa,CAAC,0FAA0F,gBAAgB,CAAC,aAAa,CAAC,0CAA8D,qBAAgB,CAAC,WAAW,CAAC,eAAe,CAAC,WAAW,CAAC,yBAA0B,CAAC,yBAA0B,CAAC,iGAAiG,aAA6C,CAA7C,6CAA6C,CAAC,eAAe,CAAC,gCAAgC,qBAAqB,CAAC,YAAY,CAAC,qBAAqB,CAAC,8CAA8C,iBAAiB,CAAC,iDAAiD,eAAe,CAAC,iDAAiD,oBAAoB,CAAC,+BAAA,CAAA,uDAAuD,CAAC,2DAA2D,kBAAkB,CAAC,2CAA2C,mBAAoB,CAAC,8CAA8C,gBAAgB,CAAC,eAAe,CAAC,wDAAwD,mBAAoB,CAAC,eAAgB,CAAC,gBAAA,CAAA,yCAAyC,CAAC,8DAA8D,+BAAuD,CAAvD,uDAAuD,CAAC,oBAAqB,CAAC,iBAAiB,CAAC,kBAAkB,CAAC,gBAAA,CAAA,yCAAyC,CAAC,2DAA2D,eAAyC,CAAzC,yCAAyC,CAAC,iBAAiB,CAAC,kEAAkE,eAAkB,CAAC,UAAW,CAAC,oDAAoD,kBAAkB,CAAC,4DAA4D,gBAAiB,CAAC,4BAA4B,YAAY,CAAC,6BAA6B,CAAC,kBAAkB,CAAC,iBAAkB,CAAC,qCAAqC,sBAAsB,CAAC,0CAA0C,wBAAwB,CAAC,yCAAyC,0BAA0B,CAAC,sCAAsC,sBAAsB,CAAC,qDAAqD,UAAU,CAAC,yFAAyF,oBAAqB,CAAC,sCAAsC,iBAAkB,CAAC,oBAAqB,CAAC,kCAAkC,QAAQ,CAAC,SAAS,CAAC,6BAA6B,wBAAgD,CAAhD,gDAAgD,CAAC,aAAa,CAAC,SAAS,CAAC,6BAA6B,UAAU,CAAC,kCAAkC,SAAS,CAAC,0CAA0C,iBAAkB,CAAC,6BAA6B,wBAAwB,CAAC,gBAAgB,CAAC,6BAA6B,qBAAoD,CAApD,oDAAoD,CAAC,wBAAyD,CAAzD,yDAAyD,CAAC,iBAAsD,CAAtD,sDAAsD,CAAC,eAAe,CAAC,wBAAgB,CAAhB,oBAAgB,CAAhB,gBAAgB,CAAC,yBAA0B,CAAC,yBAA0B,CAAC,mDAAmD,kBAAmB,CAAC,+BAAgE,CAAhE,gEAAgE,CAAC,wBAA6D,CAA7D,6DAA6D,CAAC,aAAkD,CAAlD,kDAAkD,CAAC,YAAY,CAAC,6BAA6B,CAAC,kBAAkB,CAAC,yDAAyD,eAAgB,CAAC,cAAA,CAAA,yCAAyC,CAAC,4DAA4D,gBAAiB,CAAC,UAAW,CAAC,gDAAgD,YAAiB,CAAC,cAAc,CAAC,YAAY,CAAC,kBAAkB,CAAC,6BAA6B,CAAC,+BAAA,CAAA,uDAAuD,CAAC,sDAAsD,wBAA6D,CAA7D,6DAA6D,CAAC,aAAkD,CAAlD,kDAAkD,CAAC,oBAAA,CAAA,qDAAqD,CAAC,sEAAsE,YAAY,CAAC,sBAAsB,CAAC,qBAAqB,CAAC,wFAAwF,iBAAmB,CAAC,oBAAqB,CAAC,8EAA8E,UAAU,CAAC,6FAA6F,eAAe,CAAC,qLAAqL,wBAAyD,CAAzD,yDAAyD,CAAC,eAAe,CAAC,iMAAiM,qBAAA,CAAA,oDAAoD,CAAC,4EAA4E,YAAY,CAAC,iiBAAiiB,eAAyC,CAAzC,yCAAyC,CAAC,eAAkB,CAAC,oPAAoP,cAAwC,CAAxC,wCAAwC,CAAC,eAAgB,CAAC,6DAA6D,eAAyC,CAAzC,yCAAyC,CAAC,gBAAiB,CAAC,UAAW,CAAC,mBAAmB,aAAA,CAAA,qCAAqC,CAAC,sBAAsB,aAAA,CAAA,mCAAmC,CAAC,0BAA0B,0BAA2B,CAAC,8BAA+B,CAAC,+BAAgC,CAAC,kCAAmC,CAAC,yGAAyG,QAAQ,CAAC,SAAS,CAAC,eAAkB,CAAC,qBAAqB,eAAe,CAAC,gBAAyC,CAAzC,yCAAyC,CAAC,kBAAkB,CAAC,qBAAqB,gBAAyC,CAAzC,yCAAyC,CAAC,kBAAkB,CAAC,qBAAqB,gBAAyC,CAAzC,yCAAyC,CAAC,kBAAkB,CAAC,qBAAqB,cAAwC,CAAxC,wCAAwC,CAAC,kBAAkB,CAAC,qBAAqB,eAAA,CAAA,yCAAyC,CAAC,uBAAuB,eAAgB,CAAC,6BAA6B,eAAA,CAAA,yCAAyC,CAAC,8BAA8B,cAAA,CAAA,wCAAwC,CAAC,6BAA6B,gBAAA,CAAA,yCAAyC,CAAC,qBAAqB,cAAc,CAAC,wBAAA,CAAA,oBAAA,CAAA,gBAAgB,CAAC,8BAA8B,aAAsC,CAAtC,sCAAsC,CAAC,UAAW,CAAC,2BAA2B,iBAAsD,CAAtD,sDAAsD,CAAC,mBAAqB,CAAC,iCAAiC,oBAAoB,CAAC,mCAAmC,wBAAiD,CAAjD,iDAAiD,CAAC,UAAA,CAAA,+CAA+C,CAAC,gCAAgC,wBAA8C,CAA9C,8CAA8C,CAAC,UAAA,CAAA,4CAA4C,CAAC,mCAAmC,wBAAiD,CAAjD,iDAAiD,CAAC,UAAA,CAAA,+CAA+C,CAAC,kCAAkC,wBAAgD,CAAhD,gDAAgD,CAAC,UAAA,CAAA,8CAA8C,CAAC,mCAAmC,wBAAiD,CAAjD,iDAAiD,CAAC,UAAA,CAAA,+CAA+C,CAAC,oBAAoB,oBAAoB,CAAC,uBAAwB,UAAA,CAAA,yCAAyC,CAAC,wBAAyB,aAAA,CAAA,kDAAkD,CAAC,uBAAwB,aAAA,CAAA,sCAAsC,CAAC,oBAAqB,aAAA,CAAA,mCAAmC,CAAC,6BAA8B,UAAA,CAAA,4CAA4C,CAAC,uBAAwB,aAAA,CAAA,sCAAsC,CAAC,sBAAuB,aAAA,CAAA,qCAAqC,CAAC,uBAAwB,aAAA,CAAA,sCAAsC,CAAC,sBAAuB,uBAAA,CAAA,6CAA8C,CAAC,yBAA0B,uBAAA,CAAA,gDAAiD,CAAC,wBAAyB,uBAAA,CAAA,+CAAgD,CAAC,yBAA0B,uBAAA,CAAA,gDAAiD,CAAC,qBAAsB,4BAA4B,CAAC,WAAW,CAAC,2BAA2B,2BAA4B,CAAC,gCAAiC,CAAC,qBAAqB,cAAe,CAAC,6BAA6B,qBAAqB,CAAC,mBAAqB,CAAC,cAAgB,CAAC,WAAW,CAAC,gBAAyC,CAAzC,yCAAyC,CAAC,UAAU,CAAC,SAAS,CAAC,WAAW,CAAC,mCAAmC,UAAyC,CAAzC,yCAAyC,CAAC,4BAA4B,CAAC,WAAW,CAAC,uCAAuC,WAAW,CAAC,mFAAmF,eAAgB,CAAC,mGAAmG,eAAkB,CAAC,6FAA6F,cAAe,CAAC,aAAa,CAAC,uKAA6K,UAAU,CAAC,mBAAoB,CAAC,qBAAqB,CAAC,qEAAqE,oBAAoB,CAAC,qBAAqB,CAAC,uGAAyG,iBAAkB,CAAC,gCAAgC,+BAAA,CAAA,uDAAuD,CAAC,iCAAiC,iBAAkB,CAAC,oBAAqB,CAAC,0CAA4B,aAAA,CAAA,gDAAgD,CAA5E,4BAA4B,aAAA,CAAA,gDAAgD,CAAC,qCAAqC,aAAA,CAAA,gDAAgD,CAAC,sCAAsC,aAAA,CAAA,gDAAgD,CAAC,uCAAuC,YAAY,CAAC,UAAU,CAAC,iGAAiG,aAAa,CAAC,WAAW,CAAC,iBAAiB,CAAC,iFAAiF,oBAAoB,CAAC,qBAAqB,CAAC,mHAAmH,gBAAgB,CAAC,qIAAqI,gBAAgB,CAAC,oCAAoC,YAAY,CAAC,kBAAkB,CAAC,2FAA2F,eAAe,CAAC,kBAAkB,CAAC,QAAQ,CAAC,uBAAwB,CAAC,wBAAyB,CAAC,6HAA6H,iBAAiB,CAAC,eAAe,CAAC,mHAAmH,0BAA+D,CAA/D,+DAA+D,CAAC,6BAAkE,CAAlE,kEAAkE,CAAC,iBAAiB,CAAC,yBAAyB,CAAC,4BAA4B,CAAC,iHAAiH,2BAAgE,CAAhE,gEAAgE,CAAC,8BAAmE,CAAnE,mEAAmE,CAAC,gBAAgB,CAAC,wBAAwB,CAAC,2BAA2B,CAAC,oCAAoC,oBAAoB,CAAC,qDAAqD,gBAAgB,CAAC,2BAA2B,oBAAoB,CAAC,+CAA+C,aAAa,CAAC,mBAAqB,CAAC,eAAyC,CAAzC,yCAAyC,CAAC,cAAc,CAAC,iBAAiB,CAAC,wBAAA,CAAA,oBAAA,CAAA,gBAAgB,CAAC,2FAA2F,2BAA4B,CAAC,yDAAyD,oBAAqB,CAAC,4MAA4M,eAAgB,CAAC,aAAa,CAAC,iBAAiB,CAAC,uDAAuD,gBAAyC,CAAzC,yCAAyC,CAAC,oBAAqB,CAAC,sBAAsB,qBAAqB,CAAC,8HAA8H,UAAyC,CAAzC,yCAAyC,CAAC,iBAAiB,CAAC,qBAAoD,CAApD,oDAAoD,CAAC,eAAe,CAAC,iBAAsD,CAAtD,sDAAsD,CAAC,iBAAA,CAAA,gDAAgD,CAAC,sIAAsI,iBAAiB,CAAC,0JAA0J,UAAU,CAAC,iBAAiB,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,qBAAoD,CAApD,oDAAoD,CAAC,SAAW,CAAC,iBAAA,CAAA,sDAAsD,CAAC,sJAAsJ,UAAU,CAAC,aAAa,CAAC,WAAW,CAAC,iBAAiB,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,iBAAsD,CAAtD,sDAAsD,CAAC,mBAAmB,CAAC,0BAA0B,CAAC,UAAA,CAAA,yCAAyC,CAAC,kLAAkL,+BAAA,CAAA,uBAAuB,CAAC,sJAAsJ,4BAA4B,CAAC,kLAAkL,YAAY,CAAC,kKAAkK,WAAW,CAAC,sBAAuB,CAAC,gBAAA,CAAA,yCAAyC,CAAC,8LAA8L,SAAW,CAAC,kIAAkI,aAAkD,CAAlD,kDAAkD,CAAC,iBAAiB,CAAC,wBAA6D,CAA7D,6DAA6D,CAAC,eAAe,CAAC,iBAAsD,CAAtD,sDAAsD,CAAC,oBAAA,CAAA,yDAAyD,CAAC,0IAA0I,iBAAiB,CAAC,8JAA8J,UAAU,CAAC,iBAAiB,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,wBAA6D,CAA7D,6DAA6D,CAAC,SAAW,CAAC,iBAAA,CAAA,sDAAsD,CAAC,0JAA0J,UAAU,CAAC,aAAa,CAAC,WAAW,CAAC,iBAAiB,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,iBAAsD,CAAtD,sDAAsD,CAAC,mBAAmB,CAAC,0BAA0B,CAAC,aAAA,CAAA,kDAAkD,CAAC,sLAAsL,+BAAA,CAAA,uBAAuB,CAAC,0JAA0J,4BAA4B,CAAC,sLAAsL,YAAY,CAAC,sKAAsK,WAAW,CAAC,sBAAuB,CAAC,gBAAA,CAAA,yCAAyC,CAAC,kMAAkM,SAAW,CAAC,kJAAkJ,aAAmD,CAAnD,mDAAmD,CAAC,iBAAiB,CAAC,wBAA8D,CAA9D,8DAA8D,CAAC,eAAe,CAAC,iBAAsD,CAAtD,sDAAsD,CAAC,oBAAA,CAAA,0DAA0D,CAAC,0JAA0J,iBAAiB,CAAC,8KAA8K,UAAU,CAAC,iBAAiB,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,wBAA8D,CAA9D,8DAA8D,CAAC,SAAW,CAAC,iBAAA,CAAA,sDAAsD,CAAC,0KAA0K,UAAU,CAAC,aAAa,CAAC,WAAW,CAAC,iBAAiB,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,iBAAsD,CAAtD,sDAAsD,CAAC,mBAAmB,CAAC,0BAA0B,CAAC,aAAA,CAAA,mDAAmD,CAAC,sMAAsM,+BAAA,CAAA,uBAAuB,CAAC,0KAA0K,4BAA4B,CAAC,sMAAsM,YAAY,CAAC,sLAAsL,WAAW,CAAC,sBAAuB,CAAC,gBAAA,CAAA,yCAAyC,CAAC,kNAAkN,SAAW,CAAC,sLAAsL,aAA4D,CAA5D,4DAA4D,CAAC,iBAAiB,CAAC,wBAAuE,CAAvE,uEAAuE,CAAC,eAAe,CAAC,iBAAsD,CAAtD,sDAAsD,CAAC,oBAAA,CAAA,mEAAmE,CAAC,8LAA8L,iBAAiB,CAAC,kNAAkN,UAAU,CAAC,iBAAiB,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,wBAAuE,CAAvE,uEAAuE,CAAC,SAAW,CAAC,iBAAA,CAAA,sDAAsD,CAAC,8MAA8M,UAAU,CAAC,aAAa,CAAC,WAAW,CAAC,iBAAiB,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,iBAAsD,CAAtD,sDAAsD,CAAC,mBAAmB,CAAC,0BAA0B,CAAC,aAAA,CAAA,4DAA4D,CAAC,0OAA0O,+BAAA,CAAA,uBAAuB,CAAC,8MAA8M,4BAA4B,CAAC,0OAA0O,YAAY,CAAC,0NAA0N,WAAW,CAAC,sBAAuB,CAAC,gBAAA,CAAA,yCAAyC,CAAC,sPAAsP,SAAW,CAAC,8HAA8H,UAA+C,CAA/C,+CAA+C,CAAC,iBAAiB,CAAC,wBAAiD,CAAjD,iDAAiD,CAAC,eAAe,CAAC,iBAAsD,CAAtD,sDAAsD,CAAC,oBAAA,CAAA,6CAA6C,CAAC,sIAAsI,iBAAiB,CAAC,0JAA0J,UAAU,CAAC,iBAAiB,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,wBAAiD,CAAjD,iDAAiD,CAAC,SAAW,CAAC,iBAAA,CAAA,sDAAsD,CAAC,sJAAsJ,UAAU,CAAC,aAAa,CAAC,WAAW,CAAC,iBAAiB,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,iBAAsD,CAAtD,sDAAsD,CAAC,mBAAmB,CAAC,0BAA0B,CAAC,aAAA,CAAA,sCAAsC,CAAC,kLAAkL,+BAAA,CAAA,uBAAuB,CAAC,sJAAsJ,4BAA4B,CAAC,kLAAkL,YAAY,CAAC,kKAAkK,WAAW,CAAC,sBAAuB,CAAC,gBAAA,CAAA,yCAAyC,CAAC,8LAA8L,SAAW,CAAC,kHAAkH,UAA4C,CAA5C,4CAA4C,CAAC,iBAAiB,CAAC,wBAA8C,CAA9C,8CAA8C,CAAC,eAAe,CAAC,iBAAsD,CAAtD,sDAAsD,CAAC,oBAAA,CAAA,0CAA0C,CAAC,0HAA0H,iBAAiB,CAAC,8IAA8I,UAAU,CAAC,iBAAiB,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,wBAA8C,CAA9C,8CAA8C,CAAC,SAAW,CAAC,iBAAA,CAAA,sDAAsD,CAAC,0IAA0I,UAAU,CAAC,aAAa,CAAC,WAAW,CAAC,iBAAiB,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,iBAAsD,CAAtD,sDAAsD,CAAC,mBAAmB,CAAC,0BAA0B,CAAC,aAAA,CAAA,mCAAmC,CAAC,sKAAsK,+BAAA,CAAA,uBAAuB,CAAC,0IAA0I,4BAA4B,CAAC,sKAAsK,YAAY,CAAC,sJAAsJ,WAAW,CAAC,sBAAuB,CAAC,gBAAA,CAAA,yCAAyC,CAAC,kLAAkL,SAAW,CAAC,8HAA8H,UAA+C,CAA/C,+CAA+C,CAAC,iBAAiB,CAAC,wBAAiD,CAAjD,iDAAiD,CAAC,eAAe,CAAC,iBAAsD,CAAtD,sDAAsD,CAAC,oBAAA,CAAA,6CAA6C,CAAC,sIAAsI,iBAAiB,CAAC,0JAA0J,UAAU,CAAC,iBAAiB,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,wBAAiD,CAAjD,iDAAiD,CAAC,SAAW,CAAC,iBAAA,CAAA,sDAAsD,CAAC,sJAAsJ,UAAU,CAAC,aAAa,CAAC,WAAW,CAAC,iBAAiB,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,iBAAsD,CAAtD,sDAAsD,CAAC,mBAAmB,CAAC,0BAA0B,CAAC,aAAA,CAAA,sCAAsC,CAAC,kLAAkL,+BAAA,CAAA,uBAAuB,CAAC,sJAAsJ,4BAA4B,CAAC,kLAAkL,YAAY,CAAC,kKAAkK,WAAW,CAAC,sBAAuB,CAAC,gBAAA,CAAA,yCAAyC,CAAC,8LAA8L,SAAW,CAAC,0HAA0H,UAA8C,CAA9C,8CAA8C,CAAC,iBAAiB,CAAC,wBAAgD,CAAhD,gDAAgD,CAAC,eAAe,CAAC,iBAAsD,CAAtD,sDAAsD,CAAC,oBAAA,CAAA,4CAA4C,CAAC,kIAAkI,iBAAiB,CAAC,sJAAsJ,UAAU,CAAC,iBAAiB,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,wBAAgD,CAAhD,gDAAgD,CAAC,SAAW,CAAC,iBAAA,CAAA,sDAAsD,CAAC,kJAAkJ,UAAU,CAAC,aAAa,CAAC,WAAW,CAAC,iBAAiB,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,iBAAsD,CAAtD,sDAAsD,CAAC,mBAAmB,CAAC,0BAA0B,CAAC,aAAA,CAAA,qCAAqC,CAAC,8KAA8K,+BAAA,CAAA,uBAAuB,CAAC,kJAAkJ,4BAA4B,CAAC,8KAA8K,YAAY,CAAC,8JAA8J,WAAW,CAAC,sBAAuB,CAAC,gBAAA,CAAA,yCAAyC,CAAC,0LAA0L,SAAW,CAAC,8HAA8H,UAA+C,CAA/C,+CAA+C,CAAC,iBAAiB,CAAC,wBAAiD,CAAjD,iDAAiD,CAAC,eAAe,CAAC,iBAAsD,CAAtD,sDAAsD,CAAC,oBAAA,CAAA,6CAA6C,CAAC,sIAAsI,iBAAiB,CAAC,0JAA0J,UAAU,CAAC,iBAAiB,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,wBAAiD,CAAjD,iDAAiD,CAAC,SAAW,CAAC,iBAAA,CAAA,sDAAsD,CAAC,sJAAsJ,UAAU,CAAC,aAAa,CAAC,WAAW,CAAC,iBAAiB,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,iBAAsD,CAAtD,sDAAsD,CAAC,mBAAmB,CAAC,0BAA0B,CAAC,aAAA,CAAA,sCAAsC,CAAC,kLAAkL,+BAAA,CAAA,uBAAuB,CAAC,sJAAsJ,4BAA4B,CAAC,kLAAkL,YAAY,CAAC,kKAAkK,WAAW,CAAC,sBAAuB,CAAC,gBAAA,CAAA,yCAAyC,CAAC,8LAA8L,SAAW,CAAC,yEAAyE,aAAkD,CAAlD,kDAAkD,CAAC,iBAAiB,CAAC,wBAA6D,CAA7D,6DAA6D,CAAC,eAAe,CAAC,iBAAsD,CAAtD,sDAAsD,CAAuD,wBAAA,CAAA,yDAAyD,CAAC,6EAA6E,iBAAiB,CAAC,uFAAuF,UAAU,CAAC,iBAAiB,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,wBAA6D,CAA7D,6DAA6D,CAAC,SAAW,CAAC,iBAAA,CAAA,sDAAsD,CAAC,qFAAqF,UAAU,CAAC,aAAa,CAAC,WAAW,CAAC,iBAAiB,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,iBAAsD,CAAtD,sDAAsD,CAAC,mBAAmB,CAAC,aAA8C,CAA9C,8CAA8C,CAAC,oBAAA,CAAA,qDAAqD,CAAC,qFAAqF,4BAA4B,CAAC,mGAAmG,YAAY,CAAC,2FAA2F,WAAW,CAAC,sBAAuB,CAAC,gBAAA,CAAA,yCAAyC,CAAC,yGAAyG,SAAW,CAAC,iFAAiF,aAAmD,CAAnD,mDAAmD,CAAC,iBAAiB,CAAC,wBAA8D,CAA9D,8DAA8D,CAAC,eAAe,CAAC,iBAAsD,CAAtD,sDAAsD,CAAwD,wBAAA,CAAA,0DAA0D,CAAC,qFAAqF,iBAAiB,CAAC,+FAA+F,UAAU,CAAC,iBAAiB,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,wBAA8D,CAA9D,8DAA8D,CAAC,SAAW,CAAC,iBAAA,CAAA,sDAAsD,CAAC,6FAA6F,UAAU,CAAC,aAAa,CAAC,WAAW,CAAC,iBAAiB,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,iBAAsD,CAAtD,sDAAsD,CAAC,mBAAmB,CAAC,aAA+C,CAA/C,+CAA+C,CAAC,oBAAA,CAAA,sDAAsD,CAAC,6FAA6F,4BAA4B,CAAC,2GAA2G,YAAY,CAAC,mGAAmG,WAAW,CAAC,sBAAuB,CAAC,gBAAA,CAAA,yCAAyC,CAAC,iHAAiH,SAAW,CAAC,mGAAmG,aAA4D,CAA5D,4DAA4D,CAAC,iBAAiB,CAAC,wBAAuE,CAAvE,uEAAuE,CAAC,eAAe,CAAC,iBAAsD,CAAtD,sDAAsD,CAAC,+DAA+D,CAAC,mEAAmE,CAAC,uGAAuG,iBAAiB,CAAC,iHAAiH,UAAU,CAAC,iBAAiB,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,wBAAuE,CAAvE,uEAAuE,CAAC,SAAW,CAAC,iBAAA,CAAA,sDAAsD,CAAC,+GAA+G,UAAU,CAAC,aAAa,CAAC,WAAW,CAAC,iBAAiB,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,iBAAsD,CAAtD,sDAAsD,CAAC,mBAAmB,CAAC,wDAAwD,CAAC,+DAA+D,CAAC,+GAA+G,4BAA4B,CAAC,6HAA6H,YAAY,CAAC,qHAAqH,WAAW,CAAC,sBAAuB,CAAC,gBAAA,CAAA,yCAAyC,CAAC,mIAAmI,SAAW,CAAC,uEAAuE,UAAyC,CAAzC,yCAAyC,CAAC,iBAAiB,CAAC,qBAAoD,CAApD,oDAAoD,CAAC,eAAe,CAAC,iBAAsD,CAAtD,sDAAsD,CAA8C,wBAAA,CAAA,gDAAgD,CAAC,2EAA2E,iBAAiB,CAAC,qFAAqF,UAAU,CAAC,iBAAiB,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,qBAAoD,CAApD,oDAAoD,CAAC,SAAW,CAAC,iBAAA,CAAA,sDAAsD,CAAC,mFAAmF,UAAU,CAAC,aAAa,CAAC,WAAW,CAAC,iBAAiB,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,iBAAsD,CAAtD,sDAAsD,CAAC,mBAAmB,CAAC,aAAqC,CAArC,qCAAqC,CAAC,oBAAA,CAAA,4CAA4C,CAAC,mFAAmF,4BAA4B,CAAC,iGAAiG,YAAY,CAAC,yFAAyF,WAAW,CAAC,sBAAuB,CAAC,gBAAA,CAAA,yCAAyC,CAAC,uGAAuG,SAAW,CAAC,uEAAuE,UAA+C,CAA/C,+CAA+C,CAAC,iBAAiB,CAAC,wBAAiD,CAAjD,iDAAiD,CAAC,eAAe,CAAC,iBAAsD,CAAtD,sDAAsD,CAAC,oBAAA,CAAA,6CAA6C,CAAC,2EAA2E,iBAAiB,CAAC,qFAAqF,UAAU,CAAC,iBAAiB,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,wBAAiD,CAAjD,iDAAiD,CAAC,SAAW,CAAC,iBAAA,CAAA,sDAAsD,CAAC,mFAAmF,UAAU,CAAC,aAAa,CAAC,WAAW,CAAC,iBAAiB,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,iBAAsD,CAAtD,sDAAsD,CAAC,mBAAmB,CAAC,0BAA0B,CAAC,aAAA,CAAA,sCAAsC,CAAC,mFAAmF,4BAA4B,CAAC,iGAAiG,YAAY,CAAC,yFAAyF,WAAW,CAAC,sBAAuB,CAAC,gBAAA,CAAA,yCAAyC,CAAC,uGAAuG,SAAW,CAAC,iEAAiE,UAA4C,CAA5C,4CAA4C,CAAC,iBAAiB,CAAC,wBAA8C,CAA9C,8CAA8C,CAAC,eAAe,CAAC,iBAAsD,CAAtD,sDAAsD,CAAC,oBAAA,CAAA,0CAA0C,CAAC,qEAAqE,iBAAiB,CAAC,+EAA+E,UAAU,CAAC,iBAAiB,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,wBAA8C,CAA9C,8CAA8C,CAAC,SAAW,CAAC,iBAAA,CAAA,sDAAsD,CAAC,6EAA6E,UAAU,CAAC,aAAa,CAAC,WAAW,CAAC,iBAAiB,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,iBAAsD,CAAtD,sDAAsD,CAAC,mBAAmB,CAAC,0BAA0B,CAAC,aAAA,CAAA,mCAAmC,CAAC,6EAA6E,4BAA4B,CAAC,2FAA2F,YAAY,CAAC,mFAAmF,WAAW,CAAC,sBAAuB,CAAC,gBAAA,CAAA,yCAAyC,CAAC,iGAAiG,SAAW,CAAC,uEAAuE,UAA+C,CAA/C,+CAA+C,CAAC,iBAAiB,CAAC,wBAAiD,CAAjD,iDAAiD,CAAC,eAAe,CAAC,iBAAsD,CAAtD,sDAAsD,CAAC,oBAAA,CAAA,6CAA6C,CAAC,2EAA2E,iBAAiB,CAAC,qFAAqF,UAAU,CAAC,iBAAiB,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,wBAAiD,CAAjD,iDAAiD,CAAC,SAAW,CAAC,iBAAA,CAAA,sDAAsD,CAAC,mFAAmF,UAAU,CAAC,aAAa,CAAC,WAAW,CAAC,iBAAiB,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,iBAAsD,CAAtD,sDAAsD,CAAC,mBAAmB,CAAC,0BAA0B,CAAC,aAAA,CAAA,sCAAsC,CAAC,mFAAmF,4BAA4B,CAAC,iGAAiG,YAAY,CAAC,yFAAyF,WAAW,CAAC,sBAAuB,CAAC,gBAAA,CAAA,yCAAyC,CAAC,uGAAuG,SAAW,CAAC,qEAAqE,UAA8C,CAA9C,8CAA8C,CAAC,iBAAiB,CAAC,wBAAgD,CAAhD,gDAAgD,CAAC,eAAe,CAAC,iBAAsD,CAAtD,sDAAsD,CAAC,oBAAA,CAAA,4CAA4C,CAAC,yEAAyE,iBAAiB,CAAC,mFAAmF,UAAU,CAAC,iBAAiB,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,wBAAgD,CAAhD,gDAAgD,CAAC,SAAW,CAAC,iBAAA,CAAA,sDAAsD,CAAC,iFAAiF,UAAU,CAAC,aAAa,CAAC,WAAW,CAAC,iBAAiB,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,iBAAsD,CAAtD,sDAAsD,CAAC,mBAAmB,CAAC,0BAA0B,CAAC,aAAA,CAAA,qCAAqC,CAAC,iFAAiF,4BAA4B,CAAC,+FAA+F,YAAY,CAAC,uFAAuF,WAAW,CAAC,sBAAuB,CAAC,gBAAA,CAAA,yCAAyC,CAAC,qGAAqG,SAAW,CAAC,uEAAuE,UAA+C,CAA/C,+CAA+C,CAAC,iBAAiB,CAAC,wBAAiD,CAAjD,iDAAiD,CAAC,eAAe,CAAC,iBAAsD,CAAtD,sDAAsD,CAAC,oBAAA,CAAA,6CAA6C,CAAC,2EAA2E,iBAAiB,CAAC,qFAAqF,UAAU,CAAC,iBAAiB,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,wBAAiD,CAAjD,iDAAiD,CAAC,SAAW,CAAC,iBAAA,CAAA,sDAAsD,CAAC,mFAAmF,UAAU,CAAC,aAAa,CAAC,WAAW,CAAC,iBAAiB,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,iBAAsD,CAAtD,sDAAsD,CAAC,mBAAmB,CAAC,0BAA0B,CAAC,aAAA,CAAA,sCAAsC,CAAC,mFAAmF,4BAA4B,CAAC,iGAAiG,YAAY,CAAC,yFAAyF,WAAW,CAAC,sBAAuB,CAAC,gBAAA,CAAA,yCAAyC,CAAC,uGAAuG,SAAW,CAAC,+BAA+B,mBAAmB,CAAC,eAAe,CAAC,eAAe,CAAC,cAAc,CAAC,wCAAwC,eAAmB,CAAC,uCAAuC,UAAU,CAAC,sCAAsC,mBAAmB,CAAC,gBAAgB,CAAC,4CAA4C,eAAe,CAAC,sDAAsD,gBAAyC,CAAzC,yCAAyC,CAAC,eAAgB,CAAC,kBAAkB,CAAC,qDAAqD,kBAAkB,CAAC,cAAwC,CAAxC,wCAAwC,CAAC,eAAe,CAAC,eAAkB,CAAC,yBAA0C,cAAc,CAAC,wBAAyD,CAAzD,yDAAyD,CAAC,wBAA6D,CAA7D,6DAA6D,CAAC,SAAS,CAAC,2BAA4B,CAAC,aAAa,CAA8D,+DAA+B,2BAA4B,CAAC,+BAA+B,UAAU,CAAC,WAAW,CAAC,0BAA0B,6BAAiD,CAAjD,+BAAiD,CAAjD,4BAAiD,CAAjD,iDAAiD,CAAC,iBAAiB,CAAC,oCAAqC,CAAC,kCAA8B,CAAC,gCAAgC,UAAU,CAAC,WAAW,CAAC,wCAAwC,iBAAmD,CAAnD,mDAAmD,CAAC,8BAA8B,CAAC,+BAA+B,oBAA0C,CAA1C,0CAA0C,CAAC,8BAA8B,CAAC,kCAAkC,oBAA6C,CAA7C,6CAA6C,CAAC,8BAA8B,CAAC,iCAAiC,oBAA4C,CAA5C,4CAA4C,CAAC,8BAA8B,CAAC,kCAAkC,oBAA6C,CAA7C,6CAA6C,CAAC,8BAA8B,CAAC,kBAAkB,GAAG,sBAAsB,CAAC,GAAK,uBAAwB,CAAA,CAAE,0BAA0B,YAAY,CAAC,UAAU,CAAC,WAAW,CAAC,eAAqB,CAAC,wBAA6D,CAA7D,6DAA6D,CAAC,aAAkD,CAAlD,kDAAkD,CAAC,6BAA6B,CAAC,kBAAkB,CAAC,wBAAyD,CAAzD,yDAAyD,CAAC,wBAAA,CAAA,oBAAA,CAAA,gBAAgB,CAAC,mCAAmC,aAAa,CAAC,cAAc,CAAC,yCAAyC,eAAe,CAAC,iEAAiE,YAAY,CAAC,WAAW,CAAC,2CAA2C,WAAW,CAAC,cAAc,CAAC,YAAY,CAAC,kBAAkB,CAAC,sBAAsB,CAAC,6DAA6D,gBAAgB,CAAC,kDAAkD,6BAAA,CAAA,8DAA8D,CAAC,mEAAmE,WAAW,CAAC,YAAY,CAAC,kBAAkB,CAAC,qFAAqF,iBAAkB,CAAC,6EAA6E,+BAAA,CAAA,qDAAqD,CAAC,sDAAsD,cAAc,CAAC,kzBAAkzB,aAAA,CAAA,mCAAmC,CAAC,khBAAkhB,eAAgB,CAAC,eAAyC,CAAzC,yCAAyC,CAAC,kBAAkB,CAAC,wIAAwI,eAAyC,CAAzC,yCAAyC,CAAC,eAAkB,CAAC,kBAAkB,CAAC,mDAAmD,eAAkB,CAAC,UAAW,CAAC,8BAA8B,YAAY,CAAC,cAAc,CAAC,gBAAgB,CAAC,eAAe,CAAC,mDAAmD,UAAQ,CAAC,cAAc,CAAC,wBAAgD,CAAhD,gDAAgD,CAAC,YAAY,CAAC,gBAAgB,CAAC,eAAe,CAAC,YAAY,CAAC,qBAAqB,CAAC,6BAA6B,CAAC,uDAAuD,cAAc,CAAC,kBAAkB,CAAC,gFAAgF,YAAY,CAAC,kBAAkB,CAAC,+EAA+E,kBAAkB,CAAC,uFAAuF,UAAU,CAAC,iGAAiG,mBAAoB,CAAC,uFAAuF,cAAc,CAAC,8FAA8F,cAAc,CAAC,+EAA+E,kBAAkB,CAAC,6DAA6D,WAAW,CAAC,wBAAwB,cAAc,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,aAAa,CAAC,WAAW,CAAC,YAAY,CAAC,4BAA4B,CAAC,aAAkD,CAAlD,kDAAkD,CAAC,YAAY,CAAC,kBAAkB,CAAC,sBAAsB,CAAmD,sFAAgD,WAAW,CAAC,sDAAsD,qBAAsB,CAAC,gDAAgD,WAAW,CAAC,YAAY,CAAC,iDAAiD,WAAW,CAAC,YAAY,CAAC,gDAAgD,WAAW,CAAC,YAAY,CAAC,6CAA6C,iBAAiB,CAAC,UAAU,CAAC,UAAU,CAAC,WAAW,CAAC,wBAA6D,CAA7D,6DAA6D,CAAC,UAAW,CAAC,0CAA0C,eAAe,CAAC,UAAU,CAAW,SAAgB,CAAC,eAAe,CAAwG,uCAA4C,CAAC,wBAAwB,wBAAA,CAAA,oBAAA,CAAA,gBAAgB,CAAC,iCAAiC,gBAAA,CAAA,sDAAsD,CAAC,wDAAwD,oBAAoB,CAAC,wIAAwI,UAAU,CAAC,WAAW,CAAC,4EAA6E,CAAC,gKAAgK,4BAA8B,CAAC,2BAA2B,CAAC,0BAA0B,CAAC,wBAAyD,CAAzD,yDAAyD,CAAC,oFAA0F,CAAC,oKAAoK,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC,oKAAoK,4BAA4B","file":"2.ee6590b6.chunk.css","sourcesContent":[":root{--sn-stylekit-base-font-size: 13px;--sn-stylekit-font-size-p: 1.0rem;--sn-stylekit-font-size-editor: 1.21rem;--sn-stylekit-font-size-h6: 0.8rem;--sn-stylekit-font-size-h5: 0.9rem;--sn-stylekit-font-size-h4: 1.0rem;--sn-stylekit-font-size-h3: 1.1rem;--sn-stylekit-font-size-h2: 1.2rem;--sn-stylekit-font-size-h1: 1.3rem;--sn-stylekit-neutral-color: #989898;--sn-stylekit-neutral-contrast-color: white;--sn-stylekit-info-color: #086DD6;--sn-stylekit-info-contrast-color: white;--sn-stylekit-success-color: #2B9612;--sn-stylekit-success-contrast-color: white;--sn-stylekit-warning-color: #f6a200;--sn-stylekit-warning-contrast-color: white;--sn-stylekit-danger-color: #F80324;--sn-stylekit-danger-contrast-color: white;--sn-stylekit-shadow-color: #C8C8C8;--sn-stylekit-background-color: white;--sn-stylekit-border-color: #e3e3e3;--sn-stylekit-foreground-color: black;--sn-stylekit-contrast-background-color: #F6F6F6;--sn-stylekit-contrast-foreground-color: #2e2e2e;--sn-stylekit-contrast-border-color: #e3e3e3;--sn-stylekit-secondary-background-color: #F6F6F6;--sn-stylekit-secondary-foreground-color: #2e2e2e;--sn-stylekit-secondary-border-color: #e3e3e3;--sn-stylekit-secondary-contrast-background-color: #e3e3e3;--sn-stylekit-secondary-contrast-foreground-color: #2e2e2e;--sn-styleki--secondary-contrast-border-color: #a2a2a2;--sn-stylekit-editor-background-color: var(--sn-stylekit-background-color);--sn-stylekit-editor-foreground-color: var(--sn-stylekit-foreground-color);--sn-stylekit-paragraph-text-color: #454545;--sn-stylekit-input-placeholder-color: rgb(168, 168, 168);--sn-stylekit-input-border-color: #e3e3e3;--sn-stylekit-scrollbar-thumb-color: #dfdfdf;--sn-stylekit-scrollbar-track-border-color: #E7E7E7;--sn-stylekit-general-border-radius: 2px;--sn-stylekit-simplified-chinese-font: \"Microsoft Yahei\", \"微软雅黑体\";--sn-stylekit-monospace-font: \"Ubuntu Mono\", courier, monospace;--sn-stylekit-sans-serif-font: -apple-system, BlinkMacSystemFont, \"Segoe UI\",\n \"Roboto\", \"Oxygen\", \"Ubuntu\", \"Cantarell\", \"Fira Sans\", \"Droid Sans\",\n \"Helvetica Neue\", var(--sn-stylekit-simplified-chinese-font), sans-serif}.sn-component{font-family:var(--sn-stylekit-sans-serif-font);-webkit-font-smoothing:antialiased;color:var(--sn-stylekit-foreground-color)}.sn-component .sk-panel{box-shadow:0px 2px 5px var(--sn-stylekit-shadow-color);background-color:var(--sn-stylekit-background-color);border:1px solid var(--sn-stylekit-border-color);border-radius:var(--sn-stylekit-general-border-radius);display:flex;flex-direction:column;overflow:auto;flex-grow:1}.sn-component .sk-panel a:hover{text-decoration:underline}.sn-component .sk-panel.static{box-shadow:none;border:none;border-radius:0}.sn-component .sk-panel .sk-panel-header{flex-shrink:0;display:flex;justify-content:space-between;padding:1.1rem 2rem;border-bottom:1px solid var(--sn-stylekit-contrast-border-color);background-color:var(--sn-stylekit-contrast-background-color);color:var(--sn-stylekit-contrast-foreground-color);align-items:center}.sn-component .sk-panel .sk-panel-header .sk-panel-header-title{font-size:var(--sn-stylekit-font-size-h1);font-weight:500}.sn-component .sk-panel .sk-panel-header .close-button{font-weight:bold}.sn-component .sk-panel .sk-footer,.sn-component .sk-panel .sk-panel-footer{padding:1rem 2rem;border-top:1px solid var(--sn-stylekit-border-color);box-sizing:border-box}.sn-component .sk-panel .sk-footer.extra-padding,.sn-component .sk-panel .sk-panel-footer.extra-padding{padding:2rem 2rem}.sn-component .sk-panel .sk-footer .left,.sn-component .sk-panel .sk-panel-footer .left{text-align:left;display:block}.sn-component .sk-panel .sk-footer .right,.sn-component .sk-panel .sk-panel-footer .right{text-align:right;display:block}.sn-component .sk-panel .sk-panel-content{padding:1.6rem 2rem;padding-bottom:0;flex-grow:1;overflow:scroll;height:100%;overflow-y:auto !important;overflow-x:auto !important}.sn-component .sk-panel .sk-panel-content .sk-p,.sn-component .sk-panel .sk-panel-content .sk-li{color:var(--sn-stylekit-paragraph-text-color);line-height:1.3}.sn-component .sk-panel-section{padding-bottom:1.6rem;display:flex;flex-direction:column}.sn-component .sk-panel-section.sk-panel-hero{text-align:center}.sn-component .sk-panel-section .sk-p:last-child{margin-bottom:0}.sn-component .sk-panel-section:not(:last-child){margin-bottom:1.5rem;border-bottom:1px solid var(--sn-stylekit-border-color)}.sn-component .sk-panel-section:not(:last-child).no-border{border-bottom:none}.sn-component .sk-panel-section:last-child{margin-bottom:0.5rem}.sn-component .sk-panel-section.no-bottom-pad{padding-bottom:0;margin-bottom:0}.sn-component .sk-panel-section .sk-panel-section-title{margin-bottom:0.5rem;font-weight:bold;font-size:var(--sn-stylekit-font-size-h3)}.sn-component .sk-panel-section .sk-panel-section-outer-title{border-bottom:1px solid var(--sn-stylekit-border-color);padding-bottom:0.9rem;margin-top:2.1rem;margin-bottom:15px;font-size:var(--sn-stylekit-font-size-h3)}.sn-component .sk-panel-section .sk-panel-section-subtitle{font-size:var(--sn-stylekit-font-size-h5);margin-bottom:2px}.sn-component .sk-panel-section .sk-panel-section-subtitle.subtle{font-weight:normal;opacity:0.6}.sn-component .sk-panel-section .text-content .sk-p{margin-bottom:1rem}.sn-component .sk-panel-section .text-content p:first-child{margin-top:0.3rem}.sn-component .sk-panel-row{display:flex;justify-content:space-between;align-items:center;padding-top:0.4rem}.sn-component .sk-panel-row.centered{justify-content:center}.sn-component .sk-panel-row.justify-right{justify-content:flex-end}.sn-component .sk-panel-row.justify-left{justify-content:flex-start}.sn-component .sk-panel-row.align-top{align-items:flex-start}.sn-component .sk-panel-row .sk-panel-column.stretch{width:100%}.sn-component .sk-panel-row.default-padding,.sn-component .sk-panel-row:not(:last-child){padding-bottom:0.4rem}.sn-component .sk-panel-row.condensed{padding-top:0.2rem;padding-bottom:0.2rem}.sn-component .sk-panel-row .sk-p{margin:0;padding:0}.sn-component .vertical-rule{background-color:var(--sn-stylekit-border-color);height:1.5rem;width:1px}.sn-component .sk-panel-form{width:100%}.sn-component .sk-panel-form.half{width:50%}.sn-component .sk-panel-form .form-submit{margin-top:0.15rem}.sn-component .right-aligned{justify-content:flex-end;text-align:right}.sn-component .sk-menu-panel{background-color:var(--sn-stylekit-background-color);border:1px solid var(--sn-stylekit-contrast-border-color);border-radius:var(--sn-stylekit-general-border-radius);overflow:scroll;user-select:none;overflow-y:auto !important;overflow-x:auto !important}.sn-component .sk-menu-panel .sk-menu-panel-header{padding:0.8rem 1rem;border-bottom:1px solid var(--sn-stylekit-contrast-border-color);background-color:var(--sn-stylekit-contrast-background-color);color:var(--sn-stylekit-contrast-foreground-color);display:flex;justify-content:space-between;align-items:center}.sn-component .sk-menu-panel .sk-menu-panel-header-title{font-weight:bold;font-size:var(--sn-stylekit-font-size-h4)}.sn-component .sk-menu-panel .sk-menu-panel-header-subtitle{margin-top:0.2rem;opacity:0.6}.sn-component .sk-menu-panel .sk-menu-panel-row{padding:1rem 1rem;cursor:pointer;display:flex;flex-direction:row;justify-content:space-between;border-bottom:1px solid var(--sn-stylekit-border-color)}.sn-component .sk-menu-panel .sk-menu-panel-row:hover{background-color:var(--sn-stylekit-contrast-background-color);color:var(--sn-stylekit-contrast-foreground-color);border-color:var(--sn-stylekit-contrast-border-color)}.sn-component .sk-menu-panel .sk-menu-panel-row .sk-menu-panel-column{display:flex;justify-content:center;flex-direction:column}.sn-component .sk-menu-panel .sk-menu-panel-row .sk-menu-panel-column:not(:first-child){padding-left:1.0rem;padding-right:0.15rem}.sn-component .sk-menu-panel .sk-menu-panel-row .sk-menu-panel-column.stretch{width:100%}.sn-component .sk-menu-panel .sk-menu-panel-row .sk-menu-panel-column .sk-menu-panel-subrows{margin-top:1rem}.sn-component .sk-menu-panel .sk-menu-panel-row .sk-menu-panel-column .sk-menu-panel-row,.sn-component .sk-menu-panel .sk-menu-panel-row .sk-menu-panel-column .sk-menu-panel-subrow{border:1px solid var(--sn-stylekit-contrast-border-color);margin-top:-1px}.sn-component .sk-menu-panel .sk-menu-panel-row .sk-menu-panel-column .sk-menu-panel-row:hover,.sn-component .sk-menu-panel .sk-menu-panel-row .sk-menu-panel-column .sk-menu-panel-subrow:hover{background-color:var(--sn-stylekit-background-color)}.sn-component .sk-menu-panel .sk-menu-panel-row .sk-menu-panel-column .left{display:flex}.sn-component .sk-menu-panel .sk-menu-panel-row .sk-button .sk-label,.sn-component .sk-menu-panel .sk-menu-panel-row .sk-box .sk-label,.sn-component .sk-menu-panel .sk-menu-panel-row .sk-button .sk-panel-section .sk-panel-section-subtitle,.sn-component .sk-panel-section .sk-menu-panel .sk-menu-panel-row .sk-button .sk-panel-section-subtitle,.sn-component .sk-menu-panel .sk-menu-panel-row .sk-box .sk-panel-section .sk-panel-section-subtitle,.sn-component .sk-panel-section .sk-menu-panel .sk-menu-panel-row .sk-box .sk-panel-section-subtitle{font-size:var(--sn-stylekit-font-size-h6);font-weight:normal}.sn-component .sk-menu-panel .sk-menu-panel-row .sk-label,.sn-component .sk-menu-panel .sk-menu-panel-row .sk-panel-section .sk-panel-section-subtitle,.sn-component .sk-panel-section .sk-menu-panel .sk-menu-panel-row .sk-panel-section-subtitle{font-size:var(--sn-stylekit-font-size-p);font-weight:bold}.sn-component .sk-menu-panel .sk-menu-panel-row .sk-sublabel{font-size:var(--sn-stylekit-font-size-h5);margin-top:0.2rem;opacity:0.6}.sn-component .red{color:var(--sn-stylekit-danger-color)}.sn-component .tinted{color:var(--sn-stylekit-info-color)}.sn-component .selectable{user-select:text !important;-ms-user-select:text !important;-moz-user-select:text !important;-webkit-user-select:text !important}.sn-component .sk-h1,.sn-component .sk-h2,.sn-component .sk-h3,.sn-component .sk-h4,.sn-component .sk-h5{margin:0;padding:0;font-weight:normal}.sn-component .sk-h1{font-weight:500;font-size:var(--sn-stylekit-font-size-h1);line-height:1.9rem}.sn-component .sk-h2{font-size:var(--sn-stylekit-font-size-h2);line-height:1.8rem}.sn-component .sk-h3{font-size:var(--sn-stylekit-font-size-h3);line-height:1.7rem}.sn-component .sk-h4{font-size:var(--sn-stylekit-font-size-p);line-height:1.4rem}.sn-component .sk-h5{font-size:var(--sn-stylekit-font-size-h5)}.sn-component .sk-bold{font-weight:bold}.sn-component .sk-font-small{font-size:var(--sn-stylekit-font-size-h5)}.sn-component .sk-font-normal{font-size:var(--sn-stylekit-font-size-p)}.sn-component .sk-font-large{font-size:var(--sn-stylekit-font-size-h3)}.sn-component a.sk-a{cursor:pointer;user-select:none}.sn-component a.sk-a.disabled{color:var(--sn-stylekit-neutral-color);opacity:0.6}.sn-component a.sk-a.boxed{border-radius:var(--sn-stylekit-general-border-radius);padding:0.3rem 0.4rem}.sn-component a.sk-a.boxed:hover{text-decoration:none}.sn-component a.sk-a.boxed.neutral{background-color:var(--sn-stylekit-neutral-color);color:var(--sn-stylekit-neutral-contrast-color)}.sn-component a.sk-a.boxed.info{background-color:var(--sn-stylekit-info-color);color:var(--sn-stylekit-info-contrast-color)}.sn-component a.sk-a.boxed.warning{background-color:var(--sn-stylekit-warning-color);color:var(--sn-stylekit-warning-contrast-color)}.sn-component a.sk-a.boxed.danger{background-color:var(--sn-stylekit-danger-color);color:var(--sn-stylekit-danger-contrast-color)}.sn-component a.sk-a.boxed.success{background-color:var(--sn-stylekit-success-color);color:var(--sn-stylekit-success-contrast-color)}.sn-component .wrap{word-wrap:break-word}.sn-component *.sk-base{color:var(--sn-stylekit-foreground-color)}.sn-component *.contrast{color:var(--sn-stylekit-contrast-foreground-color)}.sn-component *.neutral{color:var(--sn-stylekit-neutral-color)}.sn-component *.info{color:var(--sn-stylekit-info-color)}.sn-component *.info-contrast{color:var(--sn-stylekit-info-contrast-color)}.sn-component *.warning{color:var(--sn-stylekit-warning-color)}.sn-component *.danger{color:var(--sn-stylekit-danger-color)}.sn-component *.success{color:var(--sn-stylekit-success-color)}.sn-component *.info-i{color:var(--sn-stylekit-info-color) !important}.sn-component *.warning-i{color:var(--sn-stylekit-warning-color) !important}.sn-component *.danger-i{color:var(--sn-stylekit-danger-color) !important}.sn-component *.success-i{color:var(--sn-stylekit-success-color) !important}.sn-component *.clear{background-color:transparent;border:none}.sn-component .center-text{text-align:center !important;justify-content:center !important}.sn-component p.sk-p{margin:0.5rem 0}.sn-component input.sk-input{box-sizing:border-box;padding:0.7rem 0.8rem;margin:0.30rem 0;border:none;font-size:var(--sn-stylekit-font-size-h3);width:100%;outline:0;resize:none}.sn-component input.sk-input.clear{color:var(--sn-stylekit-foreground-color);background-color:transparent;border:none}.sn-component input.sk-input.no-border{border:none}.sn-component .sk-label,.sn-component .sk-panel-section .sk-panel-section-subtitle{font-weight:bold}.sn-component .sk-label.no-bold,.sn-component .sk-panel-section .no-bold.sk-panel-section-subtitle{font-weight:normal}.sn-component label.sk-label,.sn-component .sk-panel-section label.sk-panel-section-subtitle{margin:0.7rem 0;display:block}.sn-component label.sk-label input[type='checkbox'],.sn-component .sk-panel-section label.sk-panel-section-subtitle input[type='checkbox'],.sn-component input[type='radio']{width:auto;margin-right:0.45rem;vertical-align:middle}.sn-component .sk-horizontal-group>*,.sn-component .sk-input-group>*{display:inline-block;vertical-align:middle}.sn-component .sk-horizontal-group>*:not(:first-child),.sn-component .sk-input-group>*:not(:first-child){margin-left:0.9rem}.sn-component .sk-border-bottom{border-bottom:1px solid var(--sn-stylekit-border-color)}.sn-component .sk-checkbox-group{padding-top:0.5rem;padding-bottom:0.3rem}.sn-component ::placeholder{color:var(--sn-stylekit-input-placeholder-color)}.sn-component :-ms-input-placeholder{color:var(--sn-stylekit-input-placeholder-color)}.sn-component ::-ms-input-placeholder{color:var(--sn-stylekit-input-placeholder-color)}.sn-component .sk-button-group.stretch{display:flex;width:100%}.sn-component .sk-button-group.stretch .sk-button,.sn-component .sk-button-group.stretch .sk-box{display:block;flex-grow:1;text-align:center}.sn-component .sk-button-group .sk-button,.sn-component .sk-button-group .sk-box{display:inline-block;vertical-align:middle}.sn-component .sk-button-group .sk-button:not(:last-child),.sn-component .sk-button-group .sk-box:not(:last-child){margin-right:5px}.sn-component .sk-button-group .sk-button:not(:last-child).featured,.sn-component .sk-button-group .sk-box:not(:last-child).featured{margin-right:8px}.sn-component .sk-segmented-buttons{display:flex;flex-direction:row}.sn-component .sk-segmented-buttons .sk-button,.sn-component .sk-segmented-buttons .sk-box{border-radius:0;white-space:nowrap;margin:0;margin-left:0 !important;margin-right:0 !important}.sn-component .sk-segmented-buttons .sk-button:not(:last-child),.sn-component .sk-segmented-buttons .sk-box:not(:last-child){border-right:none;border-radius:0}.sn-component .sk-segmented-buttons .sk-button:first-child,.sn-component .sk-segmented-buttons .sk-box:first-child{border-top-left-radius:var(--sn-stylekit-general-border-radius);border-bottom-left-radius:var(--sn-stylekit-general-border-radius);border-right:none;border-top-right-radius:0;border-bottom-right-radius:0}.sn-component .sk-segmented-buttons .sk-button:last-child,.sn-component .sk-segmented-buttons .sk-box:last-child{border-top-right-radius:var(--sn-stylekit-general-border-radius);border-bottom-right-radius:var(--sn-stylekit-general-border-radius);border-left:none;border-top-left-radius:0;border-bottom-left-radius:0}.sn-component .sk-box-group .sk-box{display:inline-block}.sn-component .sk-box-group .sk-box:not(:last-child){margin-right:5px}.sn-component .sk-a.button{text-decoration:none}.sn-component .sk-button,.sn-component .sk-box{display:table;padding:0.5rem 0.7rem;font-size:var(--sn-stylekit-font-size-h5);cursor:pointer;text-align:center;user-select:none}.sn-component .sk-button.no-hover-border:after,.sn-component .no-hover-border.sk-box:after{color:transparent !important}.sn-component .sk-button.wide,.sn-component .wide.sk-box{padding:0.3rem 1.7rem}.sn-component .sk-button>.sk-label,.sn-component .sk-box>.sk-label,.sn-component .sk-panel-section .sk-button>.sk-panel-section-subtitle,.sn-component .sk-panel-section .sk-box>.sk-panel-section-subtitle{font-weight:bold;display:block;text-align:center}.sn-component .sk-button.big,.sn-component .big.sk-box{font-size:var(--sn-stylekit-font-size-h3);padding:0.7rem 2.5rem}.sn-component .sk-box{padding:2.5rem 1.5rem}.sn-component .sk-button.sk-base,.sn-component .sk-base.sk-box,.sn-component .sk-box.sk-base,.sn-component .sk-circle.sk-base{color:var(--sn-stylekit-foreground-color);position:relative;background-color:var(--sn-stylekit-background-color);overflow:hidden;border-radius:var(--sn-stylekit-general-border-radius);border-color:var(--sn-stylekit-background-color)}.sn-component .sk-button.sk-base *,.sn-component .sk-base.sk-box *,.sn-component .sk-box.sk-base *,.sn-component .sk-circle.sk-base *{position:relative}.sn-component .sk-button.sk-base:before,.sn-component .sk-base.sk-box:before,.sn-component .sk-box.sk-base:before,.sn-component .sk-circle.sk-base:before{content:\"\";position:absolute;top:0;left:0;width:100%;height:100%;background-color:var(--sn-stylekit-background-color);opacity:1.0;border-radius:var(--sn-stylekit-general-border-radius)}.sn-component .sk-button.sk-base:after,.sn-component .sk-base.sk-box:after,.sn-component .sk-box.sk-base:after,.sn-component .sk-circle.sk-base:after{content:'';display:block;height:100%;position:absolute;top:0;left:0;width:100%;border-radius:var(--sn-stylekit-general-border-radius);pointer-events:none;box-shadow:inset 0 0 0 1px;color:var(--sn-stylekit-background-color)}.sn-component .sk-button.sk-base:hover:before,.sn-component .sk-base.sk-box:hover:before,.sn-component .sk-box.sk-base:hover:before,.sn-component .sk-circle.sk-base:hover:before{filter:brightness(130%)}.sn-component .sk-button.sk-base.no-bg,.sn-component .sk-base.no-bg.sk-box,.sn-component .sk-box.sk-base.no-bg,.sn-component .sk-circle.sk-base.no-bg{background-color:transparent}.sn-component .sk-button.sk-base.no-bg:before,.sn-component .sk-base.no-bg.sk-box:before,.sn-component .sk-box.sk-base.no-bg:before,.sn-component .sk-circle.sk-base.no-bg:before{content:none}.sn-component .sk-button.sk-base.featured,.sn-component .sk-base.featured.sk-box,.sn-component .sk-box.sk-base.featured,.sn-component .sk-circle.sk-base.featured{border:none;padding:0.75rem 1.25rem;font-size:var(--sn-stylekit-font-size-h3)}.sn-component .sk-button.sk-base.featured:before,.sn-component .sk-base.featured.sk-box:before,.sn-component .sk-box.sk-base.featured:before,.sn-component .sk-circle.sk-base.featured:before{opacity:1.0}.sn-component .sk-button.contrast,.sn-component .contrast.sk-box,.sn-component .sk-box.contrast,.sn-component .sk-circle.contrast{color:var(--sn-stylekit-contrast-foreground-color);position:relative;background-color:var(--sn-stylekit-contrast-background-color);overflow:hidden;border-radius:var(--sn-stylekit-general-border-radius);border-color:var(--sn-stylekit-contrast-background-color)}.sn-component .sk-button.contrast *,.sn-component .contrast.sk-box *,.sn-component .sk-box.contrast *,.sn-component .sk-circle.contrast *{position:relative}.sn-component .sk-button.contrast:before,.sn-component .contrast.sk-box:before,.sn-component .sk-box.contrast:before,.sn-component .sk-circle.contrast:before{content:\"\";position:absolute;top:0;left:0;width:100%;height:100%;background-color:var(--sn-stylekit-contrast-background-color);opacity:1.0;border-radius:var(--sn-stylekit-general-border-radius)}.sn-component .sk-button.contrast:after,.sn-component .contrast.sk-box:after,.sn-component .sk-box.contrast:after,.sn-component .sk-circle.contrast:after{content:'';display:block;height:100%;position:absolute;top:0;left:0;width:100%;border-radius:var(--sn-stylekit-general-border-radius);pointer-events:none;box-shadow:inset 0 0 0 1px;color:var(--sn-stylekit-contrast-background-color)}.sn-component .sk-button.contrast:hover:before,.sn-component .contrast.sk-box:hover:before,.sn-component .sk-box.contrast:hover:before,.sn-component .sk-circle.contrast:hover:before{filter:brightness(130%)}.sn-component .sk-button.contrast.no-bg,.sn-component .contrast.no-bg.sk-box,.sn-component .sk-box.contrast.no-bg,.sn-component .sk-circle.contrast.no-bg{background-color:transparent}.sn-component .sk-button.contrast.no-bg:before,.sn-component .contrast.no-bg.sk-box:before,.sn-component .sk-box.contrast.no-bg:before,.sn-component .sk-circle.contrast.no-bg:before{content:none}.sn-component .sk-button.contrast.featured,.sn-component .contrast.featured.sk-box,.sn-component .sk-box.contrast.featured,.sn-component .sk-circle.contrast.featured{border:none;padding:0.75rem 1.25rem;font-size:var(--sn-stylekit-font-size-h3)}.sn-component .sk-button.contrast.featured:before,.sn-component .contrast.featured.sk-box:before,.sn-component .sk-box.contrast.featured:before,.sn-component .sk-circle.contrast.featured:before{opacity:1.0}.sn-component .sk-button.sk-secondary,.sn-component .sk-secondary.sk-box,.sn-component .sk-box.sk-secondary,.sn-component .sk-circle.sk-secondary{color:var(--sn-stylekit-secondary-foreground-color);position:relative;background-color:var(--sn-stylekit-secondary-background-color);overflow:hidden;border-radius:var(--sn-stylekit-general-border-radius);border-color:var(--sn-stylekit-secondary-background-color)}.sn-component .sk-button.sk-secondary *,.sn-component .sk-secondary.sk-box *,.sn-component .sk-box.sk-secondary *,.sn-component .sk-circle.sk-secondary *{position:relative}.sn-component .sk-button.sk-secondary:before,.sn-component .sk-secondary.sk-box:before,.sn-component .sk-box.sk-secondary:before,.sn-component .sk-circle.sk-secondary:before{content:\"\";position:absolute;top:0;left:0;width:100%;height:100%;background-color:var(--sn-stylekit-secondary-background-color);opacity:1.0;border-radius:var(--sn-stylekit-general-border-radius)}.sn-component .sk-button.sk-secondary:after,.sn-component .sk-secondary.sk-box:after,.sn-component .sk-box.sk-secondary:after,.sn-component .sk-circle.sk-secondary:after{content:'';display:block;height:100%;position:absolute;top:0;left:0;width:100%;border-radius:var(--sn-stylekit-general-border-radius);pointer-events:none;box-shadow:inset 0 0 0 1px;color:var(--sn-stylekit-secondary-background-color)}.sn-component .sk-button.sk-secondary:hover:before,.sn-component .sk-secondary.sk-box:hover:before,.sn-component .sk-box.sk-secondary:hover:before,.sn-component .sk-circle.sk-secondary:hover:before{filter:brightness(130%)}.sn-component .sk-button.sk-secondary.no-bg,.sn-component .sk-secondary.no-bg.sk-box,.sn-component .sk-box.sk-secondary.no-bg,.sn-component .sk-circle.sk-secondary.no-bg{background-color:transparent}.sn-component .sk-button.sk-secondary.no-bg:before,.sn-component .sk-secondary.no-bg.sk-box:before,.sn-component .sk-box.sk-secondary.no-bg:before,.sn-component .sk-circle.sk-secondary.no-bg:before{content:none}.sn-component .sk-button.sk-secondary.featured,.sn-component .sk-secondary.featured.sk-box,.sn-component .sk-box.sk-secondary.featured,.sn-component .sk-circle.sk-secondary.featured{border:none;padding:0.75rem 1.25rem;font-size:var(--sn-stylekit-font-size-h3)}.sn-component .sk-button.sk-secondary.featured:before,.sn-component .sk-secondary.featured.sk-box:before,.sn-component .sk-box.sk-secondary.featured:before,.sn-component .sk-circle.sk-secondary.featured:before{opacity:1.0}.sn-component .sk-button.sk-secondary-contrast,.sn-component .sk-secondary-contrast.sk-box,.sn-component .sk-box.sk-secondary-contrast,.sn-component .sk-circle.sk-secondary-contrast{color:var(--sn-stylekit-secondary-contrast-foreground-color);position:relative;background-color:var(--sn-stylekit-secondary-contrast-background-color);overflow:hidden;border-radius:var(--sn-stylekit-general-border-radius);border-color:var(--sn-stylekit-secondary-contrast-background-color)}.sn-component .sk-button.sk-secondary-contrast *,.sn-component .sk-secondary-contrast.sk-box *,.sn-component .sk-box.sk-secondary-contrast *,.sn-component .sk-circle.sk-secondary-contrast *{position:relative}.sn-component .sk-button.sk-secondary-contrast:before,.sn-component .sk-secondary-contrast.sk-box:before,.sn-component .sk-box.sk-secondary-contrast:before,.sn-component .sk-circle.sk-secondary-contrast:before{content:\"\";position:absolute;top:0;left:0;width:100%;height:100%;background-color:var(--sn-stylekit-secondary-contrast-background-color);opacity:1.0;border-radius:var(--sn-stylekit-general-border-radius)}.sn-component .sk-button.sk-secondary-contrast:after,.sn-component .sk-secondary-contrast.sk-box:after,.sn-component .sk-box.sk-secondary-contrast:after,.sn-component .sk-circle.sk-secondary-contrast:after{content:'';display:block;height:100%;position:absolute;top:0;left:0;width:100%;border-radius:var(--sn-stylekit-general-border-radius);pointer-events:none;box-shadow:inset 0 0 0 1px;color:var(--sn-stylekit-secondary-contrast-background-color)}.sn-component .sk-button.sk-secondary-contrast:hover:before,.sn-component .sk-secondary-contrast.sk-box:hover:before,.sn-component .sk-box.sk-secondary-contrast:hover:before,.sn-component .sk-circle.sk-secondary-contrast:hover:before{filter:brightness(130%)}.sn-component .sk-button.sk-secondary-contrast.no-bg,.sn-component .sk-secondary-contrast.no-bg.sk-box,.sn-component .sk-box.sk-secondary-contrast.no-bg,.sn-component .sk-circle.sk-secondary-contrast.no-bg{background-color:transparent}.sn-component .sk-button.sk-secondary-contrast.no-bg:before,.sn-component .sk-secondary-contrast.no-bg.sk-box:before,.sn-component .sk-box.sk-secondary-contrast.no-bg:before,.sn-component .sk-circle.sk-secondary-contrast.no-bg:before{content:none}.sn-component .sk-button.sk-secondary-contrast.featured,.sn-component .sk-secondary-contrast.featured.sk-box,.sn-component .sk-box.sk-secondary-contrast.featured,.sn-component .sk-circle.sk-secondary-contrast.featured{border:none;padding:0.75rem 1.25rem;font-size:var(--sn-stylekit-font-size-h3)}.sn-component .sk-button.sk-secondary-contrast.featured:before,.sn-component .sk-secondary-contrast.featured.sk-box:before,.sn-component .sk-box.sk-secondary-contrast.featured:before,.sn-component .sk-circle.sk-secondary-contrast.featured:before{opacity:1.0}.sn-component .sk-button.neutral,.sn-component .neutral.sk-box,.sn-component .sk-box.neutral,.sn-component .sk-circle.neutral{color:var(--sn-stylekit-neutral-contrast-color);position:relative;background-color:var(--sn-stylekit-neutral-color);overflow:hidden;border-radius:var(--sn-stylekit-general-border-radius);border-color:var(--sn-stylekit-neutral-color)}.sn-component .sk-button.neutral *,.sn-component .neutral.sk-box *,.sn-component .sk-box.neutral *,.sn-component .sk-circle.neutral *{position:relative}.sn-component .sk-button.neutral:before,.sn-component .neutral.sk-box:before,.sn-component .sk-box.neutral:before,.sn-component .sk-circle.neutral:before{content:\"\";position:absolute;top:0;left:0;width:100%;height:100%;background-color:var(--sn-stylekit-neutral-color);opacity:1.0;border-radius:var(--sn-stylekit-general-border-radius)}.sn-component .sk-button.neutral:after,.sn-component .neutral.sk-box:after,.sn-component .sk-box.neutral:after,.sn-component .sk-circle.neutral:after{content:'';display:block;height:100%;position:absolute;top:0;left:0;width:100%;border-radius:var(--sn-stylekit-general-border-radius);pointer-events:none;box-shadow:inset 0 0 0 1px;color:var(--sn-stylekit-neutral-color)}.sn-component .sk-button.neutral:hover:before,.sn-component .neutral.sk-box:hover:before,.sn-component .sk-box.neutral:hover:before,.sn-component .sk-circle.neutral:hover:before{filter:brightness(130%)}.sn-component .sk-button.neutral.no-bg,.sn-component .neutral.no-bg.sk-box,.sn-component .sk-box.neutral.no-bg,.sn-component .sk-circle.neutral.no-bg{background-color:transparent}.sn-component .sk-button.neutral.no-bg:before,.sn-component .neutral.no-bg.sk-box:before,.sn-component .sk-box.neutral.no-bg:before,.sn-component .sk-circle.neutral.no-bg:before{content:none}.sn-component .sk-button.neutral.featured,.sn-component .neutral.featured.sk-box,.sn-component .sk-box.neutral.featured,.sn-component .sk-circle.neutral.featured{border:none;padding:0.75rem 1.25rem;font-size:var(--sn-stylekit-font-size-h3)}.sn-component .sk-button.neutral.featured:before,.sn-component .neutral.featured.sk-box:before,.sn-component .sk-box.neutral.featured:before,.sn-component .sk-circle.neutral.featured:before{opacity:1.0}.sn-component .sk-button.info,.sn-component .info.sk-box,.sn-component .sk-box.info,.sn-component .sk-circle.info{color:var(--sn-stylekit-info-contrast-color);position:relative;background-color:var(--sn-stylekit-info-color);overflow:hidden;border-radius:var(--sn-stylekit-general-border-radius);border-color:var(--sn-stylekit-info-color)}.sn-component .sk-button.info *,.sn-component .info.sk-box *,.sn-component .sk-box.info *,.sn-component .sk-circle.info *{position:relative}.sn-component .sk-button.info:before,.sn-component .info.sk-box:before,.sn-component .sk-box.info:before,.sn-component .sk-circle.info:before{content:\"\";position:absolute;top:0;left:0;width:100%;height:100%;background-color:var(--sn-stylekit-info-color);opacity:1.0;border-radius:var(--sn-stylekit-general-border-radius)}.sn-component .sk-button.info:after,.sn-component .info.sk-box:after,.sn-component .sk-box.info:after,.sn-component .sk-circle.info:after{content:'';display:block;height:100%;position:absolute;top:0;left:0;width:100%;border-radius:var(--sn-stylekit-general-border-radius);pointer-events:none;box-shadow:inset 0 0 0 1px;color:var(--sn-stylekit-info-color)}.sn-component .sk-button.info:hover:before,.sn-component .info.sk-box:hover:before,.sn-component .sk-box.info:hover:before,.sn-component .sk-circle.info:hover:before{filter:brightness(130%)}.sn-component .sk-button.info.no-bg,.sn-component .info.no-bg.sk-box,.sn-component .sk-box.info.no-bg,.sn-component .sk-circle.info.no-bg{background-color:transparent}.sn-component .sk-button.info.no-bg:before,.sn-component .info.no-bg.sk-box:before,.sn-component .sk-box.info.no-bg:before,.sn-component .sk-circle.info.no-bg:before{content:none}.sn-component .sk-button.info.featured,.sn-component .info.featured.sk-box,.sn-component .sk-box.info.featured,.sn-component .sk-circle.info.featured{border:none;padding:0.75rem 1.25rem;font-size:var(--sn-stylekit-font-size-h3)}.sn-component .sk-button.info.featured:before,.sn-component .info.featured.sk-box:before,.sn-component .sk-box.info.featured:before,.sn-component .sk-circle.info.featured:before{opacity:1.0}.sn-component .sk-button.warning,.sn-component .warning.sk-box,.sn-component .sk-box.warning,.sn-component .sk-circle.warning{color:var(--sn-stylekit-warning-contrast-color);position:relative;background-color:var(--sn-stylekit-warning-color);overflow:hidden;border-radius:var(--sn-stylekit-general-border-radius);border-color:var(--sn-stylekit-warning-color)}.sn-component .sk-button.warning *,.sn-component .warning.sk-box *,.sn-component .sk-box.warning *,.sn-component .sk-circle.warning *{position:relative}.sn-component .sk-button.warning:before,.sn-component .warning.sk-box:before,.sn-component .sk-box.warning:before,.sn-component .sk-circle.warning:before{content:\"\";position:absolute;top:0;left:0;width:100%;height:100%;background-color:var(--sn-stylekit-warning-color);opacity:1.0;border-radius:var(--sn-stylekit-general-border-radius)}.sn-component .sk-button.warning:after,.sn-component .warning.sk-box:after,.sn-component .sk-box.warning:after,.sn-component .sk-circle.warning:after{content:'';display:block;height:100%;position:absolute;top:0;left:0;width:100%;border-radius:var(--sn-stylekit-general-border-radius);pointer-events:none;box-shadow:inset 0 0 0 1px;color:var(--sn-stylekit-warning-color)}.sn-component .sk-button.warning:hover:before,.sn-component .warning.sk-box:hover:before,.sn-component .sk-box.warning:hover:before,.sn-component .sk-circle.warning:hover:before{filter:brightness(130%)}.sn-component .sk-button.warning.no-bg,.sn-component .warning.no-bg.sk-box,.sn-component .sk-box.warning.no-bg,.sn-component .sk-circle.warning.no-bg{background-color:transparent}.sn-component .sk-button.warning.no-bg:before,.sn-component .warning.no-bg.sk-box:before,.sn-component .sk-box.warning.no-bg:before,.sn-component .sk-circle.warning.no-bg:before{content:none}.sn-component .sk-button.warning.featured,.sn-component .warning.featured.sk-box,.sn-component .sk-box.warning.featured,.sn-component .sk-circle.warning.featured{border:none;padding:0.75rem 1.25rem;font-size:var(--sn-stylekit-font-size-h3)}.sn-component .sk-button.warning.featured:before,.sn-component .warning.featured.sk-box:before,.sn-component .sk-box.warning.featured:before,.sn-component .sk-circle.warning.featured:before{opacity:1.0}.sn-component .sk-button.danger,.sn-component .danger.sk-box,.sn-component .sk-box.danger,.sn-component .sk-circle.danger{color:var(--sn-stylekit-danger-contrast-color);position:relative;background-color:var(--sn-stylekit-danger-color);overflow:hidden;border-radius:var(--sn-stylekit-general-border-radius);border-color:var(--sn-stylekit-danger-color)}.sn-component .sk-button.danger *,.sn-component .danger.sk-box *,.sn-component .sk-box.danger *,.sn-component .sk-circle.danger *{position:relative}.sn-component .sk-button.danger:before,.sn-component .danger.sk-box:before,.sn-component .sk-box.danger:before,.sn-component .sk-circle.danger:before{content:\"\";position:absolute;top:0;left:0;width:100%;height:100%;background-color:var(--sn-stylekit-danger-color);opacity:1.0;border-radius:var(--sn-stylekit-general-border-radius)}.sn-component .sk-button.danger:after,.sn-component .danger.sk-box:after,.sn-component .sk-box.danger:after,.sn-component .sk-circle.danger:after{content:'';display:block;height:100%;position:absolute;top:0;left:0;width:100%;border-radius:var(--sn-stylekit-general-border-radius);pointer-events:none;box-shadow:inset 0 0 0 1px;color:var(--sn-stylekit-danger-color)}.sn-component .sk-button.danger:hover:before,.sn-component .danger.sk-box:hover:before,.sn-component .sk-box.danger:hover:before,.sn-component .sk-circle.danger:hover:before{filter:brightness(130%)}.sn-component .sk-button.danger.no-bg,.sn-component .danger.no-bg.sk-box,.sn-component .sk-box.danger.no-bg,.sn-component .sk-circle.danger.no-bg{background-color:transparent}.sn-component .sk-button.danger.no-bg:before,.sn-component .danger.no-bg.sk-box:before,.sn-component .sk-box.danger.no-bg:before,.sn-component .sk-circle.danger.no-bg:before{content:none}.sn-component .sk-button.danger.featured,.sn-component .danger.featured.sk-box,.sn-component .sk-box.danger.featured,.sn-component .sk-circle.danger.featured{border:none;padding:0.75rem 1.25rem;font-size:var(--sn-stylekit-font-size-h3)}.sn-component .sk-button.danger.featured:before,.sn-component .danger.featured.sk-box:before,.sn-component .sk-box.danger.featured:before,.sn-component .sk-circle.danger.featured:before{opacity:1.0}.sn-component .sk-button.success,.sn-component .success.sk-box,.sn-component .sk-box.success,.sn-component .sk-circle.success{color:var(--sn-stylekit-success-contrast-color);position:relative;background-color:var(--sn-stylekit-success-color);overflow:hidden;border-radius:var(--sn-stylekit-general-border-radius);border-color:var(--sn-stylekit-success-color)}.sn-component .sk-button.success *,.sn-component .success.sk-box *,.sn-component .sk-box.success *,.sn-component .sk-circle.success *{position:relative}.sn-component .sk-button.success:before,.sn-component .success.sk-box:before,.sn-component .sk-box.success:before,.sn-component .sk-circle.success:before{content:\"\";position:absolute;top:0;left:0;width:100%;height:100%;background-color:var(--sn-stylekit-success-color);opacity:1.0;border-radius:var(--sn-stylekit-general-border-radius)}.sn-component .sk-button.success:after,.sn-component .success.sk-box:after,.sn-component .sk-box.success:after,.sn-component .sk-circle.success:after{content:'';display:block;height:100%;position:absolute;top:0;left:0;width:100%;border-radius:var(--sn-stylekit-general-border-radius);pointer-events:none;box-shadow:inset 0 0 0 1px;color:var(--sn-stylekit-success-color)}.sn-component .sk-button.success:hover:before,.sn-component .success.sk-box:hover:before,.sn-component .sk-box.success:hover:before,.sn-component .sk-circle.success:hover:before{filter:brightness(130%)}.sn-component .sk-button.success.no-bg,.sn-component .success.no-bg.sk-box,.sn-component .sk-box.success.no-bg,.sn-component .sk-circle.success.no-bg{background-color:transparent}.sn-component .sk-button.success.no-bg:before,.sn-component .success.no-bg.sk-box:before,.sn-component .sk-box.success.no-bg:before,.sn-component .sk-circle.success.no-bg:before{content:none}.sn-component .sk-button.success.featured,.sn-component .success.featured.sk-box,.sn-component .sk-box.success.featured,.sn-component .sk-circle.success.featured{border:none;padding:0.75rem 1.25rem;font-size:var(--sn-stylekit-font-size-h3)}.sn-component .sk-button.success.featured:before,.sn-component .success.featured.sk-box:before,.sn-component .sk-box.success.featured:before,.sn-component .sk-circle.success.featured:before{opacity:1.0}.sn-component .sk-notification.contrast,.sn-component .sk-input.contrast{color:var(--sn-stylekit-contrast-foreground-color);position:relative;background-color:var(--sn-stylekit-contrast-background-color);overflow:hidden;border-radius:var(--sn-stylekit-general-border-radius);border-color:var(--sn-stylekit-contrast-border-color);border:1px solid var(--sn-stylekit-contrast-border-color)}.sn-component .sk-notification.contrast *,.sn-component .sk-input.contrast *{position:relative}.sn-component .sk-notification.contrast:before,.sn-component .sk-input.contrast:before{content:\"\";position:absolute;top:0;left:0;width:100%;height:100%;background-color:var(--sn-stylekit-contrast-background-color);opacity:1.0;border-radius:var(--sn-stylekit-general-border-radius)}.sn-component .sk-notification.contrast:after,.sn-component .sk-input.contrast:after{content:'';display:block;height:100%;position:absolute;top:0;left:0;width:100%;border-radius:var(--sn-stylekit-general-border-radius);pointer-events:none;color:var(--sn-stylekit-contrast-border-color);border-color:var(--sn-stylekit-contrast-border-color)}.sn-component .sk-notification.contrast.no-bg,.sn-component .sk-input.contrast.no-bg{background-color:transparent}.sn-component .sk-notification.contrast.no-bg:before,.sn-component .sk-input.contrast.no-bg:before{content:none}.sn-component .sk-notification.contrast.featured,.sn-component .sk-input.contrast.featured{border:none;padding:0.75rem 1.25rem;font-size:var(--sn-stylekit-font-size-h3)}.sn-component .sk-notification.contrast.featured:before,.sn-component .sk-input.contrast.featured:before{opacity:1.0}.sn-component .sk-notification.sk-secondary,.sn-component .sk-input.sk-secondary{color:var(--sn-stylekit-secondary-foreground-color);position:relative;background-color:var(--sn-stylekit-secondary-background-color);overflow:hidden;border-radius:var(--sn-stylekit-general-border-radius);border-color:var(--sn-stylekit-secondary-border-color);border:1px solid var(--sn-stylekit-secondary-border-color)}.sn-component .sk-notification.sk-secondary *,.sn-component .sk-input.sk-secondary *{position:relative}.sn-component .sk-notification.sk-secondary:before,.sn-component .sk-input.sk-secondary:before{content:\"\";position:absolute;top:0;left:0;width:100%;height:100%;background-color:var(--sn-stylekit-secondary-background-color);opacity:1.0;border-radius:var(--sn-stylekit-general-border-radius)}.sn-component .sk-notification.sk-secondary:after,.sn-component .sk-input.sk-secondary:after{content:'';display:block;height:100%;position:absolute;top:0;left:0;width:100%;border-radius:var(--sn-stylekit-general-border-radius);pointer-events:none;color:var(--sn-stylekit-secondary-border-color);border-color:var(--sn-stylekit-secondary-border-color)}.sn-component .sk-notification.sk-secondary.no-bg,.sn-component .sk-input.sk-secondary.no-bg{background-color:transparent}.sn-component .sk-notification.sk-secondary.no-bg:before,.sn-component .sk-input.sk-secondary.no-bg:before{content:none}.sn-component .sk-notification.sk-secondary.featured,.sn-component .sk-input.sk-secondary.featured{border:none;padding:0.75rem 1.25rem;font-size:var(--sn-stylekit-font-size-h3)}.sn-component .sk-notification.sk-secondary.featured:before,.sn-component .sk-input.sk-secondary.featured:before{opacity:1.0}.sn-component .sk-notification.sk-secondary-contrast,.sn-component .sk-input.sk-secondary-contrast{color:var(--sn-stylekit-secondary-contrast-foreground-color);position:relative;background-color:var(--sn-stylekit-secondary-contrast-background-color);overflow:hidden;border-radius:var(--sn-stylekit-general-border-radius);border-color:var(--sn-stylekit-secondary-contrast-border-color);border:1px solid var(--sn-stylekit-secondary-contrast-border-color)}.sn-component .sk-notification.sk-secondary-contrast *,.sn-component .sk-input.sk-secondary-contrast *{position:relative}.sn-component .sk-notification.sk-secondary-contrast:before,.sn-component .sk-input.sk-secondary-contrast:before{content:\"\";position:absolute;top:0;left:0;width:100%;height:100%;background-color:var(--sn-stylekit-secondary-contrast-background-color);opacity:1.0;border-radius:var(--sn-stylekit-general-border-radius)}.sn-component .sk-notification.sk-secondary-contrast:after,.sn-component .sk-input.sk-secondary-contrast:after{content:'';display:block;height:100%;position:absolute;top:0;left:0;width:100%;border-radius:var(--sn-stylekit-general-border-radius);pointer-events:none;color:var(--sn-stylekit-secondary-contrast-border-color);border-color:var(--sn-stylekit-secondary-contrast-border-color)}.sn-component .sk-notification.sk-secondary-contrast.no-bg,.sn-component .sk-input.sk-secondary-contrast.no-bg{background-color:transparent}.sn-component .sk-notification.sk-secondary-contrast.no-bg:before,.sn-component .sk-input.sk-secondary-contrast.no-bg:before{content:none}.sn-component .sk-notification.sk-secondary-contrast.featured,.sn-component .sk-input.sk-secondary-contrast.featured{border:none;padding:0.75rem 1.25rem;font-size:var(--sn-stylekit-font-size-h3)}.sn-component .sk-notification.sk-secondary-contrast.featured:before,.sn-component .sk-input.sk-secondary-contrast.featured:before{opacity:1.0}.sn-component .sk-notification.sk-base,.sn-component .sk-input.sk-base{color:var(--sn-stylekit-foreground-color);position:relative;background-color:var(--sn-stylekit-background-color);overflow:hidden;border-radius:var(--sn-stylekit-general-border-radius);border-color:var(--sn-stylekit-border-color);border:1px solid var(--sn-stylekit-border-color)}.sn-component .sk-notification.sk-base *,.sn-component .sk-input.sk-base *{position:relative}.sn-component .sk-notification.sk-base:before,.sn-component .sk-input.sk-base:before{content:\"\";position:absolute;top:0;left:0;width:100%;height:100%;background-color:var(--sn-stylekit-background-color);opacity:1.0;border-radius:var(--sn-stylekit-general-border-radius)}.sn-component .sk-notification.sk-base:after,.sn-component .sk-input.sk-base:after{content:'';display:block;height:100%;position:absolute;top:0;left:0;width:100%;border-radius:var(--sn-stylekit-general-border-radius);pointer-events:none;color:var(--sn-stylekit-border-color);border-color:var(--sn-stylekit-border-color)}.sn-component .sk-notification.sk-base.no-bg,.sn-component .sk-input.sk-base.no-bg{background-color:transparent}.sn-component .sk-notification.sk-base.no-bg:before,.sn-component .sk-input.sk-base.no-bg:before{content:none}.sn-component .sk-notification.sk-base.featured,.sn-component .sk-input.sk-base.featured{border:none;padding:0.75rem 1.25rem;font-size:var(--sn-stylekit-font-size-h3)}.sn-component .sk-notification.sk-base.featured:before,.sn-component .sk-input.sk-base.featured:before{opacity:1.0}.sn-component .sk-notification.neutral,.sn-component .sk-input.neutral{color:var(--sn-stylekit-neutral-contrast-color);position:relative;background-color:var(--sn-stylekit-neutral-color);overflow:hidden;border-radius:var(--sn-stylekit-general-border-radius);border-color:var(--sn-stylekit-neutral-color)}.sn-component .sk-notification.neutral *,.sn-component .sk-input.neutral *{position:relative}.sn-component .sk-notification.neutral:before,.sn-component .sk-input.neutral:before{content:\"\";position:absolute;top:0;left:0;width:100%;height:100%;background-color:var(--sn-stylekit-neutral-color);opacity:1.0;border-radius:var(--sn-stylekit-general-border-radius)}.sn-component .sk-notification.neutral:after,.sn-component .sk-input.neutral:after{content:'';display:block;height:100%;position:absolute;top:0;left:0;width:100%;border-radius:var(--sn-stylekit-general-border-radius);pointer-events:none;box-shadow:inset 0 0 0 1px;color:var(--sn-stylekit-neutral-color)}.sn-component .sk-notification.neutral.no-bg,.sn-component .sk-input.neutral.no-bg{background-color:transparent}.sn-component .sk-notification.neutral.no-bg:before,.sn-component .sk-input.neutral.no-bg:before{content:none}.sn-component .sk-notification.neutral.featured,.sn-component .sk-input.neutral.featured{border:none;padding:0.75rem 1.25rem;font-size:var(--sn-stylekit-font-size-h3)}.sn-component .sk-notification.neutral.featured:before,.sn-component .sk-input.neutral.featured:before{opacity:1.0}.sn-component .sk-notification.info,.sn-component .sk-input.info{color:var(--sn-stylekit-info-contrast-color);position:relative;background-color:var(--sn-stylekit-info-color);overflow:hidden;border-radius:var(--sn-stylekit-general-border-radius);border-color:var(--sn-stylekit-info-color)}.sn-component .sk-notification.info *,.sn-component .sk-input.info *{position:relative}.sn-component .sk-notification.info:before,.sn-component .sk-input.info:before{content:\"\";position:absolute;top:0;left:0;width:100%;height:100%;background-color:var(--sn-stylekit-info-color);opacity:1.0;border-radius:var(--sn-stylekit-general-border-radius)}.sn-component .sk-notification.info:after,.sn-component .sk-input.info:after{content:'';display:block;height:100%;position:absolute;top:0;left:0;width:100%;border-radius:var(--sn-stylekit-general-border-radius);pointer-events:none;box-shadow:inset 0 0 0 1px;color:var(--sn-stylekit-info-color)}.sn-component .sk-notification.info.no-bg,.sn-component .sk-input.info.no-bg{background-color:transparent}.sn-component .sk-notification.info.no-bg:before,.sn-component .sk-input.info.no-bg:before{content:none}.sn-component .sk-notification.info.featured,.sn-component .sk-input.info.featured{border:none;padding:0.75rem 1.25rem;font-size:var(--sn-stylekit-font-size-h3)}.sn-component .sk-notification.info.featured:before,.sn-component .sk-input.info.featured:before{opacity:1.0}.sn-component .sk-notification.warning,.sn-component .sk-input.warning{color:var(--sn-stylekit-warning-contrast-color);position:relative;background-color:var(--sn-stylekit-warning-color);overflow:hidden;border-radius:var(--sn-stylekit-general-border-radius);border-color:var(--sn-stylekit-warning-color)}.sn-component .sk-notification.warning *,.sn-component .sk-input.warning *{position:relative}.sn-component .sk-notification.warning:before,.sn-component .sk-input.warning:before{content:\"\";position:absolute;top:0;left:0;width:100%;height:100%;background-color:var(--sn-stylekit-warning-color);opacity:1.0;border-radius:var(--sn-stylekit-general-border-radius)}.sn-component .sk-notification.warning:after,.sn-component .sk-input.warning:after{content:'';display:block;height:100%;position:absolute;top:0;left:0;width:100%;border-radius:var(--sn-stylekit-general-border-radius);pointer-events:none;box-shadow:inset 0 0 0 1px;color:var(--sn-stylekit-warning-color)}.sn-component .sk-notification.warning.no-bg,.sn-component .sk-input.warning.no-bg{background-color:transparent}.sn-component .sk-notification.warning.no-bg:before,.sn-component .sk-input.warning.no-bg:before{content:none}.sn-component .sk-notification.warning.featured,.sn-component .sk-input.warning.featured{border:none;padding:0.75rem 1.25rem;font-size:var(--sn-stylekit-font-size-h3)}.sn-component .sk-notification.warning.featured:before,.sn-component .sk-input.warning.featured:before{opacity:1.0}.sn-component .sk-notification.danger,.sn-component .sk-input.danger{color:var(--sn-stylekit-danger-contrast-color);position:relative;background-color:var(--sn-stylekit-danger-color);overflow:hidden;border-radius:var(--sn-stylekit-general-border-radius);border-color:var(--sn-stylekit-danger-color)}.sn-component .sk-notification.danger *,.sn-component .sk-input.danger *{position:relative}.sn-component .sk-notification.danger:before,.sn-component .sk-input.danger:before{content:\"\";position:absolute;top:0;left:0;width:100%;height:100%;background-color:var(--sn-stylekit-danger-color);opacity:1.0;border-radius:var(--sn-stylekit-general-border-radius)}.sn-component .sk-notification.danger:after,.sn-component .sk-input.danger:after{content:'';display:block;height:100%;position:absolute;top:0;left:0;width:100%;border-radius:var(--sn-stylekit-general-border-radius);pointer-events:none;box-shadow:inset 0 0 0 1px;color:var(--sn-stylekit-danger-color)}.sn-component .sk-notification.danger.no-bg,.sn-component .sk-input.danger.no-bg{background-color:transparent}.sn-component .sk-notification.danger.no-bg:before,.sn-component .sk-input.danger.no-bg:before{content:none}.sn-component .sk-notification.danger.featured,.sn-component .sk-input.danger.featured{border:none;padding:0.75rem 1.25rem;font-size:var(--sn-stylekit-font-size-h3)}.sn-component .sk-notification.danger.featured:before,.sn-component .sk-input.danger.featured:before{opacity:1.0}.sn-component .sk-notification.success,.sn-component .sk-input.success{color:var(--sn-stylekit-success-contrast-color);position:relative;background-color:var(--sn-stylekit-success-color);overflow:hidden;border-radius:var(--sn-stylekit-general-border-radius);border-color:var(--sn-stylekit-success-color)}.sn-component .sk-notification.success *,.sn-component .sk-input.success *{position:relative}.sn-component .sk-notification.success:before,.sn-component .sk-input.success:before{content:\"\";position:absolute;top:0;left:0;width:100%;height:100%;background-color:var(--sn-stylekit-success-color);opacity:1.0;border-radius:var(--sn-stylekit-general-border-radius)}.sn-component .sk-notification.success:after,.sn-component .sk-input.success:after{content:'';display:block;height:100%;position:absolute;top:0;left:0;width:100%;border-radius:var(--sn-stylekit-general-border-radius);pointer-events:none;box-shadow:inset 0 0 0 1px;color:var(--sn-stylekit-success-color)}.sn-component .sk-notification.success.no-bg,.sn-component .sk-input.success.no-bg{background-color:transparent}.sn-component .sk-notification.success.no-bg:before,.sn-component .sk-input.success.no-bg:before{content:none}.sn-component .sk-notification.success.featured,.sn-component .sk-input.success.featured{border:none;padding:0.75rem 1.25rem;font-size:var(--sn-stylekit-font-size-h3)}.sn-component .sk-notification.success.featured:before,.sn-component .sk-input.success.featured:before{opacity:1.0}.sn-component .sk-notification{padding:1.1rem 1rem;margin:1.4rem 0;text-align:left;cursor:default}.sn-component .sk-notification.one-line{padding:0rem 0.4rem}.sn-component .sk-notification.stretch{width:100%}.sn-component .sk-notification.dashed{border-style:dashed;border-width:2px}.sn-component .sk-notification.dashed:after{box-shadow:none}.sn-component .sk-notification .sk-notification-title{font-size:var(--sn-stylekit-font-size-h1);font-weight:bold;line-height:1.9rem}.sn-component .sk-notification .sk-notification-text{line-height:1.5rem;font-size:var(--sn-stylekit-font-size-p);text-align:left;font-weight:normal}.sn-component .sk-circle{border:1px solid;cursor:pointer;border-color:var(--sn-stylekit-contrast-foreground-color);background-color:var(--sn-stylekit-contrast-background-color);padding:0;border-radius:50% !important;flex-shrink:0}.sn-component .sk-circle:before{border-radius:50% !important}.sn-component .sk-circle:after{border-radius:50% !important}.sn-component .sk-circle.small{width:11px;height:11px}.sn-component .sk-spinner{border:1px solid var(--sn-stylekit-neutral-color);border-radius:50%;animation:rotate 0.8s infinite linear;border-right-color:transparent}.sn-component .sk-spinner.small{width:12px;height:12px}.sn-component .sk-spinner.info-contrast{border-color:var(--sn-stylekit-info-contrast-color);border-right-color:transparent}.sn-component .sk-spinner.info{border-color:var(--sn-stylekit-info-color);border-right-color:transparent}.sn-component .sk-spinner.warning{border-color:var(--sn-stylekit-warning-color);border-right-color:transparent}.sn-component .sk-spinner.danger{border-color:var(--sn-stylekit-danger-color);border-right-color:transparent}.sn-component .sk-spinner.success{border-color:var(--sn-stylekit-success-color);border-right-color:transparent}@keyframes rotate{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}.sn-component .sk-app-bar{display:flex;width:100%;height:2rem;padding:0.0rem 0.8rem;background-color:var(--sn-stylekit-contrast-background-color);color:var(--sn-stylekit-contrast-foreground-color);justify-content:space-between;align-items:center;border:1px solid var(--sn-stylekit-contrast-border-color);user-select:none}.sn-component .sk-app-bar.no-edges{border-left:0;border-right:0}.sn-component .sk-app-bar.no-bottom-edge{border-bottom:0}.sn-component .sk-app-bar .left,.sn-component .sk-app-bar .right{display:flex;height:100%}.sn-component .sk-app-bar .sk-app-bar-item{flex-grow:1;cursor:pointer;display:flex;align-items:center;justify-content:center}.sn-component .sk-app-bar .sk-app-bar-item:not(:first-child){margin-left:1rem}.sn-component .sk-app-bar .sk-app-bar-item.border{border-left:1px solid var(--sn-stylekit-contrast-border-color)}.sn-component .sk-app-bar .sk-app-bar-item>.sk-app-bar-item-column{height:100%;display:flex;align-items:center}.sn-component .sk-app-bar .sk-app-bar-item>.sk-app-bar-item-column:not(:first-child){margin-left:0.5rem}.sn-component .sk-app-bar .sk-app-bar-item>.sk-app-bar-item-column.underline{border-bottom:2px solid var(--sn-stylekit-info-color)}.sn-component .sk-app-bar .sk-app-bar-item.no-pointer{cursor:default}.sn-component .sk-app-bar .sk-app-bar-item:hover>.sk-label:not(.subtle),.sn-component .sk-app-bar .sk-panel-section .sk-app-bar-item:hover>.sk-panel-section-subtitle:not(.subtle),.sn-component .sk-panel-section .sk-app-bar .sk-app-bar-item:hover>.sk-panel-section-subtitle:not(.subtle),.sn-component .sk-app-bar .sk-app-bar-item:hover>.sk-sublabel:not(.subtle),.sn-component .sk-app-bar .sk-app-bar-item:hover>.sk-app-bar-item-column>.sk-label:not(.subtle),.sn-component .sk-app-bar .sk-panel-section .sk-app-bar-item:hover>.sk-app-bar-item-column>.sk-panel-section-subtitle:not(.subtle),.sn-component .sk-panel-section .sk-app-bar .sk-app-bar-item:hover>.sk-app-bar-item-column>.sk-panel-section-subtitle:not(.subtle),.sn-component .sk-app-bar .sk-app-bar-item:hover>.sk-app-bar-item-column>.sk-sublabel:not(.subtle){color:var(--sn-stylekit-info-color)}.sn-component .sk-app-bar .sk-app-bar-item>.sk-label,.sn-component .sk-app-bar .sk-panel-section .sk-app-bar-item>.sk-panel-section-subtitle,.sn-component .sk-panel-section .sk-app-bar .sk-app-bar-item>.sk-panel-section-subtitle,.sn-component .sk-app-bar .sk-app-bar-item>.sk-app-bar-item-column>.sk-label,.sn-component .sk-app-bar .sk-panel-section .sk-app-bar-item>.sk-app-bar-item-column>.sk-panel-section-subtitle,.sn-component .sk-panel-section .sk-app-bar .sk-app-bar-item>.sk-app-bar-item-column>.sk-panel-section-subtitle{font-weight:bold;font-size:var(--sn-stylekit-font-size-h5);white-space:nowrap}.sn-component .sk-app-bar .sk-app-bar-item>.sk-sublabel,.sn-component .sk-app-bar .sk-app-bar-item>.sk-app-bar-item-column>.sk-sublabel{font-size:var(--sn-stylekit-font-size-h5);font-weight:normal;white-space:nowrap}.sn-component .sk-app-bar .sk-app-bar-item .subtle{font-weight:normal;opacity:0.6}.sn-component .sk-panel-table{display:flex;flex-wrap:wrap;padding-left:1px;padding-top:1px}.sn-component .sk-panel-table .sk-panel-table-item{flex:45%;flex-flow:wrap;border:1px solid var(--sn-stylekit-border-color);padding:1rem;margin-left:-1px;margin-top:-1px;display:flex;flex-direction:column;justify-content:space-between}.sn-component .sk-panel-table .sk-panel-table-item img{max-width:100%;margin-bottom:1rem}.sn-component .sk-panel-table .sk-panel-table-item .sk-panel-table-item-content{display:flex;flex-direction:row}.sn-component .sk-panel-table .sk-panel-table-item .sk-panel-table-item-column{align-items:center}.sn-component .sk-panel-table .sk-panel-table-item .sk-panel-table-item-column.stretch{width:100%}.sn-component .sk-panel-table .sk-panel-table-item .sk-panel-table-item-column:not(:first-child){padding-left:0.75rem}.sn-component .sk-panel-table .sk-panel-table-item .sk-panel-table-item-column.quarter{flex-basis:25%}.sn-component .sk-panel-table .sk-panel-table-item .sk-panel-table-item-column.three-quarters{flex-basis:75%}.sn-component .sk-panel-table .sk-panel-table-item .sk-panel-table-item-footer{margin-top:1.25rem}.sn-component .sk-panel-table .sk-panel-table-item.no-border{border:none}.sn-component .sk-modal{position:fixed;margin-left:auto;margin-right:auto;left:0;right:0;top:0;bottom:0;z-index:10000;width:100vw;height:100vh;background-color:transparent;color:var(--sn-stylekit-contrast-foreground-color);display:flex;align-items:center;justify-content:center}.sn-component .sk-modal .sn-component{height:100%}.sn-component .sk-modal .sn-component .sk-panel{height:100%}.sn-component .sk-modal.auto-height>.sk-modal-content{height:auto !important}.sn-component .sk-modal.large>.sk-modal-content{width:900px;height:600px}.sn-component .sk-modal.medium>.sk-modal-content{width:700px;height:500px}.sn-component .sk-modal.small>.sk-modal-content{width:700px;height:344px}.sn-component .sk-modal .sk-modal-background{position:absolute;z-index:-1;width:100%;height:100%;background-color:var(--sn-stylekit-contrast-background-color);opacity:0.7}.sn-component .sk-modal>.sk-modal-content{overflow-y:auto;width:auto;padding:0;padding-bottom:0;min-width:300px;-webkit-box-shadow:0px 2px 35px 0px rgba(0,0,0,0.19);-moz-box-shadow:0px 2px 35px 0px rgba(0,0,0,0.19);box-shadow:0px 2px 35px 0px rgba(0,0,0,0.19)}.sn-component.no-select{user-select:none}input,textarea,[contenteditable]{caret-color:var(--sn-stylekit-editor-foreground-color)}.windows-web,.windows-desktop,.linux-web,.linux-desktop{scrollbar-width:thin}.windows-web ::-webkit-scrollbar,.windows-desktop ::-webkit-scrollbar,.linux-web ::-webkit-scrollbar,.linux-desktop ::-webkit-scrollbar{width:17px;height:18px;border-left:0.5px solid var(--sn-stylekit-scrollbar-track-border-color-color)}.windows-web ::-webkit-scrollbar-thumb,.windows-desktop ::-webkit-scrollbar-thumb,.linux-web ::-webkit-scrollbar-thumb,.linux-desktop ::-webkit-scrollbar-thumb{border:4px solid rgba(0,0,0,0);background-clip:padding-box;-webkit-border-radius:10px;background-color:var(--sn-stylekit-scrollbar-thumb-color);-webkit-box-shadow:inset -1px -1px 0px rgba(0,0,0,0.05),inset 1px 1px 0px rgba(0,0,0,0.05)}.windows-web ::-webkit-scrollbar-button,.windows-desktop ::-webkit-scrollbar-button,.linux-web ::-webkit-scrollbar-button,.linux-desktop ::-webkit-scrollbar-button{width:0;height:0;display:none}.windows-web ::-webkit-scrollbar-corner,.windows-desktop ::-webkit-scrollbar-corner,.linux-web ::-webkit-scrollbar-corner,.linux-desktop ::-webkit-scrollbar-corner{background-color:transparent}\n"]} \ No newline at end of file diff --git a/build/static/css/main.8cc0684d.chunk.css b/build/static/css/main.8cc0684d.chunk.css new file mode 100644 index 0000000..d7dbddc --- /dev/null +++ b/build/static/css/main.8cc0684d.chunk.css @@ -0,0 +1,2 @@ +body{margin:0;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Roboto","Oxygen","Ubuntu","Cantarell","Fira Sans","Droid Sans","Helvetica Neue",sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}code{font-family:source-code-pro,Menlo,Monaco,Consolas,"Courier New",monospace}:root{--sn-stylekit-font-size-editor:16px;--sn-stylekit-monospace-font:SFMono-Regular,Consolas,Liberation Mono,Menlo,"Ubuntu Mono",courier,monospace}@media screen and (max-width:650px){:root{--sn-stylekit-font-size-editor:18px}}body,html{font-family:SFMono-Regular,Consolas,Liberation Mono,Menlo,"Ubuntu Mono",courier,monospace;font-family:var(--sn-stylekit-monospace-font);height:100%;width:100%;margin:0;padding:0;font-size:var(--sn-stylekit-base-font-size);background-color:transparent}*{-webkit-tap-highlight-color:rgba(0,0,0,0)}#music-editor{display:flex;width:100%;height:100%;min-height:100vh;max-height:100vh;flex-direction:column;font-size:16px;font-size:var(--sn-stylekit-font-size-editor);background-color:var(--sn-stylekit-editor-background-color);color:var(--sn-stylekit-editor-foreground-color)}#header{border-bottom:1px solid var(--sn-stylekit-border-color);padding:5px;background-color:var(--sn-stylekit-background-color);color:var(--sn-stylekit-foreground-color)}#header .segmented-buttons-container{display:flex;justify-content:center;-webkit-user-select:none;-ms-user-select:none;user-select:none}#header .buttons{display:flex}#header .button{padding:4px 12px;margin-right:4px;border:1px solid var(--sn-component-inner-border-color);border-radius:0}#header .button.selected{font-weight:700}#header .sk-label{font-size:13px;width:50px}#header #print-button{position:absolute;right:5px;top:5px}@media screen and (max-width:500px){#header #print-button{display:none}}#editor-container{flex-grow:1;display:flex;flex-direction:row;overflow:hidden}#editor{background-color:var(--sn-stylekit-editor-background-color);color:var(--sn-stylekit-editor-foreground-color);font-size:16px;font-size:var(--sn-stylekit-font-size-editor);-webkit-overflow-scrolling:touch;font-family:SFMono-Regular,Consolas,Liberation Mono,Menlo,"Ubuntu Mono",courier,monospace;font-family:var(--sn-stylekit-monospace-font);flex-grow:0;border:0;resize:none;padding:12px}#editor.edit{width:100%!important}#editor.split{width:calc(50% - 28px)}#editor.view{width:0!important;padding:0}#column-resizer{width:8px;background-color:var(--sn-stylekit-border-color);cursor:col-resize}#column-resizer.edit,#column-resizer.view{display:none}#view{background-color:var(--sn-stylekit-background-color);color:var(--sn-stylekit-foreground-color);flex:1 1;font-family:SFMono-Regular,Consolas,Liberation Mono,Menlo,"Ubuntu Mono",courier,monospace;font-family:var(--sn-stylekit-monospace-font);overflow:auto;padding:12px;white-space:pre}#view.edit{width:0!important;padding:0}#view.split{width:calc(50% - 28px)}#view.view{width:100%!important}#view svg{height:100%;width:100%}#view a{color:var(--sn-stylekit-info-color);text-decoration:none}#view a:hover{text-decoration:underline}#view hr{border:.5px solid var(--sn-stylekit-border-color)}@media print{#column-resizer,#editor,#header{display:none}.sn-component{outline:0}} +/*# sourceMappingURL=main.8cc0684d.chunk.css.map */ \ No newline at end of file diff --git a/build/static/css/main.8cc0684d.chunk.css.map b/build/static/css/main.8cc0684d.chunk.css.map new file mode 100644 index 0000000..40818ad --- /dev/null +++ b/build/static/css/main.8cc0684d.chunk.css.map @@ -0,0 +1 @@ +{"version":3,"sources":["webpack://src/index.css","webpack://src/stylesheets/main.scss","webpack://src/stylesheets/print.scss"],"names":[],"mappings":"AAAA,KACE,QAAS,CACT,mJAEY,CACZ,kCAAmC,CACnC,iCACF,CAEA,KACE,yEAEF,CCVA,MACE,mCAA+B,CAC/B,0GAA6B,CAE9B,oCAGC,MACE,mCAA+B,CAChC,CAGH,UAEE,yFAA8C,CAA9C,6CAA8C,CAC9C,WAAY,CACZ,UAAW,CACX,QAAS,CACT,SAAU,CACV,2CAA4C,CAC5C,4BAA6B,CAC9B,EAIC,yCAA6C,CAC9C,cAGC,YAAa,CACb,UAAW,CACX,WAAY,CACZ,gBAAiB,CACjB,gBAAiB,CACjB,qBAAsB,CACtB,cAA8C,CAA9C,6CAA8C,CAC9C,2DAA4D,CAC5D,gDAAiD,CAClD,QAGC,uDAAwD,CACxD,WAAY,CACZ,oDAAqD,CACrD,yCAA0C,CAJ5C,qCAOI,YAAa,CACb,sBAAuB,CACvB,wBAAA,CAAA,oBAAA,CAAA,gBAAiB,CATrB,iBAaI,YAAa,CAbjB,gBAiBI,gBAAiB,CACjB,gBAAiB,CACjB,uDAAwD,CACxD,eAAgB,CApBpB,yBAuBM,eAAiB,CAvBvB,kBA4BI,cAAe,CACf,UAAW,CA7Bf,sBAiCI,iBAAkB,CAClB,SAAU,CACV,OAAQ,CACR,oCApCJ,sBAqCM,YAAa,CAEhB,CAGH,kBACE,WAAY,CACZ,YAAa,CACb,kBAAmB,CACnB,eAAgB,CACjB,QAGC,2DAA4D,CAC5D,gDAAiD,CACjD,cAA8C,CAA9C,6CAA8C,CAC9C,gCAAiC,CACjC,yFAA8C,CAA9C,6CAA8C,CAgB9C,WAAY,CACZ,QAAW,CACX,WAAY,CACZ,YAAa,CAxBf,aAQI,oBAAsB,CAR1B,cAYI,sBAAuB,CAZ3B,aAgBI,iBAAmB,CAEnB,SAAe,CAChB,gBASD,SAAU,CACV,gDAAiD,CACjD,iBAAkB,CAHpB,0CAOI,YAAa,CACd,MAOD,oDAAqD,CACrD,yCAA0C,CAC1C,QAAO,CACP,yFAA8C,CAA9C,6CAA8C,CAC9C,aAAc,CACd,YAAa,CACb,eAAgB,CAPlB,WAUI,iBAAmB,CAEnB,SAAe,CAZnB,YAgBI,sBAAuB,CAhB3B,WAoBI,oBAAsB,CApB1B,UAuBI,WAAY,CACZ,UAAW,CAxBf,QA2BI,mCAAoC,CACpC,oBAAqB,CA5BzB,cA+BI,yBAA0B,CA/B9B,SAkCI,iDAAmD,CACpD,aCtKD,gCAGE,YAAa,CACd,cAEC,SAAY,CACb","file":"main.8cc0684d.chunk.css","sourcesContent":["body {\n margin: 0;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',\n 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',\n sans-serif;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n\ncode {\n font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',\n monospace;\n}\n","@import '~sn-stylekit/dist/stylekit.css';\n\n:root {\n --sn-stylekit-font-size-editor: 16px;\n --sn-stylekit-monospace-font: SFMono-Regular, Consolas, Liberation Mono, Menlo,\n 'Ubuntu Mono', courier, monospace;\n}\n\n@media screen and (max-width: 650px) {\n :root {\n --sn-stylekit-font-size-editor: 18px;\n }\n}\n\nbody,\nhtml {\n font-family: var(--sn-stylekit-monospace-font);\n height: 100%;\n width: 100%;\n margin: 0;\n padding: 0;\n font-size: var(--sn-stylekit-base-font-size);\n background-color: transparent;\n}\n\n* {\n // To prevent gray flash when focusing input on mobile Safari\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\n}\n\n#music-editor {\n display: flex;\n width: 100%;\n height: 100%;\n min-height: 100vh;\n max-height: 100vh;\n flex-direction: column;\n font-size: var(--sn-stylekit-font-size-editor);\n background-color: var(--sn-stylekit-editor-background-color);\n color: var(--sn-stylekit-editor-foreground-color);\n}\n\n#header {\n border-bottom: 1px solid var(--sn-stylekit-border-color);\n padding: 5px;\n background-color: var(--sn-stylekit-background-color);\n color: var(--sn-stylekit-foreground-color);\n\n .segmented-buttons-container {\n display: flex;\n justify-content: center;\n user-select: none;\n }\n\n .buttons {\n display: flex;\n }\n\n .button {\n padding: 4px 12px;\n margin-right: 4px;\n border: 1px solid var(--sn-component-inner-border-color);\n border-radius: 0;\n\n &.selected {\n font-weight: bold;\n }\n }\n\n .sk-label {\n font-size: 13px;\n width: 50px;\n }\n\n #print-button {\n position: absolute;\n right: 5px;\n top: 5px;\n @media screen and (max-width: 500px) {\n display: none;\n }\n }\n}\n\n#editor-container {\n flex-grow: 1;\n display: flex;\n flex-direction: row;\n overflow: hidden; // required for footer bar to display in Firefox\n}\n\n#editor {\n background-color: var(--sn-stylekit-editor-background-color);\n color: var(--sn-stylekit-editor-foreground-color);\n font-size: var(--sn-stylekit-font-size-editor);\n -webkit-overflow-scrolling: touch;\n font-family: var(--sn-stylekit-monospace-font);\n\n &.edit {\n width: 100% !important;\n }\n\n &.split {\n width: calc(50% - 28px);\n }\n\n &.view {\n width: 0 !important;\n padding: 0;\n padding-left: 0;\n }\n\n flex-grow: 0;\n border: 0px;\n resize: none;\n padding: 12px;\n}\n\n#column-resizer {\n width: 8px;\n background-color: var(--sn-stylekit-border-color);\n cursor: col-resize;\n\n &.edit,\n &.view {\n display: none;\n }\n\n //&.dragging {\n //}\n}\n\n#view {\n background-color: var(--sn-stylekit-background-color);\n color: var(--sn-stylekit-foreground-color);\n flex: 1;\n font-family: var(--sn-stylekit-monospace-font);\n overflow: auto;\n padding: 12px;\n white-space: pre;\n\n &.edit {\n width: 0 !important;\n padding: 0;\n padding-left: 0;\n }\n\n &.split {\n width: calc(50% - 28px);\n }\n\n &.view {\n width: 100% !important;\n }\n svg {\n height: 100%;\n width: 100%;\n }\n a {\n color: var(--sn-stylekit-info-color);\n text-decoration: none;\n }\n a:hover {\n text-decoration: underline;\n }\n hr {\n border: 0.5px solid var(--sn-stylekit-border-color);\n }\n}\n\n@import './print.scss';\n","@media print {\n #editor,\n #header,\n #column-resizer {\n display: none;\n }\n .sn-component {\n outline: 0px;\n }\n}\n"]} \ No newline at end of file diff --git a/build/static/js/2.c20f73b8.chunk.js b/build/static/js/2.c20f73b8.chunk.js new file mode 100644 index 0000000..4606f47 --- /dev/null +++ b/build/static/js/2.c20f73b8.chunk.js @@ -0,0 +1,3 @@ +/*! For license information please see 2.c20f73b8.chunk.js.LICENSE.txt */ +(this["webpackJsonpmusic-editor"]=this["webpackJsonpmusic-editor"]||[]).push([[2],[function(t,e,n){"use strict";t.exports=n(20)},function(t,e,n){"use strict";t.exports=n(21)},function(t,e){function n(e){return t.exports=n=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},n(e)}t.exports=n},function(t,e,n){var r=n(8),i=n(28),a=n(2),o=n(30),s=n(11),l=n(12),u=n(35),c=n(39),b=n(40),h=n(41),f=n(42),d=n(43),p=n(44);window,t.exports=function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=12)}([function(t,e,n){"use strict";var m=function(){};m.L=function(t,e){if(e){var n=Array.prototype.slice.call(e).join(" ");window.console.log(t+": "+n)}},m.MakeException=function(t){return function(e){f(r,e);var n=d(r);function r(e,i){var a;return h(this,r),(a=n.call(this,e)).name=t,a.message=e,a.data=i,a}return r}(p(Error))},m.RERR=m.RuntimeError=function(){function t(e,n){h(this,t),this.code=e,this.message=n}return b(t,[{key:"toString",value:function(){return"[RuntimeError] "+this.code+":"+this.message}}]),t}(),m.Merge=function(t,e){for(var n in e)t[n]=e[n];return t},m.Min=Math.min,m.Max=Math.max,m.forEach=function(t,e){for(var n=0;n=e/2?parseInt(t/e,10)*e+e:parseInt(t/e,10)*e},m.MidLine=function(t,e){var n=e+(t-e)/2;return n%2>0&&(n=m.RoundN(10*n,5)/10),n},m.SortAndUnique=function(t,e,n){if(t.length>1){var r,i=[];t.sort(e);for(var a=0;a3&&void 0!==arguments[3]?arguments[3]:"#55";t.save(),t.setFillStyle(r),t.beginPath(),t.arc(e,n,3,0,2*Math.PI,!0),t.closePath(),t.fill(),t.restore()},m.BM=function(t,e){var n=(new Date).getTime();e();var r=(new Date).getTime()-n;m.L(t+r+"ms")},m.StackTrace=function(){return(new Error).stack},m.W=function(){for(var t=arguments.length,e=new Array(t),n=0;n0}},{key:"greaterThanEquals",value:function(e){var n=t.__compareB.copy(this);return n.subtract(e),n.numerator>=0}},{key:"lessThan",value:function(t){return!this.greaterThanEquals(t)}},{key:"lessThanEquals",value:function(t){return!this.greaterThan(t)}},{key:"clone",value:function(){return new t(this.numerator,this.denominator)}},{key:"copy",value:function(t){return"number"==typeof t?this.set(t||0,1):this.set(t.numerator,t.denominator)}},{key:"quotient",value:function(){return Math.floor(this.numerator/this.denominator)}},{key:"fraction",value:function(){return this.numerator%this.denominator}},{key:"abs",value:function(){return this.denominator=Math.abs(this.denominator),this.numerator=Math.abs(this.numerator),this}},{key:"toString",value:function(){return this.numerator+"/"+this.denominator}},{key:"toSimplifiedString",value:function(){return t.__tmp.copy(this).simplify().toString()}},{key:"toMixedString",value:function(){var e="",n=this.quotient(),r=t.__tmp.copy(this);return n<0?r.abs().fraction():r.fraction(),0!==n?(e+=n,0!==r.numerator&&(e+=" "+r.toSimplifiedString())):e=0===r.numerator?"0":r.toSimplifiedString(),e}},{key:"parse",value:function(t){var e=t.split("/"),n=parseInt(e[0],10),r=e[1]?parseInt(e[1],10):1;return this.set(n,r)}}]),t}();v.__compareA=new v,v.__compareB=new v,v.__tmp=new v;var y=m.MakeException("RegistryError");function g(t,e,n,r,i){t[e][n]||(t[e][n]={}),t[e][n][r]=i}var _=function(){function t(){h(this,t),this.clear()}return b(t,null,[{key:"INDEXES",get:function(){return["type"]}}]),b(t,[{key:"clear",value:function(){return this.index={id:{},type:{},class:{}},this}},{key:"updateIndex",value:function(t){var e=t.id,n=t.name,r=t.value,i=t.oldValue,a=this.getElementById(e);null!==i&&this.index[n][i]&&delete this.index[n][i][e],null!==r&&g(this.index,n,r,a.getAttribute("id"),a)}},{key:"register",value:function(e,n){var r=this;if(!(n=n||e.getAttribute("id")))throw new y("Can't add element without `id` attribute to registry",e);return e.setAttribute("id",n),g(this.index,"id",n,n,e),t.INDEXES.forEach((function(t){r.updateIndex({id:n,name:t,value:e.getAttribute(t),oldValue:null})})),e.onRegister(this),this}},{key:"getElementById",value:function(t){return this.index.id[t]?this.index.id[t][t]:null}},{key:"getElementsByAttribute",value:function(t,e){var n=this.index[t];return n&&n[e]?Object.keys(n[e]).map((function(t){return n[e][t]})):[]}},{key:"getElementsByType",value:function(t){return this.getElementsByAttribute("type",t)}},{key:"getElementsByClass",value:function(t){return this.getElementsByAttribute("class",t)}},{key:"onUpdate",value:function(e){var n=e.id,r=e.name,i=e.value,a=e.oldValue;return function(t,e){return t.filter((function(t){return t===e})).length>0}(t.INDEXES.concat(["id","class"]),r)?(this.updateIndex({id:n,name:r,value:i,oldValue:a}),this):this}}],[{key:"enableDefaultRegistry",value:function(e){t.defaultRegistry=e}},{key:"getDefaultRegistry",value:function(){return t.defaultRegistry}},{key:"disableDefaultRegistry",value:function(){t.defaultRegistry=null}}]),t}();_.defaultRegistry=null;var x=function(){function t(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).type;h(this,t),this.attrs={id:t.newID(),el:null,type:e||"Base",classes:{}},this.boundingBox=null,this.context=null,this.rendered=!1,this.fontStack=R.DEFAULT_FONT_STACK,this.musicFont=R.DEFAULT_FONT_STACK[0],_.getDefaultRegistry()&&_.getDefaultRegistry().register(this)}return b(t,null,[{key:"newID",value:function(){return"auto"+t.ID++}}]),b(t,[{key:"setFontStack",value:function(t){return this.fontStack=t,this.musicFont=t[0],this}},{key:"getFontStack",value:function(){return this.fontStack}},{key:"setStyle",value:function(t){return this.style=t,this}},{key:"getStyle",value:function(){return this.style}},{key:"applyStyle",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.context,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.getStyle();return e?(t.save(),e.shadowColor&&t.setShadowColor(e.shadowColor),e.shadowBlur&&t.setShadowBlur(e.shadowBlur),e.fillStyle&&t.setFillStyle(e.fillStyle),e.strokeStyle&&t.setStrokeStyle(e.strokeStyle),e.lineWidth&&t.setLineWidth(e.lineWidth),this):this}},{key:"restoreStyle",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.context;return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.getStyle())?(t.restore(),this):this}},{key:"drawWithStyle",value:function(){this.checkContext(),this.applyStyle(),this.draw(),this.restoreStyle()}},{key:"hasClass",value:function(t){return!0===this.attrs.classes[t]}},{key:"addClass",value:function(t){return this.attrs.classes[t]=!0,this.registry&&this.registry.onUpdate({id:this.getAttribute("id"),name:"class",value:t,oldValue:null}),this}},{key:"removeClass",value:function(t){return delete this.attrs.classes[t],this.registry&&this.registry.onUpdate({id:this.getAttribute("id"),name:"class",value:null,oldValue:t}),this}},{key:"onRegister",value:function(t){return this.registry=t,this}},{key:"isRendered",value:function(){return this.rendered}},{key:"setRendered",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.rendered=t,this}},{key:"getAttributes",value:function(){return this.attrs}},{key:"getAttribute",value:function(t){return this.attrs[t]}},{key:"setAttribute",value:function(t,e){var n=this.attrs.id,r=this.attrs[t];return this.attrs[t]=e,this.registry&&this.registry.onUpdate({id:n,name:t,value:e,oldValue:r}),this}},{key:"getContext",value:function(){return this.context}},{key:"setContext",value:function(t){return this.context=t,this}},{key:"getBoundingBox",value:function(){return this.boundingBox}},{key:"checkContext",value:function(){if(!this.context)throw new m.RERR("NoContext","No rendering context attached to instance");return this.context}}]),t}();x.ID=1e3;var k=function(){function t(e,n,r,i){h(this,t),this.x1=Number.NaN,this.y1=Number.NaN,this.x2=Number.NaN,this.y2=Number.NaN,this.addPoint(e,n),this.addPoint(r,i)}return b(t,[{key:"width",value:function(){return this.x2-this.x1}},{key:"height",value:function(){return this.y2-this.y1}},{key:"noOp",value:function(){}},{key:"addPoint",value:function(t,e){null!=t&&((isNaN(this.x1)||isNaN(this.x2))&&(this.x1=t,this.x2=t),tthis.x2&&(this.x2=t)),null!=e&&((isNaN(this.y1)||isNaN(this.y2))&&(this.y1=e,this.y2=e),ethis.y2&&(this.y2=e))}},{key:"addX",value:function(t){this.addPoint(t,null)}},{key:"addY",value:function(t){this.addPoint(null,t)}},{key:"addQuadraticCurve",value:function(t,e,n,r,i,a){var o=t+2/3*(n-t),s=e+2/3*(r-e),l=o+1/3*(i-t),u=s+1/3*(a-e);this.addBezierCurve(t,e,o,s,l,u,i,a)}},{key:"addBezierCurve",value:function(t,e,n,r,i,a,o,s){var l,u=[t,e],c=[n,r],b=[i,a],h=[o,s];this.addPoint(u[0],u[1]),this.addPoint(h[0],h[1]);var f=function(t,e){return Math.pow(1-t,3)*u[e]+3*Math.pow(1-t,2)*t*c[e]+3*(1-t)*Math.pow(t,2)*b[e]+Math.pow(t,3)*h[e]};for(l=0;l<=1;l++){var d=6*u[l]-12*c[l]+6*b[l],p=-3*u[l]+9*c[l]-9*b[l]+3*h[l],m=3*c[l]-3*u[l];if(0!==p){var v=Math.pow(d,2)-4*m*p;if(!(v<0)){var y=(-d+Math.sqrt(v))/(2*p);01?e-1:0),r=1;r2&&void 0!==arguments[2]?arguments[2]:null,a=n.lookupGlyph(t,e),o=a.glyph,s=a.font,l=i?n.lookupFontMetric({font:s,category:i,code:e,key:"shiftX",defaultValue:0}):0,u=i?n.lookupFontMetric({font:s,category:i,code:e,key:"shiftY",defaultValue:0}):0,c=i?n.lookupFontMetric({font:s,category:i,code:e,key:"scale",defaultValue:1}):1,b=o.x_min,h=o.x_max,f=o.ha;if(o.o)return o.cached_outline?r=o.cached_outline:(r=o.o.split(" "),o.cached_outline=r),{x_min:b,x_max:h,x_shift:l,y_shift:u,scale:c,ha:f,outline:r,font:s};throw new m.RERR("BadGlyph","Glyph ".concat(e," has no outline defined."))}},{key:"renderGlyph",value:function(t,e,r,i,a,o){var s=c({fontStack:R.DEFAULT_FONT_STACK,category:null},o),l=n.loadMetrics(s.fontStack,a,s.category),u=72*(i=s.category?n.lookupFontMetric({font:l.font,category:s.category,code:a,key:"point",defaultValue:i}):i)/(100*l.font.getResolution());return n.renderOutline(t,l.outline,u*l.scale,e+l.x_shift,r+l.y_shift,o),l}},{key:"renderOutline",value:function(t,e,n,r,i,a){t.beginPath(),t.moveTo(r,i),S(e,r,i,n,-n,{m:t.moveTo.bind(t),l:t.lineTo.bind(t),q:t.quadraticCurveTo.bind(t),b:t.bezierCurveTo.bind(t)}),t.fill()}},{key:"getOutlineBoundingBox",value:function(t,e,n,r){var i=new k;return S(t,n,r,e,-e,{m:i.addPoint.bind(i),l:i.addPoint.bind(i),q:i.addQuadraticCurve.bind(i),b:i.addBezierCurve.bind(i),z:i.noOp.bind(i)}),new w(i.x1,i.y1,i.width(),i.height())}}]),b(n,[{key:"getCode",value:function(){return this.code}},{key:"setOptions",value:function(t){this.options=c(c({},this.options),t),this.reset()}},{key:"setPoint",value:function(t){return this.point=t,this}},{key:"setStave",value:function(t){return this.stave=t,this}},{key:"setXShift",value:function(t){return this.x_shift=t,this}},{key:"setYShift",value:function(t){return this.y_shift=t,this}},{key:"reset",value:function(){this.metrics=n.loadMetrics(this.options.fontStack,this.code,this.options.category),this.point=this.options.category?n.lookupFontMetric({category:this.options.category,font:this.metrics.font,code:this.code,key:"point",defaultValue:this.point}):this.point,this.scale=72*this.point/(100*this.metrics.font.getResolution()),this.bbox=n.getOutlineBoundingBox(this.metrics.outline,this.scale*this.metrics.scale,this.metrics.x_shift,this.metrics.y_shift)}},{key:"getMetrics",value:function(){if(!this.metrics)throw new m.RuntimeError("BadGlyph","Glyph ".concat(this.code," is not initialized."));return{x_min:this.metrics.x_min*this.scale*this.metrics.scale,x_max:this.metrics.x_max*this.scale*this.metrics.scale,width:this.bbox.getW(),height:this.bbox.getH()}}},{key:"setOriginX",value:function(t){var e=this.bbox,n=(t-Math.abs(e.getX()/e.getW()))*e.getW();this.originShift.x=-n}},{key:"setOriginY",value:function(t){var e=this.bbox,n=(t-Math.abs(e.getY()/e.getH()))*e.getH();this.originShift.y=-n}},{key:"setOrigin",value:function(t,e){this.setOriginX(t),this.setOriginY(e)}},{key:"render",value:function(t,e,r){if(!this.metrics)throw new m.RuntimeError("BadGlyph","Glyph ".concat(this.code," is not initialized."));var i=this.metrics.outline,a=this.scale*this.metrics.scale;this.setRendered(),this.applyStyle(t),n.renderOutline(t,i,a,e+this.originShift.x+this.metrics.x_shift,r+this.originShift.y+this.metrics.y_shift),this.restoreStyle(t)}},{key:"renderToStave",value:function(t){if(this.checkContext(),!this.metrics)throw new m.RuntimeError("BadGlyph","Glyph ".concat(this.code," is not initialized."));if(!this.stave)throw new m.RuntimeError("GlyphError","No valid stave");var e=this.metrics.outline,r=this.scale*this.metrics.scale;this.setRendered(),this.applyStyle(),n.renderOutline(this.context,e,r,t+this.x_shift+this.metrics.x_shift,this.stave.getYForGlyphs()+this.y_shift+this.metrics.y_shift),this.restoreStyle()}}]),n}(x),E=function(){function t(e,n,r){h(this,t),this.name=e,this.metrics=n,this.fontData=r,this.codePoints={}}return b(t,[{key:"getName",value:function(){return this.name}},{key:"getResolution",value:function(){return this.fontData.resolution}},{key:"getMetrics",value:function(){return this.metrics}},{key:"lookupMetric",value:function(t,e){for(var n=t.split("."),r=this.metrics,i=0;i=6&&2*l%2==0&&(u=-1);var b=void 0!==o.int_val?12*s+o.int_val:null,h=o.code,f=o.shift_right,d={};if(i.length>2&&i[2]){var p=i[2].toUpperCase();d=R.keyProperties.customNoteHeads[p]||{}}return c({key:a,octave:s,line:l,int_value:b,accidental:o.accidental,code:h,stroke:u,shift_right:f,displaced:!1},d)},R.keyProperties.note_values={C:{index:0,int_val:0,accidental:null},CN:{index:0,int_val:0,accidental:"n"},"C#":{index:0,int_val:1,accidental:"#"},"C##":{index:0,int_val:2,accidental:"##"},CB:{index:0,int_val:-1,accidental:"b"},CBB:{index:0,int_val:-2,accidental:"bb"},D:{index:1,int_val:2,accidental:null},DN:{index:1,int_val:2,accidental:"n"},"D#":{index:1,int_val:3,accidental:"#"},"D##":{index:1,int_val:4,accidental:"##"},DB:{index:1,int_val:1,accidental:"b"},DBB:{index:1,int_val:0,accidental:"bb"},E:{index:2,int_val:4,accidental:null},EN:{index:2,int_val:4,accidental:"n"},"E#":{index:2,int_val:5,accidental:"#"},"E##":{index:2,int_val:6,accidental:"##"},EB:{index:2,int_val:3,accidental:"b"},EBB:{index:2,int_val:2,accidental:"bb"},F:{index:3,int_val:5,accidental:null},FN:{index:3,int_val:5,accidental:"n"},"F#":{index:3,int_val:6,accidental:"#"},"F##":{index:3,int_val:7,accidental:"##"},FB:{index:3,int_val:4,accidental:"b"},FBB:{index:3,int_val:3,accidental:"bb"},G:{index:4,int_val:7,accidental:null},GN:{index:4,int_val:7,accidental:"n"},"G#":{index:4,int_val:8,accidental:"#"},"G##":{index:4,int_val:9,accidental:"##"},GB:{index:4,int_val:6,accidental:"b"},GBB:{index:4,int_val:5,accidental:"bb"},A:{index:5,int_val:9,accidental:null},AN:{index:5,int_val:9,accidental:"n"},"A#":{index:5,int_val:10,accidental:"#"},"A##":{index:5,int_val:11,accidental:"##"},AB:{index:5,int_val:8,accidental:"b"},ABB:{index:5,int_val:7,accidental:"bb"},B:{index:6,int_val:11,accidental:null},BN:{index:6,int_val:11,accidental:"n"},"B#":{index:6,int_val:12,accidental:"#"},"B##":{index:6,int_val:13,accidental:"##"},BB:{index:6,int_val:10,accidental:"b"},BBB:{index:6,int_val:9,accidental:"bb"},R:{index:6,int_val:9,rest:!0},X:{index:6,accidental:"",octave:4,code:"noteheadXBlack",shift_right:5.5}},R.integerToNote=function(t){if(void 0===t)throw new m.RERR("BadArguments","Undefined integer for integerToNote");if(t<-2)throw new m.RERR("BadArguments","integerToNote requires integer > -2: "+t);var e=R.integerToNote.table[t];if(!e)throw new m.RERR("BadArguments","Unknown note value for integer: "+t);return e},R.integerToNote.table={0:"C",1:"C#",2:"D",3:"D#",4:"E",5:"F",6:"F#",7:"G",8:"G#",9:"A",10:"A#",11:"B"},R.tabToGlyph=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=null,r=0,i=0;if("X"===t.toString().toUpperCase()){var a=new T("accidentalDoubleSharp",R.DEFAULT_TABLATURE_FONT_SCALE).getMetrics();n="accidentalDoubleSharp",r=a.width,i=-a.height/2}else r=R.textWidth(t.toString());return{text:t,code:n,getWidth:function(){return r*e},shift_y:i}},R.textWidth=function(t){return 7*t.toString().length},R.articulationCodes=function(t){return R.articulationCodes.articulations[t]},R.articulationCodes.articulations={"a.":{code:"augmentationDot",between_lines:!0},av:{aboveCode:"articStaccatissimoAbove",belowCode:"articStaccatissimoBelow",between_lines:!0},"a>":{aboveCode:"articAccentAbove",belowCode:"articAccentBelow",between_lines:!0},"a-":{aboveCode:"articTenutoAbove",belowCode:"articTenutoBelow",between_lines:!0},"a^":{aboveCode:"articMarcatoAbove",belowCode:"articMarcatoBelow",between_lines:!1},"a+":{code:"pluckedLeftHandPizzicato",between_lines:!1},ao:{aboveCode:"pluckedSnapPizzicatoAbove",belowCode:"pluckedSnapPizzicatoBelow",between_lines:!1},ah:{code:"stringsHarmonic",between_lines:!1},"a@":{aboveCode:"fermataAbove",belowCode:"fermataBelow",between_lines:!1},"a@a":{code:"fermataAbove",between_lines:!1},"a@u":{code:"fermataBelow",between_lines:!1},"a|":{code:"stringsUpBow",between_lines:!1},am:{code:"stringsDownBow",between_lines:!1},"a,":{code:"pictChokeCymbal",between_lines:!1}},R.accidentalCodes=function(t){return R.accidentalCodes.accidentals[t]},R.accidentalCodes.accidentals={"#":{code:"accidentalSharp",parenRightPaddingAdjustment:-1},"##":{code:"accidentalDoubleSharp",parenRightPaddingAdjustment:-1},b:{code:"accidentalFlat",parenRightPaddingAdjustment:-2},bb:{code:"accidentalDoubleFlat",parenRightPaddingAdjustment:-2},n:{code:"accidentalNatural",parenRightPaddingAdjustment:-1},"{":{code:"accidentalParensLeft",parenRightPaddingAdjustment:-1},"}":{code:"accidentalParensRight",parenRightPaddingAdjustment:-1},db:{code:"accidentalThreeQuarterTonesFlatZimmermann",parenRightPaddingAdjustment:-1},d:{code:"accidentalQuarterToneFlatStein",parenRightPaddingAdjustment:0},"++":{code:"accidentalThreeQuarterTonesSharpStein",parenRightPaddingAdjustment:-1},"+":{code:"accidentalQuarterToneSharpStein",parenRightPaddingAdjustment:-1},"+-":{code:"accidentalKucukMucennebSharp",parenRightPaddingAdjustment:-1},bs:{code:"accidentalBakiyeFlat",parenRightPaddingAdjustment:-1},bss:{code:"accidentalBuyukMucennebFlat",parenRightPaddingAdjustment:-1},o:{code:"accidentalSori",parenRightPaddingAdjustment:-1},k:{code:"accidentalKoron",parenRightPaddingAdjustment:-1},bbs:{code:"vexAccidentalMicrotonal1",parenRightPaddingAdjustment:-1},"++-":{code:"vexAccidentalMicrotonal2",parenRightPaddingAdjustment:-1},ashs:{code:"vexAccidentalMicrotonal3",parenRightPaddingAdjustment:-1},afhf:{code:"vexAccidentalMicrotonal4",parenRightPaddingAdjustment:-1}},R.accidentalColumnsTable={1:{a:[1],b:[1]},2:{a:[1,2]},3:{a:[1,3,2],b:[1,2,1],second_on_bottom:[1,2,3]},4:{a:[1,3,4,2],b:[1,2,3,1],spaced_out_tetrachord:[1,2,1,2]},5:{a:[1,3,5,4,2],b:[1,2,4,3,1],spaced_out_pentachord:[1,2,3,2,1],very_spaced_out_pentachord:[1,2,1,2,1]},6:{a:[1,3,5,6,4,2],b:[1,2,4,5,3,1],spaced_out_hexachord:[1,3,2,1,3,2],very_spaced_out_hexachord:[1,2,1,2,1,2]}},R.ornamentCodes=function(t){return R.ornamentCodes.ornaments[t]},R.ornamentCodes.ornaments={mordent:{code:"ornamentShortTrill"},mordent_inverted:{code:"ornamentMordent"},turn:{code:"ornamentTurn"},turn_inverted:{code:"ornamentTurnSlash"},tr:{code:"ornamentTrill"},upprall:{code:"ornamentPrecompSlideTrillDAnglebert"},downprall:{code:"ornamentPrecompDoubleCadenceUpperPrefix"},prallup:{code:"ornamentPrecompTrillSuffixDandrieu"},pralldown:{code:"ornamentPrecompTrillLowerSuffix"},upmordent:{code:"ornamentPrecompSlideTrillBach"},downmordent:{code:"ornamentPrecompDoubleCadenceUpperPrefixTurn"},lineprall:{code:"ornamentPrecompAppoggTrill"},prallprall:{code:"ornamentTremblement"}},R.keySignature=function(t){var e=R.keySignature.keySpecs[t];if(!e)throw new m.RERR("BadKeySignature","Bad key signature spec: '".concat(t,"'"));if(!e.acc)return[];for(var n=R.keySignature.accidentalList(e.acc),r=[],i=0;i0&&void 0!==arguments[0]?arguments[0]:R.DEFAULT_NOTATION_FONT_SCALE;return new T(this.code_head||"v53",t).getMetrics().width},stem:!1,stem_offset:0,flag:!1,stem_up_extension:-R.STEM_HEIGHT,stem_down_extension:-R.STEM_HEIGHT,tabnote_stem_up_extension:-R.STEM_HEIGHT,tabnote_stem_down_extension:-R.STEM_HEIGHT,dot_shiftY:0,line_above:0,line_below:0},type:{n:{code_head:"noteheadDoubleWhole"},h:{code_head:"unpitchedPercussionClef1"},m:{code_head:"vexNoteHeadMutedBreve",stem_offset:0},r:{code_head:"restDoubleWhole",rest:!0,position:"B/5",dot_shiftY:.5},s:{getWidth:function(){return R.SLASH_NOTEHEAD_WIDTH},position:"B/4"}}},1:{common:{getWidth:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:R.DEFAULT_NOTATION_FONT_SCALE;return new T(this.code_head||"v1d",t).getMetrics().width},stem:!1,stem_offset:0,flag:!1,stem_up_extension:-R.STEM_HEIGHT,stem_down_extension:-R.STEM_HEIGHT,tabnote_stem_up_extension:-R.STEM_HEIGHT,tabnote_stem_down_extension:-R.STEM_HEIGHT,dot_shiftY:0,line_above:0,line_below:0},type:{n:{code_head:"noteheadWhole"},h:{code_head:"noteheadDiamondWhole"},m:{code_head:"noteheadXWhole",stem_offset:-3},r:{code_head:"restWhole",rest:!0,position:"D/5",dot_shiftY:.5},s:{getWidth:function(){return R.SLASH_NOTEHEAD_WIDTH},position:"B/4"}}},2:{common:{getWidth:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:R.DEFAULT_NOTATION_FONT_SCALE;return new T(this.code_head||"noteheadHalf",t).getMetrics().width},stem:!0,stem_offset:0,flag:!1,stem_up_extension:0,stem_down_extension:0,tabnote_stem_up_extension:0,tabnote_stem_down_extension:0,dot_shiftY:0,line_above:0,line_below:0},type:{n:{code_head:"noteheadHalf"},h:{code_head:"noteheadDiamondHalf"},m:{code_head:"noteheadXHalf",stem_offset:-3},r:{code_head:"restHalf",stem:!1,rest:!0,position:"B/4",dot_shiftY:-.5},s:{getWidth:function(){return R.SLASH_NOTEHEAD_WIDTH},position:"B/4"}}},4:{common:{getWidth:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:R.DEFAULT_NOTATION_FONT_SCALE;return new T(this.code_head||"noteheadBlack",t).getMetrics().width},stem:!0,stem_offset:0,flag:!1,stem_up_extension:0,stem_down_extension:0,tabnote_stem_up_extension:0,tabnote_stem_down_extension:0,dot_shiftY:0,line_above:0,line_below:0},type:{n:{code_head:"noteheadBlack"},h:{code_head:"noteheadDiamondBlack"},m:{code_head:"noteheadXBlack"},r:{code_head:"restQuarter",stem:!1,rest:!0,position:"B/4",dot_shiftY:-.5,line_above:1.5,line_below:1.5},s:{getWidth:function(){return R.SLASH_NOTEHEAD_WIDTH},position:"B/4"}}},8:{common:{getWidth:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:R.DEFAULT_NOTATION_FONT_SCALE;return new T(this.code_head||"noteheadBlack",t).getMetrics().width},stem:!0,stem_offset:0,flag:!0,beam_count:1,code_flag_upstem:"flag8thUp",code_flag_downstem:"flag8thDown",stem_up_extension:0,stem_down_extension:0,tabnote_stem_up_extension:0,tabnote_stem_down_extension:0,dot_shiftY:0,line_above:0,line_below:0},type:{n:{code_head:"noteheadBlack"},h:{code_head:"noteheadDiamondBlack"},m:{code_head:"noteheadXBlack"},r:{code_head:"rest8th",stem:!1,flag:!1,rest:!0,position:"B/4",dot_shiftY:-.5,line_above:1,line_below:1},s:{getWidth:function(){return R.SLASH_NOTEHEAD_WIDTH},position:"B/4"}}},16:{common:{beam_count:2,getWidth:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:R.DEFAULT_NOTATION_FONT_SCALE;return new T(this.code_head||"noteheadBlack",t).getMetrics().width},stem:!0,stem_offset:0,flag:!0,code_flag_upstem:"flag16thUp",code_flag_downstem:"flag16thDown",stem_up_extension:0,stem_down_extension:0,tabnote_stem_up_extension:0,tabnote_stem_down_extension:0,dot_shiftY:0,line_above:0,line_below:0},type:{n:{code_head:"noteheadBlack"},h:{code_head:"noteheadDiamondBlack"},m:{code_head:"noteheadXBlack"},r:{code_head:"rest16th",stem:!1,flag:!1,rest:!0,position:"B/4",dot_shiftY:-.5,line_above:1,line_below:2},s:{getWidth:function(){return R.SLASH_NOTEHEAD_WIDTH},position:"B/4"}}},32:{common:{beam_count:3,getWidth:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:R.DEFAULT_NOTATION_FONT_SCALE;return new T(this.code_head||"noteheadBlack",t).getMetrics().width},stem:!0,stem_offset:0,flag:!0,code_flag_upstem:"flag32ndUp",code_flag_downstem:"flag32ndDown",stem_up_extension:9,stem_down_extension:9,tabnote_stem_up_extension:8,tabnote_stem_down_extension:5,dot_shiftY:0,line_above:0,line_below:0},type:{n:{code_head:"noteheadBlack"},h:{code_head:"noteheadDiamondBlack"},m:{code_head:"noteheadXBlack"},r:{code_head:"rest32nd",stem:!1,flag:!1,rest:!0,position:"B/4",dot_shiftY:-1.5,line_above:2,line_below:2},s:{getWidth:function(){return R.SLASH_NOTEHEAD_WIDTH},position:"B/4"}}},64:{common:{beam_count:4,getWidth:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:R.DEFAULT_NOTATION_FONT_SCALE;return new T(this.code_head||"noteheadBlack",t).getMetrics().width},stem:!0,stem_offset:0,flag:!0,code_flag_upstem:"flag64thUp",code_flag_downstem:"flag64thDown",stem_up_extension:13,stem_down_extension:13,tabnote_stem_up_extension:12,tabnote_stem_down_extension:9,dot_shiftY:0,line_above:0,line_below:0},type:{n:{code_head:"noteheadBlack"},h:{code_head:"noteheadDiamondBlack"},m:{code_head:"noteheadXBlack"},r:{code_head:"rest64th",stem:!1,flag:!1,rest:!0,position:"B/4",dot_shiftY:-1.5,line_above:2,line_below:3},s:{getWidth:function(){return R.SLASH_NOTEHEAD_WIDTH},position:"B/4"}}},128:{common:{beam_count:5,getWidth:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:R.DEFAULT_NOTATION_FONT_SCALE;return new T(this.code_head||"noteheadBlack",t).getMetrics().width},stem:!0,stem_offset:0,flag:!0,code_flag_upstem:"flag128thUp",code_flag_downstem:"flag128thDown",stem_up_extension:22,stem_down_extension:22,tabnote_stem_up_extension:21,tabnote_stem_down_extension:18,dot_shiftY:0,line_above:0,line_below:0},type:{n:{code_head:"noteheadBlack"},h:{code_head:"noteheadDiamondBlack"},m:{code_head:"noteheadXBlack"},r:{code_head:"rest128th",stem:!1,flag:!1,rest:!0,position:"B/4",dot_shiftY:1.5,line_above:3,line_below:3},s:{getWidth:function(){return R.SLASH_NOTEHEAD_WIDTH},position:"B/4"}}}},R.TIME4_4={num_beats:4,beat_value:4,resolution:R.RESOLUTION};var F=function(){function t(e){h(this,t),this.vexFlowCanvasContext=e,e.canvas?this.canvas=e.canvas:this.canvas={width:t.WIDTH,height:t.HEIGHT}}return b(t,null,[{key:"SanitizeCanvasDims",value:function(t,e){return Math.max(t,e)>this.CANVAS_BROWSER_SIZE_LIMIT&&(m.W("Canvas dimensions exceed browser limit. Cropping to "+this.CANVAS_BROWSER_SIZE_LIMIT),t>this.CANVAS_BROWSER_SIZE_LIMIT&&(t=this.CANVAS_BROWSER_SIZE_LIMIT),e>this.CANVAS_BROWSER_SIZE_LIMIT&&(e=this.CANVAS_BROWSER_SIZE_LIMIT)),[t,e]}},{key:"WIDTH",get:function(){return 600}},{key:"HEIGHT",get:function(){return 400}},{key:"CANVAS_BROWSER_SIZE_LIMIT",get:function(){return 32767}}]),b(t,[{key:"clear",value:function(){this.vexFlowCanvasContext.clearRect(0,0,this.canvas.width,this.canvas.height)}},{key:"openGroup",value:function(){}},{key:"closeGroup",value:function(){}},{key:"add",value:function(){}},{key:"setFont",value:function(t,e,n){return this.vexFlowCanvasContext.font=(n||"")+" "+e+"pt "+t,this}},{key:"setRawFont",value:function(t){return this.vexFlowCanvasContext.font=t,this}},{key:"setFillStyle",value:function(t){return this.vexFlowCanvasContext.fillStyle=t,this}},{key:"setBackgroundFillStyle",value:function(t){return this.background_fillStyle=t,this}},{key:"setStrokeStyle",value:function(t){return this.vexFlowCanvasContext.strokeStyle=t,this}},{key:"setShadowColor",value:function(t){return this.vexFlowCanvasContext.shadowColor=t,this}},{key:"setShadowBlur",value:function(t){return this.vexFlowCanvasContext.shadowBlur=t,this}},{key:"setLineWidth",value:function(t){return this.vexFlowCanvasContext.lineWidth=t,this}},{key:"setLineCap",value:function(t){return this.vexFlowCanvasContext.lineCap=t,this}},{key:"setLineDash",value:function(t){return this.vexFlowCanvasContext.lineDash=t,this}},{key:"scale",value:function(t,e){return this.vexFlowCanvasContext.scale(parseFloat(t),parseFloat(e))}},{key:"resize",value:function(t,e){var n,r;return n=this.SanitizeCanvasDims(parseInt(t,10),parseInt(e,10)),t=(r=u(n,2))[0],e=r[1],this.vexFlowCanvasContext.resize(t,e)}},{key:"rect",value:function(t,e,n,r){return this.vexFlowCanvasContext.rect(t,e,n,r)}},{key:"fillRect",value:function(t,e,n,r){return this.vexFlowCanvasContext.fillRect(t,e,n,r)}},{key:"clearRect",value:function(t,e,n,r){return this.vexFlowCanvasContext.clearRect(t,e,n,r)}},{key:"beginPath",value:function(){return this.vexFlowCanvasContext.beginPath()}},{key:"moveTo",value:function(t,e){return this.vexFlowCanvasContext.moveTo(t,e)}},{key:"lineTo",value:function(t,e){return this.vexFlowCanvasContext.lineTo(t,e)}},{key:"bezierCurveTo",value:function(t,e,n,r,i,a){return this.vexFlowCanvasContext.bezierCurveTo(t,e,n,r,i,a)}},{key:"quadraticCurveTo",value:function(t,e,n,r){return this.vexFlowCanvasContext.quadraticCurveTo(t,e,n,r)}},{key:"arc",value:function(t,e,n,r,i,a){return this.vexFlowCanvasContext.arc(t,e,n,r,i,a)}},{key:"glow",value:function(){return this.vexFlowCanvasContext.glow()}},{key:"fill",value:function(){return this.vexFlowCanvasContext.fill()}},{key:"stroke",value:function(){return this.vexFlowCanvasContext.stroke()}},{key:"closePath",value:function(){return this.vexFlowCanvasContext.closePath()}},{key:"measureText",value:function(t){return this.vexFlowCanvasContext.measureText(t)}},{key:"fillText",value:function(t,e,n){return this.vexFlowCanvasContext.fillText(t,e,n)}},{key:"save",value:function(){return this.vexFlowCanvasContext.save()}},{key:"restore",value:function(){return this.vexFlowCanvasContext.restore()}}]),t}(),M=function(){function t(e){h(this,t),this.element=e,this.paper=Raphael(e),this.path="",this.pen={x:0,y:0},this.lineWidth=1,this.state={scale:{x:1,y:1},font_family:"Arial",font_size:8,font_weight:800},this.attributes={"stroke-width":.3,fill:"black",stroke:"black",font:"10pt Arial"},this.background_attributes={"stroke-width":0,fill:"white",stroke:"white",font:"10pt Arial"},this.shadow_attributes={width:0,color:"black"},this.state_stack=[]}return b(t,[{key:"openGroup",value:function(){}},{key:"closeGroup",value:function(){}},{key:"add",value:function(){}},{key:"setFont",value:function(t,e,n){return this.state.font_family=t,this.state.font_size=e,this.state.font_weight=n,this.attributes.font=(this.state.font_weight||"")+" "+this.state.font_size*this.state.scale.x+"pt "+this.state.font_family,this}},{key:"setRawFont",value:function(t){return this.attributes.font=t,this}},{key:"setFillStyle",value:function(t){return this.attributes.fill=t,this}},{key:"setBackgroundFillStyle",value:function(t){return this.background_attributes.fill=t,this.background_attributes.stroke=t,this}},{key:"setStrokeStyle",value:function(t){return this.attributes.stroke=t,this}},{key:"setShadowColor",value:function(t){return this.shadow_attributes.color=t,this}},{key:"setShadowBlur",value:function(t){return this.shadow_attributes.width=t,this}},{key:"setLineWidth",value:function(t){this.attributes["stroke-width"]=t,this.lineWidth=t}},{key:"setLineDash",value:function(){return this}},{key:"setLineCap",value:function(){return this}},{key:"scale",value:function(t,e){return this.state.scale={x:t,y:e},this.attributes.transform="S"+t+","+e+",0,0",this.attributes.scale=t+","+e+",0,0",this.attributes.font=this.state.font_size*this.state.scale.x+"pt "+this.state.font_family,this.background_attributes.transform="S"+t+","+e+",0,0",this.background_attributes.font=this.state.font_size*this.state.scale.x+"pt "+this.state.font_family,this}},{key:"clear",value:function(){this.paper.clear()}},{key:"resize",value:function(t,e){return this.element.style.width=t,this.paper.setSize(t,e),this}},{key:"setViewBox",value:function(t){this.paper.canvas.setAttribute("viewBox",t)}},{key:"rect",value:function(t,e,n,r){return r<0&&(e+=r,r=-r),this.paper.rect(t,e,n-.5,r-.5).attr(this.attributes).attr("fill","none").attr("stroke-width",this.lineWidth),this}},{key:"fillRect",value:function(t,e,n,r){return r<0&&(e+=r,r=-r),this.paper.rect(t,e,n-.5,r-.5).attr(this.attributes),this}},{key:"clearRect",value:function(t,e,n,r){return r<0&&(e+=r,r=-r),this.paper.rect(t,e,n-.5,r-.5).attr(this.background_attributes),this}},{key:"beginPath",value:function(){return this.path="",this.pen.x=0,this.pen.y=0,this}},{key:"moveTo",value:function(t,e){return this.path+="M"+t+","+e,this.pen.x=t,this.pen.y=e,this}},{key:"lineTo",value:function(t,e){return this.path+="L"+t+","+e,this.pen.x=t,this.pen.y=e,this}},{key:"bezierCurveTo",value:function(t,e,n,r,i,a){return this.path+="C"+t+","+e+","+n+","+r+","+i+","+a,this.pen.x=i,this.pen.y=a,this}},{key:"quadraticCurveTo",value:function(t,e,n,r){return this.path+="Q"+t+","+e+","+n+","+r,this.pen.x=n,this.pen.y=r,this}},{key:"arc",value:function(t,e,n,r,i,a){function o(t){for(;t<0;)t+=2*Math.PI;for(;t>2*Math.PI;)t-=2*Math.PI;return t}if((r=o(r))>(i=o(i))){var s=r;r=i,i=s,a=!a}var l=i-r;return l>Math.PI?(this.arcHelper(t,e,n,r,r+l/2,a),this.arcHelper(t,e,n,r+l/2,i,a)):this.arcHelper(t,e,n,r,i,a),this}},{key:"arcHelper",value:function(t,e,n,r,i,a){var o=t+n*Math.cos(r),s=e+n*Math.sin(r),l=t+n*Math.cos(i),u=e+n*Math.sin(i),c=0,b=0;a?(b=1,i-rMath.PI&&(c=1),this.path+="M"+o+","+s+",A"+n+","+n+",0,"+c+","+b+","+l+","+u+"M"+this.pen.x+","+this.pen.y}},{key:"glow",value:function(){var t=this.paper.set();if(this.shadow_attributes.width>0)for(var e=this.shadow_attributes,n=e.width/2,r=1;r<=n;r++)t.push(this.paper.path(this.path).attr({stroke:e.color,"stroke-linejoin":"round","stroke-linecap":"round","stroke-width":+(e.width/n*r).toFixed(3),opacity:+((e.opacity||.3)/n).toFixed(3),transform:this.attributes.transform,scale:this.attributes.scale}));return t}},{key:"fill",value:function(){var t=this.paper.path(this.path).attr(this.attributes).attr("stroke-width",0);return this.glow(t),this}},{key:"stroke",value:function(){var t=this.lineWidth*(this.state.scale.x+this.state.scale.y)/2,e=this.paper.path(this.path).attr(this.attributes).attr("fill","none").attr("stroke-width",t);return this.glow(e),this}},{key:"closePath",value:function(){return this.path+="Z",this}},{key:"measureText",value:function(t){var e=this.paper.text(0,0,t).attr(this.attributes).attr("fill","none").attr("stroke","none"),n=e.getBBox();return e.remove(),{width:n.width,height:n.height}}},{key:"fillText",value:function(t,e,n){return this.paper.text(e+this.measureText(t).width/2,n-this.state.font_size/(2.25*this.state.scale.y),t).attr(this.attributes),this}},{key:"save",value:function(){return this.state_stack.push({state:{font_family:this.state.font_family},attributes:{font:this.attributes.font,fill:this.attributes.fill,stroke:this.attributes.stroke,"stroke-width":this.attributes["stroke-width"]},shadow_attributes:{width:this.shadow_attributes.width,color:this.shadow_attributes.color}}),this}},{key:"restore",value:function(){var t=this.state_stack.pop();return this.state.font_family=t.state.font_family,this.attributes.font=t.attributes.font,this.attributes.fill=t.attributes.fill,this.attributes.stroke=t.attributes.stroke,this.attributes["stroke-width"]=t.attributes["stroke-width"],this.shadow_attributes.width=t.shadow_attributes.width,this.shadow_attributes.color=t.shadow_attributes.color,this}}]),t}(),P={path:{x:!0,y:!0,width:!0,height:!0},rect:{},text:{width:!0,height:!0}},O={"font-family":!0,"font-weight":!0,"font-style":!0,"font-size":!0};m.Merge(P.rect,O),m.Merge(P.path,O);var D=function(){function t(e){h(this,t),this.element=e,this.svgNS="http://www.w3.org/2000/svg";var n=this.create("svg");this.element.appendChild(n),this.svg=n,this.groups=[this.svg],this.parent=this.svg,this.path="",this.pen={x:NaN,y:NaN},this.lineWidth=1,this.state={scale:{x:1,y:1},"font-family":"Arial","font-size":"8pt","font-weight":"normal"},this.attributes={"stroke-width":.3,fill:"black",stroke:"black","stroke-dasharray":"none","font-family":"Arial","font-size":"10pt","font-weight":"normal","font-style":"normal"},this.background_attributes={"stroke-width":0,fill:"white",stroke:"white","stroke-dasharray":"none","font-family":"Arial","font-size":"10pt","font-weight":"normal","font-style":"normal"},this.shadow_attributes={width:0,color:"black"},this.state_stack=[],this.iePolyfill()}return b(t,[{key:"create",value:function(t){return document.createElementNS(this.svgNS,t)}},{key:"openGroup",value:function(t,e,n){var r=this.create("g");return this.groups.push(r),this.parent.appendChild(r),this.parent=r,t&&r.setAttribute("class",m.Prefix(t)),e&&r.setAttribute("id",m.Prefix(e)),n&&n.pointerBBox&&r.setAttribute("pointer-events","bounding-box"),r}},{key:"closeGroup",value:function(){this.groups.pop(),this.parent=this.groups[this.groups.length-1]}},{key:"add",value:function(t){this.parent.appendChild(t)}},{key:"iePolyfill",value:function(){"undefined"!=typeof navigator&&(this.ie=/MSIE 9/i.test(navigator.userAgent)||/MSIE 10/i.test(navigator.userAgent)||/rv:11\.0/i.test(navigator.userAgent)||/Trident/i.test(navigator.userAgent))}},{key:"setFont",value:function(t,e,n){var r=!1,i=!1,a="normal";"string"==typeof n&&(-1!==n.indexOf("italic")&&(n=n.replace(/italic/g,""),i=!0),-1!==n.indexOf("bold")&&(n=n.replace(/bold/g,""),r=!0),n=n.replace(/ /g,""));var o={"font-family":t,"font-size":e+"pt","font-weight":n=void 0===(n=r?"bold":n)||""===n?"normal":n,"font-style":a=i?"italic":a};return this.fontSize=Number(e),m.Merge(this.attributes,o),m.Merge(this.state,o),this}},{key:"setRawFont",value:function(t){var e=(t=t.trim()).split(" ");return this.attributes["font-family"]=e[1],this.state["font-family"]=e[1],this.attributes["font-size"]=e[0],this.state["font-size"]=e[0],this.fontSize=Number(e[0].match(/\d+/)),this}},{key:"setFillStyle",value:function(t){return this.attributes.fill=t,this}},{key:"setBackgroundFillStyle",value:function(t){return this.background_attributes.fill=t,this.background_attributes.stroke=t,this}},{key:"setStrokeStyle",value:function(t){return this.attributes.stroke=t,this}},{key:"setShadowColor",value:function(t){return this.shadow_attributes.color=t,this}},{key:"setShadowBlur",value:function(t){return this.shadow_attributes.width=t,this}},{key:"setLineWidth",value:function(t){this.attributes["stroke-width"]=t,this.lineWidth=t}},{key:"setLineDash",value:function(t){if("[object Array]"===Object.prototype.toString.call(t))return t=t.join(", "),this.attributes["stroke-dasharray"]=t,this;throw new m.RERR("ArgumentError","lineDash must be an array of integers.")}},{key:"setLineCap",value:function(t){return this.attributes["stroke-linecap"]=t,this}},{key:"resize",value:function(t,e){this.width=t,this.height=e,this.element.style.width=t,this.svg.style.width=t,this.svg.style.height=e;var n={width:t,height:e};return this.applyAttributes(this.svg,n),this.scale(this.state.scale.x,this.state.scale.y),this}},{key:"scale",value:function(t,e){this.state.scale={x:t,y:e};var n=this.width/t,r=this.height/e;return this.setViewBox(0,0,n,r),this}},{key:"setViewBox",value:function(){for(var t=arguments.length,e=new Array(t),n=0;n2*Math.PI;)t-=2*Math.PI;return t}if((r=o(r))>(i=o(i))){var s=r;r=i,i=s,a=!a}var l=i-r;return l>Math.PI?(this.arcHelper(t,e,n,r,r+l/2,a),this.arcHelper(t,e,n,r+l/2,i,a)):this.arcHelper(t,e,n,r,i,a),this}},{key:"arcHelper",value:function(t,e,n,r,i,a){var o=t+n*Math.cos(r),s=e+n*Math.sin(r),l=t+n*Math.cos(i),u=e+n*Math.sin(i),c=0,b=0;a?(b=1,i-rMath.PI&&(c=1),this.path+="M"+o+" "+s+" A"+n+" "+n+" 0 "+c+" "+b+" "+l+" "+u,isNaN(this.pen.x)||isNaN(this.pen.y)||(this.peth+="M"+this.pen.x+" "+this.pen.y)}},{key:"closePath",value:function(){return this.path+="Z",this}},{key:"glow",value:function(){if(this.shadow_attributes.width>0)for(var t=this.shadow_attributes,e=t.width/2,n=1;n<=e;n++){var r={stroke:t.color,"stroke-linejoin":"round","stroke-linecap":"round","stroke-width":+(.4*t.width/e*n).toFixed(3),opacity:+((t.opacity||.3)/e).toFixed(3)},i=this.create("path");r.d=this.path,this.applyAttributes(i,r),this.add(i)}return this}},{key:"fill",value:function(t){this.glow();var e=this.create("path");return void 0===t&&(m.Merge(t={},this.attributes),t.stroke="none"),t.d=this.path,this.applyAttributes(e,t),this.add(e),this}},{key:"stroke",value:function(){this.glow();var t=this.create("path"),e={};return m.Merge(e,this.attributes),e.fill="none",e["stroke-width"]=this.lineWidth,e.d=this.path,this.applyAttributes(t,e),this.add(t),this}},{key:"measureText",value:function(t){var e=this.create("text");if("function"!=typeof e.getBBox)return{x:0,y:0,width:0,height:0};e.textContent=t,this.applyAttributes(e,this.attributes),this.svg.appendChild(e);var n=e.getBBox();return this.ie&&""!==t&&"italic"===this.attributes["font-style"]&&(n=this.ieMeasureTextFix(n,t)),this.svg.removeChild(e),n}},{key:"ieMeasureTextFix",value:function(t){var e=1.196*Number(this.fontSize)+1.9598,n=t.width-e,r=t.height-1.5;return{x:t.x,y:t.y,width:n,height:r}}},{key:"fillText",value:function(t,e,n){if(t&&!(t.length<=0)){var r={};m.Merge(r,this.attributes),r.stroke="none",r.x=e,r.y=n;var i=this.create("text");i.textContent=t,this.applyAttributes(i,r),this.add(i)}}},{key:"save",value:function(){return this.state_stack.push({state:{"font-family":this.state["font-family"],"font-weight":this.state["font-weight"],"font-style":this.state["font-style"],"font-size":this.state["font-size"],scale:this.state.scale},attributes:{"font-family":this.attributes["font-family"],"font-weight":this.attributes["font-weight"],"font-style":this.attributes["font-style"],"font-size":this.attributes["font-size"],fill:this.attributes.fill,stroke:this.attributes.stroke,"stroke-width":this.attributes["stroke-width"],"stroke-dasharray":this.attributes["stroke-dasharray"]},shadow_attributes:{width:this.shadow_attributes.width,color:this.shadow_attributes.color},lineWidth:this.lineWidth}),this}},{key:"restore",value:function(){var t=this.state_stack.pop();return this.state["font-family"]=t.state["font-family"],this.state["font-weight"]=t.state["font-weight"],this.state["font-style"]=t.state["font-style"],this.state["font-size"]=t.state["font-size"],this.state.scale=t.state.scale,this.attributes["font-family"]=t.attributes["font-family"],this.attributes["font-weight"]=t.attributes["font-weight"],this.attributes["font-style"]=t.attributes["font-style"],this.attributes["font-size"]=t.attributes["font-size"],this.attributes.fill=t.attributes.fill,this.attributes.stroke=t.attributes.stroke,this.attributes["stroke-width"]=t.attributes["stroke-width"],this.attributes["stroke-dasharray"]=t.attributes["stroke-dasharray"],this.shadow_attributes.width=t.shadow_attributes.width,this.shadow_attributes.color=t.shadow_attributes.color,this.lineWidth=t.lineWidth,this}}]),t}(),I=null,N=function(){function t(e,n){if(h(this,t),this.elementId=e,!this.elementId)throw new m.RERR("BadArgument","Invalid id for renderer.");if(this.element=document.getElementById(e),this.element||(this.element=e),this.ctx=null,this.paper=null,this.backend=n,this.backend===t.Backends.CANVAS){if(!this.element.getContext)throw new m.RERR("BadElement","Can't get canvas context from element: "+e);this.ctx=t.bolsterCanvasContext(this.element.getContext("2d"))}else if(this.backend===t.Backends.RAPHAEL)this.ctx=new M(this.element);else{if(this.backend!==t.Backends.SVG)throw new m.RERR("InvalidBackend","No support for backend: "+this.backend);this.ctx=new D(this.element)}}return b(t,null,[{key:"buildContext",value:function(e,n,r,i,a){var o=new t(e,n);r&&i&&o.resize(r,i),a||(a="#FFF");var s=o.getContext();return s.setBackgroundFillStyle(a),t.lastContext=s,s}},{key:"getCanvasContext",value:function(e,n,r,i){return t.buildContext(e,t.Backends.CANVAS,n,r,i)}},{key:"getRaphaelContext",value:function(e,n,r,i){return t.buildContext(e,t.Backends.RAPHAEL,n,r,i)}},{key:"getSVGContext",value:function(e,n,r,i){return t.buildContext(e,t.Backends.SVG,n,r,i)}},{key:"bolsterCanvasContext",value:function(e){return t.USE_CANVAS_PROXY?new F(e):(e.vexFlowCanvasContext=e,["clear","setFont","setRawFont","setFillStyle","setBackgroundFillStyle","setStrokeStyle","setShadowColor","setShadowBlur","setLineWidth","setLineCap","setLineDash","openGroup","closeGroup","getGroup"].forEach((function(t){e[t]=e[t]||F.prototype[t]})),e)}},{key:"drawDashedLine",value:function(t,e,n,r,i,a){t.beginPath();var o=r-e,s=i-n,l=Math.atan2(s,o),u=e,c=n;t.moveTo(e,n);for(var b=0,h=!0;!(o<0?u<=r:u>=r)||!(s<0?c<=i:c>=i);){var f=a[b++%a.length],d=u+Math.cos(l)*f;u=o<0?Math.max(r,d):Math.min(r,d);var p=c+Math.sin(l)*f;c=s<0?Math.max(i,p):Math.min(i,p),h?t.lineTo(u,c):t.moveTo(u,c),h=!h}t.closePath(),t.stroke()}},{key:"Backends",get:function(){return{CANVAS:1,RAPHAEL:2,SVG:3,VML:4}}},{key:"LineEndType",get:function(){return{NONE:1,UP:2,DOWN:3}}},{key:"USE_CANVAS_PROXY",get:function(){return!1}},{key:"lastContext",get:function(){return I},set:function(t){I=t}}]),b(t,[{key:"resize",value:function(e,n){if(this.backend===t.Backends.CANVAS){if(!this.element.getContext)throw new m.RERR("BadElement","Can't get canvas context from element: "+this.elementId);var r=F.SanitizeCanvasDims(e,n),i=u(r,2);e=i[0],n=i[1];var a=window.devicePixelRatio||1;this.element.width=e*a,this.element.height=n*a,this.element.style.width=e+"px",this.element.style.height=n+"px",this.ctx=t.bolsterCanvasContext(this.element.getContext("2d")),this.ctx.scale(a,a)}else this.ctx.resize(e,n);return this}},{key:"getContext",value:function(){return this.ctx}}]),t}(),L=function(t){f(n,t);var e=d(n);function n(){var t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return h(this,n),(t=e.call(this)).setAttribute("type","Stem"),t.x_begin=r.x_begin||0,t.x_end=r.x_end||0,t.y_top=r.y_top||0,t.y_bottom=r.y_bottom||0,t.stem_extension=r.stem_extension||0,t.stem_direction=r.stem_direction||0,t.hide=r.hide||!1,t.isStemlet=r.isStemlet||!1,t.stemletHeight=r.stemletHeight||0,t.renderHeightAdjustment=0,t.setOptions(r),t}return b(n,null,[{key:"CATEGORY",get:function(){return"stem"}},{key:"UP",get:function(){return 1}},{key:"DOWN",get:function(){return-1}},{key:"WIDTH",get:function(){return R.STEM_WIDTH}},{key:"HEIGHT",get:function(){return R.STEM_HEIGHT}}]),b(n,[{key:"setOptions",value:function(t){this.stem_up_y_offset=t.stem_up_y_offset||0,this.stem_down_y_offset=t.stem_down_y_offset||0,this.stem_up_y_base_offset=t.stem_up_y_base_offset||0,this.stem_down_y_base_offset=t.stem_down_y_base_offset||0}},{key:"setNoteHeadXBounds",value:function(t,e){return this.x_begin=t,this.x_end=e,this}},{key:"setDirection",value:function(t){this.stem_direction=t}},{key:"setExtension",value:function(t){this.stem_extension=t}},{key:"getExtension",value:function(){return this.stem_extension}},{key:"setYBounds",value:function(t,e){this.y_top=t,this.y_bottom=e}},{key:"getCategory",value:function(){return n.CATEGORY}},{key:"getHeight",value:function(){var t=this.stem_direction===n.UP?this.stem_up_y_offset:this.stem_down_y_offset;return(this.y_bottom-this.y_top)*this.stem_direction+(n.HEIGHT-t+this.stem_extension)*this.stem_direction}},{key:"getBoundingBox",value:function(){throw new m.RERR("NotImplemented","getBoundingBox() not implemented.")}},{key:"getExtents",value:function(){var t=this.stem_direction===n.UP,e=[this.y_top,this.y_bottom],r=n.HEIGHT+this.stem_extension,i=(t?Math.min:Math.max).apply(void 0,e),a=(t?Math.max:Math.min).apply(void 0,e);return{topY:i+r*-this.stem_direction,baseY:a}}},{key:"setVisibility",value:function(t){return this.hide=!t,this}},{key:"setStemlet",value:function(t,e){return this.isStemlet=t,this.stemletHeight=e,this}},{key:"draw",value:function(){if(this.setRendered(),!this.hide){var t,e,r=this.checkContext(),i=this.stem_direction,a=0;i===n.DOWN?(t=this.x_begin,e=this.y_top+this.stem_down_y_offset,a=this.stem_down_y_base_offset):(t=this.x_end,e=this.y_bottom-this.stem_up_y_offset,a=this.stem_up_y_base_offset);var o=this.getHeight();!function(){for(var t=arguments.length,e=new Array(t),r=0;r1,i.point=i.musicFont.lookupMetric("digits.tupletPoint"),i.y_pos=16,i.x_pos=100,i.width=200,i.location=i.options.location||n.LOCATION_TOP,Rt.AlignRestsToNotes(t,!0,!0),i.resolveGlyphs(),i.attach(),l(i)}return b(n,null,[{key:"LOCATION_TOP",get:function(){return 1}},{key:"LOCATION_BOTTOM",get:function(){return-1}},{key:"NESTING_OFFSET",get:function(){return 15}}]),b(n,[{key:"attach",value:function(){for(var t=0;t=1;)this.numerator_glyphs.unshift(new T("timeSig"+t%10,this.point)),t=parseInt(t/10,10);for(this.denom_glyphs=[],t=this.notes_occupied;t>=1;)this.denom_glyphs.unshift(new T("timeSig"+t%10,this.point)),t=parseInt(t/10,10)}},{key:"getNestedTupletCount",value:function(){var t=this.location,e=this.notes[0],n=i(e,t),r=i(e,t);function i(t,e){return t.tupletStack.filter((function(t){return t.location===e})).length}return this.notes.forEach((function(e){var a=i(e,t);n=a>n?a:n,r=at&&(t=l)}}return t+e+r}},{key:"draw",value:function(){var t=this;this.checkContext(),this.setRendered();var e=this.notes[0],r=this.notes[this.notes.length-1];this.bracketed?(this.x_pos=e.getTieLeftX()-5,this.width=r.getTieRightX()-this.x_pos+5):(this.x_pos=e.getStemX(),this.width=r.getStemX()-this.x_pos),this.y_pos=this.getYPosition();var i=function(t,e){return t+e.getMetrics().width},a=this.numerator_glyphs.reduce(i,0);this.ratioed&&(a=this.denom_glyphs.reduce(i,a),a+=.32*this.point);var o=this.x_pos+this.width/2-a/2;if(this.bracketed){var s=this.width/2-a/2-5;s>0&&(this.context.fillRect(this.x_pos,this.y_pos,s,1),this.context.fillRect(this.x_pos+this.width/2+a/2+5,this.y_pos,s,1),this.context.fillRect(this.x_pos,this.y_pos+(this.location===n.LOCATION_BOTTOM),1,10*this.location),this.context.fillRect(this.x_pos+this.width,this.y_pos+(this.location===n.LOCATION_BOTTOM),1,10*this.location))}var l=this.musicFont.lookupMetric("digits.shiftY",0),u=0;if(this.numerator_glyphs.forEach((function(e){e.render(t.context,o+u,t.y_pos+t.point/3-2+l),u+=e.getMetrics().width})),this.ratioed){var c=o+u+.16*this.point,b=.06*this.point;this.context.beginPath(),this.context.arc(c,this.y_pos-.08*this.point,b,0,2*Math.PI,!0),this.context.closePath(),this.context.fill(),this.context.beginPath(),this.context.arc(c,this.y_pos+.12*this.point,b,0,2*Math.PI,!0),this.context.closePath(),this.context.fill(),u+=.32*this.point,this.denom_glyphs.forEach((function(e){e.render(t.context,o+u,t.y_pos+t.point/3-2+l),u+=e.getMetrics().width}))}}}]),n}(x);function z(t){var e=0;return t.forEach((function(t){t.keyProps&&t.keyProps.forEach((function(t){e+=t.line-3}))})),e>=0?L.DOWN:L.UP}var U="L",j="B",H=function(t){f(n,t);var e=d(n);function n(t,r){var i,a,o;if(h(this,n),(i=e.call(this)).setAttribute("type","Beam"),!t||t===[])throw new m.RuntimeError("BadArguments","No notes provided for beam.");if(1===t.length)throw new m.RuntimeError("BadArguments","Too few notes for beam.");if(i.ticks=t[0].getIntrinsicTicks(),i.ticks>=R.durationToTicks("4"))throw new m.RuntimeError("BadArguments","Beams can only be applied to notes shorter than a quarter note.");for(i.stem_direction=L.UP,a=0;a-1?L.UP:L.DOWN),a=0;a4?[new v(2,r)]:r<=4?[new v(1,r)]:[new v(1,4)]}},{key:"applyAndGetBeams",value:function(t,e,r){return n.generateBeams(t.getTickables(),{groups:r,stem_direction:e})}},{key:"generateBeams",value:function(t,e){e||(e={}),e.groups&&e.groups.length||(e.groups=[new v(2,8)]);var r=e.groups.map((function(t){if(!t.multiply)throw new m.RuntimeError("InvalidBeamGroups","The beam groups must be an array of Vex.Flow.Fractions");return t.clone().multiply(R.RESOLUTION,1)})),i=t,a=0,o=[],s=[];function l(){r.length-1>a?a+=1:a=0}!function(){var t=[];i.forEach((function(e){if(t=[],e.shouldIgnoreTicks())return o.push(s),void(s=t);s.push(e);var n=r[a].clone(),i=s.reduce((function(t,e){return e.getTicks().clone().add(t)}),new v(0,1)),u=R.durationToNumber(e.duration)<8;u&&e.tuplet&&(n.numerator*=2),i.greaterThan(n)?(u||t.push(s.pop()),o.push(s),s=t,l()):i.equals(n)&&(o.push(s),s=t,l())})),s.length>0&&o.push(s)}(),function(){var t=[];o.forEach((function(n){var r=[];n.forEach((function(n,i,a){var o=0===i||i===a.length-1,s=a[i-1],l=!e.beam_rests&&n.isRest(),u=e.beam_rests&&e.beam_middle_only&&n.isRest()&&o,c=!1;if(e.maintain_stem_directions&&s&&!n.isRest()&&!s.isRest()){var b=s.getStemDirection();c=n.getStemDirection()!==b}var h=parseInt(n.duration,10)<8;l||u||c||h?(r.length>0&&t.push(r),r=c?[n]:[]):r.push(n)})),r.length>0&&t.push(r)})),o=t}(),o.forEach((function(t){var n;if(e.maintain_stem_directions){var r=function(t){for(var e=0;e1){var e=!0;return t.forEach((function(t){t.getIntrinsicTicks()>=R.durationToTicks("4")&&(e=!1)})),e}return!1})),c=function(){var t=[];return o.forEach((function(e){var n=null;e.forEach((function(e){e.tuplet&&n!==e.tuplet&&(n=e.tuplet,t.push(n))}))})),t}(),b=[];return u.forEach((function(t){var r=new n(t);e.show_stemlets&&(r.render_options.show_stemlets=!0),e.secondary_breaks&&(r.render_options.secondary_break_ticks=R.durationToTicks(e.secondary_breaks)),!0===e.flat_beams&&(r.render_options.flat_beams=!0,r.render_options.flat_beam_offset=e.flat_beam_offset),b.push(r)})),c.forEach((function(t){var e=t.notes[0].stem_direction===L.DOWN?B.LOCATION_BOTTOM:B.LOCATION_TOP;t.setTupletLocation(e);for(var n=!1,r=0;rt?e:t}))}},{key:"breakSecondaryAt",value:function(t){return this.break_on_indices=t,this}},{key:"getSlopeY",value:function(t,e,n,r){return n+(t-e)*r}},{key:"calculateSlope",value:function(){for(var t=this.notes,e=this.stem_direction,n=this.render_options,r=n.max_slope,i=n.min_slope,a=n.slope_iterations,o=n.slope_cost,s=t[0],l=function(t,e){var n=t.getStemExtents().topY,r=t.getStemX();return(e.getStemExtents().topY-n)/(e.getStemX()-r)}(s,t[t.length-1]),u=(r-i)/a,c=Number.MAX_VALUE,b=0,h=0,f=i;f<=r;f+=u){for(var d=0,p=0,m=1;mf)&&(c=f,l=Math.min.apply(Math,o(h.getYs())),u=h.getBeamCount())}var d=s/t.length,p=i+u*(1.5*r),m=l+p*-e;e===L.DOWN&&dm&&(d=l-p),a?(e===L.DOWN&&d>a||e===L.UP&&d=8&&(c=-1!==this.break_on_indices.indexOf(l),this.render_options.secondary_break_ticks&&s>=this.render_options.secondary_break_ticks&&(s=0,c=!0));var b=u.getIntrinsicTicks()0&&void 0!==arguments[0]?arguments[0]:this.context,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.stave;this.setRendered();for(var n=null,r=0;r0&&n){var a=i.getBoundingBox();a&&n.mergeWith(a)}i.setContext(t),i.drawWithStyle()}this.boundingBox=n}}]),n}(x);function Y(t,e,n,r,i){if(e!==G.type.BOLD_DOUBLE_LEFT&&e!==G.type.BOLD_DOUBLE_RIGHT)throw new m.RERR("InvalidConnector","A REPEAT_BEGIN or REPEAT_END type must be provided.");var a=3,o=3.5;e===G.type.BOLD_DOUBLE_RIGHT&&(a=-5,o=3),t.fillRect(n+a,r,1,i-r),t.fillRect(n-2,r,o,i-r)}var G=function(t){f(n,t);var e=d(n);function n(t,r){var i;return h(this,n),(i=e.call(this)).setAttribute("type","StaveConnector"),i.thickness=R.STAVE_LINE_THICKNESS,i.width=3,i.top_stave=t,i.bottom_stave=r,i.type=n.type.DOUBLE,i.font={family:"times",size:16,weight:"normal"},i.x_shift=0,i.texts=[],i}return b(n,null,[{key:"type",get:function(){return{SINGLE_RIGHT:0,SINGLE_LEFT:1,SINGLE:1,DOUBLE:2,BRACE:3,BRACKET:4,BOLD_DOUBLE_LEFT:5,BOLD_DOUBLE_RIGHT:6,THIN_DOUBLE:7,NONE:8}}},{key:"typeString",get:function(){return{singleRight:n.type.SINGLE_RIGHT,singleLeft:n.type.SINGLE_LEFT,single:n.type.SINGLE,double:n.type.DOUBLE,brace:n.type.BRACE,bracket:n.type.BRACKET,boldDoubleLeft:n.type.BOLD_DOUBLE_LEFT,boldDoubleRight:n.type.BOLD_DOUBLE_RIGHT,thinDouble:n.type.THIN_DOUBLE,none:n.type.NONE}}}]),b(n,[{key:"setType",value:function(t){return(t="string"==typeof t?n.typeString[t]:t)>=n.type.SINGLE_RIGHT&&t<=n.type.NONE&&(this.type=t),this}},{key:"setText",value:function(t,e){return this.texts.push({content:t,options:m.Merge({shift_x:0,shift_y:0},e)}),this}},{key:"setFont",value:function(t){m.Merge(this.font,t)}},{key:"setXShift",value:function(t){if("number"!=typeof t)throw m.RERR("InvalidType","x_shift must be a Number");return this.x_shift=t,this}},{key:"draw",value:function(){var t=this.checkContext();this.setRendered();var e=this.top_stave.getYForLine(0),r=this.bottom_stave.getYForLine(this.bottom_stave.getNumLines()-1)+this.thickness,i=this.width,a=this.top_stave.getX();(this.type===n.type.SINGLE_RIGHT||this.type===n.type.BOLD_DOUBLE_RIGHT||this.type===n.type.THIN_DOUBLE)&&(a=this.top_stave.getX()+this.top_stave.width);var o=r-e;switch(this.type){case n.type.SINGLE:case n.type.SINGLE_LEFT:case n.type.SINGLE_RIGHT:i=1;break;case n.type.DOUBLE:a-=this.width+2,e-=this.thickness,o+=.5;break;case n.type.BRACE:i=12;var s=this.top_stave.getX()-2+this.x_shift,l=e,u=s,c=r,b=s-i,h=l+o/2,f=b-.9*i,d=l+.2*o,p=s+1.1*i,v=h-.135*o,y=p,g=h+.135*o,_=f,x=c-.2*o,k=b-i,w=x,S=s+.4*i,E=h+.135*o,C=S,A=h-.135*o,R=k,F=d;t.beginPath(),t.moveTo(s,l),t.bezierCurveTo(f,d,p,v,b,h),t.bezierCurveTo(y,g,_,x,u,c),t.bezierCurveTo(k,w,S,E,b,h),t.bezierCurveTo(C,A,R,F,s,l),t.fill(),t.stroke();break;case n.type.BRACKET:o=(r+=6)-(e-=6),T.renderGlyph(t,a-5,e,40,"bracketTop"),T.renderGlyph(t,a-5,r,40,"bracketBottom"),a-=this.width+2;break;case n.type.BOLD_DOUBLE_LEFT:Y(t,this.type,a+this.x_shift,e,r-this.thickness);break;case n.type.BOLD_DOUBLE_RIGHT:Y(t,this.type,a,e,r-this.thickness);break;case n.type.THIN_DOUBLE:i=1,o-=this.thickness;break;case n.type.NONE:break;default:throw new m.RERR("InvalidType","The provided StaveConnector.type (".concat(this.type,") is invalid"))}this.type!==n.type.BRACE&&this.type!==n.type.BOLD_DOUBLE_LEFT&&this.type!==n.type.BOLD_DOUBLE_RIGHT&&this.type!==n.type.NONE&&t.fillRect(a,e,i,o),this.type===n.type.THIN_DOUBLE&&t.fillRect(a-3,e,i,o),t.save(),t.lineWidth=2,t.setFont(this.font.family,this.font.size,this.font.weight);for(var M=0;M3&&void 0!==arguments[3]?arguments[3]:h;t.beginPath(),t.setStrokeStyle(i),t.setFillStyle(i),t.setLineWidth(3),t.moveTo(n+e.getXShift(),a),t.lineTo(r+e.getXShift(),a),t.stroke()}f(i,a,"red"),f(a,o,"#999"),f(o,s,"green"),f(s,l,"#999"),f(l,u,"red"),f(u,c,"#DD0"),f(i-e.getXShift(),i,"#BBB"),m.drawDot(t,o+e.getXShift(),h,"blue");var d=e.getFormatterMetrics();if(d.iterations>0){var p=d.space.deviation,v=p>=0?"+":"";t.setFillStyle("red"),t.fillText(v+Math.round(p),o+e.getXShift(),n-10)}t.restore()}},{key:"parseDuration",value:function(t){if("string"!=typeof t)return null;var e=/(\d*\/?\d+|[a-z])(d*)([nrhms]|$)/.exec(t);return e?{duration:e[1],dots:e[2].length,type:e[3]||"n"}:null}},{key:"parseNoteStruct",value:function(t){var e=t.duration,r=[],i=n.parseDuration(e);if(!i)return null;var a=t.type;if(a&&!R.getGlyphProps.validTypes[a])return null;a||(a=i.type||"n",void 0!==t.keys&&t.keys.forEach((function(t,e){var n=t.split("/");r[e]=n&&3===n.length?n[2]:a})));var o=R.durationToTicks(i.duration);if(null==o)return null;var s=t.dots?t.dots:i.dots;if("number"!=typeof s)return null;for(var l=o,u=0;u0}},{key:"hasStem",value:function(){return!1}},{key:"getDots",value:function(){return this.dots}},{key:"getNoteType",value:function(){return this.noteType}},{key:"setBeam",value:function(){return this}},{key:"setModifierContext",value:function(t){return this.modifierContext=t,this}},{key:"addModifier",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t.setNote(this),t.setIndex(e),this.modifiers.push(t),this.setPreFormatted(!1),this}},{key:"getModifierStartXY",value:function(){if(!this.preFormatted)throw new m.RERR("UnformattedNote","Can't call GetModifierStartXY on an unformatted note");return{x:this.getAbsoluteX(),y:this.ys[0]}}},{key:"getMetrics",value:function(){if(!this.preFormatted)throw new m.RERR("UnformattedNote","Can't call getMetrics on an unformatted note.");var t=this.modifierContext?this.modifierContext.state.left_shift:0,e=this.modifierContext?this.modifierContext.state.right_shift:0,n=this.getWidth();return{width:n,glyphWidth:this.getGlyphWidth(),notePx:n-t-e-this.leftDisplacedHeadPx-this.rightDisplacedHeadPx,modLeftPx:t,modRightPx:e,leftDisplacedHeadPx:this.leftDisplacedHeadPx,rightDisplacedHeadPx:this.rightDisplacedHeadPx}}},{key:"getAbsoluteX",value:function(){if(!this.tickContext)throw new m.RERR("NoTickContext","Note needs a TickContext assigned for an X-Value");var t=this.tickContext.getX();return this.stave&&(t+=this.stave.getNoteStartX()+this.musicFont.lookupMetric("stave.padding")),this.isCenterAligned()&&(t+=this.getCenterXShift()),t}},{key:"setPreFormatted",value:function(t){this.preFormatted=t}}]),n}(V),K=function(t){f(n,t);var e=d(n);function n(t){var r;if(h(this,n),(r=e.call(this,t)).setAttribute("type","NoteHead"),r.index=t.index,r.x=t.x||0,r.y=t.y||0,r.note_type=t.note_type,r.duration=t.duration,r.displaced=t.displaced||!1,r.stem_direction=t.stem_direction||Z.STEM_UP,r.line=t.line,r.glyph=R.getGlyphProps(r.duration,r.note_type),!r.glyph)throw new m.RuntimeError("BadArguments","No glyph found for duration '".concat(r.duration,"' and type '").concat(r.note_type,"'"));return r.glyph_code=r.glyph.code_head,r.x_shift=t.x_shift||0,t.custom_glyph_code&&(r.custom_glyph=!0,r.glyph_code=t.custom_glyph_code,r.stem_up_x_offset=t.stem_up_x_offset||0,r.stem_down_x_offset=t.stem_down_x_offset||0),r.style=t.style,r.slashed=t.slashed,m.Merge(r.render_options,{glyph_font_scale:t.glyph_font_scale||R.DEFAULT_NOTATION_FONT_SCALE,stroke_px:3}),r.setWidth(r.glyph.getWidth(r.render_options.glyph_font_scale)),l(r)}return b(n,null,[{key:"CATEGORY",get:function(){return"notehead"}}]),b(n,[{key:"getCategory",value:function(){return n.CATEGORY}},{key:"getWidth",value:function(){return this.width}},{key:"isDisplaced",value:function(){return!0===this.displaced}},{key:"getGlyph",value:function(){return this.glyph}},{key:"setX",value:function(t){return this.x=t,this}},{key:"getY",value:function(){return this.y}},{key:"setY",value:function(t){return this.y=t,this}},{key:"getLine",value:function(){return this.line}},{key:"setLine",value:function(t){return this.line=t,this}},{key:"getAbsoluteX",value:function(){var t=this.preFormatted?i(a(n.prototype),"getAbsoluteX",this).call(this):this.x,e=L.WIDTH/2,r=this.musicFont.lookupMetric("notehead.shiftX",0)*this.stem_direction,o=this.musicFont.lookupMetric("noteHead.displaced.shiftX",0)*this.stem_direction;return t+r+(this.displaced?(this.width-e)*this.stem_direction+o:0)}},{key:"getBoundingBox",value:function(){if(!this.preFormatted)throw new m.RERR("UnformattedNote","Can't call getBoundingBox on an unformatted note.");var t=this.stave.getSpacingBetweenLines(),e=t/2,n=this.y-e;return new R.BoundingBox(this.getAbsoluteX(),n,this.width,t)}},{key:"setStave",value:function(t){var e=this.getLine();return this.stave=t,this.setY(t.getYForNote(e)),this.context=this.stave.context,this}},{key:"preFormat",value:function(){if(this.preFormatted)return this;var t=this.getWidth()+this.leftDisplacedHeadPx+this.rightDisplacedHeadPx;return this.setWidth(t),this.setPreFormatted(!0),this}},{key:"draw",value:function(){this.checkContext(),this.setRendered();var t=this.context,e=this.getAbsoluteX();this.custom_glyph&&(e+=this.stem_direction===L.UP?this.stem_up_x_offset:this.stem_down_x_offset);var r=this.y;!function(){for(var t=arguments.length,e=new Array(t),r=0;r2&&(s=!0),s||(n-=R.STEM_WIDTH/2*i),t.beginPath(),t.moveTo(n,r+a),t.lineTo(n,r+1),t.lineTo(n+o,r-a),t.lineTo(n+o,r),t.lineTo(n,r+a),t.closePath(),s?t.fill():t.stroke(),R.durationToFraction(e).equals(.5))for(var l=[-3,-1,o+1,o+3],u=0;u0&&void 0!==arguments[0]?arguments[0]:"flag",e=this.glyph,n=null===this.beam;if(e&&e.flag&&n){var r=this.getStemDirection()===L.DOWN?e.code_flag_downstem:e.code_flag_upstem;this.flag=new T(r,this.render_options.glyph_font_scale,{category:t})}}},{key:"getBaseCustomNoteHeadGlyph",value:function(){return this.getStemDirection()===L.DOWN?this.customGlyphs[this.customGlyphs.length-1]:this.customGlyphs[0]}},{key:"getStemLength",value:function(){return L.HEIGHT+this.getStemExtension()}},{key:"getBeamCount",value:function(){var t=this.getGlyph();return t?t.beam_count:0}},{key:"getStemMinumumLength",value:function(){var t=R.durationToFraction(this.duration).value()<=1?0:20;switch(this.duration){case"8":null==this.beam&&(t=35);break;case"16":t=null==this.beam?35:25;break;case"32":t=null==this.beam?45:35;break;case"64":t=null==this.beam?50:40;break;case"128":t=null==this.beam?55:45}return t}},{key:"getStemDirection",value:function(){return this.stem_direction}},{key:"setStemDirection",value:function(t){if(t||(t=L.UP),t!==L.UP&&t!==L.DOWN)throw new m.RERR("BadArgument","Invalid stem direction: "+t);if(this.stem_direction=t,this.stem){this.stem.setDirection(t),this.stem.setExtension(this.getStemExtension());var e=this.getBaseCustomNoteHeadGlyph()||this.getGlyph(),n=this.musicFont.lookupMetric("stem.noteHead."+e.code_head,{offsetYBaseStemUp:0,offsetYTopStemUp:0,offsetYBaseStemDown:0,offsetYTopStemDown:0});this.stem.setOptions({stem_up_y_offset:n.offsetYTopStemUp,stem_down_y_offset:n.offsetYTopStemDown,stem_up_y_base_offset:n.offsetYBaseStemUp,stem_down_y_base_offset:n.offsetYBaseStemDown})}return this.reset(),this.flag&&this.buildFlag(),this.beam=null,this.preFormatted&&this.preFormat(),this}},{key:"getStemX",value:function(){var t=this.getAbsoluteX()+this.x_shift,e=this.getAbsoluteX()+this.x_shift+this.getGlyphWidth();return this.stem_direction===L.DOWN?t:e}},{key:"getCenterGlyphX",value:function(){return this.getAbsoluteX()+this.x_shift+this.getGlyphWidth()/2}},{key:"getStemExtension",value:function(){var t=this.getGlyph();return null!=this.stemExtensionOverride?this.stemExtensionOverride:t?1===this.getStemDirection()?t.stem_up_extension:t.stem_down_extension:0}},{key:"setStemLength",value:function(t){return this.stemExtensionOverride=t-L.HEIGHT,this}},{key:"getStemExtents",value:function(){return this.stem.getExtents()}},{key:"setBeam",value:function(t){return this.beam=t,this}},{key:"getYForTopText",value:function(t){var e=this.getStemExtents();return this.hasStem()?Math.min(this.stave.getYForTopText(t),e.topY-this.render_options.annotation_spacing*(t+1)):this.stave.getYForTopText(t)}},{key:"getYForBottomText",value:function(t){var e=this.getStemExtents();return this.hasStem()?Math.max(this.stave.getYForTopText(t),e.baseY+this.render_options.annotation_spacing*t):this.stave.getYForBottomText(t)}},{key:"hasFlag",value:function(){return R.getGlyphProps(this.duration).flag&&!this.beam}},{key:"postFormat",value:function(){return this.beam&&this.beam.postFormat(),this.postFormatted=!0,this}},{key:"drawStem",value:function(t){this.checkContext(),this.setRendered(),this.setStem(new L(t)),this.stem.setContext(this.context).draw()}}]),n}(X),q=function(t){f(n,t);var e=d(n);function n(){var t;return h(this,n),(t=e.call(this)).setAttribute("type","Modifier"),t.width=0,t.note=null,t.index=null,t.text_line=0,t.position=n.Position.LEFT,t.modifier_context=null,t.x_shift=0,t.y_shift=0,t.spacingFromNextModifier=0,t}return b(n,null,[{key:"CATEGORY",get:function(){return"none"}},{key:"Position",get:function(){return{LEFT:1,RIGHT:2,ABOVE:3,BELOW:4}}},{key:"PositionString",get:function(){return{above:n.Position.ABOVE,below:n.Position.BELOW,left:n.Position.LEFT,right:n.Position.RIGHT}}}]),b(n,[{key:"reset",value:function(){}},{key:"getCategory",value:function(){return n.CATEGORY}},{key:"getWidth",value:function(){return this.width}},{key:"setWidth",value:function(t){return this.width=t,this}},{key:"getNote",value:function(){return this.note}},{key:"setNote",value:function(t){return this.note=t,this}},{key:"getIndex",value:function(){return this.index}},{key:"setIndex",value:function(t){return this.index=t,this}},{key:"getModifierContext",value:function(){return this.modifier_context}},{key:"setModifierContext",value:function(t){return this.modifier_context=t,this}},{key:"getPosition",value:function(){return this.position}},{key:"setPosition",value:function(t){return this.position="string"==typeof t?n.PositionString[t]:t,this.reset(),this}},{key:"setTextLine",value:function(t){return this.text_line=t,this}},{key:"setYShift",value:function(t){return this.y_shift=t,this}},{key:"setSpacingFromNextModifier",value:function(t){this.spacingFromNextModifier=t}},{key:"getSpacingFromNextModifier",value:function(){return this.spacingFromNextModifier}},{key:"setXShift",value:function(t){this.x_shift=0,this.position===n.Position.LEFT?this.x_shift-=t:this.x_shift+=t}},{key:"getXShift",value:function(){return this.x_shift}},{key:"draw",value:function(){throw this.checkContext(),new m.RERR("MethodNotImplemented","draw() not implemented for this modifier.")}},{key:"alignSubNotesWithNote",value:function(t,e){var n=e.getTickContext(),r=n.getMetrics(),i=n.getX()-r.modLeftPx-r.modRightPx+this.getSpacingFromNextModifier();t.forEach((function(t){var n=t.getTickContext();t.setStave(e.stave),n.setXOffset(i)}))}}]),n}(x),J=function(t){f(n,t);var e=d(n);function n(){var t;return h(this,n),(t=e.call(this)).setAttribute("type","Dot"),t.note=null,t.index=null,t.position=q.Position.RIGHT,t.radius=2,t.setWidth(5),t.dot_shiftY=0,t}return b(n,null,[{key:"format",value:function(t,e){var n=e.right_shift;if(!t||0===t.length)return!1;for(var r=[],i={},a=0;ah?b:h,f=k,d=_}return e.right_shift+=h,!0}},{key:"CATEGORY",get:function(){return"dots"}}]),b(n,[{key:"getCategory",value:function(){return n.CATEGORY}},{key:"setNote",value:function(t){this.note=t,"gracenotes"===this.note.getCategory()&&(this.radius*=.5,this.setWidth(3))}},{key:"setDotShiftY",value:function(t){return this.dot_shiftY=t,this}},{key:"draw",value:function(){if(this.checkContext(),this.setRendered(),!this.note||null===this.index)throw new m.RERR("NoAttachedNote","Can't draw dot without a note and index.");var t=this.note.stave.options.spacing_between_lines_px,e=this.note.getModifierStartXY(this.position,this.index,{forceFlagRight:!0});"tabnotes"===this.note.getCategory()&&(e.y=this.note.getStemExtents().baseY);var n=e.x+this.x_shift+this.width-this.radius,r=e.y+this.y_shift+this.dot_shiftY*t,i=this.context;i.beginPath(),i.arc(n,r,this.radius,0,2*Math.PI,!1),i.fill()}}]),n}(q);function Q(t,e,n){var r=(e.isrest?0:1)*n;t.line+=r,t.maxLine+=r,t.minLine+=r,t.note.setKeyLine(0,t.note.getKeyLine(0)+r)}var Z=function(t){f(n,t);var e=d(n);function n(t){var r;if(h(this,n),(r=e.call(this,t)).setAttribute("type","StaveNote"),r.keys=t.keys,r.clef=t.clef,r.octave_shift=t.octave_shift,r.beam=null,r.glyph=R.getGlyphProps(r.duration,r.noteType),!r.glyph)throw new m.RuntimeError("BadArguments","Invalid note initialization data (No glyph found): "+JSON.stringify(t));return r.displaced=!1,r.dot_shiftY=0,r.keyProps=[],r.use_default_head_x=!1,r.note_heads=[],r.modifiers=[],m.Merge(r.render_options,{glyph_font_scale:t.glyph_font_scale||R.DEFAULT_NOTATION_FONT_SCALE,stroke_px:t.stroke_px||n.DEFAULT_LEDGER_LINE_OFFSET}),r.calculateKeyProps(),r.buildStem(),t.auto_stem?r.autoStem():r.setStemDirection(t.stem_direction),r.reset(),r.buildFlag(),l(r)}return b(n,null,[{key:"format",value:function(t,e){if(!t||t.length<2)return!1;if(t[0].getStave())return n.formatByY(t,e);for(var r=[],i=0;i2?r[1]:null,p=h>2?r[2]:r[1];2===h&&-1===f.stemDirection&&1===p.stemDirection&&(f=r[1],p=r[0]);var v,y=Math.max(f.voice_shift,p.voice_shift),g=0;if(2===h){var _=f.stemDirection===p.stemDirection?0:.5;return f.stemDirection===p.stemDirection&&f.minLine<=p.maxLine&&(f.isrest||(v=Math.abs(f.line-(p.maxLine+.5)),v=Math.max(v,f.stemMin),f.minLine=f.line-v,f.note.setStemLength(10*v))),f.minLine<=p.maxLine+_&&(f.isrest?Q(f,p,1):p.isrest?Q(p,f,-1):(g=y,f.stemDirection===p.stemDirection?f.note.setXShift(g+3):p.note.setXShift(g))),!0}return null!==d&&d.minLine0&&(this.keyProps[e-1].displaced=!0)),t=a,this.keyProps.push(i)}t=-1/0,this.keyProps.forEach((function(e){e.linee&&(e=r):r1}},{key:"hasStem",value:function(){return this.glyph.stem}},{key:"hasFlag",value:function(){return i(a(n.prototype),"hasFlag",this).call(this)&&!this.isRest()}},{key:"getStemX",value:function(){return"r"===this.noteType?this.getCenterGlyphX():i(a(n.prototype),"getStemX",this).call(this)+(t=this,L.WIDTH/(2*-t.getStemDirection()));var t}},{key:"getYForTopText",value:function(t){var e=this.getStemExtents();return Math.min(this.stave.getYForTopText(t),e.topY-this.render_options.annotation_spacing*(t+1))}},{key:"getYForBottomText",value:function(t){var e=this.getStemExtents();return Math.max(this.stave.getYForTopText(t),e.baseY+this.render_options.annotation_spacing*t)}},{key:"setStave",value:function(t){i(a(n.prototype),"setStave",this).call(this,t);var e=this.note_heads.map((function(e){return e.setStave(t),e.getY()}));if(this.setYs(e),this.stem){var r=this.getNoteHeadBounds(),o=r.y_top,s=r.y_bottom;this.stem.setYBounds(o,s)}return this}},{key:"getKeys",value:function(){return this.keys}},{key:"getKeyProps",value:function(){return this.keyProps}},{key:"isDisplaced",value:function(){return this.displaced}},{key:"setNoteDisplaced",value:function(t){return this.displaced=t,this}},{key:"getTieRightX",value:function(){var t=this.getAbsoluteX();return t+=this.getGlyphWidth()+this.x_shift+this.rightDisplacedHeadPx,this.modifierContext&&(t+=this.modifierContext.getRightShift()),t}},{key:"getTieLeftX",value:function(){var t=this.getAbsoluteX();return t+=this.x_shift-this.leftDisplacedHeadPx}},{key:"getLineForRest",value:function(){var t=this.keyProps[0].line;if(this.keyProps.length>1){var e=this.keyProps[this.keyProps.length-1].line,n=Math.max(t,e),r=Math.min(t,e);t=m.MidLine(n,r)}return t}},{key:"getModifierStartXY",value:function(t,e,n){if(n=n||{},!this.preFormatted)throw new m.RERR("UnformattedNote","Can't call GetModifierStartXY on an unformatted note");if(0===this.ys.length)throw new m.RERR("NoYValues","No Y-Values calculated for this note.");var r=q.Position,i=r.ABOVE,a=r.BELOW,o=r.LEFT,s=r.RIGHT,l=0;return t===o?l=-2:t===s?(l=this.getGlyphWidth()+this.x_shift+2,this.stem_direction===L.UP&&this.hasFlag()&&(n.forceFlagRight||function(t,e){return e===(t.getStemDirection()===L.UP?t.keyProps.length-1:0)}(this,e))&&(l+=this.flag.getMetrics().width)):t!==a&&t!==i||(l=this.getGlyphWidth()/2),{x:this.getAbsoluteX()+l,y:this.ys[e]}}},{key:"setStyle",value:function(t){i(a(n.prototype),"setStyle",this).call(this,t),this.note_heads.forEach((function(e){return e.setStyle(t)})),this.stem.setStyle(t)}},{key:"setStemStyle",value:function(t){this.getStem().setStyle(t)}},{key:"getStemStyle",value:function(){return this.stem.getStyle()}},{key:"setLedgerLineStyle",value:function(t){this.ledgerLineStyle=t}},{key:"getLedgerLineStyle",value:function(){return this.ledgerLineStyle}},{key:"setFlagStyle",value:function(t){this.flagStyle=t}},{key:"getFlagStyle",value:function(){return this.flagStyle}},{key:"setKeyStyle",value:function(t,e){return this.note_heads[t].setStyle(e),this}},{key:"setKeyLine",value:function(t,e){return this.keyProps[t].line=e,this.reset(),this}},{key:"getKeyLine",value:function(t){return this.keyProps[t].line}},{key:"addToModifierContext",value:function(t){this.setModifierContext(t);for(var e=0;ee)&&(e=h),null===r&&c.isDisplaced()&&(r=c.getAbsoluteX()),null!==n||c.isDisplaced()||(n=c.getAbsoluteX()),i=b>i?b:i,a=b=l;--w){var S=null!==p&&w>=f,T=null!==d&&w>=h;y(t.getYForNote(w),S,T)}this.restoreStyle(r,g)}}},{key:"drawModifiers",value:function(){if(!this.context)throw new m.RERR("NoCanvasContext","Can't draw without a canvas context.");var t=this.context;t.openGroup("modifiers");for(var e=0;em?x:m):S===q.Position.RIGHT&&(T.setXShift(p),v=(x=s+R)>v?x:v),y=E,g=w}return e.left_shift+=m,e.right_shift+=v,!0}},{key:"CATEGORY",get:function(){return"frethandfinger"}}]),b(n,[{key:"getCategory",value:function(){return n.CATEGORY}},{key:"setFretHandFinger",value:function(t){return this.finger=t,this}},{key:"setOffsetX",value:function(t){return this.x_offset=t,this}},{key:"setOffsetY",value:function(t){return this.y_offset=t,this}},{key:"draw",value:function(){if(this.checkContext(),!this.note||null==this.index)throw new m.RERR("NoAttachedNote","Can't draw string number without a note and index.");this.setRendered();var t=this.context,e=this.note.getModifierStartXY(this.position,this.index),n=e.x+this.x_shift+this.x_offset,r=e.y+this.y_shift+this.y_offset+5;switch(this.position){case q.Position.ABOVE:n-=4,r-=12;break;case q.Position.BELOW:n-=2,r+=10;break;case q.Position.LEFT:n-=this.width;break;case q.Position.RIGHT:n+=1;break;default:throw new m.RERR("InvalidPostion","The position ".concat(this.position," does not exist"))}t.save(),t.setFont(this.font.family,this.font.size,this.font.weight),t.fillText(""+this.finger,n,r),t.restore()}}]),n}(q),et=function(){function t(){h(this,t)}return b(t,[{key:"isValidNoteValue",value:function(e){return!(null==e||e<0||e>=t.NUM_TONES)}},{key:"isValidIntervalValue",value:function(t){return this.isValidNoteValue(t)}},{key:"getNoteParts",value:function(t){if(!t||t.length<1)throw new m.RERR("BadArguments","Invalid note name: "+t);if(t.length>3)throw new m.RERR("BadArguments","Invalid note name: "+t);var e=t.toLowerCase(),n=/^([cdefgab])(b|bb|n|#|##)?$/.exec(e);if(null!=n)return{root:n[1],accidental:n[2]};throw new m.RERR("BadArguments","Invalid note name: "+t)}},{key:"getKeyParts",value:function(t){if(!t||t.length<1)throw new m.RERR("BadArguments","Invalid key: "+t);var e=t.toLowerCase(),n=/^([cdefgab])(b|#)?(mel|harm|m|M)?$/.exec(e);if(null!=n){var r=n[1],i=n[2],a=n[3];return a||(a="M"),{root:r,accidental:i,type:a}}throw new m.RERR("BadArguments","Invalid key: "+t)}},{key:"getNoteValue",value:function(e){var n=t.noteValues[e];if(null==n)throw new m.RERR("BadArguments","Invalid note name: "+e);return n.int_val}},{key:"getIntervalValue",value:function(e){var n=t.intervals[e];if(null==n)throw new m.RERR("BadArguments","Invalid interval name: "+e);return n}},{key:"getCanonicalNoteName",value:function(e){if(!this.isValidNoteValue(e))throw new m.RERR("BadArguments","Invalid note value: "+e);return t.canonical_notes[e]}},{key:"getCanonicalIntervalName",value:function(e){if(!this.isValidIntervalValue(e))throw new m.RERR("BadArguments","Invalid interval value: "+e);return t.diatonic_intervals[e]}},{key:"getRelativeNoteValue",value:function(e,n,r){if(null==r&&(r=1),1!==r&&-1!==r)throw new m.RERR("BadArguments","Invalid direction: "+r);var i=(e+r*n)%t.NUM_TONES;return i<0&&(i+=t.NUM_TONES),i}},{key:"getRelativeNoteName",value:function(e,n){var r=this.getNoteParts(e),i=this.getNoteValue(r.root),a=n-i;if(Math.abs(a)>t.NUM_TONES-3){var o=1;a>0&&(o=-1);var s=(n+1+(i+1))%t.NUM_TONES*o;if(Math.abs(s)>2)throw new m.RERR("BadArguments","Notes not related: ".concat(e,", ").concat(n,")"));a=s}if(Math.abs(a)>2)throw new m.RERR("BadArguments","Notes not related: ".concat(e,", ").concat(n,")"));var l=r.root;if(a>0)for(var u=1;u<=a;++u)l+="#";else if(a<0)for(var c=-1;c>=a;--c)l+="b";return l}},{key:"getScaleTones",value:function(t,e){for(var n=[t],r=t,i=0;i0&&void 0!==arguments[0]?arguments[0]:null;if(h(this,n),(t=e.call(this)).setAttribute("type","Accidental"),nt("New accidental: ",r),t.note=null,t.index=null,t.type=r,t.position=q.Position.LEFT,t.render_options={font_scale:38,stroke_px:3,parenLeftPadding:2,parenRightPadding:2},t.accidental=R.accidentalCodes(t.type),!t.accidental)throw new m.RERR("ArgumentError","Unknown accidental type: "+r);return t.cautionary=!1,t.parenLeft=null,t.parenRight=null,t.reset(),l(t)}return b(n,null,[{key:"format",value:function(t,e){var n=this,r=e.left_shift+1;if(t&&0!==t.length){for(var i=[],a=null,s=0,l=0;lg?k.shift:g,_=k.line}for(var w=0,S=function(t){for(var e=!1,r=t,i=t;i+1=7){for(var p=2,m=!0;!0===m;){m=!1;for(var v=0;v+pf?w:f}else for(h=t;h<=i;h++)f=R.accidentalColumnsTable[b][d][h-t],y[h].column=f,w=w>f?w:f;T=t=i},T=0;TE[t.column]&&(E[t.column]=t.width)}));for(var F=1;F0?(r=e.flatLine||e.dblSharpLine?2.5:3,t.dblSharpLine&&(n-=.5)):(r=t.flatLine||t.dblSharpLine?2.5:3,e.dblSharpLine&&(n-=.5));var i=Math.abs(n)-1;if(!c||c&&b){o[s.root]=u;var h=new n(l);e.addAccidental(i,h),r.push(u)}})),e.getModifiers().forEach((function(e){"gracenotegroups"===e.getCategory()&&e.getGraceNotes().forEach(t)})))};e.forEach(s)}))}},{key:"CATEGORY",get:function(){return"accidentals"}}]),b(n,[{key:"reset",value:function(){var t=this.render_options.font_scale;this.glyph=new T(this.accidental.code,t),this.glyph.setOriginX(1),this.cautionary&&(this.parenLeft=new T(R.accidentalCodes("{").code,t),this.parenRight=new T(R.accidentalCodes("}").code,t),this.parenLeft.setOriginX(1),this.parenRight.setOriginX(1))}},{key:"getCategory",value:function(){return n.CATEGORY}},{key:"getWidth",value:function(){var t=this.cautionary?rt(this.parenLeft)+rt(this.parenRight)+this.render_options.parenLeftPadding+this.render_options.parenRightPadding:0;return rt(this.glyph)+t}},{key:"setNote",value:function(t){if(!t)throw new m.RERR("ArgumentError","Bad note value: "+t);this.note=t,"gracenotes"===this.note.getCategory()&&(this.render_options.font_scale=25,this.reset())}},{key:"setAsCautionary",value:function(){return this.cautionary=!0,this.render_options.font_scale=28,this.reset(),this}},{key:"draw",value:function(){var t=this.context,e=this.type,n=this.position,r=this.note,i=this.index,a=this.cautionary,o=this.x_shift,s=this.y_shift,l=this.glyph,u=this.parenLeft,c=this.parenRight,b=this.render_options,h=b.parenLeftPadding,f=b.parenRightPadding;if(this.checkContext(),!r||null==i)throw new m.RERR("NoAttachedNote","Can't draw accidental without a note and index.");var d=r.getModifierStartXY(n,i),p=d.x+o,v=d.y+s;nt("Rendering: ",e,p,v),a?(c.render(t,p,v),p-=rt(c),p-=f,p-=this.accidental.parenRightPaddingAdjustment,l.render(t,p,v),p-=rt(l),p-=h,u.render(t,p,v)):l.render(t,p,v),this.setRendered()}}]),n}(q),at=function(t){f(n,t);var e=d(n);function n(t){var r;return h(this,n),l(r,((r=e.call(this)).setAttribute("type","NoteSubGroup"),r.note=null,r.index=null,r.position=q.Position.LEFT,r.subNotes=t,r.subNotes.forEach((function(t){t.ignore_ticks=!1})),r.width=0,r.preFormatted=!1,r.formatter=new Rt,r.voice=new W({num_beats:4,beat_value:4,resolution:R.RESOLUTION}).setStrict(!1),r.voice.addTickables(r.subNotes),s(r)))}return b(n,null,[{key:"format",value:function(t,e){if(!t||0===t.length)return!1;for(var n=0,r=0;r1){var e=new H(t);e.render_options.beam_width=3,e.render_options.partial_beam_length=4,this.beams.push(e)}return this}},{key:"setNote",value:function(t){this.note=t}},{key:"setWidth",value:function(t){this.width=t}},{key:"getWidth",value:function(){return this.width}},{key:"getGraceNotes",value:function(){return this.grace_notes}},{key:"draw",value:function(){var t=this;this.checkContext();var e=this.getNote();if(function(){for(var t=arguments.length,e=new Array(t),r=0;rp?g:p):s===q.Position.RIGHT&&(a.setXShift(d),m=(g+=k)>m?g:m),v=_,y=o}return e.left_shift+=p,e.right_shift+=m,!0}},{key:"CATEGORY",get:function(){return"stringnumber"}}]),b(n,[{key:"getCategory",value:function(){return n.CATEGORY}},{key:"getNote",value:function(){return this.note}},{key:"setNote",value:function(t){return this.note=t,this}},{key:"getIndex",value:function(){return this.index}},{key:"setIndex",value:function(t){return this.index=t,this}},{key:"setLineEndType",value:function(t){return t>=N.LineEndType.NONE&&t<=N.LineEndType.DOWN&&(this.leg=t),this}},{key:"setStringNumber",value:function(t){return this.string_number=t,this}},{key:"setOffsetX",value:function(t){return this.x_offset=t,this}},{key:"setOffsetY",value:function(t){return this.y_offset=t,this}},{key:"setLastNote",value:function(t){return this.last_note=t,this}},{key:"setDashed",value:function(t){return this.dashed=t,this}},{key:"draw",value:function(){var t=this.checkContext();if(!this.note||null==this.index)throw new m.RERR("NoAttachedNote","Can't draw string number without a note and index.");this.setRendered();var e=this.note.stave.options.spacing_between_lines_px,n=this.note.getModifierStartXY(this.position,this.index),r=n.x+this.x_shift+this.x_offset,i=n.y+this.y_shift+this.y_offset;switch(this.position){case q.Position.ABOVE:case q.Position.BELOW:var a=this.note.getStemExtents(),o=a.topY,s=a.baseY+2;this.note.stem_direction===Z.STEM_DOWN&&(o=a.baseY,s=a.topY-2),i=this.position===q.Position.ABOVE?this.note.hasStem()?o-1.75*e:n.y-1.75*e:this.note.hasStem()?s+1.5*e:n.y+1.75*e,i+=this.y_shift+this.y_offset;break;case q.Position.LEFT:r-=this.radius/2+5;break;case q.Position.RIGHT:r+=this.radius/2+6;break;default:throw new m.RERR("InvalidPosition","The position ".concat(this.position," is invalid"))}t.save(),t.beginPath(),t.arc(r,i,this.radius,0,2*Math.PI,!1),t.lineWidth=1.5,t.stroke(),t.setFont(this.font.family,this.font.size,this.font.weight);var l=r-t.measureText(this.string_number).width/2;if(t.fillText(""+this.string_number,l,i+4.5),null!=this.last_note){var u,c,b=this.last_note.getStemX()-this.note.getX()+5;switch(t.strokeStyle="#000000",t.lineCap="round",t.lineWidth=.6,this.dashed?N.drawDashedLine(t,r+10,i,r+b,i,[3,3]):N.drawDashedLine(t,r+10,i,r+b,i,[3,0]),this.leg){case N.LineEndType.UP:u=-10,c=this.dashed?[3,3]:[3,0],N.drawDashedLine(t,r+b,i,r+b,i+u,c);break;case N.LineEndType.DOWN:u=10,c=this.dashed?[3,3]:[3,0],N.drawDashedLine(t,r+b,i,r+b,i+u,c)}}t.restore()}}]),n}(q),bt=q.Position,ht=bt.ABOVE,ft=bt.BELOW,dt=function(t,e){return.5*t(e/.5)},pt=function(t,e){return e===ht?t<=5:t>=1},mt=function(t,e){return pt(t,e)?e===ht?Math.ceil:Math.floor:Math.round},vt=function(t){var e=t.getCategory();return"stavenotes"===e||"gracenotes"===e},yt=function(t){f(n,t);var e=d(n);function n(t){var r;return h(this,n),(r=e.call(this)).setAttribute("type","Articulation"),r.note=null,r.index=null,r.type=t,r.position=ft,r.render_options={font_scale:38},r.reset(),r}return b(n,null,[{key:"format",value:function(t,e){if(!t||0===t.length)return!1;var n=function(t,e,n){return dt(mt(e,n),t.glyph.getMetrics().height/10+.5)};t.filter((function(t){return t.getPosition()===ht})).forEach((function(t){t.setTextLine(e.top_text_line),e.top_text_line+=n(t,e.top_text_line,ht)})),t.filter((function(t){return t.getPosition()===ft})).forEach((function(t){t.setTextLine(e.text_line),e.text_line+=n(t,e.text_line,ft)}));var r=t.map((function(t){return t.getWidth()})).reduce((function(t,e){return Math.max(e,t)}));return e.left_shift+=r/2,e.right_shift+=r/2,!0}},{key:"easyScoreHook",value:function(t,e,n){var r=t.articulations;if(r){var i={staccato:"a.",tenuto:"a-"};r.split(",").map((function(t){return t.trim().split(".")})).map((function(t){var e=u(t,2),r=e[0],a=e[1],o={type:i[r]};return a&&(o.position=q.PositionString[a]),n.getFactory().Articulation(o)})).map((function(t){return e.addModifier(0,t)}))}}},{key:"CATEGORY",get:function(){return"articulations"}},{key:"INITIAL_OFFSET",get:function(){return-.5}}]),b(n,[{key:"reset",value:function(){if(this.articulation=R.articulationCodes(this.type),!this.articulation)throw new m.RERR("ArgumentError","Articulation not found: "+this.type);var t=(this.position===ht?this.articulation.aboveCode:this.articulation.belowCode)||this.articulation.code;this.glyph=new T(t,this.render_options.font_scale),this.setWidth(this.glyph.getMetrics().width)}},{key:"getCategory",value:function(){return n.CATEGORY}},{key:"draw",value:function(){var t,e=this.note,i=this.index,a=this.position,s=this.glyph,l=this.articulation.between_lines,u=this.text_line,c=this.context;if(this.checkContext(),!e||null==i)throw new m.RERR("NoAttachedNote","Can't draw Articulation without a note and index.");this.setRendered();var b=e.getStave(),h=b.getSpacingBetweenLines(),f="tabnotes"===e.getCategory(),d=e.getModifierStartXY(a,i).x,p=!l||f,v=function(t,e){var n=e===ht&&t.getStemDirection()===L.UP||e===ft&&t.getStemDirection()===L.DOWN;return vt(t)?t.hasStem()&&n?.5:1:t.hasStem()&&n?1:0}(e,a),y=this.musicFont.lookupMetric("articulation.".concat(s.getCode(),".padding"),0),g=(t={},r(t,ht,(function(){s.setOrigin(.5,1);var t=function(t,e){var n=t.getStave(),r=t.getStemDirection(),i=t.getStemExtents(),a=i.topY,s=i.baseY;if(vt(t))return t.hasStem()?r===L.UP?a:s:Math.min.apply(Math,o(t.getYs()));if("tabnotes"===t.getCategory())return t.hasStem()&&r===L.UP?a:n.getYForTopText(e);throw new m.RERR("UnknownCategory","Only can get the top and bottom ys of stavenotes and tabnotes")}(e,u)-(u+v)*h;return p?Math.min(b.getYForTopText(n.INITIAL_OFFSET),t):t})),r(t,ft,(function(){s.setOrigin(.5,0);var t=function(t,e){var n=t.getStave(),r=t.getStemDirection(),i=t.getStemExtents(),a=i.topY,s=i.baseY;if(vt(t))return t.hasStem()?r===L.UP?s:a:Math.max.apply(Math,o(t.getYs()));if("tabnotes"===t.getCategory())return t.hasStem()?r===L.UP?n.getYForBottomText(e):a:n.getYForBottomText(e);throw new m.RERR("UnknownCategory","Only can get the top and bottom ys of stavenotes and tabnotes")}(e,u)+(u+v)*h;return p?Math.max(b.getYForBottomText(n.INITIAL_OFFSET),t):t})),t)[a]();if(!f){var _=a===ht?-1:1,x=f?e.positions[i].str:e.getKeyProps()[i].line,k=(e.getYs()[i]-g)/h+x,w=function(t,e,n,r){var i=dt(mt(e,n),e);return t&&pt(i,n)&&i%1==0?i+.5*-r:i}(l,k,a,_);pt(w,a)&&s.setOrigin(.5,.5),g+=Math.abs(w-k)*h*_+y*_}!function(){for(var t=arguments.length,e=new Array(t),r=0;r0&&r--;for(var s=0;s1&&void 0!==arguments[1]?arguments[1]:0,n=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).paddingBetween,r=void 0===n?10:n;t.reduce((function(t,e){e.addToModifierContext(new Tt);var n=(new gt).addTickable(e).preFormat(),i=n.getMetrics();return n.setX(t+i.totalLeftPx),t+n.getWidth()+i.totalRightPx+r}),e)}},{key:"plotDebugging",value:function(t,e,n,r,i,a){var o=n+(a=c({stavePadding:m.Flow.DEFAULT_FONT_STACK[0].lookupMetric("stave.padding")},a)).stavePadding,s=e.contextGaps;t.save(),t.setFont("Arial",8,""),s.gaps.forEach((function(e){var n,a,s;n=o+e.x1,a=o+e.x2,s="rgba(100,200,100,0.4)",t.beginPath(),t.setStrokeStyle(s),t.setFillStyle(s),t.setLineWidth(1),t.fillRect(n,r,Math.max(a-n,0),i-r),t.setFillStyle("green"),t.fillText(Math.round(e.x2-e.x1),o+e.x1,i+12)})),t.setFillStyle("red"),t.fillText("Loss: ".concat((e.totalCost||0).toFixed(2)," Shift: ").concat((e.totalShift||0).toFixed(2)," Gap: ").concat(s.total.toFixed(2)),o-20,i+27),t.restore()}},{key:"FormatAndDraw",value:function(e,n,r,i){var a={auto_beam:!1,align_rests:!1};"object"==typeof i?m.Merge(a,i):"boolean"==typeof i&&(a.auto_beam=i);var o=new W(R.TIME4_4).setMode(W.Mode.SOFT).addTickables(r),s=a.auto_beam?H.applyAndGetBeams(o):[];return(new t).joinVoices([o],{align_rests:a.align_rests}).formatToStave([o],n,{align_rests:a.align_rests,stave:n}),o.setStave(n).draw(e,n),s.forEach((function(t){return t.setContext(e).draw()})),o.getBoundingBox()}},{key:"FormatAndDrawTab",value:function(e,n,r,i,a,o,s){var l={auto_beam:o,align_rests:!1};"object"==typeof s?m.Merge(l,s):"boolean"==typeof s&&(l.auto_beam=s);var u=new W(R.TIME4_4).setMode(W.Mode.SOFT).addTickables(a),c=new W(R.TIME4_4).setMode(W.Mode.SOFT).addTickables(i),b=l.auto_beam?H.applyAndGetBeams(u):[];(new t).joinVoices([u],{align_rests:l.align_rests}).joinVoices([c]).formatToStave([u,c],r,{align_rests:l.align_rests}),u.draw(e,r),c.draw(e,n),b.forEach((function(t){return t.setContext(e).draw()})),new G(r,n).setContext(e).draw()}},{key:"AlignRestsToNotes",value:function(t,e,n){return t.forEach((function(r,i){if(r instanceof Z&&r.isRest()){if(r.tuplet&&!n)return;var a=r.getGlyph().position.toUpperCase();if("R/4"!==a&&"B/4"!==a)return;if(e||null!=r.beam){var o=r.getKeyProps()[0];if(0===i)o.line=Et(t,o.line,i,!1),r.setKeyLine(0,o.line);else if(i>0&&i0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0,a=this.tickContexts,o=a.list,s=a.map;this.lossHistory=[],r&&i&&r.forEach((function(t){return t.setStave(i).preFormat()}));var l=0,u=0;if(this.minTotalWidth=0,o.forEach((function(e){var r=s[e];n&&r.setContext(n),r.preFormat();var i=r.getWidth();t.minTotalWidth+=i;var a=r.getMetrics();l=l+u+a.totalLeftPx,r.setX(l),u=i-a.totalLeftPx})),this.minTotalWidth=l+u,this.hasMinTotalWidth=!0,e<=0)return this.evaluate();var c=s[o[0]],b=s[o[o.length-1]];function h(t){return o.map((function(e,n){var r=s[e],i=r.getTickablesByVoice(),a=null;if(n>0)for(var l=s[o[n-1]],u=function(e){var n=s[o[e]].getTickablesByVoice(),u=[];if(Object.keys(i).forEach((function(t){n[t]&&u.push(t)})),u.length>0){var c=0,b=1/0,h=0;return{v:(u.forEach((function(t){var e=n[t].getTicks().value();e>c&&(a=n[t],c=e);var r=i[t],o=r.getX()-(r.getMetrics().modLeftPx+r.getMetrics().leftDisplacedHeadPx),s=n[t].getMetrics(),l=n[t].getX()+s.notePx+s.modRightPx+s.rightDisplacedHeadPx;b=Math.min(b,o-l)})),b=Math.min(b,r.getX()-l.getX()),h=a.getVoice().softmax(c)*t,{expectedDistance:h,maxNegativeShiftPx:b,fromTickable:a})}}},c=n-1;c>=0;c--){var b=u(c);if("object"===typeof b)return b.v}return{errorPx:0,fromTickablePx:0,maxNegativeShiftPx:0}}))}function f(t){var e=d/2,n=0,r=0;return o.forEach((function(i,a){var o=s[i];if(a>0){var l=o.getX(),u=t[a],c=u.fromTickable.getX()+u.expectedDistance-(l+n),b=0;c>0?n+=c:c<0&&(b=Math.min(u.maxNegativeShiftPx+r,Math.abs(c))),o.setX(l+n-b),r+=b}o.getCenterAlignedTickables().forEach((function(t){t.center_x_shift=e-o.getX()}))})),b.getX()-c.getX()}var d=e-b.getMetrics().notePx-b.getMetrics().totalRightPx-c.getMetrics().totalLeftPx,p=f(h(d));return p>d&&f(h(d-(p-d))),1===o.length?null:(this.justifyWidth=e,this.evaluate())}},{key:"evaluate",value:function(){var t=this,e=this.justifyWidth;this.contextGaps={total:0,gaps:[]},this.tickContexts.list.forEach((function(e,n){if(0!==n){var r=t.tickContexts.list[n-1],i=t.tickContexts.map[r],a=t.tickContexts.map[e],o=i.getMetrics(),s=a.getMetrics(),l=i.getX()+o.notePx+o.totalRightPx,u=a.getX()-s.totalLeftPx,c=u-l;t.contextGaps.total+=c,t.contextGaps.gaps.push({x1:l,x2:u}),a.getFormatterMetrics().freedom.left=c,i.getFormatterMetrics().freedom.right=c}}));var n=this.durationStats={};this.voices.forEach((function(t){t.getTickables().forEach((function(t,r,i){var a=t.getTicks().clone().simplify().toString(),o=t.getMetrics(),s=t.getFormatterMetrics(),l=t.getX()+o.notePx+o.totalRightPx,u=0;if(r0?e.tickContexts.map[a[i-1]]:null,l=i0?n=-Math.min(o.getFormatterMetrics().freedom.right,Math.abs(u)):u<0&&(n=l?Math.min(l.getFormatterMetrics().freedom.right,Math.abs(u)):0),n*=t.alpha,e.totalShift+=n})),this.iterationsCompleted++,this.evaluate()}},{key:"postFormat",value:function(){var t=function(t){return t.list.forEach((function(e){return t.map[e].postFormat()}))};return t(this.modiferContexts),t(this.tickContexts),this}},{key:"joinVoices",value:function(t){return this.createModifierContexts(t),this.hasMinTotalWidth=!1,this}},{key:"format",value:function(t,e,n){var r=this,i=c({align_rests:!1,context:null,stave:null},n);return this.voices=t,this.options.softmaxFactor&&this.voices.forEach((function(t){return t.setSoftmaxFactor(r.options.softmaxFactor)})),this.alignRests(t,i.align_rests),this.createTickContexts(t),this.preFormat(e,i.context,t,i.stave),i.stave&&this.postFormat(),this}},{key:"formatToStave",value:function(e,n,r){r=c({padding:10},r);var i=n.getNoteEndX()-n.getNoteStartX()-r.padding;return function(){for(var e=arguments.length,n=new Array(e),r=0;r3&&void 0!==arguments[3]?arguments[3]:0;t.setYShift(e.getYForLine(n)-e.getYForGlyphs()+r)}},{key:"getPadding",value:function(t){return void 0!==t&&t<2?0:this.padding}},{key:"setPadding",value:function(t){return this.padding=t,this}},{key:"setLayoutMetrics",value:function(t){return this.layoutMetrics=t,this}},{key:"getLayoutMetrics",value:function(){return this.layoutMetrics}}]),n}(x),Mt=function(t){f(n,t);var e=d(n);function n(t){var r;h(this,n),(r=e.call(this)).setAttribute("type","Barline"),r.thickness=R.STAVE_LINE_THICKNESS;var i=n.type;return r.widths={},r.widths[i.SINGLE]=5,r.widths[i.DOUBLE]=5,r.widths[i.END]=5,r.widths[i.REPEAT_BEGIN]=5,r.widths[i.REPEAT_END]=5,r.widths[i.REPEAT_BOTH]=5,r.widths[i.NONE]=5,r.paddings={},r.paddings[i.SINGLE]=0,r.paddings[i.DOUBLE]=0,r.paddings[i.END]=0,r.paddings[i.REPEAT_BEGIN]=15,r.paddings[i.REPEAT_END]=15,r.paddings[i.REPEAT_BOTH]=15,r.paddings[i.NONE]=0,r.layoutMetricsMap={},r.layoutMetricsMap[i.SINGLE]={xMin:0,xMax:1,paddingLeft:5,paddingRight:5},r.layoutMetricsMap[i.DOUBLE]={xMin:-3,xMax:1,paddingLeft:5,paddingRight:5},r.layoutMetricsMap[i.END]={xMin:-5,xMax:1,paddingLeft:5,paddingRight:5},r.layoutMetricsMap[i.REPEAT_END]={xMin:-10,xMax:1,paddingLeft:5,paddingRight:5},r.layoutMetricsMap[i.REPEAT_BEGIN]={xMin:-2,xMax:10,paddingLeft:5,paddingRight:5},r.layoutMetricsMap[i.REPEAT_BOTH]={xMin:-10,xMax:10,paddingLeft:5,paddingRight:5},r.layoutMetricsMap[i.NONE]={xMin:0,xMax:0,paddingLeft:5,paddingRight:5},r.setPosition(Ft.Position.BEGIN),r.setType(t),r}return b(n,null,[{key:"CATEGORY",get:function(){return"barlines"}},{key:"type",get:function(){return{SINGLE:1,DOUBLE:2,END:3,REPEAT_BEGIN:4,REPEAT_END:5,REPEAT_BOTH:6,NONE:7}}},{key:"typeString",get:function(){return{single:n.type.SINGLE,double:n.type.DOUBLE,end:n.type.END,repeatBegin:n.type.REPEAT_BEGIN,repeatEnd:n.type.REPEAT_END,repeatBoth:n.type.REPEAT_BOTH,none:n.type.NONE}}}]),b(n,[{key:"getCategory",value:function(){return n.CATEGORY}},{key:"getType",value:function(){return this.type}},{key:"setType",value:function(t){return this.type="string"==typeof t?n.typeString[t]:t,this.setWidth(this.widths[this.type]),this.setPadding(this.paddings[this.type]),this.setLayoutMetrics(this.layoutMetricsMap[this.type]),this}},{key:"draw",value:function(t){switch(t.checkContext(),this.setRendered(),this.type){case n.type.SINGLE:this.drawVerticalBar(t,this.x,!1);break;case n.type.DOUBLE:this.drawVerticalBar(t,this.x,!0);break;case n.type.END:this.drawVerticalEndBar(t,this.x);break;case n.type.REPEAT_BEGIN:this.drawRepeatBar(t,this.x,!0),t.getX()!==this.x&&this.drawVerticalBar(t,t.getX());break;case n.type.REPEAT_END:this.drawRepeatBar(t,this.x,!1);break;case n.type.REPEAT_BOTH:this.drawRepeatBar(t,this.x,!1),this.drawRepeatBar(t,this.x,!0)}}},{key:"drawVerticalBar",value:function(t,e,n){t.checkContext();var r=t.getTopLineTopY(),i=t.getBottomLineBottomY();n&&t.context.fillRect(e-3,r,1,i-r),t.context.fillRect(e,r,1,i-r)}},{key:"drawVerticalEndBar",value:function(t,e){t.checkContext();var n=t.getTopLineTopY(),r=t.getBottomLineBottomY();t.context.fillRect(e-5,n,1,r-n),t.context.fillRect(e-2,n,3,r-n)}},{key:"drawRepeatBar",value:function(t,e,n){t.checkContext();var r=t.getTopLineTopY(),i=t.getBottomLineBottomY(),a=3;n||(a=-5),t.context.fillRect(e+a,r,1,i-r),t.context.fillRect(e-2,r,3,i-r),n?a+=4:a-=4;var o=e+a+1,s=(t.getNumLines()-1)*t.getSpacingBetweenLines(),l=r+(s=s/2-t.getSpacingBetweenLines()/2)+1;t.context.beginPath(),t.context.arc(o,l,2,0,2*Math.PI,!1),t.context.fill(),l+=t.getSpacingBetweenLines(),t.context.beginPath(),t.context.arc(o,l,2,0,2*Math.PI,!1),t.context.fill()}}]),n}(Ft),Pt=function(t){f(n,t);var e=d(n);function n(t,r,i){var a;return h(this,n),(a=e.call(this)).setAttribute("type","Repetition"),a.symbol_type=t,a.x=r,a.x_shift=0,a.y_shift=i,a.font={family:"times",size:12,weight:"bold italic"},a}return b(n,null,[{key:"CATEGORY",get:function(){return"repetitions"}},{key:"type",get:function(){return{NONE:1,CODA_LEFT:2,CODA_RIGHT:3,SEGNO_LEFT:4,SEGNO_RIGHT:5,DC:6,DC_AL_CODA:7,DC_AL_FINE:8,DS:9,DS_AL_CODA:10,DS_AL_FINE:11,FINE:12}}}]),b(n,[{key:"getCategory",value:function(){return n.CATEGORY}},{key:"setShiftX",value:function(t){return this.x_shift=t,this}},{key:"setShiftY",value:function(t){return this.y_shift=t,this}},{key:"draw",value:function(t,e){switch(this.setRendered(),this.symbol_type){case n.type.CODA_RIGHT:this.drawCodaFixed(t,e+t.width);break;case n.type.CODA_LEFT:this.drawSymbolText(t,e,"Coda",!0);break;case n.type.SEGNO_LEFT:this.drawSignoFixed(t,e);break;case n.type.SEGNO_RIGHT:this.drawSignoFixed(t,e+t.width);break;case n.type.DC:this.drawSymbolText(t,e,"D.C.",!1);break;case n.type.DC_AL_CODA:this.drawSymbolText(t,e,"D.C. al",!0);break;case n.type.DC_AL_FINE:this.drawSymbolText(t,e,"D.C. al Fine",!1);break;case n.type.DS:this.drawSymbolText(t,e,"D.S.",!1);break;case n.type.DS_AL_CODA:this.drawSymbolText(t,e,"D.S. al",!0);break;case n.type.DS_AL_FINE:this.drawSymbolText(t,e,"D.S. al Fine",!1);break;case n.type.FINE:this.drawSymbolText(t,e,"Fine",!1)}return this}},{key:"drawCodaFixed",value:function(t,e){var n=t.getYForTopText(t.options.num_lines)+this.y_shift;return T.renderGlyph(t.context,this.x+e+this.x_shift,n+25,40,"coda",{category:"coda"}),this}},{key:"drawSignoFixed",value:function(t,e){var n=t.getYForTopText(t.options.num_lines)+this.y_shift;return T.renderGlyph(t.context,this.x+e+this.x_shift,n+25,30,"segno",{category:"segno"}),this}},{key:"drawSymbolText",value:function(t,e,r,i){var a=t.checkContext();a.save(),a.setFont(this.font.family,this.font.size,this.font.weight);var o=0+this.x_shift,s=e+this.x_shift;this.symbol_type===n.type.CODA_LEFT?s=(o=this.x+t.options.vertical_bar_width)+a.measureText(r).width+12:o=(s=this.x+e+t.width-5+this.x_shift)-+a.measureText(r).width-12;var l=t.getYForTopText(t.options.num_lines)+this.y_shift;return i&&T.renderGlyph(a,s,l,40,"coda",{category:"coda"}),a.fillText(r,o,l+5),a.restore(),this}}]),n}(Ft),Ot=function(t){f(n,t);var e=d(n);function n(t,r,i){var a;return h(this,n),(a=e.call(this)).setAttribute("type","StaveSection"),a.setWidth(16),a.section=t,a.x=r,a.shift_x=0,a.shift_y=i,a.font={family:"sans-serif",size:12,weight:"bold"},a}return b(n,null,[{key:"CATEGORY",get:function(){return"stavesection"}}]),b(n,[{key:"getCategory",value:function(){return n.CATEGORY}},{key:"setStaveSection",value:function(t){return this.section=t,this}},{key:"setShiftX",value:function(t){return this.shift_x=t,this}},{key:"setShiftY",value:function(t){return this.shift_y=t,this}},{key:"draw",value:function(t,e){var n=t.checkContext();this.setRendered(),n.save(),n.lineWidth=2,n.setFont(this.font.family,this.font.size,this.font.weight);var r=n.measureText(""+this.section).width,i=r+6;i<18&&(i=18);var a=t.getYForTopText(3)+this.shift_y,o=this.x+e;return n.beginPath(),n.lineWidth=2,n.rect(o,a,i,20),n.stroke(),o+=(i-r)/2,n.fillText(""+this.section,o,a+16),n.restore(),this}}]),n}(Ft),Dt=function(t){f(n,t);var e=d(n);function n(t,r,i){var a;return h(this,n),(a=e.call(this)).setAttribute("type","StaveTempo"),a.tempo=t,a.position=q.Position.ABOVE,a.x=r,a.shift_x=10,a.shift_y=i,a.font={family:"times",size:14,weight:"bold"},a.render_options={glyph_font_scale:30},a}return b(n,null,[{key:"CATEGORY",get:function(){return"stavetempo"}}]),b(n,[{key:"getCategory",value:function(){return n.CATEGORY}},{key:"setTempo",value:function(t){return this.tempo=t,this}},{key:"setShiftX",value:function(t){return this.shift_x=t,this}},{key:"setShiftY",value:function(t){return this.shift_y=t,this}},{key:"draw",value:function(t,e){var n=t.checkContext();this.setRendered();var r=this.render_options,i=r.glyph_font_scale/38,a=this.tempo.name,o=this.tempo.duration,s=this.tempo.dots,l=this.tempo.bpm,u=this.font,c=this.x+this.shift_x+e,b=t.getYForTopText(1)+this.shift_y;if(n.save(),a&&(n.setFont(u.family,u.size,u.weight),n.fillText(a,c,b),c+=n.measureText(a).width),o&&l){n.setFont(u.family,u.size,"normal"),a&&(c+=n.measureText(" ").width,n.fillText("(",c,b),c+=n.measureText("(").width);var h=R.getGlyphProps(o);if(c+=3*i,T.renderGlyph(n,c,b,r.glyph_font_scale,h.code_head),c+=h.getWidth()*i,h.stem){var f=30;h.beam_count&&(f+=3*(h.beam_count-1));var d=b-(f*=i);n.fillRect(c-i,d,i,f),h.flag&&(T.renderGlyph(n,c,d,r.glyph_font_scale,h.code_flag_upstem,{category:"flag.staveTempo"}),s||(c+=6*i))}for(var p=0;p=t.line?o.above:o.below)}this.placeGlyphOnLine(i,this.stave,t.line),this.glyphs.push(i);var s=this.xPositions[this.xPositions.length-1],l=i.getMetrics().width+a;this.xPositions.push(s+l),this.width+=l}},{key:"cancelKey",value:function(t){return this.formatted=!1,this.cancelKeySpec=t,this}},{key:"convertToCancelAccList",value:function(t){var e=R.keySignature(t),n=this.accList.length>0&&e.length>0&&e[0].type!==this.accList[0].type,r=n?e.length:e.length-this.accList.length;if(!(r<1)){for(var i=[],a=0;a2&&void 0!==arguments[2]?arguments[2]:this.accList,a=0;switch(t){case"soprano":"#"===e?n=[2.5,.5,2,0,1.5,-.5,1]:a=-1;break;case"mezzo-soprano":"b"===e?n=[0,2,.5,2.5,1,3,1.5]:a=1.5;break;case"alto":a=.5;break;case"tenor":"#"===e?n=[3,1,2.5,.5,2,0,1.5]:a=-.5;break;case"baritone-f":case"baritone-c":"b"===e?n=[.5,2.5,1,3,1.5,3.5,2]:a=2;break;case"bass":case"french":a=1}if(void 0!==n)for(r=0;r0?e[0].type:null;if(this.cancelKeySpec&&(t=this.convertToCancelAccList(this.cancelKeySpec)),this.alterKeySpec&&this.convertToAlterAccList(this.alterKeySpec),this.accList.length>0){var r=(this.position===Ft.Position.END?this.stave.endClef:this.stave.clef)||this.stave.clef;t&&this.convertAccLines(r,t.type,t.accList),this.convertAccLines(r,n,e);for(var i=0;i0&&void 0!==arguments[0]?arguments[0]:null,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:15,a=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(h(this,n),(t=e.call(this)).setAttribute("type","TimeSignature"),t.validate_args=a,null===r)return l(t);var o=i;t.point=t.musicFont.lookupMetric("digits.point");var s=t.musicFont.lookupMetric("digits.shiftLine",0);return t.topLine=2+s,t.bottomLine=4+s,t.setPosition(Ft.Position.BEGIN),t.setTimeSig(r),t.setWidth(t.timeSig.glyph.getMetrics().width),t.setPadding(o),l(t)}return b(n,null,[{key:"CATEGORY",get:function(){return"timesignatures"}},{key:"glyphs",get:function(){return{C:{code:"timeSigCommon",point:40,line:2},"C|":{code:"timeSigCutCommon",point:40,line:2}}}}]),b(n,[{key:"getCategory",value:function(){return n.CATEGORY}},{key:"parseTimeSpec",value:function(t){if("C"===t||"C|"===t){var e=n.glyphs[t],r=e.line,i=e.code,a=e.point;return{line:r,num:!1,glyph:new T(i,a)}}this.validate_args&&function(t){var e=t.split("/").filter((function(t){return""!==t}));if(2!==e.length)throw new m.RERR("BadTimeSignature","Invalid time spec: ".concat(t,'. Must be in the form "/"'));e.forEach((function(e){if(isNaN(Number(e)))throw new m.RERR("BadTimeSignature","Invalid time spec: ".concat(t,". Must contain two valid numbers."))}))}(t);var o=t.split("/").map((function(t){return t.split("")})),s=u(o,2),l=s[0],c=s[1];return{num:!0,glyph:this.makeTimeSignatureGlyph(l,c)}}},{key:"makeTimeSignatureGlyph",value:function(t,e){var n=new T("timeSig0",this.point);n.topGlyphs=[],n.botGlyphs=[];for(var r=0,i=0;is?r:s,h=n.getMetrics().x_min;n.getMetrics=function(){return{x_min:h,x_max:h+b,width:b}};var f=(b-r)/2,d=(b-s)/2,p=this;return n.renderToStave=function(t){for(var e=t+f,n=0;n0&&void 0!==arguments[0]?arguments[0]:0))throw new m.RERR("InvalidIndex","Must be of number type");if(this.formatted||this.format(),1===this.getModifiers(Ft.Position.BEGIN).length)return 0;var t=this.start_x-this.x,e=this.modifiers[0];return e.getType()===Mt.type.REPEAT_BEGIN&&t>e.getWidth()&&(t-=e.getWidth()),t}},{key:"setRepetitionTypeLeft",value:function(t,e){return this.modifiers.push(new Pt(t,this.x,e)),this}},{key:"setRepetitionTypeRight",value:function(t,e){return this.modifiers.push(new Pt(t,this.x,e)),this}},{key:"setVoltaType",value:function(t,e,n){return this.modifiers.push(new Ut(t,e,this.x,n)),this}},{key:"setSection",value:function(t,e){return this.modifiers.push(new Ot(t,this.x,e)),this}},{key:"setTempo",value:function(t,e){return this.modifiers.push(new Dt(t,this.x,e)),this}},{key:"setText",value:function(t,e,n){return this.modifiers.push(new Nt(t,e,n)),this}},{key:"getHeight",value:function(){return this.height}},{key:"getSpacingBetweenLines",value:function(){return this.options.spacing_between_lines_px}},{key:"getBoundingBox",value:function(){return new w(this.x,this.y,this.width,this.getBottomY()-this.y)}},{key:"getBottomY",value:function(){var t=this.options,e=t.spacing_between_lines_px;return this.getYForLine(t.num_lines)+t.space_below_staff_ln*e}},{key:"getBottomLineY",value:function(){return this.getYForLine(this.options.num_lines)}},{key:"getYForLine",value:function(t){var e=this.options,n=e.spacing_between_lines_px,r=e.space_above_staff_ln;return this.y+t*n+r*n}},{key:"getLineForY",value:function(t){var e=this.options,n=e.spacing_between_lines_px,r=e.space_above_staff_ln;return(t-this.y)/n-r}},{key:"getYForTopText",value:function(t){var e=t||0;return this.getYForLine(-e-this.options.top_text_position)}},{key:"getYForBottomText",value:function(t){var e=t||0;return this.getYForLine(this.options.bottom_text_position+e)}},{key:"getYForNote",value:function(t){var e=this.options,n=e.spacing_between_lines_px,r=e.space_above_staff_ln;return this.y+r*n+5*n-t*n}},{key:"getYForGlyphs",value:function(){return this.getYForLine(3)}},{key:"addModifier",value:function(t,e){return void 0!==e&&t.setPosition(e),t.setStave(this),this.formatted=!1,this.modifiers.push(t),this}},{key:"addEndModifier",value:function(t){return this.addModifier(t,Ft.Position.END),this}},{key:"setBegBarType",value:function(t){var e=Mt.type,n=e.SINGLE,r=e.REPEAT_BEGIN,i=e.NONE;return t!==n&&t!==r&&t!==i||(this.modifiers[0].setType(t),this.formatted=!1),this}},{key:"setEndBarType",value:function(t){return t!==Mt.type.REPEAT_BEGIN&&(this.modifiers[1].setType(t),this.formatted=!1),this}},{key:"setClef",value:function(t,e,n,r){void 0===r&&(r=Ft.Position.BEGIN),r===Ft.Position.END?this.endClef=t:this.clef=t;var i=this.getModifiers(r,Lt.CATEGORY);return 0===i.length?this.addClef(t,e,n,r):i[0].setType(t,e,n),this}},{key:"setEndClef",value:function(t,e,n){return this.setClef(t,e,n,Ft.Position.END),this}},{key:"setKeySignature",value:function(t,e,n){void 0===n&&(n=Ft.Position.BEGIN);var r=this.getModifiers(n,Bt.CATEGORY);return 0===r.length?this.addKeySignature(t,e,n):r[0].setKeySig(t,e),this}},{key:"setEndKeySignature",value:function(t,e){return this.setKeySignature(t,e,Ft.Position.END),this}},{key:"setTimeSignature",value:function(t,e,n){void 0===n&&(n=Ft.Position.BEGIN);var r=this.getModifiers(n,zt.CATEGORY);return 0===r.length?this.addTimeSignature(t,e,n):r[0].setTimeSig(t),this}},{key:"setEndTimeSignature",value:function(t,e){return this.setTimeSignature(t,e,Ft.Position.END),this}},{key:"addKeySignature",value:function(t,e,n){return void 0===n&&(n=Ft.Position.BEGIN),this.addModifier(new Bt(t,e).setPosition(n),n),this}},{key:"addClef",value:function(t,e,n,r){return void 0===r||r===Ft.Position.BEGIN?this.clef=t:r===Ft.Position.END&&(this.endClef=t),this.addModifier(new Lt(t,e,n),r),this}},{key:"addEndClef",value:function(t,e,n){return this.addClef(t,e,n,Ft.Position.END),this}},{key:"addTimeSignature",value:function(t,e,n){return this.addModifier(new zt(t,e),n),this}},{key:"addEndTimeSignature",value:function(t,e){return this.addTimeSignature(t,e,Ft.Position.END),this}},{key:"addTrebleGlyph",value:function(){return this.addClef("treble"),this}},{key:"getModifiers",value:function(t,e){return void 0===t&&void 0===e?this.modifiers:this.modifiers.filter((function(n){return!(void 0!==t&&t!==n.getPosition()||void 0!==e&&e!==n.getCategory())}))}},{key:"sortByCategory",value:function(t,e){for(var n=t.length-1;n>=0;n--)for(var r=0;re[t[r+1].getCategory()]){var i=t[r];t[r]=t[r+1],t[r+1]=i}}},{key:"format",value:function(){var t,e,n,r=this.modifiers[0],i=this.modifiers[1],a=this.getModifiers(Ft.Position.BEGIN),o=this.getModifiers(Ft.Position.END);this.sortByCategory(a,{barlines:0,clefs:1,keysignatures:2,timesignatures:3}),this.sortByCategory(o,{timesignatures:0,keysignatures:1,barlines:2,clefs:3}),a.length>1&&r.getType()===Mt.type.REPEAT_BEGIN&&(a.push(a.splice(0,1)[0]),a.splice(0,0,new Mt(Mt.type.SINGLE))),o.indexOf(i)>0&&o.splice(0,0,new Mt(Mt.type.NONE));for(var s=0,l=this.x,u=0;u0){this.context.save(),this.context.setFont(this.font.family,this.font.size,this.font.weight);var o=this.context.measureText(""+this.measure).width;t=this.getYForTopText(0)+3,this.context.fillText(""+this.measure,this.x-o/2,t),this.context.restore()}return this}},{key:"drawVertical",value:function(t,e){this.drawVerticalFixed(this.x+t,e)}},{key:"drawVerticalFixed",value:function(t,e){this.checkContext();var n=this.getYForLine(0),r=this.getYForLine(this.options.num_lines-1);e&&this.context.fillRect(t-3,n,1,r-n+1),this.context.fillRect(t,n,1,r-n+1)}},{key:"drawVerticalBar",value:function(t){this.drawVerticalBarFixed(this.x+t,!1)}},{key:"drawVerticalBarFixed",value:function(t){this.checkContext();var e=this.getYForLine(0),n=this.getYForLine(this.options.num_lines-1);this.context.fillRect(t,e,1,n-e+1)}},{key:"getConfigForLines",value:function(){return this.options.line_config}},{key:"setConfigForLine",value:function(t,e){if(t>=this.options.num_lines||t<0)throw new m.RERR("StaveConfigError","The line number must be within the range of the number of lines in the Stave.");if(void 0===e.visible)throw new m.RERR("StaveConfigError","The line configuration object is missing the 'visible' property.");if("boolean"!=typeof e.visible)throw new m.RERR("StaveConfigError","The line configuration objects 'visible' property must be true or false.");return this.options.line_config[t]=e,this}},{key:"setConfigForLines",value:function(t){if(t.length!==this.options.num_lines)throw new m.RERR("StaveConfigError","The length of the lines configuration array must match the number of lines in the Stave");for(var e in t)t[e]||(t[e]=this.options.line_config[e]),m.Merge(this.options.line_config[e],t[e]);return this.options.line_config=t,this}}]),n}(x),Ht=function(t){f(n,t);var e=d(n);function n(t,r,i,a){var o;h(this,n);var s={spacing_between_lines_px:13,num_lines:6,top_text_position:1};return m.Merge(s,a),(o=e.call(this,t,r,i,s)).setAttribute("type","TabStave"),o}return b(n,[{key:"getYForGlyphs",value:function(){return this.getYForLine(2.5)}},{key:"addTabGlyph",value:function(){return this.addClef("tab"),this}}]),n}(jt),Wt=function(t){f(n,t);var e=d(n);function n(t,r){var i;if(h(this,n),(i=e.call(this,t)).setAttribute("type","TabNote"),i.ghost=!1,i.positions=t.positions,m.Merge(i.render_options,{glyph_font_scale:R.DEFAULT_TABLATURE_FONT_SCALE,draw_stem:r,draw_dots:r,draw_stem_through_stave:!1,y_shift:0,scale:1,font:"10pt Arial"}),i.glyph=R.getGlyphProps(i.duration,i.noteType),!i.glyph)throw new m.RuntimeError("BadArguments","Invalid note initialization data (No glyph found): "+JSON.stringify(t));return i.buildStem(),t.stem_direction?i.setStemDirection(t.stem_direction):i.setStemDirection(L.UP),i.ghost=!1,i.updateWidth(),l(i)}return b(n,null,[{key:"CATEGORY",get:function(){return"tabnotes"}}]),b(n,[{key:"reset",value:function(){this.stave&&this.setStave(this.stave)}},{key:"getCategory",value:function(){return n.CATEGORY}},{key:"setGhost",value:function(t){return this.ghost=t,this.updateWidth(),this}},{key:"hasStem",value:function(){return this.render_options.draw_stem}},{key:"getStemExtension",value:function(){var t=this.getGlyph();return null!=this.stem_extension_override?this.stem_extension_override:t?1===this.getStemDirection()?t.tabnote_stem_up_extension:t.tabnote_stem_down_extension:0}},{key:"addDot",value:function(){var t=new J;return this.dots+=1,this.addModifier(t,0)}},{key:"updateWidth",value:function(){var t=this;this.glyphs=[],this.width=0;for(var e=0;e-1,c=e.indexOf(1)>-1;if(!(i&&c||a&&u)){1===e.length&&e.push(e[0]);var b=[];e.forEach((function(e,i,a){var l=1===e,u=e===s,c=n.getYForLine(e-1);0!==i||l?i!==a.length-1||u||(c+=o/2-1):c-=o/2-1,b.push(c),1===r&&l?b.push(t-2):-1===r&&u&&b.push(t+2)})),l.push(b.sort((function(t,e){return t-e})))}})),l}(e,function(t,e){for(var n=[],r=[],i=1;i<=t;i++)e.indexOf(i)>-1?(n.push(r),r=[]):r.push(i);return r.length>0&&n.push(r),n}(this.stave.getNumLines(),this.positions.map((function(t){return t.str}))),this.getStave(),this.getStemDirection());n.save(),n.setLineWidth(L.WIDTH),i.forEach((function(e){0!==e.length&&(n.beginPath(),n.moveTo(t,e[0]),n.lineTo(t,e[e.length-1]),n.stroke(),n.closePath())})),n.restore()}}},{key:"drawPositions",value:function(){for(var t=this.context,e=this.getAbsoluteX(),n=this.ys,r=0;rparseInt(o,10)?n.SLIDE_DOWN:n.SLIDE_UP}return i.slide_direction=r,i.render_options.cp1=11,i.render_options.cp2=14,i.render_options.y_shift=.5,i.setFont({font:"Times",size:10,style:"bold italic"}),i.setNotes(t),l(i)}return b(n,null,[{key:"createSlideUp",value:function(t){return new n(t,n.SLIDE_UP)}},{key:"createSlideDown",value:function(t){return new n(t,n.SLIDE_DOWN)}},{key:"SLIDE_UP",get:function(){return 1}},{key:"SLIDE_DOWN",get:function(){return-1}}]),b(n,[{key:"renderTie",value:function(t){if(0===t.first_ys.length||0===t.last_ys.length)throw new m.RERR("BadArguments","No Y-values to render");var e=this.context,r=t.first_x_px,i=t.first_ys,a=t.last_x_px,o=this.slide_direction;if(o!==n.SLIDE_UP&&o!==n.SLIDE_DOWN)throw new m.RERR("BadSlide","Invalid slide direction");for(var s=0;s0&&void 0!==arguments[0]?arguments[0]:"E/5,B/4,G/4,D/4,A/3,E/3,B/2,E/2";h(this,t),this.setTuning(e)}return b(t,null,[{key:"names",get:function(){return{standard:"E/5,B/4,G/4,D/4,A/3,E/3",dagdad:"D/5,A/4,G/4,D/4,A/3,D/3",dropd:"E/5,B/4,G/4,D/4,A/3,D/3",eb:"Eb/5,Bb/4,Gb/4,Db/4,Ab/3,Db/3",standardBanjo:"D/5,B/4,G/4,D/4,G/5"}}}]),b(t,[{key:"noteToInteger",value:function(t){return R.keyProperties(t).int_value}},{key:"setTuning",value:function(e){t.names[e]&&(e=t.names[e]),this.tuningString=e,this.tuningValues=[],this.numStrings=0;var n=e.split(/\s*,\s*/);if(0===n.length)throw new m.RERR("BadArguments","Invalid tuning string: "+e);this.numStrings=n.length;for(var r=0;rthis.numStrings)throw new m.RERR("BadArguments","String number must be between 1 and ".concat(this.numStrings,":").concat(t));return this.tuningValues[e-1]}},{key:"getValueForFret",value:function(t,e){var n=this.getValueForString(e),r=parseInt(t,10);if(r<0)throw new m.RERR("BadArguments","Fret number must be 0 or higher: "+t);return n+r}},{key:"getNoteForFret",value:function(t,e){var n=this.getValueForFret(t,e),r=Math.floor(n/12),i=n%12;return R.integerToNote(i)+"/"+r}}]),t}(),Zt=function(t){f(n,t);var e=d(n);function n(t,r){var i;return h(this,n),(i=e.call(this)).setAttribute("type","StaveHairpin"),i.notes=t,i.hairpin=r,i.position=q.Position.BELOW,i.render_options={height:10,y_shift:0,left_shift_px:0,right_shift_px:0},i.setNotes(t),i}return b(n,null,[{key:"FormatByTicksAndDraw",value:function(t,e,r,i,a,o){var s=e.pixelsPerTick;if(null==s)throw new m.RuntimeError("BadArguments","A valid Formatter must be provide to draw offsets by ticks.");var l=s*o.left_shift_ticks,u=s*o.right_shift_ticks,c={height:o.height,y_shift:o.y_shift,left_shift_px:l,right_shift_px:u};new n({first_note:r.first_note,last_note:r.last_note},i).setContext(t).setRenderOptions(c).setPosition(a).draw()}},{key:"type",get:function(){return{CRESC:1,DECRESC:2}}}]),b(n,[{key:"setPosition",value:function(t){return t!==q.Position.ABOVE&&t!==q.Position.BELOW||(this.position=t),this}},{key:"setRenderOptions",value:function(t){return null!=t.height&&null!=t.y_shift&&null!=t.left_shift_px&&null!=t.right_shift_px&&(this.render_options=t),this}},{key:"setNotes",value:function(t){if(!t.first_note&&!t.last_note)throw new m.RuntimeError("BadArguments","Hairpin needs to have either first_note or last_note set.");return this.first_note=t.first_note,this.last_note=t.last_note,this}},{key:"renderHairpin",value:function(t){var e=this.checkContext(),r=this.render_options.y_shift+20,i=t.first_y;this.position===q.Position.ABOVE&&(r=30-r,i=t.first_y-t.staff_height);var a=this.render_options.left_shift_px,o=this.render_options.right_shift_px;switch(e.beginPath(),this.hairpin){case n.type.CRESC:e.moveTo(t.last_x+o,i+r),e.lineTo(t.first_x+a,i+this.render_options.height/2+r),e.lineTo(t.last_x+o,i+this.render_options.height+r);break;case n.type.DECRESC:e.moveTo(t.first_x+a,i+r),e.lineTo(t.last_x+o,i+this.render_options.height/2+r),e.lineTo(t.first_x+a,i+this.render_options.height+r)}e.stroke(),e.closePath()}},{key:"draw",value:function(){this.checkContext(),this.setRendered();var t=this.first_note,e=this.last_note,n=t.getModifierStartXY(this.position,0),r=e.getModifierStartXY(this.position,0);return this.renderHairpin({first_x:n.x,last_x:r.x,first_y:t.getStave().y+t.getStave().height,last_y:e.getStave().y+e.getStave().height,staff_height:t.getStave().height}),!0}}]),n}(x),te=function(t){f(n,t);var e=d(n);function n(t,r,i){var a;return h(this,n),(a=e.call(this)).setAttribute("type","Curve"),a.render_options={spacing:2,thickness:2,x_shift:0,y_shift:10,position:n.Position.NEAR_HEAD,position_end:n.Position.NEAR_HEAD,invert:!1,cps:[{x:0,y:10},{x:0,y:10}]},m.Merge(a.render_options,i),a.setNotes(t,r),a}return b(n,null,[{key:"Position",get:function(){return{NEAR_HEAD:1,NEAR_TOP:2}}},{key:"PositionString",get:function(){return{nearHead:n.Position.NEAR_HEAD,nearTop:n.Position.NEAR_TOP}}}]),b(n,[{key:"setNotes",value:function(t,e){if(!t&&!e)throw new m.RuntimeError("BadArguments","Curve needs to have either first_note or last_note set.");return this.from=t,this.to=e,this}},{key:"isPartial",value:function(){return!this.from||!this.to}},{key:"renderCurve",value:function(t){var e=this.context,n=this.render_options.cps,r=this.render_options.x_shift,i=this.render_options.y_shift*t.direction,a=t.first_x+r,o=t.first_y+i,s=t.last_x-r,l=t.last_y+i,u=this.render_options.thickness,c=(s-a)/(n.length+2);e.beginPath(),e.moveTo(a,o),e.bezierCurveTo(a+c+n[0].x,o+n[0].y*t.direction,s-c+n[1].x,l+n[1].y*t.direction,s,l),e.bezierCurveTo(s-c+n[1].x,l+(n[1].y+u)*t.direction,a+c+n[0].x,o+(n[0].y+u)*t.direction,a,o),e.stroke(),e.closePath(),e.fill()}},{key:"draw",value:function(){this.checkContext(),this.setRendered();var t,e,r,i,a,o=this.from,s=this.to,l="baseY",u="baseY";function c(t){return"string"==typeof t?n.PositionString[t]:t}var b=c(this.render_options.position),h=c(this.render_options.position_end);return b===n.Position.NEAR_TOP&&(l="topY",u="topY"),h===n.Position.NEAR_HEAD?u="baseY":h===n.Position.NEAR_TOP&&(u="topY"),o?(t=o.getTieRightX(),a=o.getStemDirection(),r=o.getStemExtents()[l]):(t=s.getStave().getTieStartX(),r=s.getStemExtents()[l]),s?(e=s.getTieLeftX(),a=s.getStemDirection(),i=s.getStemExtents()[u]):(e=o.getStave().getTieEndX(),i=o.getStemExtents()[u]),this.renderCurve({first_x:t,last_x:e,first_y:r,last_y:i,direction:a*(!0===this.render_options.invert?-1:1)}),!0}}]),n}(x);function ee(){for(var t=arguments.length,e=new Array(t),n=0;ni.y;r.x+=a.getMetrics().modRightPx+s.padding_left,i.x-=o.getMetrics().modLeftPx+s.padding_right;var b=a.getGlyph().getWidth();a.getKeyProps()[n].displaced&&1===a.getStemDirection()&&(r.x+=b+s.padding_left),o.getKeyProps()[u].displaced&&-1===o.getStemDirection()&&(i.x-=b+s.padding_right),r.y+=c?-3:1,i.y+=c?2:0,function(t,e,n,r){var i,a,o,s,l=r.draw_start_arrow&&r.draw_end_arrow,u=e.x,c=e.y,b=n.x,h=n.y,f=Math.sqrt((b-u)*(b-u)+(h-c)*(h-c)),d=(f-r.arrowhead_length/3)/f;r.draw_end_arrow||l?(i=Math.round(u+(b-u)*d),a=Math.round(c+(h-c)*d)):(i=b,a=h),r.draw_start_arrow||l?(o=u+(b-u)*(1-d),s=c+(h-c)*(1-d)):(o=u,s=c),r.color&&(t.setStrokeStyle(r.color),t.setFillStyle(r.color)),t.beginPath(),t.moveTo(o,s),t.lineTo(i,a),t.stroke(),t.closePath();var p,m,v,y,g=Math.atan2(h-c,b-u),_=Math.abs(r.arrowhead_length/Math.cos(r.arrowhead_angle));(r.draw_end_arrow||l)&&(p=g+Math.PI+r.arrowhead_angle,v=b+Math.cos(p)*_,y=h+Math.sin(p)*_,m=g+Math.PI-r.arrowhead_angle,re(t,v,y,b,h,b+Math.cos(m)*_,h+Math.sin(m)*_)),(r.draw_start_arrow||l)&&(p=g+r.arrowhead_angle,v=u+Math.cos(p)*_,y=c+Math.sin(p)*_,m=g-r.arrowhead_angle,re(t,v,y,u,c,u+Math.cos(m)*_,c+Math.sin(m)*_))}(e,r,i,t.render_options)})),e.restore();var l,u=e.measureText(this.text).width,c=s.text_justification,b=0;c===n.TextJustification.LEFT?b=r.x:c===n.TextJustification.CENTER?b=(i.x-r.x)/2+r.x-u/2:c===n.TextJustification.RIGHT&&(b=i.x-u);var h=s.text_position_vertical;return h===n.TextVerticalPosition.TOP?l=a.getStave().getYForTopText():h===n.TextVerticalPosition.BOTTOM&&(l=a.getStave().getYForBottomText(R.TEXT_HEIGHT_OFFSET_HACK)),e.save(),this.applyFontStyle(),e.fillText(this.text,b,l),e.restore(),this}}]),n}(x);function ae(t,e,n,r,i){var a=oe.GLYPHS[t];new T(a.code,i,{category:"pedalMarking"}).render(e,n+a.x_shift,r+a.y_shift)}var oe=function(t){f(n,t);var e=d(n);function n(t){var r;return h(this,n),(r=e.call(this)).setAttribute("type","PedalMarking"),r.notes=t,r.style=n.TEXT,r.line=0,r.custom_depress_text="",r.custom_release_text="",r.font={family:"Times New Roman",size:12,weight:"italic bold"},r.render_options={bracket_height:10,text_margin_right:6,bracket_line_width:1,color:"black"},r}return b(n,null,[{key:"createSustain",value:function(t){return new n(t)}},{key:"createSostenuto",value:function(t){var e=new n(t);return e.setStyle(n.Styles.MIXED),e.setCustomText("Sost. Ped."),e}},{key:"createUnaCorda",value:function(t){var e=new n(t);return e.setStyle(n.Styles.TEXT),e.setCustomText("una corda","tre corda"),e}},{key:"GLYPHS",get:function(){return{pedal_depress:{code:"keyboardPedalPed",x_shift:-10,y_shift:0},pedal_release:{code:"keyboardPedalUp",x_shift:-2,y_shift:3}}}},{key:"Styles",get:function(){return{TEXT:1,BRACKET:2,MIXED:3}}},{key:"StylesString",get:function(){return{text:n.Styles.TEXT,bracket:n.Styles.BRACKET,mixed:n.Styles.MIXED}}}]),b(n,[{key:"setCustomText",value:function(t,e){return this.custom_depress_text=t||"",this.custom_release_text=e||"",this}},{key:"setStyle",value:function(t){if(t<1&&t>3)throw new m.RERR("InvalidParameter","The style must be one found in PedalMarking.Styles");return this.style=t,this}},{key:"setLine",value:function(t){return this.line=t,this}},{key:"drawBracketed",value:function(){var t,e,r=this,i=this.context,a=!1,o=this;this.notes.forEach((function(s,l,u){a=!a;var c=s.getAbsoluteX(),b=s.getStave().getYForBottomText(o.line+3);if(c0&&void 0!==arguments[0]?arguments[0]:Mt.type.SINGLE;h(this,n),(i=e.call(this,{duration:"b"})).setAttribute("type","BarNote"),i.metrics={widths:{}};var o=Mt.type;return i.metrics.widths=(r(t={},o.SINGLE,8),r(t,o.DOUBLE,12),r(t,o.END,15),r(t,o.REPEAT_BEGIN,14),r(t,o.REPEAT_END,14),r(t,o.REPEAT_BOTH,18),r(t,o.NONE,0),t),i.ignore_ticks=!0,i.setType(a),i}return b(n,[{key:"getType",value:function(){return this.type}},{key:"setType",value:function(t){return this.type="string"==typeof t?Mt.typeString[t]:t,this.setWidth(this.metrics.widths[this.type]),this}},{key:"getBoundingBox",value:function(){return i(a(n.prototype),"getBoundingBox",this).call(this)}},{key:"addToModifierContext",value:function(){return this}},{key:"preFormat",value:function(){return this.setPreFormatted(!0),this}},{key:"draw",value:function(){if(this.checkContext(),!this.stave)throw new m.RERR("NoStave","Can't draw without a stave.");!function(){for(var t=arguments.length,e=new Array(t),r=0;r1&&void 0!==arguments[1]&&arguments[1]?new RegExp("^(("+t+"))"):new RegExp("^(("+t+")\\s*)"),n=this.line.slice(this.pos).match(e);return null!==n?{success:!0,matchedString:n[2],incrementPos:n[1].length,pos:this.pos}:{success:!1,pos:this.pos}}},{key:"expectOne",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=[],r=this.pos,i=!0,a=!1;e=!0===e||!0===t.maybe;for(var o=0;o1&&void 0!==arguments[1]&&arguments[1],n=[],r=this.pos,i=0,a=!0;do{var o=this.expectOne(t);o.success?(i++,n.push(o.results)):a=!1}while(a);var s=i>0||!0===e;return!e||i>0||(this.pos=r),s?this.matchSuccess():this.matchFail(r),{success:s,results:n,numMatches:i}}},{key:"expectZeroOrMore",value:function(t){return this.expectOneOrMore(t,!0)}},{key:"expect",value:function(e){var n;if(function(){for(var e=arguments.length,n=new Array(e),r=0;r0&&void 0!==arguments[0]?arguments[0]:{};this.options={stem:"auto",clef:"treble"},this.elements={notes:[],accidentals:[]},this.rollingDuration="8",this.resetPiece(),Object.assign(this.options,t)}},{key:"getFactory",value:function(){return this.factory}},{key:"getElements",value:function(){return this.elements}},{key:"addCommitHook",value:function(t){this.commitHooks.push(t)}},{key:"resetPiece",value:function(){ve("resetPiece"),this.piece={chord:[],duration:this.rollingDuration,dots:0,type:void 0,options:{}}}},{key:"setNoteDots",value:function(t){ve("setNoteDots:",t),t&&(this.piece.dots=t.length)}},{key:"setNoteDuration",value:function(t){ve("setNoteDuration:",t),this.rollingDuration=this.piece.duration=t||this.rollingDuration}},{key:"setNoteType",value:function(t){ve("setNoteType:",t),t&&(this.piece.type=t)}},{key:"addNoteOption",value:function(t,e){ve("addNoteOption: key:",t,"value:",e),this.piece.options[t]=e}},{key:"addNote",value:function(t,e,n){ve("addNote:",t,e,n),this.piece.chord.push({key:t,accid:e,octave:n})}},{key:"addSingleNote",value:function(t,e,n){ve("addSingleNote:",t,e,n),this.addNote(t,e,n)}},{key:"addChord",value:function(t){var e=this;ve("startChord"),"object"!=typeof t[0]?this.addSingleNote(t[0]):t.forEach((function(t){t&&e.addNote.apply(e,o(t))})),ve("endChord")}},{key:"commitPiece",value:function(){var t=this;ve("commitPiece");var e=this.factory;if(e){var n=c(c({},this.options),this.piece.options),r=n.stem,i=n.clef,a="auto"===r.toLowerCase(),o=a||"up"!==r.toLowerCase()?Z.STEM_DOWN:Z.STEM_UP,s=this.piece,l=s.chord,u=s.duration,b=s.dots,h=s.type,f=l.map((function(t){return t.key+"/"+t.octave})),d=e.StaveNote({keys:f,duration:u,dots:b,type:h,clef:i,auto_stem:a});a||d.setStemDirection(o);var p=l.map((function(t){return t.accid||null}));p.forEach((function(t,n){t&&d.addAccidental(n,e.Accidental({type:t}))}));for(var m=0;m0&&void 0!==arguments[0]?arguments[0]:{};h(this,t),this.setOptions(e),this.defaults={clef:"treble",time:"4/4",stem:"auto"}}return b(t,[{key:"set",value:function(t){return Object.assign(this.defaults,t),this}},{key:"setOptions",value:function(t){var e=this;return this.options=c({factory:null,builder:null,commitHooks:[xe,ke,yt.easyScoreHook],throwOnError:!1},t),this.factory=this.options.factory,this.builder=this.options.builder||new _e(this.factory),this.grammar=new ge(this.builder),this.parser=new me(this.grammar),this.options.commitHooks.forEach((function(t){return e.addCommitHook(t)})),this}},{key:"setContext",value:function(t){return this.factory&&this.factory.setContext(t),this}},{key:"parse",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.builder.reset(e);var n=this.parser.parse(t);if(!n.success&&this.options.throwOnError)throw new ye("Error parsing line: "+t,n);return n}},{key:"beam",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.factory.Beam({notes:t,options:e}),t}},{key:"tuplet",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.factory.Tuplet({notes:t,options:e}),t}},{key:"notes",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e=c({clef:this.defaults.clef,stem:this.defaults.stem},e),this.parse(t,e),this.builder.getElements().notes}},{key:"voice",value:function(t,e){return e=c({time:this.defaults.time},e),this.factory.Voice(e).addTickables(t)}},{key:"addCommitHook",value:function(t){return this.builder.addCommitHook(t)}}]),t}(),Se=m.MakeException("FactoryError");function Te(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1?arguments[1]:void 0,n=e.options;return(t=Object.assign(e,t)).options=Object.assign(n,t.options),t}var Ee=function(){function t(e){h(this,t),function(){for(var e=arguments.length,n=new Array(e),r=0;r0&&void 0!==arguments[0]?arguments[0]:{};t.factory=this;var e=new Ce(t).setContext(this.context);return this.systems.push(e),e}},{key:"EasyScore",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.factory=this,new we(t)}},{key:"PedalMarking",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};t=Te(t,{notes:[],options:{style:"mixed"}});var e=new oe(t.notes);return e.setStyle(oe.StylesString[t.options.style]),e.setContext(this.context),this.renderQ.push(e),e}},{key:"NoteSubGroup",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};t=Te(t,{notes:[],options:{}});var e=new at(t.notes);return e.setContext(this.context),e}},{key:"draw",value:function(){var t=this;this.systems.forEach((function(e){return e.setContext(t.context).format()})),this.staves.forEach((function(e){return e.setContext(t.context).draw()})),this.voices.forEach((function(e){return e.setContext(t.context).draw()})),this.renderQ.forEach((function(e){e.isRendered()||e.setContext(t.context).draw()})),this.systems.forEach((function(e){return e.setContext(t.context).draw()})),this.reset()}}],[{key:"newFromElementId",value:function(e){return new t({renderer:{elementId:e,width:arguments.length>1&&void 0!==arguments[1]?arguments[1]:500,height:arguments.length>2&&void 0!==arguments[2]?arguments[2]:200}})}}]),t}(),Ce=function(t){f(n,t);var e=d(n);function n(){var t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return h(this,n),(t=e.call(this)).setAttribute("type","System"),t.setOptions(r),t.parts=[],t}return b(n,[{key:"setOptions",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.options=c(c({x:10,y:10,width:500,connector:null,spaceBetweenStaves:12,factory:null,noJustification:!1,debugFormatter:!1,formatIterations:0,noPadding:!1},t),{},{details:c({alpha:.5},t.details)}),this.factory=this.options.factory||new Ee({renderer:{el:null}})}},{key:"setContext",value:function(t){return i(a(n.prototype),"setContext",this).call(this,t),this.factory.setContext(t),this}},{key:"addConnector",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"double";return this.connector=this.factory.StaveConnector({top_stave:this.parts[0].stave,bottom_stave:this.parts[this.parts.length-1].stave,type:t}),this.connector}},{key:"addStave",value:function(t){var e=this;return(t=c(c({stave:null,voices:[],spaceAbove:0,spaceBelow:0,debugNoteMetrics:!1},t),{},{options:c({left_bar:!1},t.options)})).stave||(t.stave=this.factory.Stave({x:this.options.x,y:this.options.y,width:this.options.width,options:t.options})),t.voices.forEach((function(n){return n.setContext(e.context).setStave(t.stave).getTickables().forEach((function(e){return e.setStave(t.stave)}))})),this.parts.push(t),t.stave}},{key:"format",value:function(){var t=this,e=new Rt(c({},this.options.details));this.formatter=e;var n=this.options.y,r=0,i=[],a=[];this.parts.forEach((function(o){n+=o.stave.space(o.spaceAbove),o.stave.setY(n),e.joinVoices(o.voices),n+=o.stave.space(o.spaceBelow),n+=o.stave.space(t.options.spaceBetweenStaves),o.debugNoteMetrics&&(a.push({y:n,voice:o.voices[0]}),n+=15),i=i.concat(o.voices),r=Math.max(r,o.stave.getNoteStartX())})),this.parts.forEach((function(t){return t.stave.setNoteStartX(r)}));var o=this.options.noPadding?this.options.width-this.options.x:this.options.width-(r-this.options.x)-this.musicFont.lookupMetric("stave.padding");e.format(i,this.options.noJustification?0:o);for(var s=0;s"']/g,B=RegExp(N.source),z=RegExp(L.source),U=/<%-([\s\S]+?)%>/g,j=/<%([\s\S]+?)%>/g,H=/<%=([\s\S]+?)%>/g,W=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Y=/^\w*$/,G=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,V=/[\\^$.*+?()[\]{}|]/g,X=RegExp(V.source),K=/^\s+|\s+$/g,$=/^\s+/,q=/\s+$/,J=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Q=/\{\n\/\* \[wrapped with (.+)\] \*/,Z=/,? & /,tt=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,et=/\\(\\)?/g,nt=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,rt=/\w*$/,it=/^[-+]0x[0-9a-f]+$/i,at=/^0b[01]+$/i,ot=/^\[object .+?Constructor\]$/,st=/^0o[0-7]+$/i,lt=/^(?:0|[1-9]\d*)$/,ut=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ct=/($^)/,bt=/['\n\r\u2028\u2029\\]/g,ht="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",ft="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",dt="[\\ud800-\\udfff]",pt="["+ft+"]",mt="["+ht+"]",vt="\\d+",yt="[\\u2700-\\u27bf]",gt="[a-z\\xdf-\\xf6\\xf8-\\xff]",_t="[^\\ud800-\\udfff"+ft+vt+"\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde]",xt="\\ud83c[\\udffb-\\udfff]",kt="[^\\ud800-\\udfff]",wt="(?:\\ud83c[\\udde6-\\uddff]){2}",St="[\\ud800-\\udbff][\\udc00-\\udfff]",Tt="[A-Z\\xc0-\\xd6\\xd8-\\xde]",Et="(?:"+gt+"|"+_t+")",Ct="(?:"+Tt+"|"+_t+")",At="(?:"+mt+"|"+xt+")?",Rt="[\\ufe0e\\ufe0f]?"+At+"(?:\\u200d(?:"+[kt,wt,St].join("|")+")[\\ufe0e\\ufe0f]?"+At+")*",Ft="(?:"+[yt,wt,St].join("|")+")"+Rt,Mt="(?:"+[kt+mt+"?",mt,wt,St,dt].join("|")+")",Pt=RegExp("['\u2019]","g"),Ot=RegExp(mt,"g"),Dt=RegExp(xt+"(?="+xt+")|"+Mt+Rt,"g"),It=RegExp([Tt+"?"+gt+"+(?:['\u2019](?:d|ll|m|re|s|t|ve))?(?="+[pt,Tt,"$"].join("|")+")",Ct+"+(?:['\u2019](?:D|LL|M|RE|S|T|VE))?(?="+[pt,Tt+Et,"$"].join("|")+")",Tt+"?"+Et+"+(?:['\u2019](?:d|ll|m|re|s|t|ve))?",Tt+"+(?:['\u2019](?:D|LL|M|RE|S|T|VE))?","\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",vt,Ft].join("|"),"g"),Nt=RegExp("[\\u200d\\ud800-\\udfff"+ht+"\\ufe0e\\ufe0f]"),Lt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Bt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],zt=-1,Ut={};Ut[T]=Ut[E]=Ut[C]=Ut[A]=Ut[R]=Ut[F]=Ut["[object Uint8ClampedArray]"]=Ut[M]=Ut[P]=!0,Ut[l]=Ut[u]=Ut[w]=Ut[c]=Ut[S]=Ut[b]=Ut[h]=Ut[f]=Ut[p]=Ut[m]=Ut[v]=Ut[y]=Ut[g]=Ut[_]=Ut[k]=!1;var jt={};jt[l]=jt[u]=jt[w]=jt[S]=jt[c]=jt[b]=jt[T]=jt[E]=jt[C]=jt[A]=jt[R]=jt[p]=jt[m]=jt[v]=jt[y]=jt[g]=jt[_]=jt[x]=jt[F]=jt["[object Uint8ClampedArray]"]=jt[M]=jt[P]=!0,jt[h]=jt[f]=jt[k]=!1;var Ht={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Wt=parseFloat,Yt=parseInt,Gt="object"==typeof t&&t&&t.Object===Object&&t,Vt="object"==typeof self&&self&&self.Object===Object&&self,Xt=Gt||Vt||Function("return this")(),Kt=e&&!e.nodeType&&e,$t=Kt&&"object"==typeof r&&r&&!r.nodeType&&r,qt=$t&&$t.exports===Kt,Jt=qt&&Gt.process,Qt=function(){try{return $t&&$t.require&&$t.require("util").types||Jt&&Jt.binding&&Jt.binding("util")}catch(t){}}(),Zt=Qt&&Qt.isArrayBuffer,te=Qt&&Qt.isDate,ee=Qt&&Qt.isMap,ne=Qt&&Qt.isRegExp,re=Qt&&Qt.isSet,ie=Qt&&Qt.isTypedArray;function ae(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}function oe(t,e,n,r){for(var i=-1,a=null==t?0:t.length;++i-1}function he(t,e,n){for(var r=-1,i=null==t?0:t.length;++r-1;);return n}function De(t,e){for(var n=t.length;n--&&xe(e,t[n],0)>-1;);return n}function Ie(t,e){for(var n=t.length,r=0;n--;)t[n]===e&&++r;return r}var Ne=Ee({"\xc0":"A","\xc1":"A","\xc2":"A","\xc3":"A","\xc4":"A","\xc5":"A","\xe0":"a","\xe1":"a","\xe2":"a","\xe3":"a","\xe4":"a","\xe5":"a","\xc7":"C","\xe7":"c","\xd0":"D","\xf0":"d","\xc8":"E","\xc9":"E","\xca":"E","\xcb":"E","\xe8":"e","\xe9":"e","\xea":"e","\xeb":"e","\xcc":"I","\xcd":"I","\xce":"I","\xcf":"I","\xec":"i","\xed":"i","\xee":"i","\xef":"i","\xd1":"N","\xf1":"n","\xd2":"O","\xd3":"O","\xd4":"O","\xd5":"O","\xd6":"O","\xd8":"O","\xf2":"o","\xf3":"o","\xf4":"o","\xf5":"o","\xf6":"o","\xf8":"o","\xd9":"U","\xda":"U","\xdb":"U","\xdc":"U","\xf9":"u","\xfa":"u","\xfb":"u","\xfc":"u","\xdd":"Y","\xfd":"y","\xff":"y","\xc6":"Ae","\xe6":"ae","\xde":"Th","\xfe":"th","\xdf":"ss","\u0100":"A","\u0102":"A","\u0104":"A","\u0101":"a","\u0103":"a","\u0105":"a","\u0106":"C","\u0108":"C","\u010a":"C","\u010c":"C","\u0107":"c","\u0109":"c","\u010b":"c","\u010d":"c","\u010e":"D","\u0110":"D","\u010f":"d","\u0111":"d","\u0112":"E","\u0114":"E","\u0116":"E","\u0118":"E","\u011a":"E","\u0113":"e","\u0115":"e","\u0117":"e","\u0119":"e","\u011b":"e","\u011c":"G","\u011e":"G","\u0120":"G","\u0122":"G","\u011d":"g","\u011f":"g","\u0121":"g","\u0123":"g","\u0124":"H","\u0126":"H","\u0125":"h","\u0127":"h","\u0128":"I","\u012a":"I","\u012c":"I","\u012e":"I","\u0130":"I","\u0129":"i","\u012b":"i","\u012d":"i","\u012f":"i","\u0131":"i","\u0134":"J","\u0135":"j","\u0136":"K","\u0137":"k","\u0138":"k","\u0139":"L","\u013b":"L","\u013d":"L","\u013f":"L","\u0141":"L","\u013a":"l","\u013c":"l","\u013e":"l","\u0140":"l","\u0142":"l","\u0143":"N","\u0145":"N","\u0147":"N","\u014a":"N","\u0144":"n","\u0146":"n","\u0148":"n","\u014b":"n","\u014c":"O","\u014e":"O","\u0150":"O","\u014d":"o","\u014f":"o","\u0151":"o","\u0154":"R","\u0156":"R","\u0158":"R","\u0155":"r","\u0157":"r","\u0159":"r","\u015a":"S","\u015c":"S","\u015e":"S","\u0160":"S","\u015b":"s","\u015d":"s","\u015f":"s","\u0161":"s","\u0162":"T","\u0164":"T","\u0166":"T","\u0163":"t","\u0165":"t","\u0167":"t","\u0168":"U","\u016a":"U","\u016c":"U","\u016e":"U","\u0170":"U","\u0172":"U","\u0169":"u","\u016b":"u","\u016d":"u","\u016f":"u","\u0171":"u","\u0173":"u","\u0174":"W","\u0175":"w","\u0176":"Y","\u0177":"y","\u0178":"Y","\u0179":"Z","\u017b":"Z","\u017d":"Z","\u017a":"z","\u017c":"z","\u017e":"z","\u0132":"IJ","\u0133":"ij","\u0152":"Oe","\u0153":"oe","\u0149":"'n","\u017f":"s"}),Le=Ee({"&":"&","<":"<",">":">",'"':""","'":"'"});function Be(t){return"\\"+Ht[t]}function ze(t){return Nt.test(t)}function Ue(t){var e=-1,n=Array(t.size);return t.forEach((function(t,r){n[++e]=[r,t]})),n}function je(t,e){return function(n){return t(e(n))}}function He(t,e){for(var n=-1,r=t.length,i=0,a=[];++n",""":'"',"'":"'"}),Ke=function t(e){var n,r=(e=null==e?Xt:Ke.defaults(Xt.Object(),e,Ke.pick(Xt,Bt))).Array,i=e.Date,ht=e.Error,ft=e.Function,dt=e.Math,pt=e.Object,mt=e.RegExp,vt=e.String,yt=e.TypeError,gt=r.prototype,_t=ft.prototype,xt=pt.prototype,kt=e["__core-js_shared__"],wt=_t.toString,St=xt.hasOwnProperty,Tt=0,Et=(n=/[^.]+$/.exec(kt&&kt.keys&&kt.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Ct=xt.toString,At=wt.call(pt),Rt=Xt._,Ft=mt("^"+wt.call(St).replace(V,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Mt=qt?e.Buffer:void 0,Dt=e.Symbol,Nt=e.Uint8Array,Ht=Mt?Mt.allocUnsafe:void 0,Gt=je(pt.getPrototypeOf,pt),Vt=pt.create,Kt=xt.propertyIsEnumerable,$t=gt.splice,Jt=Dt?Dt.isConcatSpreadable:void 0,Qt=Dt?Dt.iterator:void 0,ye=Dt?Dt.toStringTag:void 0,Ee=function(){try{var t=Zi(pt,"defineProperty");return t({},"",{}),t}catch(t){}}(),$e=e.clearTimeout!==Xt.clearTimeout&&e.clearTimeout,qe=i&&i.now!==Xt.Date.now&&i.now,Je=e.setTimeout!==Xt.setTimeout&&e.setTimeout,Qe=dt.ceil,Ze=dt.floor,tn=pt.getOwnPropertySymbols,en=Mt?Mt.isBuffer:void 0,nn=e.isFinite,rn=gt.join,an=je(pt.keys,pt),on=dt.max,sn=dt.min,ln=i.now,un=e.parseInt,cn=dt.random,bn=gt.reverse,hn=Zi(e,"DataView"),fn=Zi(e,"Map"),dn=Zi(e,"Promise"),pn=Zi(e,"Set"),mn=Zi(e,"WeakMap"),vn=Zi(pt,"create"),yn=mn&&new mn,gn={},_n=Ea(hn),xn=Ea(fn),kn=Ea(dn),wn=Ea(pn),Sn=Ea(mn),Tn=Dt?Dt.prototype:void 0,En=Tn?Tn.valueOf:void 0,Cn=Tn?Tn.toString:void 0;function An(t){if(Yo(t)&&!Oo(t)&&!(t instanceof Pn)){if(t instanceof Mn)return t;if(St.call(t,"__wrapped__"))return Ca(t)}return new Mn(t)}var Rn=function(){function t(){}return function(e){if(!Wo(e))return{};if(Vt)return Vt(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}();function Fn(){}function Mn(t,e){this.__wrapped__=t,this.__actions__=[],this.__chain__=!!e,this.__index__=0,this.__values__=void 0}function Pn(t){this.__wrapped__=t,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=4294967295,this.__views__=[]}function On(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e=e?t:e)),t}function qn(t,e,n,r,i,a){var o,s=1&e,u=2&e,h=4&e;if(n&&(o=i?n(t,r,i,a):n(t)),void 0!==o)return o;if(!Wo(t))return t;var k=Oo(t);if(k){if(o=function(t){var e=t.length,n=new t.constructor(e);return e&&"string"==typeof t[0]&&St.call(t,"index")&&(n.index=t.index,n.input=t.input),n}(t),!s)return vi(t,o)}else{var O=na(t),D=O==f||O==d;if(Lo(t))return bi(t,s);if(O==v||O==l||D&&!i){if(o=u||D?{}:ia(t),!s)return u?function(t,e){return yi(t,ea(t),e)}(t,function(t,e){return t&&yi(e,xs(e),t)}(o,t)):function(t,e){return yi(t,ta(t),e)}(t,Vn(o,t))}else{if(!jt[O])return i?t:{};o=function(t,e,n){var r,i=t.constructor;switch(e){case w:return hi(t);case c:case b:return new i(+t);case S:return function(t,e){var n=e?hi(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}(t,n);case T:case E:case C:case A:case R:case F:case"[object Uint8ClampedArray]":case M:case P:return fi(t,n);case p:return new i;case m:case _:return new i(t);case y:return function(t){var e=new t.constructor(t.source,rt.exec(t));return e.lastIndex=t.lastIndex,e}(t);case g:return new i;case x:return r=t,En?pt(En.call(r)):{}}}(t,O,s)}}a||(a=new Ln);var I=a.get(t);if(I)return I;a.set(t,o),$o(t)?t.forEach((function(r){o.add(qn(r,e,n,r,t,a))})):Go(t)&&t.forEach((function(r,i){o.set(i,qn(r,e,n,i,t,a))}));var N=k?void 0:(h?u?Vi:Gi:u?xs:_s)(t);return se(N||t,(function(r,i){N&&(r=t[i=r]),Wn(o,i,qn(r,e,n,i,t,a))})),o}function Jn(t,e,n){var r=n.length;if(null==t)return!r;for(t=pt(t);r--;){var i=n[r],a=e[i],o=t[i];if(void 0===o&&!(i in t)||!a(o))return!1}return!0}function Qn(t,e,n){if("function"!=typeof t)throw new yt(a);return ga((function(){t.apply(void 0,n)}),e)}function Zn(t,e,n,r){var i=-1,a=be,o=!0,s=t.length,l=[],u=e.length;if(!s)return l;n&&(e=fe(e,Fe(n))),r?(a=he,o=!1):e.length>=200&&(a=Pe,o=!1,e=new Nn(e));t:for(;++i-1},Dn.prototype.set=function(t,e){var n=this.__data__,r=Yn(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this},In.prototype.clear=function(){this.size=0,this.__data__={hash:new On,map:new(fn||Dn),string:new On}},In.prototype.delete=function(t){var e=Ji(this,t).delete(t);return this.size-=e?1:0,e},In.prototype.get=function(t){return Ji(this,t).get(t)},In.prototype.has=function(t){return Ji(this,t).has(t)},In.prototype.set=function(t,e){var n=Ji(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this},Nn.prototype.add=Nn.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},Nn.prototype.has=function(t){return this.__data__.has(t)},Ln.prototype.clear=function(){this.__data__=new Dn,this.size=0},Ln.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},Ln.prototype.get=function(t){return this.__data__.get(t)},Ln.prototype.has=function(t){return this.__data__.has(t)},Ln.prototype.set=function(t,e){var n=this.__data__;if(n instanceof Dn){var r=n.__data__;if(!fn||r.length<199)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new In(r)}return n.set(t,e),this.size=n.size,this};var tr=xi(lr),er=xi(ur,!0);function nr(t,e){var n=!0;return tr(t,(function(t,r,i){return n=!!e(t,r,i)})),n}function rr(t,e,n){for(var r=-1,i=t.length;++r0&&n(s)?e>1?ar(s,e-1,n,r,i):de(i,s):r||(i[i.length]=s)}return i}var or=ki(),sr=ki(!0);function lr(t,e){return t&&or(t,e,_s)}function ur(t,e){return t&&sr(t,e,_s)}function cr(t,e){return ce(e,(function(e){return Uo(t[e])}))}function br(t,e){for(var n=0,r=(e=si(e,t)).length;null!=t&&ne}function pr(t,e){return null!=t&&St.call(t,e)}function mr(t,e){return null!=t&&e in pt(t)}function vr(t,e,n){for(var i=n?he:be,a=t[0].length,o=t.length,s=o,l=r(o),u=1/0,c=[];s--;){var b=t[s];s&&e&&(b=fe(b,Fe(e))),u=sn(b.length,u),l[s]=!n&&(e||a>=120&&b.length>=120)?new Nn(s&&b):void 0}b=t[0];var h=-1,f=l[0];t:for(;++h=s?l:l*("desc"==n[r]?-1:1)}return t.index-e.index}(t,e,n)}))}function Or(t,e,n){for(var r=-1,i=e.length,a={};++r-1;)s!==t&&$t.call(s,l,1),$t.call(t,l,1);return t}function Ir(t,e){for(var n=t?e.length:0,r=n-1;n--;){var i=e[n];if(n==r||i!==a){var a=i;oa(i)?$t.call(t,i,1):Zr(t,i)}}return t}function Nr(t,e){return t+Ze(cn()*(e-t+1))}function Lr(t,e){var n="";if(!t||e<1||e>9007199254740991)return n;do{e%2&&(n+=t),(e=Ze(e/2))&&(t+=t)}while(e);return n}function Br(t,e){return _a(da(t,e,Vs),t+"")}function zr(t){return zn(Rs(t))}function Ur(t,e){var n=Rs(t);return wa(n,$n(e,0,n.length))}function jr(t,e,n,r){if(!Wo(t))return t;for(var i=-1,a=(e=si(e,t)).length,o=a-1,s=t;null!=s&&++ia?0:a+e),(n=n>a?a:n)<0&&(n+=a),a=e>n?0:n-e>>>0,e>>>=0;for(var o=r(a);++i>>1,o=t[a];null!==o&&!Jo(o)&&(n?o<=e:o=200){var u=e?null:Li(t);if(u)return We(u);o=!1,i=Pe,l=new Nn}else l=e?[]:s;t:for(;++r=r?t:Gr(t,e,n)}var ci=$e||function(t){return Xt.clearTimeout(t)};function bi(t,e){if(e)return t.slice();var n=t.length,r=Ht?Ht(n):new t.constructor(n);return t.copy(r),r}function hi(t){var e=new t.constructor(t.byteLength);return new Nt(e).set(new Nt(t)),e}function fi(t,e){var n=e?hi(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}function di(t,e){if(t!==e){var n=void 0!==t,r=null===t,i=t==t,a=Jo(t),o=void 0!==e,s=null===e,l=e==e,u=Jo(e);if(!s&&!u&&!a&&t>e||a&&o&&l&&!s&&!u||r&&o&&l||!n&&l||!i)return 1;if(!r&&!a&&!u&&t1?n[i-1]:void 0,o=i>2?n[2]:void 0;for(a=t.length>3&&"function"==typeof a?(i--,a):void 0,o&&sa(n[0],n[1],o)&&(a=i<3?void 0:a,i=1),e=pt(e);++r-1?i[a?e[o]:o]:void 0}}function Ci(t){return Yi((function(e){var n=e.length,r=n,i=Mn.prototype.thru;for(t&&e.reverse();r--;){var o=e[r];if("function"!=typeof o)throw new yt(a);if(i&&!s&&"wrapper"==Ki(o))var s=new Mn([],!0)}for(r=s?r:n;++r1&&g.reverse(),b&&us))return!1;var u=a.get(t);if(u&&a.get(e))return u==e;var c=-1,b=!0,h=2&n?new Nn:void 0;for(a.set(t,e),a.set(e,t);++c-1&&t%1==0&&t1?"& ":"")+e[r],e=e.join(n>2?", ":" "),t.replace(J,"{\n/* [wrapped with "+e+"] */\n")}(r,function(t,e){return se(s,(function(n){var r="_."+n[0];e&n[1]&&!be(t,r)&&t.push(r)})),t.sort()}(function(t){var e=t.match(Q);return e?e[1].split(Z):[]}(r),n)))}function ka(t){var e=0,n=0;return function(){var r=ln(),i=16-(r-n);if(n=r,i>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}function wa(t,e){var n=-1,r=t.length,i=r-1;for(e=void 0===e?r:e;++n1?t[e-1]:void 0;return n="function"==typeof n?(t.pop(),n):void 0,Xa(t,n)}));function to(t){var e=An(t);return e.__chain__=!0,e}function eo(t,e){return e(t)}var no=Yi((function(t){var e=t.length,n=e?t[0]:0,r=this.__wrapped__,i=function(e){return Kn(e,t)};return!(e>1||this.__actions__.length)&&r instanceof Pn&&oa(n)?((r=r.slice(n,+n+(e?1:0))).__actions__.push({func:eo,args:[i],thisArg:void 0}),new Mn(r,this.__chain__).thru((function(t){return e&&!t.length&&t.push(void 0),t}))):this.thru(i)})),ro=gi((function(t,e,n){St.call(t,n)?++t[n]:Xn(t,n,1)})),io=Ei(Ma),ao=Ei(Pa);function oo(t,e){return(Oo(t)?se:tr)(t,qi(e,3))}function so(t,e){return(Oo(t)?le:er)(t,qi(e,3))}var lo=gi((function(t,e,n){St.call(t,n)?t[n].push(e):Xn(t,n,[e])})),uo=Br((function(t,e,n){var i=-1,a="function"==typeof e,o=Io(t)?r(t.length):[];return tr(t,(function(t){o[++i]=a?ae(e,t,n):yr(t,e,n)})),o})),co=gi((function(t,e,n){Xn(t,n,e)}));function bo(t,e){return(Oo(t)?fe:Cr)(t,qi(e,3))}var ho=gi((function(t,e,n){t[n?0:1].push(e)}),(function(){return[[],[]]})),fo=Br((function(t,e){if(null==t)return[];var n=e.length;return n>1&&sa(t,e[0],e[1])?e=[]:n>2&&sa(e[0],e[1],e[2])&&(e=[e[0]]),Pr(t,ar(e,1),[])})),po=qe||function(){return Xt.Date.now()};function mo(t,e,n){return e=n?void 0:e,zi(t,128,void 0,void 0,void 0,void 0,e=t&&null==e?t.length:e)}function vo(t,e){var n;if("function"!=typeof e)throw new yt(a);return t=rs(t),function(){return--t>0&&(n=e.apply(this,arguments)),t<=1&&(e=void 0),n}}var yo=Br((function(t,e,n){var r=1;if(n.length){var i=He(n,$i(yo));r|=32}return zi(t,r,e,n,i)})),go=Br((function(t,e,n){var r=3;if(n.length){var i=He(n,$i(go));r|=32}return zi(e,r,t,n,i)}));function _o(t,e,n){var r,i,o,s,l,u,c=0,b=!1,h=!1,f=!0;if("function"!=typeof t)throw new yt(a);function d(e){var n=r,a=i;return r=i=void 0,c=e,s=t.apply(a,n)}function p(t){return c=t,l=ga(v,e),b?d(t):s}function m(t){var n=t-u;return void 0===u||n>=e||n<0||h&&t-c>=o}function v(){var t=po();if(m(t))return y(t);l=ga(v,function(t){var n=e-(t-u);return h?sn(n,o-(t-c)):n}(t))}function y(t){return l=void 0,f&&r?d(t):(r=i=void 0,s)}function g(){var t=po(),n=m(t);if(r=arguments,i=this,u=t,n){if(void 0===l)return p(u);if(h)return ci(l),l=ga(v,e),d(u)}return void 0===l&&(l=ga(v,e)),s}return e=as(e)||0,Wo(n)&&(b=!!n.leading,o=(h="maxWait"in n)?on(as(n.maxWait)||0,e):o,f="trailing"in n?!!n.trailing:f),g.cancel=function(){void 0!==l&&ci(l),c=0,r=u=i=l=void 0},g.flush=function(){return void 0===l?s:y(po())},g}var xo=Br((function(t,e){return Qn(t,1,e)})),ko=Br((function(t,e,n){return Qn(t,as(e)||0,n)}));function wo(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new yt(a);var n=function n(){var r=arguments,i=e?e.apply(this,r):r[0],a=n.cache;if(a.has(i))return a.get(i);var o=t.apply(this,r);return n.cache=a.set(i,o)||a,o};return n.cache=new(wo.Cache||In),n}function So(t){if("function"!=typeof t)throw new yt(a);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}wo.Cache=In;var To=li((function(t,e){var n=(e=1==e.length&&Oo(e[0])?fe(e[0],Fe(qi())):fe(ar(e,1),Fe(qi()))).length;return Br((function(r){for(var i=-1,a=sn(r.length,n);++i=e})),Po=gr(function(){return arguments}())?gr:function(t){return Yo(t)&&St.call(t,"callee")&&!Kt.call(t,"callee")},Oo=r.isArray,Do=Zt?Fe(Zt):function(t){return Yo(t)&&fr(t)==w};function Io(t){return null!=t&&Ho(t.length)&&!Uo(t)}function No(t){return Yo(t)&&Io(t)}var Lo=en||al,Bo=te?Fe(te):function(t){return Yo(t)&&fr(t)==b};function zo(t){if(!Yo(t))return!1;var e=fr(t);return e==h||"[object DOMException]"==e||"string"==typeof t.message&&"string"==typeof t.name&&!Xo(t)}function Uo(t){if(!Wo(t))return!1;var e=fr(t);return e==f||e==d||"[object AsyncFunction]"==e||"[object Proxy]"==e}function jo(t){return"number"==typeof t&&t==rs(t)}function Ho(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}function Wo(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function Yo(t){return null!=t&&"object"==typeof t}var Go=ee?Fe(ee):function(t){return Yo(t)&&na(t)==p};function Vo(t){return"number"==typeof t||Yo(t)&&fr(t)==m}function Xo(t){if(!Yo(t)||fr(t)!=v)return!1;var e=Gt(t);if(null===e)return!0;var n=St.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&wt.call(n)==At}var Ko=ne?Fe(ne):function(t){return Yo(t)&&fr(t)==y},$o=re?Fe(re):function(t){return Yo(t)&&na(t)==g};function qo(t){return"string"==typeof t||!Oo(t)&&Yo(t)&&fr(t)==_}function Jo(t){return"symbol"==typeof t||Yo(t)&&fr(t)==x}var Qo=ie?Fe(ie):function(t){return Yo(t)&&Ho(t.length)&&!!Ut[fr(t)]},Zo=Di(Er),ts=Di((function(t,e){return t<=e}));function es(t){if(!t)return[];if(Io(t))return qo(t)?Ve(t):vi(t);if(Qt&&t[Qt])return function(t){for(var e,n=[];!(e=t.next()).done;)n.push(e.value);return n}(t[Qt]());var e=na(t);return(e==p?Ue:e==g?We:Rs)(t)}function ns(t){return t?(t=as(t))===1/0||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}function rs(t){var e=ns(t),n=e%1;return e==e?n?e-n:e:0}function is(t){return t?$n(rs(t),0,4294967295):0}function as(t){if("number"==typeof t)return t;if(Jo(t))return NaN;if(Wo(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=Wo(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(K,"");var n=at.test(t);return n||st.test(t)?Yt(t.slice(2),n?2:8):it.test(t)?NaN:+t}function os(t){return yi(t,xs(t))}function ss(t){return null==t?"":Jr(t)}var ls=_i((function(t,e){if(ba(e)||Io(e))yi(e,_s(e),t);else for(var n in e)St.call(e,n)&&Wn(t,n,e[n])})),us=_i((function(t,e){yi(e,xs(e),t)})),cs=_i((function(t,e,n,r){yi(e,xs(e),t,r)})),bs=_i((function(t,e,n,r){yi(e,_s(e),t,r)})),hs=Yi(Kn),fs=Br((function(t,e){t=pt(t);var n=-1,r=e.length,i=r>2?e[2]:void 0;for(i&&sa(e[0],e[1],i)&&(r=1);++n1),e})),yi(t,Vi(t),n),r&&(n=qn(n,7,Hi));for(var i=e.length;i--;)Zr(n,e[i]);return n})),Ts=Yi((function(t,e){return null==t?{}:function(t,e){return Or(t,e,(function(e,n){return ms(t,n)}))}(t,e)}));function Es(t,e){if(null==t)return{};var n=fe(Vi(t),(function(t){return[t]}));return e=qi(e),Or(t,n,(function(t,n){return e(t,n[0])}))}var Cs=Bi(_s),As=Bi(xs);function Rs(t){return null==t?[]:Me(t,_s(t))}var Fs=Si((function(t,e,n){return e=e.toLowerCase(),t+(n?Ms(e):e)}));function Ms(t){return zs(ss(t).toLowerCase())}function Ps(t){return(t=ss(t))&&t.replace(ut,Ne).replace(Ot,"")}var Os=Si((function(t,e,n){return t+(n?"-":"")+e.toLowerCase()})),Ds=Si((function(t,e,n){return t+(n?" ":"")+e.toLowerCase()})),Is=wi("toLowerCase"),Ns=Si((function(t,e,n){return t+(n?"_":"")+e.toLowerCase()})),Ls=Si((function(t,e,n){return t+(n?" ":"")+zs(e)})),Bs=Si((function(t,e,n){return t+(n?" ":"")+e.toUpperCase()})),zs=wi("toUpperCase");function Us(t,e,n){return t=ss(t),void 0===(e=n?void 0:e)?function(t){return Lt.test(t)}(t)?function(t){return t.match(It)||[]}(t):function(t){return t.match(tt)||[]}(t):t.match(e)||[]}var js=Br((function(t,e){try{return ae(t,void 0,e)}catch(t){return zo(t)?t:new ht(t)}})),Hs=Yi((function(t,e){return se(e,(function(e){e=Ta(e),Xn(t,e,yo(t[e],t))})),t}));function Ws(t){return function(){return t}}var Ys=Ci(),Gs=Ci(!0);function Vs(t){return t}function Xs(t){return wr("function"==typeof t?t:qn(t,1))}var Ks=Br((function(t,e){return function(n){return yr(n,t,e)}})),$s=Br((function(t,e){return function(n){return yr(t,n,e)}}));function qs(t,e,n){var r=_s(e),i=cr(e,r);null!=n||Wo(e)&&(i.length||!r.length)||(n=e,e=t,t=this,i=cr(e,_s(e)));var a=!(Wo(n)&&"chain"in n&&!n.chain),o=Uo(t);return se(i,(function(n){var r=e[n];t[n]=r,o&&(t.prototype[n]=function(){var e=this.__chain__;if(a||e){var n=t(this.__wrapped__);return(n.__actions__=vi(this.__actions__)).push({func:r,args:arguments,thisArg:t}),n.__chain__=e,n}return r.apply(t,de([this.value()],arguments))})})),t}function Js(){}var Qs=Mi(fe),Zs=Mi(ue),tl=Mi(ve);function el(t){return la(t)?Te(Ta(t)):function(t){return function(e){return br(e,t)}}(t)}var nl=Oi(),rl=Oi(!0);function il(){return[]}function al(){return!1}var ol,sl=Fi((function(t,e){return t+e}),0),ll=Ni("ceil"),ul=Fi((function(t,e){return t/e}),1),cl=Ni("floor"),bl=Fi((function(t,e){return t*e}),1),hl=Ni("round"),fl=Fi((function(t,e){return t-e}),0);return An.after=function(t,e){if("function"!=typeof e)throw new yt(a);return t=rs(t),function(){if(--t<1)return e.apply(this,arguments)}},An.ary=mo,An.assign=ls,An.assignIn=us,An.assignInWith=cs,An.assignWith=bs,An.at=hs,An.before=vo,An.bind=yo,An.bindAll=Hs,An.bindKey=go,An.castArray=function(){if(!arguments.length)return[];var t=arguments[0];return Oo(t)?t:[t]},An.chain=to,An.chunk=function(t,e,n){e=(n?sa(t,e,n):void 0===e)?1:on(rs(e),0);var i=null==t?0:t.length;if(!i||e<1)return[];for(var a=0,o=0,s=r(Qe(i/e));ai?0:i+n),(r=void 0===r||r>i?i:rs(r))<0&&(r+=i),r=n>r?0:is(r);n>>0)?(t=ss(t))&&("string"==typeof e||null!=e&&!Ko(e))&&!(e=Jr(e))&&ze(t)?ui(Ve(t),0,n):t.split(e,n):[]},An.spread=function(t,e){if("function"!=typeof t)throw new yt(a);return e=null==e?0:on(rs(e),0),Br((function(n){var r=n[e],i=ui(n,0,e);return r&&de(i,r),ae(t,this,i)}))},An.tail=function(t){var e=null==t?0:t.length;return e?Gr(t,1,e):[]},An.take=function(t,e,n){return t&&t.length?Gr(t,0,(e=n||void 0===e?1:rs(e))<0?0:e):[]},An.takeRight=function(t,e,n){var r=null==t?0:t.length;return r?Gr(t,(e=r-(e=n||void 0===e?1:rs(e)))<0?0:e,r):[]},An.takeRightWhile=function(t,e){return t&&t.length?ei(t,qi(e,3),!1,!0):[]},An.takeWhile=function(t,e){return t&&t.length?ei(t,qi(e,3)):[]},An.tap=function(t,e){return e(t),t},An.throttle=function(t,e,n){var r=!0,i=!0;if("function"!=typeof t)throw new yt(a);return Wo(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),_o(t,e,{leading:r,maxWait:e,trailing:i})},An.thru=eo,An.toArray=es,An.toPairs=Cs,An.toPairsIn=As,An.toPath=function(t){return Oo(t)?fe(t,Ta):Jo(t)?[t]:vi(Sa(ss(t)))},An.toPlainObject=os,An.transform=function(t,e,n){var r=Oo(t),i=r||Lo(t)||Qo(t);if(e=qi(e,4),null==n){var a=t&&t.constructor;n=i?r?new a:[]:Wo(t)&&Uo(a)?Rn(Gt(t)):{}}return(i?se:lr)(t,(function(t,r,i){return e(n,t,r,i)})),n},An.unary=function(t){return mo(t,1)},An.union=Wa,An.unionBy=Ya,An.unionWith=Ga,An.uniq=function(t){return t&&t.length?Qr(t):[]},An.uniqBy=function(t,e){return t&&t.length?Qr(t,qi(e,2)):[]},An.uniqWith=function(t,e){return e="function"==typeof e?e:void 0,t&&t.length?Qr(t,void 0,e):[]},An.unset=function(t,e){return null==t||Zr(t,e)},An.unzip=Va,An.unzipWith=Xa,An.update=function(t,e,n){return null==t?t:ti(t,e,oi(n))},An.updateWith=function(t,e,n,r){return r="function"==typeof r?r:void 0,null==t?t:ti(t,e,oi(n),r)},An.values=Rs,An.valuesIn=function(t){return null==t?[]:Me(t,xs(t))},An.without=Ka,An.words=Us,An.wrap=function(t,e){return Eo(oi(e),t)},An.xor=$a,An.xorBy=qa,An.xorWith=Ja,An.zip=Qa,An.zipObject=function(t,e){return ii(t||[],e||[],Wn)},An.zipObjectDeep=function(t,e){return ii(t||[],e||[],jr)},An.zipWith=Za,An.entries=Cs,An.entriesIn=As,An.extend=us,An.extendWith=cs,qs(An,An),An.add=sl,An.attempt=js,An.camelCase=Fs,An.capitalize=Ms,An.ceil=ll,An.clamp=function(t,e,n){return void 0===n&&(n=e,e=void 0),void 0!==n&&(n=(n=as(n))==n?n:0),void 0!==e&&(e=(e=as(e))==e?e:0),$n(as(t),e,n)},An.clone=function(t){return qn(t,4)},An.cloneDeep=function(t){return qn(t,5)},An.cloneDeepWith=function(t,e){return qn(t,5,e="function"==typeof e?e:void 0)},An.cloneWith=function(t,e){return qn(t,4,e="function"==typeof e?e:void 0)},An.conformsTo=function(t,e){return null==e||Jn(t,e,_s(e))},An.deburr=Ps,An.defaultTo=function(t,e){return null==t||t!=t?e:t},An.divide=ul,An.endsWith=function(t,e,n){t=ss(t),e=Jr(e);var r=t.length,i=n=void 0===n?r:$n(rs(n),0,r);return(n-=e.length)>=0&&t.slice(n,i)==e},An.eq=Ro,An.escape=function(t){return(t=ss(t))&&z.test(t)?t.replace(L,Le):t},An.escapeRegExp=function(t){return(t=ss(t))&&X.test(t)?t.replace(V,"\\$&"):t},An.every=function(t,e,n){var r=Oo(t)?ue:nr;return n&&sa(t,e,n)&&(e=void 0),r(t,qi(e,3))},An.find=io,An.findIndex=Ma,An.findKey=function(t,e){return ge(t,qi(e,3),lr)},An.findLast=ao,An.findLastIndex=Pa,An.findLastKey=function(t,e){return ge(t,qi(e,3),ur)},An.floor=cl,An.forEach=oo,An.forEachRight=so,An.forIn=function(t,e){return null==t?t:or(t,qi(e,3),xs)},An.forInRight=function(t,e){return null==t?t:sr(t,qi(e,3),xs)},An.forOwn=function(t,e){return t&&lr(t,qi(e,3))},An.forOwnRight=function(t,e){return t&&ur(t,qi(e,3))},An.get=ps,An.gt=Fo,An.gte=Mo,An.has=function(t,e){return null!=t&&ra(t,e,pr)},An.hasIn=ms,An.head=Da,An.identity=Vs,An.includes=function(t,e,n,r){t=Io(t)?t:Rs(t),n=n&&!r?rs(n):0;var i=t.length;return n<0&&(n=on(i+n,0)),qo(t)?n<=i&&t.indexOf(e,n)>-1:!!i&&xe(t,e,n)>-1},An.indexOf=function(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var i=null==n?0:rs(n);return i<0&&(i=on(r+i,0)),xe(t,e,i)},An.inRange=function(t,e,n){return e=ns(e),void 0===n?(n=e,e=0):n=ns(n),function(t,e,n){return t>=sn(e,n)&&t=-9007199254740991&&t<=9007199254740991},An.isSet=$o,An.isString=qo,An.isSymbol=Jo,An.isTypedArray=Qo,An.isUndefined=function(t){return void 0===t},An.isWeakMap=function(t){return Yo(t)&&na(t)==k},An.isWeakSet=function(t){return Yo(t)&&"[object WeakSet]"==fr(t)},An.join=function(t,e){return null==t?"":rn.call(t,e)},An.kebabCase=Os,An.last=Ba,An.lastIndexOf=function(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var i=r;return void 0!==n&&(i=(i=rs(n))<0?on(r+i,0):sn(i,r-1)),e==e?function(t,e,n){for(var r=n+1;r--;)if(t[r]===e)return r;return r}(t,e,i):_e(t,we,i,!0)},An.lowerCase=Ds,An.lowerFirst=Is,An.lt=Zo,An.lte=ts,An.max=function(t){return t&&t.length?rr(t,Vs,dr):void 0},An.maxBy=function(t,e){return t&&t.length?rr(t,qi(e,2),dr):void 0},An.mean=function(t){return Se(t,Vs)},An.meanBy=function(t,e){return Se(t,qi(e,2))},An.min=function(t){return t&&t.length?rr(t,Vs,Er):void 0},An.minBy=function(t,e){return t&&t.length?rr(t,qi(e,2),Er):void 0},An.stubArray=il,An.stubFalse=al,An.stubObject=function(){return{}},An.stubString=function(){return""},An.stubTrue=function(){return!0},An.multiply=bl,An.nth=function(t,e){return t&&t.length?Mr(t,rs(e)):void 0},An.noConflict=function(){return Xt._===this&&(Xt._=Rt),this},An.noop=Js,An.now=po,An.pad=function(t,e,n){t=ss(t);var r=(e=rs(e))?Ge(t):0;if(!e||r>=e)return t;var i=(e-r)/2;return Pi(Ze(i),n)+t+Pi(Qe(i),n)},An.padEnd=function(t,e,n){t=ss(t);var r=(e=rs(e))?Ge(t):0;return e&&re){var r=t;t=e,e=r}if(n||t%1||e%1){var i=cn();return sn(t+i*(e-t+Wt("1e-"+((i+"").length-1))),e)}return Nr(t,e)},An.reduce=function(t,e,n){var r=Oo(t)?pe:Ce,i=arguments.length<3;return r(t,qi(e,4),n,i,tr)},An.reduceRight=function(t,e,n){var r=Oo(t)?me:Ce,i=arguments.length<3;return r(t,qi(e,4),n,i,er)},An.repeat=function(t,e,n){return e=(n?sa(t,e,n):void 0===e)?1:rs(e),Lr(ss(t),e)},An.replace=function(){var t=arguments,e=ss(t[0]);return t.length<3?e:e.replace(t[1],t[2])},An.result=function(t,e,n){var r=-1,i=(e=si(e,t)).length;for(i||(i=1,t=void 0);++r9007199254740991)return[];var n=4294967295,r=sn(t,4294967295);t-=4294967295;for(var i=Re(r,e=qi(e));++n=a)return t;var s=n-Ge(r);if(s<1)return r;var l=o?ui(o,0,s).join(""):t.slice(0,s);if(void 0===i)return l+r;if(o&&(s+=l.length-s),Ko(i)){if(t.slice(s).search(i)){var u,c=l;for(i.global||(i=mt(i.source,ss(rt.exec(i))+"g")),i.lastIndex=0;u=i.exec(c);)var b=u.index;l=l.slice(0,void 0===b?s:b)}}else if(t.indexOf(Jr(i),s)!=s){var h=l.lastIndexOf(i);h>-1&&(l=l.slice(0,h))}return l+r},An.unescape=function(t){return(t=ss(t))&&B.test(t)?t.replace(N,Xe):t},An.uniqueId=function(t){var e=++Tt;return ss(t)+e},An.upperCase=Bs,An.upperFirst=zs,An.each=oo,An.eachRight=so,An.first=Da,qs(An,(ol={},lr(An,(function(t,e){St.call(An.prototype,e)||(ol[e]=t)})),ol),{chain:!1}),An.VERSION="4.17.15",se(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(t){An[t].placeholder=An})),se(["drop","take"],(function(t,e){Pn.prototype[t]=function(n){n=void 0===n?1:on(rs(n),0);var r=this.__filtered__&&!e?new Pn(this):this.clone();return r.__filtered__?r.__takeCount__=sn(n,r.__takeCount__):r.__views__.push({size:sn(n,4294967295),type:t+(r.__dir__<0?"Right":"")}),r},Pn.prototype[t+"Right"]=function(e){return this.reverse()[t](e).reverse()}})),se(["filter","map","takeWhile"],(function(t,e){var n=e+1,r=1==n||3==n;Pn.prototype[t]=function(t){var e=this.clone();return e.__iteratees__.push({iteratee:qi(t,3),type:n}),e.__filtered__=e.__filtered__||r,e}})),se(["head","last"],(function(t,e){var n="take"+(e?"Right":"");Pn.prototype[t]=function(){return this[n](1).value()[0]}})),se(["initial","tail"],(function(t,e){var n="drop"+(e?"":"Right");Pn.prototype[t]=function(){return this.__filtered__?new Pn(this):this[n](1)}})),Pn.prototype.compact=function(){return this.filter(Vs)},Pn.prototype.find=function(t){return this.filter(t).head()},Pn.prototype.findLast=function(t){return this.reverse().find(t)},Pn.prototype.invokeMap=Br((function(t,e){return"function"==typeof t?new Pn(this):this.map((function(n){return yr(n,t,e)}))})),Pn.prototype.reject=function(t){return this.filter(So(qi(t)))},Pn.prototype.slice=function(t,e){t=rs(t);var n=this;return n.__filtered__&&(t>0||e<0)?new Pn(n):(t<0?n=n.takeRight(-t):t&&(n=n.drop(t)),void 0!==e&&(n=(e=rs(e))<0?n.dropRight(-e):n.take(e-t)),n)},Pn.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},Pn.prototype.toArray=function(){return this.take(4294967295)},lr(Pn.prototype,(function(t,e){var n=/^(?:filter|find|map|reject)|While$/.test(e),r=/^(?:head|last)$/.test(e),i=An[r?"take"+("last"==e?"Right":""):e],a=r||/^find/.test(e);i&&(An.prototype[e]=function(){var e=this.__wrapped__,o=r?[1]:arguments,s=e instanceof Pn,l=o[0],u=s||Oo(e),c=function(t){var e=i.apply(An,de([t],o));return r&&b?e[0]:e};u&&n&&"function"==typeof l&&1!=l.length&&(s=u=!1);var b=this.__chain__,h=!!this.__actions__.length,f=a&&!b,d=s&&!h;if(!a&&u){e=d?e:new Pn(this);var p=t.apply(e,o);return p.__actions__.push({func:eo,args:[c],thisArg:void 0}),new Mn(p,b)}return f&&d?t.apply(this,o):(p=this.thru(c),f?r?p.value()[0]:p.value():p)})})),se(["pop","push","shift","sort","splice","unshift"],(function(t){var e=gt[t],n=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",r=/^(?:pop|shift)$/.test(t);An.prototype[t]=function(){var t=arguments;if(r&&!this.__chain__){var i=this.value();return e.apply(Oo(i)?i:[],t)}return this[n]((function(n){return e.apply(Oo(n)?n:[],t)}))}})),lr(Pn.prototype,(function(t,e){var n=An[e];if(n){var r=n.name+"";St.call(gn,r)||(gn[r]=[]),gn[r].push({name:e,func:n})}})),gn[Ai(void 0,2).name]=[{name:"wrapper",func:void 0}],Pn.prototype.clone=function(){var t=new Pn(this.__wrapped__);return t.__actions__=vi(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=vi(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=vi(this.__views__),t},Pn.prototype.reverse=function(){if(this.__filtered__){var t=new Pn(this);t.__dir__=-1,t.__filtered__=!0}else(t=this.clone()).__dir__*=-1;return t},Pn.prototype.value=function(){var t=this.__wrapped__.value(),e=this.__dir__,n=Oo(t),r=e<0,i=n?t.length:0,a=function(t,e,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:t,value:t?void 0:this.__values__[this.__index__++]}},An.prototype.plant=function(t){for(var e,n=this;n instanceof Fn;){var r=Ca(n);r.__index__=0,r.__values__=void 0,e?i.__wrapped__=r:e=r;var i=r;n=n.__wrapped__}return i.__wrapped__=t,e},An.prototype.reverse=function(){var t=this.__wrapped__;if(t instanceof Pn){var e=t;return this.__actions__.length&&(e=new Pn(this)),(e=e.reverse()).__actions__.push({func:eo,args:[Ha],thisArg:void 0}),new Mn(e,this.__chain__)}return this.thru(Ha)},An.prototype.toJSON=An.prototype.valueOf=An.prototype.value=function(){return ni(this.__wrapped__,this.__actions__)},An.prototype.first=An.prototype.head,Qt&&(An.prototype[Qt]=function(){return this}),An}();Xt._=Ke,void 0===(i=function(){return Ke}.call(e,n,e,r))||(r.exports=i)}).call(this)}).call(this,n(8),n(5)(t))},function(t,e,n){"use strict";var r,i=n(0),a=n(1),o=[].indexOf;r=function(){var t,e,n,r,s,l,c,f,d=function(){function f(t,e,n,r){h(this,f),this.x=t,this.y=e,this.width=n,this.options={font_face:"Arial",font_size:10,font_style:null,bottom_spacing:20+(f.NOLOGO?0:10),tab_stave_lower_spacing:10,note_stave_lower_spacing:0,scale:1},null!=r&&a.extend(this.options,r),this.reset()}return b(f,[{key:"reset",value:function(){return this.tuning=new i.a.Flow.Tuning,this.key_manager=new i.a.Flow.KeyManager("C"),this.music_api=new i.a.Flow.Music,this.customizations={"font-size":this.options.font_size,"font-face":this.options.font_face,"font-style":this.options.font_style,"annotation-position":"bottom",scale:this.options.scale,width:this.width,"stave-distance":0,space:0,player:"false",tempo:120,instrument:"acoustic_grand_piano",accidentals:"standard","tab-stems":"false","tab-stem-direction":"up","beam-rests":"true","beam-stemlets":"true","beam-middle-only":"false","connector-space":5},this.staves=[],this.tab_articulations=[],this.stave_articulations=[],this.player_voices=[],this.last_y=this.y,this.current_duration="q",this.current_clef="treble",this.current_bends={},this.current_octave_shift=0,this.bend_start_index=null,this.bend_start_strings=null,this.rendered=!1,this.renderer_context=null}},{key:"attachPlayer",value:function(t){return this.player=t}},{key:"setOptions",value:function(e){var n,r,s;for(n in t("setOptions: ",e),s=a.keys(this.customizations),e){if(r=e[n],!(o.call(s,n)>=0))throw new i.a.RERR("ArtistError","Invalid option '".concat(n,"'"));this.customizations[n]=r}if(this.last_y+=parseInt(this.customizations.space,10),"true"===this.customizations.player)return this.last_y+=15}},{key:"getPlayerData",value:function(){return{voices:this.player_voices,context:this.renderer_context,scale:this.customizations.scale}}},{key:"render",value:function(n){var r,o,s,l,u,c,b,h,d,p,m,v,y,g;for(t("Render: ",this.options),this.closeBends(),n.resize(this.customizations.width*this.customizations.scale,(this.last_y+this.options.bottom_spacing)*this.customizations.scale),(r=n.getContext()).scale(this.customizations.scale,this.customizations.scale),r.clear(),r.setFont(this.options.font_face,this.options.font_size,""),this.renderer_context=r,m=function(t,e){var n;if((n=a.last(e))instanceof i.a.Flow.BarNote)return e.pop(),t.setEndBarType(n.getType())},o=0,l=(h=this.staves).length;o1&&"c"===u[1]&&s.setAsCautionary(),b.addAccidental(n,s));return"d"===this.current_duration[this.current_duration.length-1]&&b.addDotToAll(),null!=l.play_note&&b.setPlayNote(l.play_note),h.push(b)}},{key:"addTabNote",value:function(t){var e,n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(n=a.last(this.staves).tab_notes,e=new i.a.Flow.TabNote({positions:t,duration:this.current_duration},"true"===this.customizations["tab-stems"]),null!=r&&e.setPlayNote(r),n.push(e),"d"===this.current_duration[this.current_duration.length-1])return e.addDot()}},{key:"setDuration",value:function(e){var n,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return n=e.split(/\s+/),t("setDuration: ",n[0],r),this.current_duration=c(n[0],r)}},{key:"addBar",value:function(e){var n,r,o;if(t("addBar: ",e),this.closeBends(),this.key_manager.reset(),o=a.last(this.staves),n=i.a.Flow.Barline.type,e=function(){switch(e){case"single":return n.SINGLE;case"double":return n.DOUBLE;case"end":return n.END;case"repeat-begin":return n.REPEAT_BEGIN;case"repeat-end":return n.REPEAT_END;case"repeat-both":return n.REPEAT_BOTH;default:return n.SINGLE}}(),r=(new i.a.Flow.BarNote).setType(e),o.tab_notes.push(r),null!=o.note)return o.note_notes.push(r)}},{key:"openBends",value:function(e,n,r,i){var o,s,u,c,b,h,f,d,p,m,v,y,g;for(t("openBends",e,n,r,i),y=a.last(this.staves).tab_notes,v=e,m=r,a.isEmpty(this.current_bends)?(this.bend_start_index=y.length-2,this.bend_start_strings=r):(v=y[this.bend_start_index],m=this.bend_start_strings),v.getPositions(),h=n.getPositions(),p=[],u=b=0,d=m.length;b0&&void 0!==arguments[0]?arguments[0]:1;if(null!=this.bend_start_index){for(r in t("closeBends(".concat(d,")")),h=a.last(this.staves).tab_notes,c=this.current_bends){for(u=[],n=0,s=(f=c[r]).length;n1&&void 0!==arguments[1]?arguments[1]:r;return new i.a.Flow.Annotation(t).setFont(a,o,s).setVerticalJustification(e)},null!=(c=t.match(/^\.([^-]*)-([^-]*)-([^.]*)\.(.*)/)))return a=c[1],o=c[2],s=c[3],(t=c[4])?u(t):null;if(null!=(c=t.match(/^\.([^.]*)\.(.*)/))){switch(l=r,t=c[2],c[1]){case"big":s="bold",o="14";break;case"italic":case"italics":a="Times",s="italic";break;case"medium":o="12";break;case"top":l=e.TOP,this.customizations["annotation-position"]="top";break;case"bottom":l=e.BOTTOM,this.customizations["annotation-position"]="bottom"}return t?u(t,l):null}return u(t)}},{key:"addAnnotations",value:function(t){var e,n,o,l,u,c,b,h,f,d,p,m,v,y,g,_,x,k,w,S;if(x=(_=a.last(this.staves)).note_notes,S=_.tab_notes,t.length>S.length)throw new i.a.RERR("ArtistError","More annotations than note elements");if(_.tab)for(o=l=0,c=(p=S.slice(S.length-t.length)).length;l=0&&r.push(h.str);return r}(),w=function(){var t,e,n,r,i;for(n=m.getPositions(),i=[],l=t=0,e=n.length;t=0&&i.push(f.str);return i}(),p=function(){var t,e,n,r,i;for(n=m.getPositions(),i=[],l=t=0,e=n.length;t=0&&i.push(l);return i}(),r=function(){var t,e,n,r,a;for(n=i.getPositions(),a=[],l=t=0,e=n.length;t=0&&a.push(l);return a}()),null!=y.tab&&this.addTabArticulation(k,m,i,p,r),null!=y.note&&this.addStaveArticulation(k,g[d],a.last(g),p,r));return s?void 0:this.closeBends(0)}this.closeBends(0)}},{key:"addRest",value:function(e){var n,r,o;return t("addRest: ",e),this.closeBends(),0===e.position?this.addStaveNote({spec:["r/4"],accidentals:[],is_rest:!0}):(n=this.tuning.getNoteForFret(2*(parseInt(e.position,10)+5),6),this.addStaveNote({spec:[n],accidentals:[],is_rest:!0})),o=a.last(this.staves).tab_notes,"true"===this.customizations["tab-stems"]?(r=new i.a.Flow.StaveNote({keys:[n||"r/4"],duration:this.current_duration+"r",clef:"treble",auto_stem:!1}),"d"===this.current_duration[this.current_duration.length-1]&&r.addDot(0),o.push(r)):o.push(new i.a.Flow.GhostNote(this.current_duration))}},{key:"addChord",value:function(e,n,r){var o,s,l,c,b,h,f,d,p,m,v,y,g,_,x,k,w,S,T,E,C,A,R,F,M,P,O,D;if(!a.isEmpty(e)){for(t("addChord: ",e),O=a.last(this.staves),P=[],A=[],s=[],c=[],d=[],D=[],p=[],T=0,f=a.first(e).string,h=0,v=0,g=e.length;v=F;1<=F?++x:--x)l.push(n);this.addArticulations(l)}return null!=r?this.addDecorator(r):void 0}}},{key:"addNote",value:function(t){return this.addChord([t])}},{key:"addTextVoice",value:function(){return a.last(this.staves).text_voices.push([])}},{key:"setTextFont",value:function(t){var e;if(null!=t&&null!=(e=t.match(/([^-]*)-([^-]*)-([^.]*)/)))return this.customizations["font-face"]=e[1],this.customizations["font-size"]=parseInt(e[2],10),this.customizations["font-style"]=e[3]}},{key:"addTextNote",value:function(t){var e,n,r,o,s,l,u,c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,b=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"center",h=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],f=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(u=a.last(this.staves).text_voices,a.isEmpty(u))throw new i.a.RERR("ArtistError","Can't add text note without text voice");return e=this.customizations["font-face"],n=this.customizations["font-size"],r=this.customizations["font-style"],o=function(){switch(b){case"center":return i.a.Flow.TextNote.Justification.CENTER;case"left":return i.a.Flow.TextNote.Justification.LEFT;case"right":return i.a.Flow.TextNote.Justification.RIGHT;default:return i.a.Flow.TextNote.Justification.CENTER}}(),l={text:t,duration:f?"b":this.current_duration,smooth:h,ignore_ticks:f,font:{family:e,size:n,weight:r}},"#"===t[0]&&(l.glyph=t.slice(1)),s=new i.a.Flow.TextNote(l).setLine(c).setJustification(o),a.last(u).push(s)}},{key:"addVoice",value:function(t){var e;return this.closeBends(),null==(e=a.last(this.staves))?this.addStave(t):(a.isEmpty(e.tab_notes)||(e.tab_voices.push(e.tab_notes),e.tab_notes=[]),a.isEmpty(e.note_notes)?void 0:(e.note_voices.push(e.note_notes),e.note_notes=[]))}},{key:"addStave",value:function(e,n){var r,o,s,l,u,c;s={tuning:"standard",clef:"treble",key:"C",notation:"tabstave"===e?"false":"true",tablature:"stave"===e?"false":"true",strings:6},a.extend(s,n),t("addStave: ",e,s),u=null,o=null,l=this.x+this.customizations["connector-space"],c=40,"true"===s.notation&&(o=new i.a.Flow.Stave(l,this.last_y,this.customizations.width-20,{left_bar:!1}),"none"!==s.clef&&o.addClef(s.clef),o.addKeySignature(s.key),null!=s.time&&o.addTimeSignature(s.time),this.last_y+=o.getHeight()+this.options.note_stave_lower_spacing+parseInt(this.customizations["stave-distance"],10),c=o.getNoteStartX(),this.current_clef="none"===s.clef?"treble":s.clef),"true"===s.tablature&&(u=new i.a.Flow.TabStave(l,this.last_y,this.customizations.width-20,{left_bar:!1}).setNumLines(s.strings),"none"!==s.clef&&u.addTabGlyph(),u.setNoteStartX(c),this.last_y+=u.getHeight()+this.options.tab_stave_lower_spacing),this.closeBends(),r=i.a.Flow.Beam.getDefaultBeamGroups(s.time),this.staves.push({tab:u,note:o,tab_voices:[],note_voices:[],tab_notes:[],note_notes:[],text_voices:[],beam_groups:r}),this.tuning.setTuning(s.tuning),this.key_manager.setKey(s.key)}},{key:"runCommand",value:function(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;switch(t("runCommand: ",e),(n=e.split(/\s+/))[0]){case"octave-shift":return this.current_octave_shift=parseInt(n[1],10),t("Octave shift: ",this.current_octave_shift);default:throw new i.a.RERR("ArtistError","Invalid command '".concat(n[0],"' at line ").concat(r," column ").concat(a))}}}]),f}();return d.DEBUG=!1,t=function(){for(var t,e=arguments.length,n=new Array(e),r=0;r1,p=m=0,y=(S=e.voices).length;m1,p=v=0,g=(T=n.voices).length;v1&&(l=!0)),a.isEmpty(r)||a.isEmpty(P)||(d.joinVoices(P),h=h.concat(P)),a.isEmpty(h)||d.formatToStave(h,b,{align_rests:l}),null!=e&&a.each(F,(function(e){return e.draw(t,R)})),null!=n&&a.each(C,(function(e){return e.draw(t,E)})),a.each(c,(function(e){return e.setContext(t).draw()})),a.isEmpty(r)||a.each(P,(function(e){return e.draw(t,M)})),null!=e&&null!=n&&new i.a.Flow.StaveConnector(n.stave,e.stave).setType(i.a.Flow.StaveConnector.type.BRACKET).setContext(t).draw(),null!=n?C:F},c=function(t,e){return t+(e?"d":"")},l=function(t,e){var n,r;return n=i.a.Flow.Bend.UP,r="",parseInt(t,10)>parseInt(e,10)?n=i.a.Flow.Bend.DOWN:r=function(){switch(Math.abs(e-t)){case 1:return"1/2";case 2:return"Full";case 3:return"1 1/2";default:return"Bend to "+e}}(),{type:n,text:r}},n=function(t){return t.match(/^\.fingering\/([^.]+)\./)},s=function(t){return t.match(/^\.stroke\/([^.]+)\./)},r=function(t){return t.match(/^\.(a[^\/]*)\/(t|b)[^.]*\./)},d}.call(void 0),e.a=r},function(t,e,n){"use strict";var r,i=n(0),a=n(1),o=n(4),s=[].indexOf;r=function(){var t,e,n=function(){function n(t){h(this,n),this.artist=t,this.reset()}return b(n,[{key:"reset",value:function(){return this.valid=!1,this.elements=!1}},{key:"isValid",value:function(){return this.valid}},{key:"getArtist",value:function(){return this.artist}},{key:"parseStaveOptions",value:function(t){var n,r,o,l,u,c,b,h,f,d,p,m;if(h={},null==t)return h;for(u=null,o=0,l=t.length;o8)throw r("Invalid number of strings: "+c);break;default:throw r("Invalid option '".concat(b.key,"'"))}if("false"===h.notation&&"false"===h.tablature)throw e(u,"Both 'notation' and 'tablature' can't be invisible");return h}},{key:"parseCommand",value:function(t){if("bar"===t.command&&this.artist.addBar(t.type),"tuplet"===t.command&&this.artist.makeTuplets(t.params.tuplet,t.params.notes),"annotations"===t.command&&this.artist.addAnnotations(t.params),"rest"===t.command&&this.artist.addRest(t.params),"command"===t.command)return this.artist.runCommand(t.params,t._l,t._c)}},{key:"parseChord",value:function(e){return t("parseChord:",e),this.artist.addChord(a.map(e.chord,(function(t){return a.pick(t,"time","dot","fret","abc","octave","string","articulation","decorator")})),e.articulation,e.decorator)}},{key:"parseFret",value:function(t){return this.artist.addNote(a.pick(t,"time","dot","fret","string","articulation","decorator"))}},{key:"parseABC",value:function(t){return this.artist.addNote(a.pick(t,"time","dot","fret","abc","octave","string","articulation","decorator"))}},{key:"parseStaveElements",value:function(e){var n,r,i,a;for(t("parseStaveElements:",e),a=[],r=0,i=e.length;rc&&E.push("'"+this.terminals_[w]+"'");R=f.showPosition?"Parse error on line "+(s+1)+":\n"+f.showPosition()+"\nExpecting "+E.join(", ")+", got '"+(this.terminals_[y]||y)+"'":"Parse error on line "+(s+1)+": Unexpected "+(y==b?"end of input":"'"+(this.terminals_[y]||y)+"'"),this.parseError(R,{text:f.match,token:this.terminals_[y]||y,line:f.yylineno,loc:m,expected:E})}if(x[0]instanceof Array&&x.length>1)throw new Error("Parse Error: multiple actions possible at state: "+_+", token: "+y);switch(x[0]){case 1:n.push(y),r.push(f.yytext),i.push(f.yylloc),n.push(x[1]),y=null,g?(y=g,g=null):(l=f.yyleng,o=f.yytext,s=f.yylineno,m=f.yylloc,u>0&&u--);break;case 2:if(S=this.productions_[x[1]][1],A.$=r[r.length-S],A._$={first_line:i[i.length-(S||1)].first_line,last_line:i[i.length-1].last_line,first_column:i[i.length-(S||1)].first_column,last_column:i[i.length-1].last_column},v&&(A._$.range=[i[i.length-(S||1)].range[0],i[i.length-1].range[1]]),void 0!==(k=this.performAction.apply(A,[o,l,s,d.yy,x[1],r,i].concat(h))))return k;S&&(n=n.slice(0,-1*S*2),r=r.slice(0,-1*S),i=i.slice(0,-1*S)),n.push(this.productions_[x[1]][0]),r.push(A.$),i.push(A._$),T=a[n[n.length-2]][n[n.length-1]],n.push(T);break;case 3:return!0}}return!0}},st=n(1),lt={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},test_match:function(t,e){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(r=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return!1}return!1},next:function(){if(this.done)return this.EOF;var t,e,n,r;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var i=this._currentRules(),a=0;ae[0].length)){if(e=n,r=a,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,i[a])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,i[r]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){return this.next()||this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"},pushState:function(t){this.begin(t)},stateStackSize:function(){return this.conditionStack.length},options:{},performAction:function(t,e,n,r){switch(n){case 0:return this.begin("notes"),19;case 1:return this.begin("options"),13;case 2:return this.begin("options"),14;case 3:return this.begin("options"),15;case 4:return this.begin("options"),11;case 5:return this.begin("text"),17;case 6:return this.begin("options"),21;case 7:return 22;case 8:return this.begin("annotations"),"$";case 9:return this.begin("notes"),"$";case 10:return 22;case 11:return this.begin("command"),"!";case 12:return this.begin("notes"),"!";case 13:return 74;case 14:return 24;case 15:return 41;case 16:return"+";case 17:return 38;case 18:return 23;case 19:return 45;case 20:return 46;case 21:return 31;case 22:return 32;case 23:return 70;case 24:return 25;case 25:return 37;case 26:return 44;case 27:return 75;case 28:return 79;case 29:return 65;case 30:return 62;case 31:return 57;case 32:return 66;case 33:return 63;case 34:return 64;case 35:return 61;case 36:return 50;case 37:return 67;case 38:return 68;case 39:return 69;case 40:return 59;case 41:return 48;case 42:return 58;case 43:return 56;case 44:return 57;case 45:return 59;case 46:return 60;case 47:return 76;case 48:return 80;case 49:return 81;case 50:this.begin("INITIAL");break;case 51:break;case 52:return 5;case 53:return"INVALID"}},rules:[/^(?:notes\b)/,/^(?:tabstave\b)/,/^(?:stave\b)/,/^(?:voice\b)/,/^(?:options\b)/,/^(?:text\b)/,/^(?:slur\b)/,/^(?:[^\s=]+)/,/^(?:[$])/,/^(?:[$])/,/^(?:[^,$]+)/,/^(?:[!])/,/^(?:[!])/,/^(?:[^!]+)/,/^(?:[^,\r\n]+)/,/^(?:\/)/,/^(?:\+)/,/^(?::)/,/^(?:=)/,/^(?:\()/,/^(?:\))/,/^(?:\[)/,/^(?:\])/,/^(?:\^)/,/^(?:,)/,/^(?:\|)/,/^(?:\.)/,/^(?:#)/,/^(?:@)/,/^(?:[b])/,/^(?:[s])/,/^(?:[h])/,/^(?:[p])/,/^(?:[t])/,/^(?:[T])/,/^(?:[-])/,/^(?:[_])/,/^(?:[v])/,/^(?:[V])/,/^(?:[u])/,/^(?:[d])/,/^(?:[0-9]+)/,/^(?:[q])/,/^(?:[w])/,/^(?:[h])/,/^(?:[d])/,/^(?:[S])/,/^(?:[A-GXLR])/,/^(?:[n])/,/^(?:[~])/,/^(?:[\r\n]+)/,/^(?:\s+)/,/^(?:$)/,/^(?:.)/],conditions:{notes:{rules:[8,11,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53],inclusive:!0},text:{rules:[14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,41,42,43,44,45,50,51,52,53],inclusive:!0},slur:{rules:[15,16,17,18,19,20,21,22,23,24,25,26,27,28,50,51,52,53],inclusive:!0},annotations:{rules:[9,10,15,16,17,18,19,20,21,22,23,24,25,26,27,28,50,51,52,53],inclusive:!0},options:{rules:[7,15,16,17,18,19,20,21,22,23,24,25,26,27,28,50,51,52,53],inclusive:!0},command:{rules:[12,13,15,16,17,18,19,20,21,22,23,24,25,26,27,28,50,51,52,53],inclusive:!0},INITIAL:{rules:[0,1,2,3,4,5,6,7,15,16,17,18,19,20,21,22,23,24,25,26,27,28,50,51,52,53],inclusive:!0}}};function ut(){this.yy={}}return ot.lexer=lt,ut.prototype=ot,ot.Parser=ut,new ut}();e.parser=i,e.Parser=i.Parser,e.parse=function(){return i.parse.apply(i,arguments)},e.main=function(r){r[1]||(console.log("Usage: "+r[0]+" FILE"),t.exit(1));var i=n(9).readFileSync(n(10).normalize(r[1]),"utf8");return e.parser.parse(i)},n.c[n.s]===r&&e.main(t.argv.slice(1))}).call(this,n(6),n(5)(t))},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e){var n,r,i=t.exports={};function a(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function s(t){if(n===setTimeout)return setTimeout(t,0);if((n===a||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:a}catch(t){n=a}try{r="function"==typeof clearTimeout?clearTimeout:o}catch(t){r=o}}();var l,u=[],c=!1,b=-1;function h(){c&&l&&(c=!1,l.length?u=l.concat(u):b=-1,u.length&&f())}function f(){if(!c){var t=s(h);c=!0;for(var e=u.length;e;){for(l=u,u=[];++b1)for(var n=1;n]*>/,d=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,p=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,m=/^(?:body|html)$/i,v=/([A-Z])/g,y=["val","css","html","text","data","width","height","offset"],g=u.createElement("table"),_=u.createElement("tr"),x={tr:u.createElement("tbody"),tbody:g,thead:g,tfoot:g,td:_,th:_,"*":u.createElement("div")},k=/complete|loaded|interactive/,w=/^[\w-]*$/,S={},T=S.toString,E={},C=u.createElement("div"),A={tabindex:"tabIndex",readonly:"readOnly",for:"htmlFor",class:"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},R=Array.isArray||function(t){return t instanceof Array};function F(t){return null==t?String(t):S[T.call(t)]||"object"}function M(t){return"function"==F(t)}function P(t){return null!=t&&t==t.window}function O(t){return null!=t&&t.nodeType==t.DOCUMENT_NODE}function D(t){return"object"==F(t)}function I(t){return D(t)&&!P(t)&&Object.getPrototypeOf(t)==Object.prototype}function N(t){var n=!!t&&"length"in t&&t.length,r=e.type(t);return"function"!=r&&!P(t)&&("array"==r||0===n||"number"==typeof n&&n>0&&n-1 in t)}function L(t){return t.replace(/::/g,"/").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/_/g,"-").toLowerCase()}function B(t){return t in b?b[t]:b[t]=new RegExp("(^|\\s)"+t+"(\\s|$)")}function z(t,e){return"number"!=typeof e||h[L(t)]?e:e+"px"}function U(t){return"children"in t?l.call(t.children):e.map(t.childNodes,(function(t){if(1==t.nodeType)return t}))}function j(t,e){var n,r=t?t.length:0;for(n=0;n")),void 0===n&&(n=f.test(t)&&RegExp.$1),n in x||(n="*"),(o=x[n]).innerHTML=""+t,i=e.each(l.call(o.childNodes),(function(){o.removeChild(this)}))),I(r)&&(a=e(i),e.each(r,(function(t,e){y.indexOf(t)>-1?a[t](e):a.attr(t,e)}))),i},E.Z=function(t,e){return new j(t,e)},E.isZ=function(t){return t instanceof E.Z},E.init=function(t,n){var r,i;if(!t)return E.Z();if("string"==typeof t)if("<"==(t=t.trim())[0]&&f.test(t))r=E.fragment(t,RegExp.$1,n),t=null;else{if(void 0!==n)return e(n).find(t);r=E.qsa(u,t)}else{if(M(t))return e(u).ready(t);if(E.isZ(t))return t;if(R(t))i=t,r=s.call(i,(function(t){return null!=t}));else if(D(t))r=[t],t=null;else if(f.test(t))r=E.fragment(t.trim(),RegExp.$1,n),t=null;else{if(void 0!==n)return e(n).find(t);r=E.qsa(u,t)}}return E.Z(r,t)},(e=function(t,e){return E.init(t,e)}).extend=function(t){var e,n=l.call(arguments,1);return"boolean"==typeof t&&(e=t,t=n.shift()),n.forEach((function(n){H(t,n,e)})),t},E.qsa=function(t,e){var n,r="#"==e[0],i=!r&&"."==e[0],a=r||i?e.slice(1):e,o=w.test(a);return t.getElementById&&o&&r?(n=t.getElementById(a))?[n]:[]:1!==t.nodeType&&9!==t.nodeType&&11!==t.nodeType?[]:l.call(o&&!r&&t.getElementsByClassName?i?t.getElementsByClassName(a):t.getElementsByTagName(e):t.querySelectorAll(e))},e.contains=u.documentElement.contains?function(t,e){return t!==e&&t.contains(e)}:function(t,e){for(;e&&(e=e.parentNode);)if(e===t)return!0;return!1},e.type=F,e.isFunction=M,e.isWindow=P,e.isArray=R,e.isPlainObject=I,e.isEmptyObject=function(t){var e;for(e in t)return!1;return!0},e.isNumeric=function(t){var e=Number(t),n=typeof t;return null!=t&&"boolean"!=n&&("string"!=n||t.length)&&!isNaN(e)&&isFinite(e)||!1},e.inArray=function(t,e,n){return a.indexOf.call(e,t,n)},e.camelCase=r,e.trim=function(t){return null==t?"":String.prototype.trim.call(t)},e.uuid=0,e.support={},e.expr={},e.noop=function(){},e.map=function(t,n){var r,i,a,o,s=[];if(N(t))for(i=0;i0?e.fn.concat.apply([],o):o},e.each=function(t,e){var n,r;if(N(t)){for(n=0;n=0?t:t+this.length]},toArray:function(){return this.get()},size:function(){return this.length},remove:function(){return this.each((function(){null!=this.parentNode&&this.parentNode.removeChild(this)}))},each:function(t){return a.every.call(this,(function(e,n){return!1!==t.call(e,n,e)})),this},filter:function(t){return M(t)?this.not(this.not(t)):e(s.call(this,(function(e){return E.matches(e,t)})))},add:function(t,n){return e(i(this.concat(e(t,n))))},is:function(t){return this.length>0&&E.matches(this[0],t)},not:function(t){var n=[];if(M(t)&&void 0!==t.call)this.each((function(e){t.call(this,e)||n.push(this)}));else{var r="string"==typeof t?this.filter(t):N(t)&&M(t.item)?l.call(t):e(t);this.forEach((function(t){r.indexOf(t)<0&&n.push(t)}))}return e(n)},has:function(t){return this.filter((function(){return D(t)?e.contains(this,t):e(this).find(t).size()}))},eq:function(t){return-1===t?this.slice(t):this.slice(t,+t+1)},first:function(){var t=this[0];return t&&!D(t)?t:e(t)},last:function(){var t=this[this.length-1];return t&&!D(t)?t:e(t)},find:function(t){var n=this;return t?"object"==typeof t?e(t).filter((function(){var t=this;return a.some.call(n,(function(n){return e.contains(n,t)}))})):1==this.length?e(E.qsa(this[0],t)):this.map((function(){return E.qsa(this,t)})):e()},closest:function(t,n){var r=[],i="object"==typeof t&&e(t);return this.each((function(e,a){for(;a&&!(i?i.indexOf(a)>=0:E.matches(a,t));)a=a!==n&&!O(a)&&a.parentNode;a&&r.indexOf(a)<0&&r.push(a)})),e(r)},parents:function(t){for(var n=[],r=this;r.length>0;)r=e.map(r,(function(t){if((t=t.parentNode)&&!O(t)&&n.indexOf(t)<0)return n.push(t),t}));return W(n,t)},parent:function(t){return W(i(this.pluck("parentNode")),t)},children:function(t){return W(this.map((function(){return U(this)})),t)},contents:function(){return this.map((function(){return this.contentDocument||l.call(this.childNodes)}))},siblings:function(t){return W(this.map((function(t,e){return s.call(U(e.parentNode),(function(t){return t!==e}))})),t)},empty:function(){return this.each((function(){this.innerHTML=""}))},pluck:function(t){return e.map(this,(function(e){return e[t]}))},show:function(){return this.each((function(){var t,e,n;"none"==this.style.display&&(this.style.display=""),"none"==getComputedStyle(this,"").getPropertyValue("display")&&(this.style.display=(t=this.nodeName,c[t]||(e=u.createElement(t),u.body.appendChild(e),n=getComputedStyle(e,"").getPropertyValue("display"),e.parentNode.removeChild(e),"none"==n&&(n="block"),c[t]=n),c[t]))}))},replaceWith:function(t){return this.before(t).remove()},wrap:function(t){var n=M(t);if(this[0]&&!n)var r=e(t).get(0),i=r.parentNode||this.length>1;return this.each((function(a){e(this).wrapAll(n?t.call(this,a):i?r.cloneNode(!0):r)}))},wrapAll:function(t){if(this[0]){var n;for(e(this[0]).before(t=e(t));(n=t.children()).length;)t=n.first();e(t).append(this)}return this},wrapInner:function(t){var n=M(t);return this.each((function(r){var i=e(this),a=i.contents(),o=n?t.call(this,r):t;a.length?a.wrapAll(o):i.append(o)}))},unwrap:function(){return this.parent().each((function(){e(this).replaceWith(e(this).children())})),this},clone:function(){return this.map((function(){return this.cloneNode(!0)}))},hide:function(){return this.css("display","none")},toggle:function(t){return this.each((function(){var n=e(this);(void 0===t?"none"==n.css("display"):t)?n.show():n.hide()}))},prev:function(t){return e(this.pluck("previousElementSibling")).filter(t||"*")},next:function(t){return e(this.pluck("nextElementSibling")).filter(t||"*")},html:function(t){return 0 in arguments?this.each((function(n){var r=this.innerHTML;e(this).empty().append(Y(this,t,n,r))})):0 in this?this[0].innerHTML:null},text:function(t){return 0 in arguments?this.each((function(e){var n=Y(this,t,e,this.textContent);this.textContent=null==n?"":""+n})):0 in this?this.pluck("textContent").join(""):null},attr:function(e,n){var r;return"string"!=typeof e||1 in arguments?this.each((function(r){if(1===this.nodeType)if(D(e))for(t in e)G(this,t,e[t]);else G(this,e,Y(this,n,r,this.getAttribute(e)))})):0 in this&&1==this[0].nodeType&&null!=(r=this[0].getAttribute(e))?r:void 0},removeAttr:function(t){return this.each((function(){1===this.nodeType&&t.split(" ").forEach((function(t){G(this,t)}),this)}))},prop:function(t,e){return t=A[t]||t,1 in arguments?this.each((function(n){this[t]=Y(this,e,n,this[t])})):this[0]&&this[0][t]},removeProp:function(t){return t=A[t]||t,this.each((function(){delete this[t]}))},data:function(t,e){var n="data-"+t.replace(v,"-$1").toLowerCase(),r=1 in arguments?this.attr(n,e):this.attr(n);return null!==r?X(r):void 0},val:function(t){return 0 in arguments?(null==t&&(t=""),this.each((function(e){this.value=Y(this,t,e,this.value)}))):this[0]&&(this[0].multiple?e(this[0]).find("option").filter((function(){return this.selected})).pluck("value"):this[0].value)},offset:function(t){if(t)return this.each((function(n){var r=e(this),i=Y(this,t,n,r.offset()),a=r.offsetParent().offset(),o={top:i.top-a.top,left:i.left-a.left};"static"==r.css("position")&&(o.position="relative"),r.css(o)}));if(!this.length)return null;if(u.documentElement!==this[0]&&!e.contains(u.documentElement,this[0]))return{top:0,left:0};var n=this[0].getBoundingClientRect();return{left:n.left+window.pageXOffset,top:n.top+window.pageYOffset,width:Math.round(n.width),height:Math.round(n.height)}},css:function(n,i){if(arguments.length<2){var a=this[0];if("string"==typeof n){if(!a)return;return a.style[r(n)]||getComputedStyle(a,"").getPropertyValue(n)}if(R(n)){if(!a)return;var o={},s=getComputedStyle(a,"");return e.each(n,(function(t,e){o[e]=a.style[r(e)]||s.getPropertyValue(e)})),o}}var l="";if("string"==F(n))i||0===i?l=L(n)+":"+z(n,i):this.each((function(){this.style.removeProperty(L(n))}));else for(t in n)n[t]||0===n[t]?l+=L(t)+":"+z(t,n[t])+";":this.each((function(){this.style.removeProperty(L(t))}));return this.each((function(){this.style.cssText+=";"+l}))},index:function(t){return t?this.indexOf(e(t)[0]):this.parent().children().indexOf(this[0])},hasClass:function(t){return!!t&&a.some.call(this,(function(t){return this.test(V(t))}),B(t))},addClass:function(t){return t?this.each((function(r){if("className"in this){n=[];var i=V(this);Y(this,t,r,i).split(/\s+/g).forEach((function(t){e(this).hasClass(t)||n.push(t)}),this),n.length&&V(this,i+(i?" ":"")+n.join(" "))}})):this},removeClass:function(t){return this.each((function(e){if("className"in this){if(void 0===t)return V(this,"");n=V(this),Y(this,t,e,n).split(/\s+/g).forEach((function(t){n=n.replace(B(t)," ")})),V(this,n.trim())}}))},toggleClass:function(t,n){return t?this.each((function(r){var i=e(this);Y(this,t,r,V(this)).split(/\s+/g).forEach((function(t){(void 0===n?!i.hasClass(t):n)?i.addClass(t):i.removeClass(t)}))})):this},scrollTop:function(t){if(this.length){var e="scrollTop"in this[0];return void 0===t?e?this[0].scrollTop:this[0].pageYOffset:this.each(e?function(){this.scrollTop=t}:function(){this.scrollTo(this.scrollX,t)})}},scrollLeft:function(t){if(this.length){var e="scrollLeft"in this[0];return void 0===t?e?this[0].scrollLeft:this[0].pageXOffset:this.each(e?function(){this.scrollLeft=t}:function(){this.scrollTo(t,this.scrollY)})}},position:function(){if(this.length){var t=this[0],n=this.offsetParent(),r=this.offset(),i=m.test(n[0].nodeName)?{top:0,left:0}:n.offset();return r.top-=parseFloat(e(t).css("margin-top"))||0,r.left-=parseFloat(e(t).css("margin-left"))||0,i.top+=parseFloat(e(n[0]).css("border-top-width"))||0,i.left+=parseFloat(e(n[0]).css("border-left-width"))||0,{top:r.top-i.top,left:r.left-i.left}}},offsetParent:function(){return this.map((function(){for(var t=this.offsetParent||u.body;t&&!m.test(t.nodeName)&&"static"==e(t).css("position");)t=t.offsetParent;return t}))}},e.fn.detach=e.fn.remove,["width","height"].forEach((function(t){var n=t.replace(/./,(function(t){return t[0].toUpperCase()}));e.fn[t]=function(r){var i,a=this[0];return void 0===r?P(a)?a["inner"+n]:O(a)?a.documentElement["scroll"+n]:(i=this.offset())&&i[t]:this.each((function(n){(a=e(this)).css(t,Y(this,r,n,a[t]()))}))}})),["after","prepend","before","append"].forEach((function(t,n){var r=n%2;e.fn[t]=function(){var t,i,a=e.map(arguments,(function(n){var r=[];return"array"==(t=F(n))?(n.forEach((function(t){return void 0!==t.nodeType?r.push(t):e.zepto.isZ(t)?r=r.concat(t.get()):void(r=r.concat(E.fragment(t)))})),r):"object"==t||null==n?n:E.fragment(n)})),o=this.length>1;return a.length<1?this:this.each((function(t,s){i=r?s:s.parentNode,s=0==n?s.nextSibling:1==n?s.firstChild:2==n?s:null;var l=e.contains(u.documentElement,i);a.forEach((function(t){if(o)t=t.cloneNode(!0);else if(!i)return e(t).remove();i.insertBefore(t,s),l&&K(t,(function(t){if(!(null==t.nodeName||"SCRIPT"!==t.nodeName.toUpperCase()||t.type&&"text/javascript"!==t.type||t.src)){var e=t.ownerDocument?t.ownerDocument.defaultView:window;e.eval.call(e,t.innerHTML)}}))}))}))},e.fn[r?t+"To":"insert"+(n?"Before":"After")]=function(n){return e(n)[t](this),this}})),E.Z.prototype=j.prototype=e.fn,E.uniq=i,E.deserializeValue=X,e.zepto=E,e}(),window.Zepto=n,void 0===window.$&&(window.$=n),t.exports=n,function(t){var e=1,n=Array.prototype.slice,r=t.isFunction,i=function(t){return"string"==typeof t},a={},o={},s="onfocusin"in window,l={focus:"focusin",blur:"focusout"},u={mouseenter:"mouseover",mouseleave:"mouseout"};function c(t){return t._zid||(t._zid=e++)}function b(t,e,n,r){if((e=h(e)).ns)var i=(o=e.ns,new RegExp("(?:^| )"+o.replace(" "," .* ?")+"(?: |$)"));var o;return(a[c(t)]||[]).filter((function(t){return t&&(!e.e||t.e==e.e)&&(!e.ns||i.test(t.ns))&&(!n||c(t.fn)===c(n))&&(!r||t.sel==r)}))}function h(t){var e=(""+t).split(".");return{e:e[0],ns:e.slice(1).sort().join(" ")}}function f(t,e){return t.del&&!s&&t.e in l||!!e}function d(t){return u[t]||s&&l[t]||t}function p(e,n,r,i,o,s,l){var b=c(e),p=a[b]||(a[b]=[]);n.split(/\s/).forEach((function(n){if("ready"==n)return t(document).ready(r);var a=h(n);a.fn=r,a.sel=o,a.e in u&&(r=function(e){var n=e.relatedTarget;if(!n||n!==this&&!t.contains(this,n))return a.fn.apply(this,arguments)}),a.del=s;var c=s||r;a.proxy=function(t){if(!(t=x(t)).isImmediatePropagationStopped()){t.data=i;var n=c.apply(e,null==t._args?[t]:[t].concat(t._args));return!1===n&&(t.preventDefault(),t.stopPropagation()),n}},a.i=p.length,p.push(a),"addEventListener"in e&&e.addEventListener(d(a.e),a.proxy,f(a,l))}))}function m(t,e,n,r,i){var o=c(t);(e||"").split(/\s/).forEach((function(e){b(t,e,n,r).forEach((function(e){delete a[o][e.i],"removeEventListener"in t&&t.removeEventListener(d(e.e),e.proxy,f(e,i))}))}))}o.click=o.mousedown=o.mouseup=o.mousemove="MouseEvents",t.event={add:p,remove:m},t.proxy=function(e,a){var o=2 in arguments&&n.call(arguments,2);if(r(e)){var s=function(){return e.apply(a,o?o.concat(n.call(arguments)):arguments)};return s._zid=c(e),s}if(i(a))return o?(o.unshift(e[a],e),t.proxy.apply(null,o)):t.proxy(e[a],e);throw new TypeError("expected function")},t.fn.bind=function(t,e,n){return this.on(t,e,n)},t.fn.unbind=function(t,e){return this.off(t,e)},t.fn.one=function(t,e,n,r){return this.on(t,e,n,r,1)};var v=function(){return!0},y=function(){return!1},g=/^([A-Z]|returnValue$|layer[XY]$|webkitMovement[XY]$)/,_={preventDefault:"isDefaultPrevented",stopImmediatePropagation:"isImmediatePropagationStopped",stopPropagation:"isPropagationStopped"};function x(e,n){return!n&&e.isDefaultPrevented||(n||(n=e),t.each(_,(function(t,r){var i=n[t];e[t]=function(){return this[r]=v,i&&i.apply(n,arguments)},e[r]=y})),e.timeStamp||(e.timeStamp=Date.now()),(void 0!==n.defaultPrevented?n.defaultPrevented:"returnValue"in n?!1===n.returnValue:n.getPreventDefault&&n.getPreventDefault())&&(e.isDefaultPrevented=v)),e}function k(t){var e,n={originalEvent:t};for(e in t)g.test(e)||void 0===t[e]||(n[e]=t[e]);return x(n,t)}t.fn.delegate=function(t,e,n){return this.on(e,t,n)},t.fn.undelegate=function(t,e,n){return this.off(e,t,n)},t.fn.live=function(e,n){return t(document.body).delegate(this.selector,e,n),this},t.fn.die=function(e,n){return t(document.body).undelegate(this.selector,e,n),this},t.fn.on=function(e,a,o,s,l){var u,c,b=this;return e&&!i(e)?(t.each(e,(function(t,e){b.on(t,a,o,e,l)})),b):(i(a)||r(s)||!1===s||(s=o,o=a,a=void 0),void 0!==s&&!1!==o||(s=o,o=void 0),!1===s&&(s=y),b.each((function(r,i){l&&(u=function(t){return m(i,t.type,s),s.apply(this,arguments)}),a&&(c=function(e){var r,o=t(e.target).closest(a,i).get(0);if(o&&o!==i)return r=t.extend(k(e),{currentTarget:o,liveFired:i}),(u||s).apply(o,[r].concat(n.call(arguments,1)))}),p(i,e,s,o,a,c||u)})))},t.fn.off=function(e,n,a){var o=this;return e&&!i(e)?(t.each(e,(function(t,e){o.off(t,n,e)})),o):(i(n)||r(a)||!1===a||(a=n,n=void 0),!1===a&&(a=y),o.each((function(){m(this,e,a,n)})))},t.fn.trigger=function(e,n){return(e=i(e)||t.isPlainObject(e)?t.Event(e):x(e))._args=n,this.each((function(){e.type in l&&"function"==typeof this[e.type]?this[e.type]():"dispatchEvent"in this?this.dispatchEvent(e):t(this).triggerHandler(e,n)}))},t.fn.triggerHandler=function(e,n){var r,a;return this.each((function(o,s){(r=k(i(e)?t.Event(e):e))._args=n,r.target=s,t.each(b(s,e.type||e),(function(t,e){if(a=e.proxy(r),r.isImmediatePropagationStopped())return!1}))})),a},"focusin focusout focus blur load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select keydown keypress keyup error".split(" ").forEach((function(e){t.fn[e]=function(t){return 0 in arguments?this.bind(e,t):this.trigger(e)}})),t.Event=function(t,e){i(t)||(t=(e=t).type);var n=document.createEvent(o[t]||"Events"),r=!0;if(e)for(var a in e)"bubbles"==a?r=!!e[a]:n[a]=e[a];return n.initEvent(t,r,!0),x(n)}}(n),function(t){var e,n,r=+new Date,i=window.document,a=/)<[^<]*)*<\/script>/gi,o=/^(?:text|application)\/javascript/i,s=/^(?:text|application)\/xml/i,l=/^\s*$/,u=i.createElement("a");function c(e,n,r,a){if(e.global)return function(e,n,r){var i=t.Event(n);return t(e).trigger(i,r),!i.isDefaultPrevented()}(n||i,r,a)}function b(t,e){var n=e.context;if(!1===e.beforeSend.call(n,t,e)||!1===c(e,n,"ajaxBeforeSend",[t,e]))return!1;c(e,n,"ajaxSend",[t,e])}function h(t,e,n,r){var i=n.context;n.success.call(i,t,"success",e),r&&r.resolveWith(i,[t,"success",e]),c(n,i,"ajaxSuccess",[e,n,t]),d("success",e,n)}function f(t,e,n,r,i){var a=r.context;r.error.call(a,n,e,t),i&&i.rejectWith(a,[n,e,t]),c(r,a,"ajaxError",[n,r,t||e]),d(e,n,r)}function d(e,n,r){var i=r.context;r.complete.call(i,n,e),c(r,i,"ajaxComplete",[n,r]),function(e){e.global&&!--t.active&&c(e,null,"ajaxStop")}(r)}function p(){}function m(t,e){return""==e?t:(t+"&"+e).replace(/[&?]{1,2}/,"?")}function v(e,n,r,i){return t.isFunction(n)&&(i=r,r=n,n=void 0),t.isFunction(r)||(i=r,r=void 0),{url:e,data:n,success:r,dataType:i}}u.href=window.location.href,t.active=0,t.ajaxJSONP=function(e,n){if(!("type"in e))return t.ajax(e);var a,o,s=e.jsonpCallback,l=(t.isFunction(s)?s():s)||"Zepto"+r++,u=i.createElement("script"),c=window[l],d=function(e){t(u).triggerHandler("error",e||"abort")},p={abort:d};return n&&n.promise(p),t(u).on("load error",(function(r,i){clearTimeout(o),t(u).off().remove(),"error"!=r.type&&a?h(a[0],p,e,n):f(null,i||"error",p,e,n),window[l]=c,a&&t.isFunction(c)&&c(a[0]),c=a=void 0})),!1===b(p,e)?(d("abort"),p):(window[l]=function(){a=arguments},u.src=e.url.replace(/\?(.+)=\?/,"?$1="+l),i.head.appendChild(u),e.timeout>0&&(o=setTimeout((function(){d("timeout")}),e.timeout)),p)},t.ajaxSettings={type:"GET",beforeSend:p,success:p,error:p,complete:p,context:null,global:!0,xhr:function(){return new window.XMLHttpRequest},accepts:{script:"text/javascript, application/javascript, application/x-javascript",json:"application/json",xml:"application/xml, text/xml",html:"text/html",text:"text/plain"},crossDomain:!1,timeout:0,processData:!0,cache:!0,dataFilter:p},t.ajax=function(r){var a,d,v=t.extend({},r||{}),y=t.Deferred&&t.Deferred();for(e in t.ajaxSettings)void 0===v[e]&&(v[e]=t.ajaxSettings[e]);!function(e){e.global&&0==t.active++&&c(e,null,"ajaxStart")}(v),v.crossDomain||((a=i.createElement("a")).href=v.url,a.href=a.href,v.crossDomain=u.protocol+"//"+u.host!=a.protocol+"//"+a.host),v.url||(v.url=window.location.toString()),(d=v.url.indexOf("#"))>-1&&(v.url=v.url.slice(0,d)),function(e){e.processData&&e.data&&"string"!=t.type(e.data)&&(e.data=t.param(e.data,e.traditional)),!e.data||e.type&&"GET"!=e.type.toUpperCase()&&"jsonp"!=e.dataType||(e.url=m(e.url,e.data),e.data=void 0)}(v);var g=v.dataType,_=/\?.+=\?/.test(v.url);if(_&&(g="jsonp"),!1!==v.cache&&(r&&!0===r.cache||"script"!=g&&"jsonp"!=g)||(v.url=m(v.url,"_="+Date.now())),"jsonp"==g)return _||(v.url=m(v.url,v.jsonp?v.jsonp+"=?":!1===v.jsonp?"":"callback=?")),t.ajaxJSONP(v,y);var x,k=v.accepts[g],w={},S=function(t,e){w[t.toLowerCase()]=[t,e]},T=/^([\w-]+:)\/\//.test(v.url)?RegExp.$1:window.location.protocol,E=v.xhr(),C=E.setRequestHeader;if(y&&y.promise(E),v.crossDomain||S("X-Requested-With","XMLHttpRequest"),S("Accept",k||"*/*"),(k=v.mimeType||k)&&(k.indexOf(",")>-1&&(k=k.split(",",2)[0]),E.overrideMimeType&&E.overrideMimeType(k)),(v.contentType||!1!==v.contentType&&v.data&&"GET"!=v.type.toUpperCase())&&S("Content-Type",v.contentType||"application/x-www-form-urlencoded"),v.headers)for(n in v.headers)S(n,v.headers[n]);if(E.setRequestHeader=S,E.onreadystatechange=function(){if(4==E.readyState){E.onreadystatechange=p,clearTimeout(x);var e,n=!1;if(E.status>=200&&E.status<300||304==E.status||0==E.status&&"file:"==T){if(g=g||function(t){return t&&(t=t.split(";",2)[0]),t&&("text/html"==t?"html":"application/json"==t?"json":o.test(t)?"script":s.test(t)&&"xml")||"text"}(v.mimeType||E.getResponseHeader("content-type")),"arraybuffer"==E.responseType||"blob"==E.responseType)e=E.response;else{e=E.responseText;try{e=function(t,e,n){if(n.dataFilter==p)return t;var r=n.context;return n.dataFilter.call(r,t,e)}(e,g,v),"script"==g?(0,eval)(e):"xml"==g?e=E.responseXML:"json"==g&&(e=l.test(e)?null:t.parseJSON(e))}catch(t){n=t}if(n)return f(n,"parsererror",E,v,y)}h(e,E,v,y)}else f(E.statusText||null,E.status?"error":"abort",E,v,y)}},!1===b(E,v))return E.abort(),f(null,"abort",E,v,y),E;var A=!("async"in v)||v.async;if(E.open(v.type,v.url,A,v.username,v.password),v.xhrFields)for(n in v.xhrFields)E[n]=v.xhrFields[n];for(n in w)C.apply(E,w[n]);return v.timeout>0&&(x=setTimeout((function(){E.onreadystatechange=p,E.abort(),f(null,"timeout",E,v,y)}),v.timeout)),E.send(v.data?v.data:null),E},t.get=function(){return t.ajax(v.apply(null,arguments))},t.post=function(){var e=v.apply(null,arguments);return e.type="POST",t.ajax(e)},t.getJSON=function(){var e=v.apply(null,arguments);return e.dataType="json",t.ajax(e)},t.fn.load=function(e,n,r){if(!this.length)return this;var i,o=this,s=e.split(/\s/),l=v(e,n,r),u=l.success;return s.length>1&&(l.url=s[0],i=s[1]),l.success=function(e){o.html(i?t("
").html(e.replace(a,"")).find(i):e),u&&u.apply(o,arguments)},t.ajax(l),this};var y=encodeURIComponent;t.param=function(e,n){var r=[];return r.add=function(e,n){t.isFunction(n)&&(n=n()),null==n&&(n=""),this.push(y(e)+"="+y(n))},function e(n,r,i,a){var o,s=t.isArray(r),l=t.isPlainObject(r);t.each(r,(function(r,u){o=t.type(u),a&&(r=i?a:a+"["+(l||"object"==o||"array"==o?r:"")+"]"),!a&&s?n.add(u.name,u.value):"array"==o||!i&&"object"==o?e(n,u,i,r):n.add(r,u)}))}(r,e,n),r.join("&").replace(/%20/g,"+")}}(n),(e=n).fn.serializeArray=function(){var t,n,r=[],i=function e(n){if(n.forEach)return n.forEach(e);r.push({name:t,value:n})};return this[0]&&e.each(this[0].elements,(function(r,a){n=a.type,(t=a.name)&&"fieldset"!=a.nodeName.toLowerCase()&&!a.disabled&&"submit"!=n&&"reset"!=n&&"button"!=n&&"file"!=n&&("radio"!=n&&"checkbox"!=n||a.checked)&&i(e(a).val())})),r},e.fn.serialize=function(){var t=[];return this.serializeArray().forEach((function(e){t.push(encodeURIComponent(e.name)+"="+encodeURIComponent(e.value))})),t.join("&")},e.fn.submit=function(t){if(0 in arguments)this.bind("submit",t);else if(this.length){var n=e.Event("submit");this.eq(0).trigger(n),n.isDefaultPrevented()||this.get(0).submit()}return this},function(){try{getComputedStyle(void 0)}catch(e){var t=getComputedStyle;window.getComputedStyle=function(e,n){try{return t(e,n)}catch(t){return null}}}}(),n;var e,n}.call(e,n,e,t))||(t.exports=r)},function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e){},function(t,e,n){(function(t){function n(t,e){for(var n=0,r=t.length-1;r>=0;r--){var i=t[r];"."===i?t.splice(r,1):".."===i?(t.splice(r,1),n++):n&&(t.splice(r,1),n--)}if(e)for(;n--;n)t.unshift("..");return t}function r(t,e){if(t.filter)return t.filter(e);for(var n=[],r=0;r=-1&&!i;a--){var o=a>=0?arguments[a]:t.cwd();if("string"!=typeof o)throw new TypeError("Arguments to path.resolve must be strings");o&&(e=o+"/"+e,i="/"===o.charAt(0))}return(i?"/":"")+(e=n(r(e.split("/"),(function(t){return!!t})),!i).join("/"))||"."},e.normalize=function(t){var a=e.isAbsolute(t),o="/"===i(t,-1);return(t=n(r(t.split("/"),(function(t){return!!t})),!a).join("/"))||a||(t="."),t&&o&&(t+="/"),(a?"/":"")+t},e.isAbsolute=function(t){return"/"===t.charAt(0)},e.join=function(){var t=Array.prototype.slice.call(arguments,0);return e.normalize(r(t,(function(t,e){if("string"!=typeof t)throw new TypeError("Arguments to path.join must be strings");return t})).join("/"))},e.relative=function(t,n){function r(t){for(var e=0;e=0&&""===t[n];n--);return e>n?[]:t.slice(e,n-e+1)}t=e.resolve(t).substr(1),n=e.resolve(n).substr(1);for(var i=r(t.split("/")),a=r(n.split("/")),o=Math.min(i.length,a.length),s=o,l=0;l=1;--a)if(47===(e=t.charCodeAt(a))){if(!i){r=a;break}}else i=!1;return-1===r?n?"/":".":n&&1===r?"/":t.slice(0,r)},e.basename=function(t,e){var n=function(t){"string"!=typeof t&&(t+="");var e,n=0,r=-1,i=!0;for(e=t.length-1;e>=0;--e)if(47===t.charCodeAt(e)){if(!i){n=e+1;break}}else-1===r&&(i=!1,r=e+1);return-1===r?"":t.slice(n,r)}(t);return e&&n.substr(-1*e.length)===e&&(n=n.substr(0,n.length-e.length)),n},e.extname=function(t){"string"!=typeof t&&(t+="");for(var e=-1,n=0,r=-1,i=!0,a=0,o=t.length-1;o>=0;--o){var s=t.charCodeAt(o);if(47!==s)-1===r&&(i=!1,r=o+1),46===s?-1===e?e=o:1!==a&&(a=1):-1!==e&&(a=-1);else if(!i){n=o+1;break}}return-1===e||-1===r||0===a||1===a&&e===r-1&&e===n+1?"":t.slice(e,r)};var i="b"==="ab".substr(-1)?function(t,e,n){return t.substr(e,n)}:function(t,e,n){return e<0&&(e=t.length+e),t.substr(e,n)}}).call(this,n(6))},function(t,e,n){"use strict";n.r(e),function(t){var r=n(0),i=n(2),a=n(3);n(13);var o=function(){function n(e){if(h(this,n),this.sel=e,!this.sel)throw new Error("VexTab.Div: invalid selector: "+e);this.code=t(e).text(),t(e).empty(),"static"===t(e).css("position")&&t(e).css("position","relative"),this.width=parseInt(t(e).attr("width"),10)||400,this.height=parseInt(t(e).attr("height"),10)||200,this.scale=parseFloat(t(e).attr("scale"),10)||1,this.rendererBackend=t(e).attr("renderer")||"svg","canvas"===this.rendererBackend.toLowerCase()?(this.canvas=t("").addClass("vex-canvas"),t(e).append(this.canvas),this.renderer=new r.a.Flow.Renderer(this.canvas[0],r.a.Flow.Renderer.Backends.CANVAS)):(this.canvas=t("
").addClass("vex-canvas"),t(e).append(this.canvas),this.renderer=new r.a.Flow.Renderer(this.canvas[0],r.a.Flow.Renderer.Backends.SVG)),this.ctx_sel=t(e).find(".vex-canvas"),this.renderer.resize(this.width,this.height),this.ctx=this.renderer.getContext(),this.ctx.setBackgroundFillStyle(this.ctx_sel.css("background-color")),this.ctx.scale(this.scale,this.scale),this.editor=t(e).attr("editor")||"",this.show_errors=t(e).attr("show-errors")||"",this.editor_width=parseInt(t(e).attr("editor-width"),10)||this.width,this.editor_height=parseInt(t(e).attr("editor-height"),10)||200;var o=this;"true"===this.editor&&(this.text_area=t("").addClass("editor").val(this.code),this.editor_error=t("
").addClass("editor-error"),t(e).append(t("

")).append(this.editor_error),t(e).append(t("

")).append(this.text_area),this.text_area.width(this.editor_width),this.text_area.height(this.editor_height),this.text_area.keyup((function(){o.timeoutID&&window.clearTimeout(o.timeoutID),o.timeoutID=window.setTimeout((function(){o.code!==o.text_area.val()&&(o.code=o.text_area.val(),o.redraw())}),250)}))),"true"===this.show_errors&&(this.editor_error=t("

").addClass("editor-error"),t(e).append(t("

")).append(this.editor_error)),this.artist=new i.a(10,0,this.width,{scale:this.scale}),this.parser=new a.a(this.artist),this.redraw()}return b(n,[{key:"redraw",value:function(){var t=this;return r.a.BM("Total render time: ",(function(){t.parse(),t.draw()})),this}},{key:"drawInternal",value:function(){return this.parser.isValid()?this.artist.draw(this.renderer):this}},{key:"parseInternal",value:function(){try{this.artist.reset(),this.parser.reset(),this.parser.parse(this.code),this.editor_error.empty()}catch(e){this.editor_error&&(this.editor_error.empty(),this.editor_error.append(t("

").addClass("text").html("

Oops!

"+e.message.replace(/(?:\r\n|\r|\n)/g,"
"))))}return this}},{key:"parse",value:function(){var t=this;return r.a.BM("Parse time: ",(function(){t.parseInternal()})),this}},{key:"draw",value:function(){var t=this;return r.a.BM("Draw time: ",(function(){t.drawInternal()})),this}}]),n}();window.VEXTAB_SEL_V3="div.vextab-auto",t((function(){var e;window.VEXTAB_SEL_V3&&(console.log("Running VexTab.Div:","3.0.6-5-g77e1691","master","77e1691568e424ba81797496c934d8cc741c8fb4"),t(e||window.VEXTAB_SEL_V3).forEach((function(t){return new o(t)})))})),e.default=o}.call(this,n(7))},function(t,e,n){"use strict";n.r(e);var r=n(0);n.d(e,"Vex",(function(){return r.a}));var i=n(2);n.d(e,"Artist",(function(){return i.a}));var a=n(3);n.d(e,"VexTab",(function(){return a.a}));var o=n(11);n.d(e,"Div",(function(){return o.default}))},function(t,e,n){var r=n(14),i=n(15);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[t.i,i,""]]);var a=(r(i,{insert:"head",singleton:!1}),i.locals?i.locals:{});t.exports=a},function(t,e,n){"use strict";var r,i=function(){return void 0===r&&(r=Boolean(window&&document&&document.all&&!window.atob)),r},a=function(){var t={};return function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(t){n=null}t[e]=n}return t[e]}}(),o=[];function s(t){for(var e=-1,n=0;n1&&void 0!==arguments[1]?arguments[1]:90;return t.length<=e?t:t.substring(0,e)+"..."}},{key:"sleep",value:function(t){return new Promise((function(e,n){setTimeout((function(){e()}),1e3*t)}))}}],(n=null)&&r(e.prototype,n),i&&r(e,i),t}()},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),n.d(e,"EditorKit",(function(){return u}));var i=n(2),a=n(8);function o(t,e,n,r,i,a,o){try{var s=t[a](o),l=s.value}catch(u){return void n(u)}s.done?e(l):Promise.resolve(l).then(r,i)}function s(t){return function(){var e=this,n=arguments;return new Promise((function(r,i){var a=t.apply(e,n);function s(t){o(a,r,i,s,l,"next",t)}function l(t){o(a,r,i,s,l,"throw",t)}s(void 0)}))}}function l(t,e){for(var n=0;n0){var n=!1,r=!0,i=!1,a=void 0;try{for(var o,s=function(){var r=o.value,i=e.find((function(t){return t.uuid==r}));if(!i)return"continue";n=!0,t.fileIdsPendingAssociation.splice(t.fileIdsPendingAssociation.indexOf(r),1);var a=u.a.insertionSyntaxForFileDescriptor(i);t.delegate.insertRawText(a)},l=t.fileIdsPendingAssociation.slice()[Symbol.iterator]();!(r=(o=l.next()).done);r=!0)s()}catch(c){i=!0,a=c}finally{try{r||null==l.return||l.return()}finally{if(i)throw a}}n&&t.textExpander.searchPatterns()}e.length>0&&t.fileLoader.loadFilesafeElements()})),this.filesafe.addNewFileDescriptorHandler((function(e){t.fileIdsPendingAssociation.push(e.uuid)})),this.fileLoader=new s.a({filesafe:this.filesafe,getElementsBySelector:this.delegate.getElementsBySelector,insertElement:this.delegate.insertElement,preprocessElement:this.delegate.preprocessElement}),this.textExpander=new l.a({afterExpand:function(){t.fileLoader.loadFilesafeElements()},getCurrentLineText:this.delegate.getCurrentLineText,getPreviousLineText:this.delegate.getPreviousLineText,replaceText:this.delegate.replaceText,patterns:[{regex:u.a.FilesafeSyntaxPattern,callback:function(t){return u.a.expandedFilesafeSyntax(t)}}]})}},{key:"connectToBridge",value:function(){var t=this;this.componentManager=new a.a(null,(function(){document.documentElement.classList.add(t.componentManager.platform)})),this.componentManager.coallesedSavingDelay=this.coallesedSavingDelay,this.componentManager.streamContextItem((function(e){var n=!0;if(t.note&&t.note.uuid==e.uuid&&(n=!1),t.supportsFilesafe){var r=t.FilesafeClass.getSFItemClass();t.note=new r(e),t.filesafe.setCurrentNote(t.note)}else t.note=e;if(!e.isMetadataUpdate){var i=e.content.text;"html"==t.mode&&n&&(/<[a-z][\s\S]*>/i.test(i)||(t.ignoreNextTextChange=!0)),t.previousText=i,t.supportsFilesafe&&(t.needsFilesafeElementLoad=!0,i=u.a.expandedFilesafeSyntax(i)),t.delegate.setEditorRawText(i),n&&t.delegate.clearUndoHistory()}}))}},{key:"onEditorKeyUp",value:function(t){var e=t.key,n=t.isSpace,r=t.isEnter;this.textExpander.onKeyUp({key:e,isSpace:n,isEnter:r})}},{key:"onEditorPaste",value:function(){this.textExpander.onKeyUp({isPaste:!0})}},{key:"onEditorValueChanged",value:function(t){var e=this;if(this.needsFilesafeElementLoad&&(this.needsFilesafeElementLoad=!1,this.fileLoader.loadFilesafeElements()),this.ignoreNextTextChange)this.ignoreNextTextChange=!1;else{if(this.supportsFilesafe&&(t=u.a.collapseFilesafeSyntax(t),this.previousText==t))return;this.previousText=t;var n=this.note;n&&this.componentManager.saveItemWithPresave(n,(function(){if(n.content.text=t,e.delegate.generateCustomPreview){var r=e.delegate.generateCustomPreview(t);r.html&&(n.content.preview_html=r.html),r.plain&&(n.content.preview_plain=r.plain)}else{if("html"==e.mode){var i=u.a.removeFilesafeSyntaxFromHtml(t);i=o.a.truncateString(o.a.htmlToText(i)),n.content.preview_plain=i.length>0?i:" "}else n.content.preview_plain=t;n.content.preview_html=null}}))}}},{key:"canUploadFiles",value:function(){var t=this.filesafe.getAllCredentials(),e=this.filesafe.getAllIntegrations();return t.length>0&&e.length>0}},{key:"uploadJSFileObject",value:function(){var t=b(r.mark((function t(e){var n,i=this;return r.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=this.fileLoader.insertStatusAtCursor("Processing file..."),t.abrupt("return",this.filesafe.encryptAndUploadJavaScriptFileObject(e).then((function(t){i.fileLoader.removeCursorStatus(n)})));case 2:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}()}])&&h(e.prototype,i),c&&h(e,c),t}()},function(t,e,n){"use strict";var r=function(){function t(t,e){for(var n=0;n0&&this.requestPermissions(this.initialPermissions);var e=!0,n=!1,r=void 0;try{for(var i,a=this.messageQueue[Symbol.iterator]();!(e=(i=a.next()).done);e=!0){var o=i.value;this.postMessage(o.action,o.data,o.callback)}}catch(s){n=!0,r=s}finally{try{!e&&a.return&&a.return()}finally{if(n)throw r}}this.messageQueue=[],this.loggingEnabled&&console.log("onReadyData",t),this.activateThemes(t.activeThemeUrls||[]),this.onReadyCallback&&this.onReadyCallback()}},{key:"getSelfComponentUUID",value:function(){return this.uuid}},{key:"isRunningInDesktopApplication",value:function(){return"desktop"===this.environment}},{key:"setComponentDataValueForKey",value:function(t,e){this.componentData[t]=e,this.postMessage("set-component-data",{componentData:this.componentData},(function(t){}))}},{key:"clearComponentData",value:function(){this.componentData={},this.postMessage("set-component-data",{componentData:this.componentData},(function(t){}))}},{key:"componentDataValueForKey",value:function(t){return this.componentData[t]}},{key:"postMessage",value:function(t,e,n){if(this.sessionKey){var r={action:t,data:e,messageId:this.generateUUID(),sessionKey:this.sessionKey,api:"component"},i=JSON.parse(JSON.stringify(r));i.callback=n,this.sentMessages.push(i),this.isMobile&&(r=JSON.stringify(r)),this.loggingEnabled&&console.log("Posting message:",r),window.parent.postMessage(r,this.origin)}else this.messageQueue.push({action:t,data:e,callback:n})}},{key:"setSize",value:function(t,e,n){this.postMessage("set-size",{type:t,width:e,height:n},(function(t){}))}},{key:"requestPermissions",value:function(t,e){this.postMessage("request-permissions",{permissions:t},function(t){e&&e()}.bind(this))}},{key:"streamItems",value:function(t,e){Array.isArray(t)||(t=[t]),this.postMessage("stream-items",{content_types:t},function(t){e(t.items)}.bind(this))}},{key:"streamContextItem",value:function(t){var e=this;this.postMessage("stream-context-item",null,(function(n){var r=n.item;(!e.lastStreamedItem||e.lastStreamedItem.uuid!==r.uuid)&&e.pendingSaveTimeout&&(clearTimeout(e.pendingSaveTimeout),e._performSavingOfItems(e.pendingSaveParams),e.pendingSaveTimeout=null,e.pendingSaveParams=null),e.lastStreamedItem=r,t(e.lastStreamedItem)}))}},{key:"selectItem",value:function(t){this.postMessage("select-item",{item:this.jsonObjectForItem(t)})}},{key:"createItem",value:function(t,e){this.postMessage("create-item",{item:this.jsonObjectForItem(t)},function(t){var n=t.item;!n&&t.items&&t.items.length>0&&(n=t.items[0]),this.associateItem(n),e&&e(n)}.bind(this))}},{key:"createItems",value:function(t,e){var n=this,r=t.map((function(t){return n.jsonObjectForItem(t)}));this.postMessage("create-items",{items:r},function(t){e&&e(t.items)}.bind(this))}},{key:"associateItem",value:function(t){this.postMessage("associate-item",{item:this.jsonObjectForItem(t)})}},{key:"deassociateItem",value:function(t){this.postMessage("deassociate-item",{item:this.jsonObjectForItem(t)})}},{key:"clearSelection",value:function(){this.postMessage("clear-selection",{content_type:"Tag"})}},{key:"deleteItem",value:function(t,e){this.deleteItems([t],e)}},{key:"deleteItems",value:function(t,e){var n={items:t.map(function(t){return this.jsonObjectForItem(t)}.bind(this))};this.postMessage("delete-items",n,(function(t){e&&e(t)}))}},{key:"sendCustomEvent",value:function(t,e,n){this.postMessage(t,e,function(t){n&&n(t)}.bind(this))}},{key:"saveItem",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.saveItems([t],e,n)}},{key:"saveItemWithPresave",value:function(t,e,n){this.saveItemsWithPresave([t],e,n)}},{key:"saveItemsWithPresave",value:function(t,e,n){this.saveItems(t,n,!1,e)}},{key:"_performSavingOfItems",value:function(t){var e=t.items,n=t.presave,r=t.callback;n&&n();var i=[],a=!0,o=!1,s=void 0;try{for(var l,u=e[Symbol.iterator]();!(a=(l=u.next()).done);a=!0){var c=l.value;i.push(this.jsonObjectForItem(c))}}catch(b){o=!0,s=b}finally{try{!a&&u.return&&u.return()}finally{if(o)throw s}}this.postMessage("save-items",{items:i},(function(t){r&&r()}))}},{key:"saveItems",value:function(t,e){var n=this,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=arguments[3];if(this.pendingSaveItems||(this.pendingSaveItems=[]),1!=this.coallesedSaving||r)this._performSavingOfItems({items:t,presave:i,callback:e});else{this.pendingSaveTimeout&&clearTimeout(this.pendingSaveTimeout);var a=t.map((function(t){return t.uuid})),o=this.pendingSaveItems.filter((function(t){return!a.includes(t.uuid)}));this.pendingSaveItems=o.concat(t),this.pendingSaveParams={items:this.pendingSaveItems,presave:i,callback:e},this.pendingSaveTimeout=setTimeout((function(){n._performSavingOfItems(n.pendingSaveParams),n.pendingSaveItems=[],n.pendingSaveTimeout=null,n.pendingSaveParams=null}),this.coallesedSavingDelay)}}},{key:"jsonObjectForItem",value:function(t){var e=Object.assign({},t);return e.children=null,e.parent=null,e}},{key:"getItemAppDataValue",value:function(t,e){var n=t.content.appData&&t.content.appData["org.standardnotes.sn"];return n?n[e]:null}},{key:"activateThemes",value:function(t){if(this.loggingEnabled&&console.log("Incoming themes",t),this.activeThemes.sort().toString()!=t.sort().toString()){var e=t||[],n=[],r=!0,i=!1,a=void 0;try{for(var o,s=this.activeThemes[Symbol.iterator]();!(r=(o=s.next()).done);r=!0){var l=o.value;t.includes(l)?e=e.filter((function(t){return t!=l})):n.push(l)}}catch(k){i=!0,a=k}finally{try{!r&&s.return&&s.return()}finally{if(i)throw a}}this.loggingEnabled&&(console.log("Deactivating themes:",n),console.log("Activating themes:",e));var u=!0,c=!1,b=void 0;try{for(var h,f=n[Symbol.iterator]();!(u=(h=f.next()).done);u=!0){var d=h.value;this.deactivateTheme(d)}}catch(k){c=!0,b=k}finally{try{!u&&f.return&&f.return()}finally{if(c)throw b}}this.activeThemes=t;var p=!0,m=!1,v=void 0;try{for(var y,g=e[Symbol.iterator]();!(p=(y=g.next()).done);p=!0){var _=y.value;if(_){var x=document.createElement("link");x.id=btoa(_),x.href=_,x.type="text/css",x.rel="stylesheet",x.media="screen,print",x.className="custom-theme",document.getElementsByTagName("head")[0].appendChild(x)}}}catch(k){m=!0,v=k}finally{try{!p&&g.return&&g.return()}finally{if(m)throw v}}}}},{key:"themeElementForUrl",value:function(t){return Array.from(document.getElementsByClassName("custom-theme")).slice().find((function(e){return e.id==btoa(t)}))}},{key:"deactivateTheme",value:function(t){var e=this.themeElementForUrl(t);e&&(e.disabled=!0,e.parentNode.removeChild(e))}},{key:"generateUUID",value:function(){var t=window.crypto||window.msCrypto;if(t){var e=new Uint32Array(4);t.getRandomValues(e);var n=-1;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){n++;var r=e[n>>3]>>n%8*4&15;return("x"==t?r:3&r|8).toString(16)}))}var r=(new Date).getTime();return window.performance&&"function"===typeof window.performance.now&&(r+=performance.now()),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var e=(r+16*Math.random())%16|0;return r=Math.floor(r/16),("x"==t?e:3&e|8).toString(16)}))}}]),t}();"undefined"!=typeof t&&"undefined"!=typeof t.exports&&(t.exports=i),window&&(window.ComponentManager=i)},function(t,e,n){"use strict";n.d(e,"a",(function(){return s}));var i=n(0);function a(t,e,n,r,i,a,o){try{var s=t[a](o),l=s.value}catch(u){return void n(u)}s.done?e(l):Promise.resolve(l).then(r,i)}function o(t,e){for(var n=0;n0)){t.next=17;break}return t.abrupt("return",{success:!1});case 17:return c=function(){p.currentlyLoadingIds.splice(p.currentlyLoadingIds.indexOf(n),1)},this.currentlyLoadingIds.push(n),this.setStatus("Downloading ".concat(o,"..."),e,n,a),t.next=22,i.a.sleep(.05);case 22:return t.next=24,this.filesafe.downloadFileFromDescriptor(l).catch((function(t){p.setStatus("Unable to download ".concat(o," ").concat(n,"."),e,n,a)}));case 24:if(b=t.sent){t.next=27;break}return t.abrupt("return");case 27:return this.setStatus("Decrypting ".concat(o,"..."),e,n,a),t.next=30,i.a.sleep(.05);case 30:return t.next=32,this.filesafe.decryptFile({fileDescriptor:l,fileItem:b}).catch((function(t){p.setStatus("Unable to decrypt ".concat(o," ").concat(n,"."),e,n,a)}));case 32:if(h=t.sent){t.next=35;break}return t.abrupt("return");case 35:return this.setStatus(null,e,n),t.next=38,i.a.sleep(.05);case 38:return f=l.content.fileType,d=this.filesafe.createTemporaryFileUrl({base64Data:h.decryptedData,dataType:f}),this.insertMediaElement({url:d,fsid:n,fileType:f,fsname:a,fsElement:e}),c(),this.uuidToFileTempUrlAndTypeMapping[n]={url:d,fileType:f,fsname:a},t.abrupt("return",{success:!0});case 44:case"end":return t.stop()}}),t,this)})),function(){var e=this,n=arguments;return new Promise((function(r,i){var o=t.apply(e,n);function s(t){a(o,r,i,s,l,"next",t)}function l(t){a(o,r,i,s,l,"throw",t)}s(void 0)}))});return function(t){return e.apply(this,arguments)}}()},{key:"insertMediaElement",value:function(t){var e,n=t.url,r=t.fsid,i=t.fsname,a=t.fileType,o=t.fsElement,s=this.fileTypeForElementType(a);return e="img"==s?this.createImageElement({url:n,fsid:r,fsname:i,fsElement:o}):"video"==s?this.createVideoElement({url:n,fsid:r,fileType:a,fsname:i,fsElement:o}):"audio"==s?this.createAudioElement({url:n,fsid:r,fsname:i}):this.createDownloadElement({url:n,fsid:r,fileType:a,fsname:i,fsElement:o}),this.insertElementNearElement(e,o),o.remove(),!0}},{key:"wrapElementInTag",value:function(t){var e=t.element,n=t.tagName,r=t.fsid,i=t.fsname,a=document.createElement(n);return a.setAttribute("fsid",r),a.setAttribute("fsname",i),a.setAttribute("fscollapsable",!0),a.setAttribute("contenteditable",!0),a.append(e),a}},{key:"basicwrapElementInTag",value:function(t,e){var n=document.createElement(e);return n.append(t),n}},{key:"createImageElement",value:function(t){var e=t.url,n=t.fsid,r=t.fsname,i=t.fsElement,a=document.createElement("img");return a.setAttribute("src",e),a.setAttribute("srcset","".concat(e," 2x")),a.setAttribute("fsid",n),a.setAttribute("fsname",r),a.setAttribute("fscollapsable",!0),i.getAttribute("width")&&(a.setAttribute("width",i.getAttribute("width")),a.setAttribute("height",i.getAttribute("height"))),a}},{key:"createVideoElement",value:function(t){var e=t.url,n=t.fsid,r=t.fileType,i=t.fsname,a=t.fsElement,o=document.createElement("video");o.setAttribute("controls",!0),o.setAttribute("fsid",n),o.setAttribute("fsname",i),o.setAttribute("fscollapsable",!0),a.getAttribute("width")&&(o.setAttribute("width",a.getAttribute("width")),o.setAttribute("height",a.getAttribute("height")));var s=document.createElement("source");return s.setAttribute("src",e),s.setAttribute("type",r),o.append(s),this.wrapElementInTag({element:o,tagName:"p",fsid:n,fsname:i})}},{key:"createDownloadElement",value:function(t){var e=t.url,n=t.fsid,r=(t.fileType,t.fsname),i=(t.fsElement,document.createElement("a"));return i.setAttribute("fsid",n),i.setAttribute("fsname",r),i.setAttribute("ghost","true"),i.setAttribute("fscollapsable",!0),i.setAttribute("href",e),i.textContent="".concat(r),i}},{key:"createAudioElement",value:function(t){var e=t.url,n=t.fsid,r=t.fsname,i=document.createElement("audio");return i.setAttribute("src",e),i.setAttribute("controls",!0),i.setAttribute("fsid",n),i.setAttribute("fsname",r),i.setAttribute("fscollapsable",!0),this.wrapElementInTag({element:i,tagName:"p",fsid:n,fsname:r})}},{key:"setStatus",value:function(t,e,n,r,i){if(n){var a=this.statusElementMapping[n];a&&(a.remove(),delete this.statusElementMapping[n])}if(t){var o=document.createElement("label");return o.setAttribute("id",n),o.setAttribute("ghost","true"),o.setAttribute("contenteditable",!1),o.style.fontWeight="bold",o.textContent=t,i&&(o.style.userSelect="all"),o=this.insertElementNearElement(o,e),n&&(this.statusElementMapping[n]=o),o}}},{key:"insertStatusAtCursor",value:function(t){var e=Math.random().toString(36).substring(7);return this.setStatus(t,null,e),e}},{key:"removeCursorStatus",value:function(t){var e=this.getElementsBySelector("#".concat(t));e.length>0&&e[0].remove()}},{key:"insertElementNearElement",value:function(t,e){var n=this.preprocessElement(t),r="child";if("figure"==n.tagName.toLowerCase()){var i=e.closest("p");i&&(e=i,r="afterend")}return this.insertElement(n,e,r),n}}])&&o(e.prototype,n),s&&o(e,s),t}()},function(t,e,n){"use strict";function r(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{},n=e.searchPreviousLine;t=n?this.getPreviousLineText():this.getCurrentLineText();var r=!0,i=!1,a=void 0;try{for(var o,s=this.patterns[Symbol.iterator]();!(r=(o=s.next()).done);r=!0){var l=o.value,u=l.regex.exec(t);if(u){var c=u[0];if(c){var b=l.callback(c);this.replaceSelection(l.regex,b,n)}}}}catch(h){i=!0,a=h}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}}},{key:"replaceSelection",value:function(t,e,n){this.beforeExpand&&this.beforeExpand(),this.replaceText({regex:t,replacement:e,previousLine:n}),this.afterExpand&&this.afterExpand()}}])&&r(e.prototype,n),i&&r(e,i),t}()},function(t,e,n){"use strict";function r(t,e){for(var n=0;n","")).replace("

","")).replace("[","").replace("]","")).split(":"),n=e[1],r=e[2],i=e[3],a="";if(i){var o=i.split("x");a="width=".concat(o[0]," height=").concat(o[1])}return"

")}},{key:"collapseFilesafeSyntax",value:function(t){var e=(new DOMParser).parseFromString(t,"text/html"),n=e.querySelectorAll("*[fscollapsable]"),r=!0,i=!1,a=void 0;try{for(var o,s=n[Symbol.iterator]();!(r=(o=s.next()).done);r=!0){var l=o.value,u=l.getAttribute("fsid"),c=l.getAttribute("fsname"),b=l.getAttribute("width"),h=l.getAttribute("height"),f=["FileSafe",u,c];if(b||h){var d="".concat(b,"x").concat(h);f.push(d)}var p="

[".concat(f.join(":"),"]

");l.insertAdjacentHTML("afterend",p),l.remove()}}catch(m){i=!0,a=m}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return e.querySelectorAll("*[ghost]").forEach((function(t){t.remove()})),e.body.innerHTML}}],(n=null)&&r(e.prototype,n),i&&r(e,i),t}();o=/(

)?\[FileSafe[^\]]*\](<\/p>)?/g,(a="FilesafeSyntaxPattern")in(i=s)?Object.defineProperty(i,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):i[a]=o},function(t,e){t.exports=n(27)},function(t,e,n){"use strict";n.d(e,"a",(function(){return r}));var r=function t(e){var n=e.insertRawText,r=e.onReceiveNote,i=e.setEditorRawText,a=e.getCurrentLineText,o=e.getPreviousLineText,s=e.replaceText,l=e.getElementsBySelector,u=e.insertElement,c=e.preprocessElement,b=e.clearUndoHistory,h=e.generateCustomPreview;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.insertRawText=n,this.onReceiveNote=r,this.setEditorRawText=i,this.getCurrentLineText=a,this.getPreviousLineText=o,this.replaceText=s,this.getElementsBySelector=l,this.insertElement=u,this.preprocessElement=c,this.clearUndoHistory=b,this.generateCustomPreview=h}}])},function(t,e,n){t.exports=n(26)},function(t,e){t.exports=function(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}},function(t,e){t.exports=function(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);nt.length)&&(e=t.length);for(var n=0,r=new Array(e);n=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,l=!1;return{s:function(){n=t[Symbol.iterator]()},n:function(){var t=n.next();return s=t.done,t},e:function(t){l=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(l)throw o}}}}n.d(e,"a",(function(){return i}))},function(t,e,n){"use strict";function r(t,e){return(r=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function i(t,e){if("function"!==typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&r(t,e)}n.d(e,"a",(function(){return i}))},function(t,e,n){"use strict";n(4);var r=n(1),i=60103;if(e.Fragment=60107,"function"===typeof Symbol&&Symbol.for){var a=Symbol.for;i=a("react.element"),e.Fragment=a("react.fragment")}var o=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s=Object.prototype.hasOwnProperty,l={key:!0,ref:!0,__self:!0,__source:!0};function u(t,e,n){var r,a={},u=null,c=null;for(r in void 0!==n&&(u=""+n),void 0!==e.key&&(u=""+e.key),void 0!==e.ref&&(c=e.ref),e)s.call(e,r)&&!l.hasOwnProperty(r)&&(a[r]=e[r]);if(t&&t.defaultProps)for(r in e=t.defaultProps)void 0===a[r]&&(a[r]=e[r]);return{$$typeof:i,type:t,key:u,ref:c,props:a,_owner:o.current}}e.jsx=u,e.jsxs=u},function(t,e,n){"use strict";var r=n(4),i=60103,a=60106;e.Fragment=60107,e.StrictMode=60108,e.Profiler=60114;var o=60109,s=60110,l=60112;e.Suspense=60113;var u=60115,c=60116;if("function"===typeof Symbol&&Symbol.for){var b=Symbol.for;i=b("react.element"),a=b("react.portal"),e.Fragment=b("react.fragment"),e.StrictMode=b("react.strict_mode"),e.Profiler=b("react.profiler"),o=b("react.provider"),s=b("react.context"),l=b("react.forward_ref"),e.Suspense=b("react.suspense"),u=b("react.memo"),c=b("react.lazy")}var h="function"===typeof Symbol&&Symbol.iterator;function f(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,n=1;n

\").html(e.replace(o,\"\")).find(s):e),l&&l.apply(r,arguments)},t.ajax(a),this};var g=encodeURIComponent;t.param=function(e,i){var n=[];return n.add=function(e,i){t.isFunction(i)&&(i=i()),null==i&&(i=\"\"),this.push(g(e)+\"=\"+g(i))},function e(i,n,s,o){var r,b=t.isArray(n),a=t.isPlainObject(n);t.each(n,(function(n,l){r=t.type(l),o&&(n=s?o:o+\"[\"+(a||\"object\"==r||\"array\"==r?n:\"\")+\"]\"),!o&&b?i.add(l.name,l.value):\"array\"==r||!s&&\"object\"==r?e(i,l,s,n):i.add(n,l)}))}(n,e,i),n.join(\"&\").replace(/%20/g,\"+\")}}(i),(e=i).fn.serializeArray=function(){var t,i,n=[],s=function(e){if(e.forEach)return e.forEach(s);n.push({name:t,value:e})};return this[0]&&e.each(this[0].elements,(function(n,o){i=o.type,(t=o.name)&&\"fieldset\"!=o.nodeName.toLowerCase()&&!o.disabled&&\"submit\"!=i&&\"reset\"!=i&&\"button\"!=i&&\"file\"!=i&&(\"radio\"!=i&&\"checkbox\"!=i||o.checked)&&s(e(o).val())})),n},e.fn.serialize=function(){var t=[];return this.serializeArray().forEach((function(e){t.push(encodeURIComponent(e.name)+\"=\"+encodeURIComponent(e.value))})),t.join(\"&\")},e.fn.submit=function(t){if(0 in arguments)this.bind(\"submit\",t);else if(this.length){var i=e.Event(\"submit\");this.eq(0).trigger(i),i.isDefaultPrevented()||this.get(0).submit()}return this},function(){try{getComputedStyle(void 0)}catch(e){var t=getComputedStyle;window.getComputedStyle=function(e,i){try{return t(e,i)}catch(t){return null}}}}(),i;var e,i}.call(e,i,e,t))||(t.exports=n)},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){},function(t,e,i){(function(t){function i(t,e){for(var i=0,n=t.length-1;n>=0;n--){var s=t[n];\".\"===s?t.splice(n,1):\"..\"===s?(t.splice(n,1),i++):i&&(t.splice(n,1),i--)}if(e)for(;i--;i)t.unshift(\"..\");return t}function n(t,e){if(t.filter)return t.filter(e);for(var i=[],n=0;n=-1&&!s;o--){var r=o>=0?arguments[o]:t.cwd();if(\"string\"!=typeof r)throw new TypeError(\"Arguments to path.resolve must be strings\");r&&(e=r+\"/\"+e,s=\"/\"===r.charAt(0))}return(s?\"/\":\"\")+(e=i(n(e.split(\"/\"),(function(t){return!!t})),!s).join(\"/\"))||\".\"},e.normalize=function(t){var o=e.isAbsolute(t),r=\"/\"===s(t,-1);return(t=i(n(t.split(\"/\"),(function(t){return!!t})),!o).join(\"/\"))||o||(t=\".\"),t&&r&&(t+=\"/\"),(o?\"/\":\"\")+t},e.isAbsolute=function(t){return\"/\"===t.charAt(0)},e.join=function(){var t=Array.prototype.slice.call(arguments,0);return e.normalize(n(t,(function(t,e){if(\"string\"!=typeof t)throw new TypeError(\"Arguments to path.join must be strings\");return t})).join(\"/\"))},e.relative=function(t,i){function n(t){for(var e=0;e=0&&\"\"===t[i];i--);return e>i?[]:t.slice(e,i-e+1)}t=e.resolve(t).substr(1),i=e.resolve(i).substr(1);for(var s=n(t.split(\"/\")),o=n(i.split(\"/\")),r=Math.min(s.length,o.length),b=r,a=0;a=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)},e.basename=function(t,e){var i=function(t){\"string\"!=typeof t&&(t+=\"\");var e,i=0,n=-1,s=!0;for(e=t.length-1;e>=0;--e)if(47===t.charCodeAt(e)){if(!s){i=e+1;break}}else-1===n&&(s=!1,n=e+1);return-1===n?\"\":t.slice(i,n)}(t);return e&&i.substr(-1*e.length)===e&&(i=i.substr(0,i.length-e.length)),i},e.extname=function(t){\"string\"!=typeof t&&(t+=\"\");for(var e=-1,i=0,n=-1,s=!0,o=0,r=t.length-1;r>=0;--r){var b=t.charCodeAt(r);if(47!==b)-1===n&&(s=!1,n=r+1),46===b?-1===e?e=r:1!==o&&(o=1):-1!==e&&(o=-1);else if(!s){i=r+1;break}}return-1===e||-1===n||0===o||1===o&&e===n-1&&e===i+1?\"\":t.slice(e,n)};var s=\"b\"===\"ab\".substr(-1)?function(t,e,i){return t.substr(e,i)}:function(t,e,i){return e<0&&(e=t.length+e),t.substr(e,i)}}).call(this,i(6))},function(t,e,i){\"use strict\";i.r(e),function(t){var n=i(0),s=i(2),o=i(3);i(13);class r{constructor(e){if(this.sel=e,!this.sel)throw new Error(\"VexTab.Div: invalid selector: \"+e);this.code=t(e).text(),t(e).empty(),\"static\"===t(e).css(\"position\")&&t(e).css(\"position\",\"relative\"),this.width=parseInt(t(e).attr(\"width\"),10)||400,this.height=parseInt(t(e).attr(\"height\"),10)||200,this.scale=parseFloat(t(e).attr(\"scale\"),10)||1,this.rendererBackend=t(e).attr(\"renderer\")||\"svg\",\"canvas\"===this.rendererBackend.toLowerCase()?(this.canvas=t(\"\").addClass(\"vex-canvas\"),t(e).append(this.canvas),this.renderer=new n.a.Flow.Renderer(this.canvas[0],n.a.Flow.Renderer.Backends.CANVAS)):(this.canvas=t(\"
\").addClass(\"vex-canvas\"),t(e).append(this.canvas),this.renderer=new n.a.Flow.Renderer(this.canvas[0],n.a.Flow.Renderer.Backends.SVG)),this.ctx_sel=t(e).find(\".vex-canvas\"),this.renderer.resize(this.width,this.height),this.ctx=this.renderer.getContext(),this.ctx.setBackgroundFillStyle(this.ctx_sel.css(\"background-color\")),this.ctx.scale(this.scale,this.scale),this.editor=t(e).attr(\"editor\")||\"\",this.show_errors=t(e).attr(\"show-errors\")||\"\",this.editor_width=parseInt(t(e).attr(\"editor-width\"),10)||this.width,this.editor_height=parseInt(t(e).attr(\"editor-height\"),10)||200;const i=this;\"true\"===this.editor&&(this.text_area=t(\"\").addClass(\"editor\").val(this.code),this.editor_error=t(\"
\").addClass(\"editor-error\"),t(e).append(t(\"

\")).append(this.editor_error),t(e).append(t(\"

\")).append(this.text_area),this.text_area.width(this.editor_width),this.text_area.height(this.editor_height),this.text_area.keyup(()=>{i.timeoutID&&window.clearTimeout(i.timeoutID),i.timeoutID=window.setTimeout(()=>{i.code!==i.text_area.val()&&(i.code=i.text_area.val(),i.redraw())},250)})),\"true\"===this.show_errors&&(this.editor_error=t(\"

\").addClass(\"editor-error\"),t(e).append(t(\"

\")).append(this.editor_error)),this.artist=new s.a(10,0,this.width,{scale:this.scale}),this.parser=new o.a(this.artist),this.redraw()}redraw(){const t=this;return n.a.BM(\"Total render time: \",()=>{t.parse(),t.draw()}),this}drawInternal(){return this.parser.isValid()?this.artist.draw(this.renderer):this}parseInternal(){try{this.artist.reset(),this.parser.reset(),this.parser.parse(this.code),this.editor_error.empty()}catch(e){this.editor_error&&(this.editor_error.empty(),this.editor_error.append(t(\"

\").addClass(\"text\").html(\"

Oops!

\"+e.message.replace(/(?:\\r\\n|\\r|\\n)/g,\"
\"))))}return this}parse(){return n.a.BM(\"Parse time: \",()=>{this.parseInternal()}),this}draw(){return n.a.BM(\"Draw time: \",()=>{this.drawInternal()}),this}}window.VEXTAB_SEL_V3=\"div.vextab-auto\",t(()=>{var e;window.VEXTAB_SEL_V3&&(console.log(\"Running VexTab.Div:\",\"3.0.6-5-g77e1691\",\"master\",\"77e1691568e424ba81797496c934d8cc741c8fb4\"),t(e||window.VEXTAB_SEL_V3).forEach(t=>new r(t)))}),e.default=r}.call(this,i(7))},function(t,e,i){\"use strict\";i.r(e);var n=i(0);i.d(e,\"Vex\",(function(){return n.a}));var s=i(2);i.d(e,\"Artist\",(function(){return s.a}));var o=i(3);i.d(e,\"VexTab\",(function(){return o.a}));var r=i(11);i.d(e,\"Div\",(function(){return r.default}))},function(t,e,i){var n=i(14),s=i(15);\"string\"==typeof(s=s.__esModule?s.default:s)&&(s=[[t.i,s,\"\"]]);var o={insert:\"head\",singleton:!1},r=(n(s,o),s.locals?s.locals:{});t.exports=r},function(t,e,i){\"use strict\";var n,s=function(){return void 0===n&&(n=Boolean(window&&document&&document.all&&!window.atob)),n},o=function(){var t={};return function(e){if(void 0===t[e]){var i=document.querySelector(e);if(window.HTMLIFrameElement&&i instanceof window.HTMLIFrameElement)try{i=i.contentDocument.head}catch(t){i=null}t[e]=i}return t[e]}}(),r=[];function b(t){for(var e=-1,i=0;i {\n setTimeout(function () {\n resolve();\n }, seconds * 1000);\n })\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/lib/Util.js","import EditorKitInternal from \"./lib/EditorKitInternal\";\nimport EditorKitDelegate from \"./EditorKitDelegate\"\n\nclass EditorKit {\n\n /*\n @param EditorKitDelegate `delegate`: The instance responsible for handling editor-specific events\n @param string `mode`: one of 'plaintext', 'html', 'markdown'\n @param bool `supportsFilesafe`\n @param int `coallesedSavingDelay`:\n For ComponentManager saving, what the debouncer ms delay should be set to.\n Defaults to 250ms.\n */\n constructor({delegate, mode = 'plaintext', supportsFilesafe = false, coallesedSavingDelay = 250}) {\n this.delegate = delegate;\n this.mode = mode;\n this.supportsFilesafe = supportsFilesafe;\n this.coallesedSavingDelay = coallesedSavingDelay;\n\n this.internal = new EditorKitInternal({delegate, mode, supportsFilesafe, coallesedSavingDelay});\n }\n\n /*\n Public\n */\n\n async getFilesafe() {\n return this.internal.getFilesafe();\n }\n\n /*\n Called by consumer when the editor has a change/input event\n */\n onEditorValueChanged(text) {\n this.internal.onEditorValueChanged(text);\n }\n\n /*\n Called by consumer when the editor has a keyup event\n */\n onEditorKeyUp({key, isSpace, isEnter}) {\n this.internal.onEditorKeyUp({key, isSpace, isEnter});\n }\n\n /*\n Called by consumer when user pastes into editor\n */\n onEditorPaste() {\n this.internal.onEditorPaste();\n }\n\n /*\n Whether or not filesafe is configured with integrations and keys, and can handle file uploads.\n If not, user should open files modal and configure FileSafe.\n */\n canUploadFiles() {\n return this.internal.canUploadFiles();\n }\n\n /*\n Returns a file descriptor if successful.\n */\n async uploadJSFileObject(file) {\n return this.internal.uploadJSFileObject(file);\n }\n}\n\nexport {EditorKit, EditorKitDelegate}\n\n\n\n// WEBPACK FOOTER //\n// ./src/EditorKit.js","import ComponentManager from 'sn-components-api';\n\nimport Util from \"./Util.js\"\nimport FileLoader from \"./FileLoader.js\"\nimport TextExpander from \"./TextExpander.js\"\nimport FilesafeHtml from \"./FilesafeHtml.js\"\n\nexport default class EditorKit {\n\n constructor({delegate, mode, supportsFilesafe, coallesedSavingDelay = 250}) {\n this.delegate = delegate;\n this.mode = mode;\n this.supportsFilesafe = supportsFilesafe;\n this.coallesedSavingDelay = coallesedSavingDelay;\n\n /*\n When we upload a file, we want to associate it with the current note.\n The best way to ensure that files are in sync with the filesafe client is to wait\n until the componentMananger has received the file descriptor item back from SN.\n So, upon being notified that files have changed, we'll sift through this array\n and associate any pending files.\n */\n this.fileIdsPendingAssociation = [];\n\n this.connectToBridge();\n\n // Conditionally import filesafe-js. This way, consumers using editor-kit\n // who don't want FileSafe support don't have to import a large module.\n // Consumers who do want FileSafe support must include filesafe-js in their own package.json\n // Note that filesafe-js is set as an \"external\" in webpack.config, so it is not included in the EditorKit bundle\n if(supportsFilesafe) {\n this.filesafeImportPromise = this.importFilesafe();\n }\n }\n\n async importFilesafe() {\n return import(\"filesafe-js\").then((result) => {\n this.FilesafeClass = result.default;\n this.configureFilesafe();\n return this.filesafe;\n });\n }\n\n async getFilesafe() {\n if(!this.filesafe || this.filesafeImportPromise) {\n if(this.filesafeImportPromise) {\n return this.filesafeImportPromise;\n }\n } else {\n return this.importFilesafe();\n }\n }\n\n configureFilesafe() {\n this.filesafe = new this.FilesafeClass({componentManager: this.componentManager});\n\n this.filesafe.addDataChangeObserver(() => {\n // Reload UI by querying Filesafe for changes\n let allFileDescriptors = this.filesafe.getAllFileDescriptors();\n\n if(this.note && this.fileIdsPendingAssociation.length > 0) {\n let hasMatch = false;\n for(let uuid of this.fileIdsPendingAssociation.slice()) {\n let descriptor = allFileDescriptors.find((candidate) => candidate.uuid == uuid);\n if(!descriptor) {\n continue;\n }\n\n hasMatch = true;\n this.fileIdsPendingAssociation.splice(this.fileIdsPendingAssociation.indexOf(uuid), 1);\n\n let syntax = FilesafeHtml.insertionSyntaxForFileDescriptor(descriptor);\n this.delegate.insertRawText(syntax);\n }\n\n if(hasMatch) {\n this.textExpander.searchPatterns()\n }\n }\n\n if(allFileDescriptors.length > 0) {\n this.fileLoader.loadFilesafeElements();\n }\n });\n\n this.filesafe.addNewFileDescriptorHandler((fileDescriptor) => {\n // Called when a new file is uploaded. We'll wait until the bridge acknowledges\n // receipt of this item, and then it will be added to the editor.\n this.fileIdsPendingAssociation.push(fileDescriptor.uuid);\n })\n\n this.fileLoader = new FileLoader({\n filesafe: this.filesafe,\n getElementsBySelector: this.delegate.getElementsBySelector,\n insertElement: this.delegate.insertElement,\n preprocessElement: this.delegate.preprocessElement\n });\n\n this.textExpander = new TextExpander({\n afterExpand: () => {\n this.fileLoader.loadFilesafeElements();\n },\n getCurrentLineText: this.delegate.getCurrentLineText,\n getPreviousLineText: this.delegate.getPreviousLineText,\n replaceText: this.delegate.replaceText,\n patterns: [{\n regex: FilesafeHtml.FilesafeSyntaxPattern,\n callback: (matchedText) => {\n return FilesafeHtml.expandedFilesafeSyntax(matchedText);\n }\n }]\n });\n }\n\n connectToBridge() {\n this.componentManager = new ComponentManager(null, () => {\n // On ready and permissions authorization\n document.documentElement.classList.add(this.componentManager.platform);\n });\n\n // The editor does some debouncing for us, so we'll lower the default debounce value from 250 to 150\n this.componentManager.coallesedSavingDelay = this.coallesedSavingDelay;\n\n this.componentManager.streamContextItem((note) => {\n // Todo: if note has changed, release previous temp object urls\n let isNewNoteLoad = true;\n if(this.note && this.note.uuid == note.uuid) {\n isNewNoteLoad = false;\n }\n\n if(this.supportsFilesafe) {\n let itemClass = this.FilesafeClass.getSFItemClass();\n this.note = new itemClass(note);\n\n this.filesafe.setCurrentNote(this.note);\n } else {\n this.note = note;\n }\n\n // Only update UI on non-metadata updates.\n if(note.isMetadataUpdate) { return; }\n\n let text = note.content.text;\n\n // If we're an html editor, and we're dealing with a new note\n // check to see if it's in html format.\n // If it's not, we don't want to convert it to HTML until the user makes an explicit change\n // So we'll ignore the next change event in this case\n if(this.mode == \"html\" && isNewNoteLoad) {\n let isHtml = /<[a-z][\\s\\S]*>/i.test(text);\n if(!isHtml) {\n this.ignoreNextTextChange = true;\n }\n }\n\n // Set before expanding. We want this value to always be the collapsed value\n this.previousText = text;\n\n if(this.supportsFilesafe) {\n // We want to expand any filesafe syntax in the text, but only after the text has been inserted. (Will be checked on editor change callback)\n this.needsFilesafeElementLoad = true;\n\n text = FilesafeHtml.expandedFilesafeSyntax(text);\n }\n\n this.delegate.setEditorRawText(text);\n\n if(isNewNoteLoad) {\n this.delegate.clearUndoHistory();\n }\n });\n }\n\n onEditorKeyUp({key, isSpace, isEnter}) {\n this.textExpander.onKeyUp({key, isSpace, isEnter});\n }\n\n onEditorPaste() {\n this.textExpander.onKeyUp({isPaste: true});\n }\n\n onEditorValueChanged(text) {\n if(this.needsFilesafeElementLoad) {\n this.needsFilesafeElementLoad = false;\n this.fileLoader.loadFilesafeElements();\n }\n\n if(this.ignoreNextTextChange) {\n this.ignoreNextTextChange = false;\n return;\n }\n\n if(this.supportsFilesafe) {\n text = FilesafeHtml.collapseFilesafeSyntax(text);\n\n // Change events may be triggered several times when expanding filesafe syntax.\n // Ultimately, while the visual layer is changing a lot, the underlying text layer,\n // after being collapsed, will not change. So we'll compare the previous html to new collapsed html before continuing\n let sameText = this.previousText == text;\n if(sameText) {\n return;\n }\n }\n\n this.previousText = text;\n\n let note = this.note;\n if(note) {\n this.componentManager.saveItemWithPresave(note, () => {\n note.content.text = text;\n if(this.delegate.generateCustomPreview) {\n let result = this.delegate.generateCustomPreview(text);\n if(result.html) {\n note.content.preview_html = result.html;\n }\n if(result.plain) {\n note.content.preview_plain = result.plain;\n }\n }\n else {\n if(this.mode == 'html') {\n let preview = FilesafeHtml.removeFilesafeSyntaxFromHtml(text);\n preview = Util.truncateString(Util.htmlToText(preview));\n // If the preview has no length due to either being an empty note, or having just 1 FileSafe file\n // that is stripped above, then we don't want to set to empty string, otherwise SN app will default to content\n // for preview. We'll set a whitespace preview instead so SN doesn't go based on innate content.\n note.content.preview_plain = preview.length > 0 ? preview : \" \";\n } else {\n note.content.preview_plain = text;\n }\n // We're only using plain in this block.\n note.content.preview_html = null;\n }\n });\n }\n }\n\n canUploadFiles() {\n let credentials = this.filesafe.getAllCredentials();\n let integrations = this.filesafe.getAllIntegrations();\n return credentials.length > 0 && integrations.length > 0;\n }\n\n async uploadJSFileObject(file) {\n let status = this.fileLoader.insertStatusAtCursor(\"Processing file...\");\n return this.filesafe.encryptAndUploadJavaScriptFileObject(file).then((descriptor) => {\n this.fileLoader.removeCursorStatus(status);\n })\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/lib/EditorKitInternal.js","class ComponentManager {\n\n constructor(permissions, onReady) {\n this.sentMessages = [];\n this.messageQueue = [];\n this.loggingEnabled = false;\n this.acceptsThemes = true;\n this.activeThemes = [];\n\n this.initialPermissions = permissions;\n this.onReadyCallback = onReady;\n\n this.coallesedSaving = true;\n this.coallesedSavingDelay = 250;\n\n this.registerMessageHandler();\n }\n\n registerMessageHandler() {\n let messageHandler = (event) => {\n if (this.loggingEnabled) { console.log(\"Components API Message received:\", event.data)}\n\n // The first message will be the most reliable one, so we won't change it after any subsequent events,\n // in case you receive an event from another window.\n if(!this.origin) {\n this.origin = event.origin;\n }\n\n // Mobile environment sends data as JSON string\n let data = event.data;\n let parsedData = typeof data === \"string\" ? JSON.parse(data) : data;\n this.handleMessage(parsedData);\n }\n\n /*\n Mobile (React Native) uses `document`, web/desktop uses `window`.addEventListener\n for postMessage API to work properly.\n\n Update May 2019:\n As part of transitioning React Native webview into the community package,\n we'll now only need to use window.addEventListener.\n\n However, we want to maintain backward compatibility for Mobile < v3.0.5, so we'll keep document.addEventListener\n\n Also, even with the new version of react-native-webview, Android may still require document.addEventListener (while iOS still only requires window.addEventListener)\n https://github.com/react-native-community/react-native-webview/issues/323#issuecomment-467767933\n */\n\n document.addEventListener(\"message\", function (event) {\n messageHandler(event);\n }, false);\n\n window.addEventListener(\"message\", function (event) {\n messageHandler(event);\n }, false);\n }\n\n handleMessage(payload) {\n if(payload.action === \"component-registered\") {\n this.sessionKey = payload.sessionKey;\n this.componentData = payload.componentData;\n\n this.onReady(payload.data);\n\n if(this.loggingEnabled) {\n console.log(\"Component successfully registered with payload:\", payload);\n }\n\n } else if(payload.action === \"themes\") {\n if(this.acceptsThemes) {\n this.activateThemes(payload.data.themes);\n }\n }\n\n else if(payload.original) {\n // get callback from queue\n var originalMessage = this.sentMessages.filter(function(message){\n return message.messageId === payload.original.messageId;\n })[0];\n\n if(!originalMessage) {\n // Connection must have been reset. Alert the user.\n alert(\"This extension is attempting to communicate with Standard Notes, but an error is preventing it from doing so. Please restart this extension and try again.\")\n }\n\n if(originalMessage.callback) {\n originalMessage.callback(payload.data);\n }\n }\n }\n\n onReady(data) {\n this.environment = data.environment;\n this.platform = data.platform;\n this.uuid = data.uuid;\n this.isMobile = this.environment == \"mobile\";\n\n if(this.initialPermissions && this.initialPermissions.length > 0) {\n this.requestPermissions(this.initialPermissions);\n }\n\n for(var message of this.messageQueue) {\n this.postMessage(message.action, message.data, message.callback);\n }\n\n this.messageQueue = [];\n\n if(this.loggingEnabled) { console.log(\"onReadyData\", data); }\n\n this.activateThemes(data.activeThemeUrls || []);\n\n if(this.onReadyCallback) {\n this.onReadyCallback();\n }\n }\n\n getSelfComponentUUID() {\n return this.uuid;\n }\n\n isRunningInDesktopApplication() {\n return this.environment === \"desktop\";\n }\n\n setComponentDataValueForKey(key, value) {\n this.componentData[key] = value;\n this.postMessage(\"set-component-data\", {componentData: this.componentData}, function(data){});\n }\n\n clearComponentData() {\n this.componentData = {};\n this.postMessage(\"set-component-data\", {componentData: this.componentData}, function(data){});\n }\n\n componentDataValueForKey(key) {\n return this.componentData[key];\n }\n\n postMessage(action, data, callback) {\n if(!this.sessionKey) {\n this.messageQueue.push({\n action: action,\n data: data,\n callback: callback\n });\n return;\n }\n\n var message = {\n action: action,\n data: data,\n messageId: this.generateUUID(),\n sessionKey: this.sessionKey,\n api: \"component\"\n }\n\n var sentMessage = JSON.parse(JSON.stringify(message));\n sentMessage.callback = callback;\n this.sentMessages.push(sentMessage);\n\n // Mobile (React Native) requires a string for the postMessage API.\n if(this.isMobile) {\n message = JSON.stringify(message);\n }\n\n if(this.loggingEnabled) {\n console.log(\"Posting message:\", message);\n }\n\n window.parent.postMessage(message, this.origin);\n }\n\n setSize(type, width, height) {\n this.postMessage(\"set-size\", {type: type, width: width, height: height}, function(data){\n\n })\n }\n\n requestPermissions(permissions, callback) {\n this.postMessage(\"request-permissions\", {permissions: permissions}, function(data){\n callback && callback();\n }.bind(this));\n }\n\n streamItems(contentTypes, callback) {\n if(!Array.isArray(contentTypes)) {\n contentTypes = [contentTypes];\n }\n this.postMessage(\"stream-items\", {content_types: contentTypes}, function(data){\n callback(data.items);\n }.bind(this));\n }\n\n streamContextItem(callback) {\n this.postMessage(\"stream-context-item\", null, (data) => {\n let item = data.item;\n /*\n If this is a new context item than the context item the component was currently entertaining,\n we want to immediately commit any pending saves, because if you send the new context item to the\n component before it has commited its presave, it will end up first replacing the UI with new context item,\n and when the debouncer executes to read the component UI, it will be reading the new UI for the previous item.\n */\n let isNewItem = !this.lastStreamedItem || this.lastStreamedItem.uuid !== item.uuid;\n if(isNewItem && this.pendingSaveTimeout) {\n clearTimeout(this.pendingSaveTimeout);\n this._performSavingOfItems(this.pendingSaveParams);\n this.pendingSaveTimeout = null;\n this.pendingSaveParams = null;\n }\n this.lastStreamedItem = item;\n callback(this.lastStreamedItem);\n });\n }\n\n selectItem(item) {\n this.postMessage(\"select-item\", {item: this.jsonObjectForItem(item)});\n }\n\n createItem(item, callback) {\n this.postMessage(\"create-item\", {item: this.jsonObjectForItem(item)}, function(data){\n var item = data.item;\n\n // A previous version of the SN app had an issue where the item in the reply to create-item\n // would be nested inside \"items\" and not \"item\". So handle both cases here.\n if(!item && data.items && data.items.length > 0) {\n item = data.items[0];\n }\n\n this.associateItem(item);\n callback && callback(item);\n }.bind(this));\n }\n\n createItems(items, callback) {\n let mapped = items.map((item) => {return this.jsonObjectForItem(item)});\n this.postMessage(\"create-items\", {items: mapped}, function(data){\n callback && callback(data.items);\n }.bind(this));\n }\n\n associateItem(item) {\n this.postMessage(\"associate-item\", {item: this.jsonObjectForItem(item)});\n }\n\n deassociateItem(item) {\n this.postMessage(\"deassociate-item\", {item: this.jsonObjectForItem(item)});\n }\n\n clearSelection() {\n this.postMessage(\"clear-selection\", {content_type: \"Tag\"});\n }\n\n deleteItem(item, callback) {\n this.deleteItems([item], callback);\n }\n\n deleteItems(items, callback) {\n var params = {\n items: items.map(function(item){\n return this.jsonObjectForItem(item);\n }.bind(this))\n };\n\n this.postMessage(\"delete-items\", params, (data) => {\n callback && callback(data);\n });\n }\n\n sendCustomEvent(action, data, callback) {\n this.postMessage(action, data, function(data){\n callback && callback(data);\n }.bind(this));\n }\n\n saveItem(item, callback, skipDebouncer = false) {\n this.saveItems([item], callback, skipDebouncer);\n }\n\n /* Presave allows clients to perform any actions last second before the save actually occurs (like setting previews).\n Saves debounce by default, so if a client needs to compute a property on an item before saving, it's best to\n hook into the debounce cycle so that clients don't have to implement their own debouncing.\n */\n\n saveItemWithPresave(item, presave, callback) {\n this.saveItemsWithPresave([item], presave, callback);\n }\n\n saveItemsWithPresave(items, presave, callback) {\n this.saveItems(items, callback, false, presave);\n }\n\n _performSavingOfItems({items, presave, callback}) {\n // presave block allows client to gain the benefit of performing something in the debounce cycle.\n presave && presave();\n\n let mappedItems = [];\n for(let item of items) {\n mappedItems.push(this.jsonObjectForItem(item));\n }\n\n this.postMessage(\"save-items\", {items: mappedItems}, (data) => {\n callback && callback();\n });\n }\n\n /*\n skipDebouncer allows saves to go through right away rather than waiting for timeout.\n This should be used when saving items via other means besides keystrokes.\n */\n saveItems(items, callback, skipDebouncer = false, presave) {\n\n // We need to make sure that when we clear a pending save timeout,\n // we carry over those pending items into the new save.\n if(!this.pendingSaveItems) { this.pendingSaveItems = [];}\n\n if(this.coallesedSaving == true && !skipDebouncer) {\n if(this.pendingSaveTimeout) {\n clearTimeout(this.pendingSaveTimeout);\n }\n\n let incomingIds = items.map((item) => item.uuid);\n\n // Replace any existing save items with incoming values\n // Only keep items here who are not in incomingIds\n let preexistingItems = this.pendingSaveItems.filter((item) => {\n return !incomingIds.includes(item.uuid);\n })\n\n // Add new items, now that we've made sure it's cleared of incoming items.\n this.pendingSaveItems = preexistingItems.concat(items);\n\n // We'll potentially need to commit early if stream-context-item message comes in\n this.pendingSaveParams = {\n items: this.pendingSaveItems,\n presave: presave,\n callback: callback\n }\n\n this.pendingSaveTimeout = setTimeout(() => {\n this._performSavingOfItems(this.pendingSaveParams);\n this.pendingSaveItems = [];\n this.pendingSaveTimeout = null;\n this.pendingSaveParams = null;\n }, this.coallesedSavingDelay);\n } else {\n this._performSavingOfItems({items, presave, callback});\n }\n }\n\n jsonObjectForItem(item) {\n var copy = Object.assign({}, item);\n copy.children = null;\n copy.parent = null;\n return copy;\n }\n\n getItemAppDataValue(item, key) {\n let AppDomain = \"org.standardnotes.sn\";\n var data = item.content.appData && item.content.appData[AppDomain];\n if(data) {\n return data[key];\n } else {\n return null;\n }\n }\n\n /* Themes */\n\n activateThemes(incomingUrls) {\n if(this.loggingEnabled) { console.log(\"Incoming themes\", incomingUrls); }\n if(this.activeThemes.sort().toString() == incomingUrls.sort().toString()) {\n // incoming are same as active, do nothing\n return;\n }\n\n let themesToActivate = incomingUrls || [];\n let themesToDeactivate = [];\n\n for(var activeUrl of this.activeThemes) {\n if(!incomingUrls.includes(activeUrl)) {\n // active not present in incoming, deactivate it\n themesToDeactivate.push(activeUrl);\n } else {\n // already present in active themes, remove it from themesToActivate\n themesToActivate = themesToActivate.filter((candidate) => {\n return candidate != activeUrl;\n })\n }\n }\n\n if(this.loggingEnabled) {\n console.log(\"Deactivating themes:\", themesToDeactivate);\n console.log(\"Activating themes:\", themesToActivate);\n }\n\n for(var theme of themesToDeactivate) {\n this.deactivateTheme(theme);\n }\n\n this.activeThemes = incomingUrls;\n\n for(var url of themesToActivate) {\n if(!url) {\n continue;\n }\n\n var link = document.createElement(\"link\");\n link.id = btoa(url);\n link.href = url;\n link.type = \"text/css\";\n link.rel = \"stylesheet\";\n link.media = \"screen,print\";\n link.className = \"custom-theme\";\n document.getElementsByTagName(\"head\")[0].appendChild(link);\n }\n }\n\n themeElementForUrl(url) {\n var elements = Array.from(document.getElementsByClassName(\"custom-theme\")).slice();\n return elements.find((element) => {\n // We used to search here by `href`, but on desktop, with local file:// urls, that didn't work for some reason.\n return element.id == btoa(url);\n })\n }\n\n deactivateTheme(url) {\n let element = this.themeElementForUrl(url);\n if(element) {\n element.disabled = true;\n element.parentNode.removeChild(element);\n }\n }\n\n /* Theme caching is currently disabled. Might be enabled in the future if neccessary. */\n /*\n activateCachedThemes() {\n let themes = this.getCachedThemeUrls();\n let writeToCache = false;\n if(this.loggingEnabled) { console.log(\"Activating cached themes\", themes); }\n this.activateThemes(themes, writeToCache);\n }\n\n cacheThemeUrls(urls) {\n if(this.loggingEnabled) { console.log(\"Caching theme urls\", urls); }\n localStorage.setItem(\"cachedThemeUrls\", JSON.stringify(urls));\n }\n\n decacheThemeUrls() {\n localStorage.removeItem(\"cachedThemeUrls\");\n }\n\n getCachedThemeUrls() {\n let urls = localStorage.getItem(\"cachedThemeUrls\");\n if(urls) {\n return JSON.parse(urls);\n } else {\n return [];\n }\n }\n */\n\n\n /* Utilities */\n\n\n generateUUID() {\n var crypto = window.crypto || window.msCrypto;\n if(crypto) {\n var buf = new Uint32Array(4);\n crypto.getRandomValues(buf);\n var idx = -1;\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {\n idx++;\n var r = (buf[idx>>3] >> ((idx%8)*4))&15;\n var v = c == 'x' ? r : (r&0x3|0x8);\n return v.toString(16);\n });\n } else {\n var d = new Date().getTime();\n if(window.performance && typeof window.performance.now === \"function\"){\n d += performance.now(); //use high-precision timer if available\n }\n var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {\n var r = (d + Math.random()*16)%16 | 0;\n d = Math.floor(d/16);\n return (c=='x' ? r : (r&0x3|0x8)).toString(16);\n });\n return uuid;\n }\n }\n}\n\n\nif(typeof module != \"undefined\" && typeof module.exports != \"undefined\") {\n module.exports = ComponentManager;\n}\n\nif(window) {\n window.ComponentManager = ComponentManager;\n}\n\n\n\n// WEBPACK FOOTER //\n// ../src/componentManager.js","import Util from \"./Util.js\";\n\nexport default class FileLoader {\n\n constructor({filesafe, getElementsBySelector, preprocessElement, insertElement}) {\n this.filesafe = filesafe;\n this.getElementsBySelector = getElementsBySelector;\n this.insertElement = insertElement;\n this.preprocessElement = preprocessElement;\n\n // When a file is decrypted and loaded into a temp url, we'll place the temp url in here so that subsequent decrypt attempts\n // dont require further work. Mapped values are of form {url, fileType, fsname}\n this.uuidToFileTempUrlAndTypeMapping = {};\n\n // uuids of files currently loading, so that we don't start a new load for currently loading file\n this.currentlyLoadingIds = [];\n\n // uuid to current status element mapping\n this.statusElementMapping = {};\n\n this.fileTypeToElementType = {\n \"image/png\": \"img\",\n \"image/jpg\": \"img\",\n \"image/jpeg\": \"img\",\n \"image/gif\": \"img\",\n \"image/tiff\": \"img\",\n \"image/bmp\": \"img\",\n \"video/mp4\": \"video\",\n \"audio/mpeg\": \"audio\",\n \"audio/mp3\": \"audio\"\n }\n }\n\n fileTypeForElementType(type) {\n return this.fileTypeToElementType[type.toLowerCase()];\n }\n\n /*\n Scans the document for elements . If found, begins loading file.\n */\n loadFilesafeElements() {\n let elements = this.getElementsBySelector(\"*[fsplaceholder]\");\n for(let element of elements) {\n this.loadFilesafeElement(element);\n }\n }\n\n /*\n @param fsSyntax\n The FileSafe syntax string. i.e [FileSafe:uuid-123:name]\n */\n\n async loadFilesafeElement(fsElement) {\n let fsid = fsElement.getAttribute(\"fsid\");\n let fsname = fsElement.getAttribute(\"fsname\");\n let fileNameDisplay = (!fsname || fsname == 'undefined') ? 'file' : fsname;\n\n let existingMapping = this.uuidToFileTempUrlAndTypeMapping[fsid];\n if(existingMapping) {\n this.insertMediaElement({url: existingMapping.url, fsid,\n fileType: existingMapping.fileType, fsname: existingMapping.fsname, fsElement});\n return;\n }\n\n if(this.currentlyLoadingIds.includes(fsid)) {\n return;\n }\n\n let descriptor = this.filesafe.findFileDescriptor(fsid);\n if(!descriptor) {\n this.setStatus(`Unable to find ${fileNameDisplay} ${fsid}.`, fsElement, fsid, fsname, true);\n return {success: false};\n }\n\n let selectorSyntax = `[fsid=\"${descriptor.uuid}\"][fscollapsable]`;\n var existingElements = document.querySelectorAll(`img${selectorSyntax}, figure${selectorSyntax}, video${selectorSyntax}, audio${selectorSyntax}`);\n if(existingElements.length > 0) {\n return {success: false};\n }\n\n const cleanup = () => {\n this.currentlyLoadingIds.splice(this.currentlyLoadingIds.indexOf(fsid), 1);\n }\n\n this.currentlyLoadingIds.push(fsid);\n\n this.setStatus(`Downloading ${fileNameDisplay}...`, fsElement, fsid, fsname);\n await Util.sleep(0.05); // Allow UI to update before beginning download\n let fileItem = await this.filesafe.downloadFileFromDescriptor(descriptor).catch((downloadError) => {\n this.setStatus(`Unable to download ${fileNameDisplay} ${fsid}.`, fsElement, fsid, fsname);\n return;\n })\n\n if(!fileItem) {\n return;\n }\n\n this.setStatus(`Decrypting ${fileNameDisplay}...`, fsElement, fsid, fsname);\n await Util.sleep(0.05); // Allow UI to update before beginning decryption\n let data = await this.filesafe.decryptFile({fileDescriptor: descriptor, fileItem: fileItem}).catch((decryptError) => {\n this.setStatus(`Unable to decrypt ${fileNameDisplay} ${fsid}.`, fsElement, fsid, fsname);\n return;\n });\n\n if(!data) {\n return;\n }\n\n // Remove loading text\n this.setStatus(null, fsElement, fsid);\n await Util.sleep(0.05); // Allow UI to update before adding image\n\n // Generate temporary url, must be released later\n let fileType = descriptor.content.fileType;\n let tempUrl = this.filesafe.createTemporaryFileUrl({base64Data: data.decryptedData, dataType: fileType});\n\n this.insertMediaElement({url: tempUrl, fsid, fileType, fsname, fsElement});\n\n cleanup();\n\n this.uuidToFileTempUrlAndTypeMapping[fsid] = {url: tempUrl, fileType, fsname: fsname};\n\n return {success: true};\n }\n\n insertMediaElement({url, fsid, fsname, fileType, fsElement}) {\n let elementType = this.fileTypeForElementType(fileType);\n\n let mediaElement;\n if(elementType == \"img\") {\n mediaElement = this.createImageElement({url, fsid, fsname, fsElement});\n } else if(elementType == \"video\") {\n mediaElement = this.createVideoElement({url, fsid, fileType, fsname, fsElement});\n } else if(elementType == \"audio\") {\n mediaElement = this.createAudioElement({url, fsid, fsname});\n } else {\n mediaElement = this.createDownloadElement({url, fsid, fileType, fsname, fsElement});\n }\n\n this.insertElementNearElement(mediaElement, fsElement);\n\n // Remove fsElement now that image is loaded\n fsElement.remove();\n\n return true;\n }\n\n wrapElementInTag({element, tagName, fsid, fsname}) {\n let tag = document.createElement(tagName);\n tag.setAttribute('fsid', fsid);\n tag.setAttribute('fsname', fsname);\n tag.setAttribute('fscollapsable', true);\n tag.setAttribute('contenteditable', true);\n tag.append(element);\n return tag;\n }\n\n basicwrapElementInTag(element, tagName) {\n let tag = document.createElement(tagName);\n tag.append(element);\n return tag;\n }\n\n createImageElement({url, fsid, fsname, fsElement}) {\n let image = document.createElement(\"img\");\n image.setAttribute('src', url);\n image.setAttribute('srcset', `${url} 2x`);\n\n image.setAttribute('fsid', fsid);\n image.setAttribute('fsname', fsname);\n image.setAttribute('fscollapsable', true);\n\n if(fsElement.getAttribute(\"width\")) {\n image.setAttribute(\"width\", fsElement.getAttribute(\"width\"));\n image.setAttribute(\"height\", fsElement.getAttribute(\"height\"));\n }\n\n return image;\n }\n\n createVideoElement({url, fsid, fileType, fsname, fsElement}) {\n let video = document.createElement(\"video\");\n video.setAttribute('controls', true);\n video.setAttribute('fsid', fsid);\n video.setAttribute('fsname', fsname);\n video.setAttribute('fscollapsable', true);\n\n if(fsElement.getAttribute(\"width\")) {\n video.setAttribute(\"width\", fsElement.getAttribute(\"width\"));\n video.setAttribute(\"height\", fsElement.getAttribute(\"height\"));\n }\n\n let source = document.createElement(\"source\");\n source.setAttribute('src', url);\n source.setAttribute('type', fileType);\n\n video.append(source);\n\n // Redactor will automatically insert a video element in a p tag,\n // so we'll do it ourselves so that we can control its attributes.\n return this.wrapElementInTag({element: video, tagName: \"p\", fsid, fsname});\n }\n\n createDownloadElement({url, fsid, fileType, fsname, fsElement}) {\n let a = document.createElement(\"a\");\n a.setAttribute('fsid', fsid);\n a.setAttribute('fsname', fsname);\n a.setAttribute('ghost', 'true');\n a.setAttribute('fscollapsable', true);\n a.setAttribute('href', url);\n a.textContent = `${fsname}`;\n return a;\n }\n\n createAudioElement({url, fsid, fsname}) {\n let audio = document.createElement(\"audio\");\n audio.setAttribute('src', url);\n audio.setAttribute('controls', true);\n audio.setAttribute('fsid', fsid);\n audio.setAttribute('fsname', fsname);\n audio.setAttribute('fscollapsable', true);\n\n return this.wrapElementInTag({element: audio, tagName: \"p\", fsid, fsname});\n }\n\n setStatus(status, fsElement, fsid, fsname, removable) {\n if(fsid) {\n let existingStatusElement = this.statusElementMapping[fsid];\n if(existingStatusElement) {\n existingStatusElement.remove();\n delete this.statusElementMapping[fsid];\n }\n }\n\n if(status) {\n let element = document.createElement('label');\n element.setAttribute('id', fsid);\n element.setAttribute('ghost', 'true');\n element.setAttribute('contenteditable', false);\n element.style.fontWeight = \"bold\";\n element.textContent = status;\n if(removable) {\n element.style.userSelect = \"all\";\n }\n\n element = this.insertElementNearElement(element, fsElement);\n\n if(fsid) {\n this.statusElementMapping[fsid] = element;\n }\n return element;\n }\n }\n\n insertStatusAtCursor(status) {\n let identifier = Math.random().toString(36).substring(7);\n this.setStatus(status, null, identifier);\n return identifier;\n }\n\n removeCursorStatus(identifier) {\n // We want to search for the element based on identifier, because the actual element\n // inserted may have been done so as raw HTML, and not via an element pointer\n let elements = this.getElementsBySelector(`#${identifier}`);\n if(elements.length > 0) {\n elements[0].remove();\n }\n }\n\n insertElementNearElement(domNodeToInsert, inVicinityOfElement) {\n let processedElement = this.preprocessElement(domNodeToInsert);\n\n let insertionType = \"child\";\n //
tags cannot be nested inside p tags.\n if(processedElement.tagName.toLowerCase() == \"figure\") {\n // If we have a p ancestor, we need to get out.\n let pAncestor = inVicinityOfElement.closest(\"p\");\n if(pAncestor) {\n // p tags cannot be nested in other p tags, so if we found one, we know its parent isn't and doesn't belong to a ptag.\n // add the new right after pAncestor\n inVicinityOfElement = pAncestor;\n insertionType = \"afterend\";\n }\n }\n\n this.insertElement(processedElement, inVicinityOfElement, insertionType);\n return processedElement;\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/lib/FileLoader.js","export default class TextExpander {\n\n constructor({patterns, afterExpand, beforeExpand, getCurrentLineText, getPreviousLineText, replaceText}) {\n this.patterns = patterns;\n this.afterExpand = afterExpand;\n this.beforeExpand = beforeExpand;\n this.getCurrentLineText = getCurrentLineText;\n this.getPreviousLineText = getPreviousLineText;\n this.replaceText = replaceText;\n }\n\n onKeyUp({key, isSpace, isEnter, isPaste}) {\n if(isSpace || isEnter || isPaste) {\n this.searchPatterns({searchPreviousLine: isEnter});\n }\n }\n\n searchPatterns({searchPreviousLine} = {}) {\n let text;\n if(searchPreviousLine) {\n text = this.getPreviousLineText();\n } else {\n text = this.getCurrentLineText();\n }\n\n for (let pattern of this.patterns) {\n const match = pattern.regex.exec(text);\n if(!match) { continue; }\n const matchedText = match[0];\n if(matchedText) {\n let replaceWith = pattern.callback(matchedText);\n this.replaceSelection(pattern.regex, replaceWith, searchPreviousLine);\n }\n }\n }\n\n replaceSelection(regex, replacement, previousLine) {\n if(this.beforeExpand) {\n this.beforeExpand();\n }\n\n this.replaceText({regex, replacement, previousLine});\n\n if(this.afterExpand) {\n this.afterExpand();\n }\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/lib/TextExpander.js","export default class FilesafeHtml {\n\n // Remove matching

tags if present\n // Also capable of matching adjacent [fsSyntax][fsSyntax]\n static FilesafeSyntaxPattern = /(

)?\\[FileSafe[^\\]]*\\](<\\/p>)?/g;\n\n /*\n Given an HTML string that includes substrings matching `FilesafeSyntaxPattern`,\n replace occurences with ghost div element \n */\n static expandedFilesafeSyntax(html) {\n let result = html.replace(this.FilesafeSyntaxPattern, (match) => {\n return this.filesafeSyntaxToHtmlElement(match);\n })\n\n return result;\n }\n\n static removeFilesafeSyntaxFromHtml(html) {\n return html.replace(this.FilesafeSyntaxPattern, (match) => {\n return \"\";\n })\n }\n\n static insertionSyntaxForFileDescriptor(descriptor) {\n return `[FileSafe:${descriptor.uuid}:${descriptor.content.fileName}]`;\n }\n\n static filesafeSyntaxToHtmlElement(syntax) {\n // remove paragraph tags\n syntax = syntax.replace(\"

\", \"\");\n syntax = syntax.replace(\"

\", \"\");\n // Remove brackets\n syntax = syntax.replace(\"[\", \"\").replace(\"]\", \"\");\n let components = syntax.split(\":\");\n let uuid = components[1];\n let name = components[2];\n let size = components[3];\n let sizeString = \"\";\n if(size) {\n let dimensions = size.split(\"x\");\n sizeString = `width=${dimensions[0]} height=${dimensions[1]}`\n }\n // We use a p tag here because if try something custom, like `filesafe` tag, the editor will automatically\n // wrap it in a p tag, causing littered p tags remaining in the plaintext representation.\n let result = `

`;\n return result;\n }\n\n /*\n Given a rendered HTML string, replace all items with [FileSafe:UUID] plaintext items.\n Also, for any elements that have the 'ghost' attribute, remove it from the resulting string\n */\n static collapseFilesafeSyntax(html) {\n let domCopy = new DOMParser().parseFromString(html, \"text/html\");\n // Elements that have fscollapsable means they should be collapsed to plain syntax\n let mediaElements = domCopy.querySelectorAll(`*[fscollapsable]`);\n\n for(let file of mediaElements) {\n let uuid = file.getAttribute('fsid');\n let name = file.getAttribute('fsname');\n let width = file.getAttribute('width');\n let height = file.getAttribute('height');\n\n let components = [\"FileSafe\", uuid, name];\n if(width || height) {\n let size = `${width}x${height}`;\n components.push(size);\n }\n\n let fsSyntax = `

[${components.join(\":\")}]

`;\n file.insertAdjacentHTML('afterend', fsSyntax);\n file.remove();\n }\n\n let ghosts = domCopy.querySelectorAll(`*[ghost]`);\n ghosts.forEach((ghost) => {ghost.remove()});\n\n let result = domCopy.body.innerHTML;\n return result;\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/lib/FilesafeHtml.js","module.exports = require(\"filesafe-js\");\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"filesafe-js\"\n// module id = 7\n// module chunks = 0 1","/*\n The delegate is responsible for responding to events and functions\n that the EditorKit requires. For example, when EditorKit wants to insert\n a new HTML element, it won't neccessarily know how, because it's not designed for\n any particular editor. Instead, it will tell the delegate to insert the element.\n\n The consumer of this API, the actual editor, would configure this delegate with\n the appropriate callbacks.\n\n Callbacks are defined in the constructor.\n*/\n\nexport default class EditorKitDelegate {\n\n constructor({insertRawText, onReceiveNote,\n setEditorRawText, getCurrentLineText, getPreviousLineText, replaceText,\n getElementsBySelector, insertElement, preprocessElement, clearUndoHistory, generateCustomPreview}) {\n this.insertRawText = insertRawText;\n this.onReceiveNote = onReceiveNote;\n this.setEditorRawText = setEditorRawText;\n this.getCurrentLineText = getCurrentLineText;\n this.getPreviousLineText = getPreviousLineText;\n this.replaceText = replaceText;\n this.getElementsBySelector = getElementsBySelector;\n this.insertElement = insertElement;\n this.preprocessElement = preprocessElement;\n this.clearUndoHistory = clearUndoHistory;\n\n // Takes in string parameter, return object {html: string, plain: string}\n this.generateCustomPreview = generateCustomPreview;\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/EditorKitDelegate.js","module.exports = require(\"regenerator-runtime\");\n","function _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nmodule.exports = _defineProperty;","function _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n\n for (var i = 0, arr2 = new Array(len); i < len; i++) {\n arr2[i] = arr[i];\n }\n\n return arr2;\n}\n\nmodule.exports = _arrayLikeToArray;","var arrayLikeToArray = require(\"./arrayLikeToArray\");\n\nfunction _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(o);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);\n}\n\nmodule.exports = _unsupportedIterableToArray;","function _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}\n\nmodule.exports = _assertThisInitialized;","var _typeof = require(\"@babel/runtime/helpers/typeof\");\n\nvar assertThisInitialized = require(\"./assertThisInitialized\");\n\nfunction _possibleConstructorReturn(self, call) {\n if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) {\n return call;\n }\n\n return assertThisInitialized(self);\n}\n\nmodule.exports = _possibleConstructorReturn;","function _isNativeReflectConstruct() {\n if (typeof Reflect === \"undefined\" || !Reflect.construct) return false;\n if (Reflect.construct.sham) return false;\n if (typeof Proxy === \"function\") return true;\n\n try {\n Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));\n return true;\n } catch (e) {\n return false;\n }\n}\n\nmodule.exports = _isNativeReflectConstruct;","'use strict';\n\nfunction checkDCE() {\n /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */\n if (\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined' ||\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE !== 'function'\n ) {\n return;\n }\n if (process.env.NODE_ENV !== 'production') {\n // This branch is unreachable because this function is only called\n // in production, but the condition is true only in development.\n // Therefore if the branch is still here, dead code elimination wasn't\n // properly applied.\n // Don't change the message. React DevTools relies on it. Also make sure\n // this message doesn't occur elsewhere in this function, or it will cause\n // a false positive.\n throw new Error('^_^');\n }\n try {\n // Verify that the code above has been dead code eliminated (DCE'd).\n __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(checkDCE);\n } catch (err) {\n // DevTools shouldn't crash React, no matter what.\n // We should still report in case we break this code.\n console.error(err);\n }\n}\n\nif (process.env.NODE_ENV === 'production') {\n // DCE check should happen before ReactDOM bundle executes so that\n // DevTools can report bad minification during injection.\n checkDCE();\n module.exports = require('./cjs/react-dom.production.min.js');\n} else {\n module.exports = require('./cjs/react-dom.development.js');\n}\n","export default function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}","function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nexport default function _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}","export default function _getPrototypeOf(o) {\n _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n };\n return _getPrototypeOf(o);\n}","export default function _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n _typeof = function _typeof(obj) {\n return typeof obj;\n };\n } else {\n _typeof = function _typeof(obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n }\n\n return _typeof(obj);\n}","import _typeof from \"@babel/runtime/helpers/esm/typeof\";\nimport assertThisInitialized from \"@babel/runtime/helpers/esm/assertThisInitialized\";\nexport default function _possibleConstructorReturn(self, call) {\n if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) {\n return call;\n }\n\n return assertThisInitialized(self);\n}","export default function _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}","import getPrototypeOf from \"@babel/runtime/helpers/esm/getPrototypeOf\";\nimport isNativeReflectConstruct from \"@babel/runtime/helpers/esm/isNativeReflectConstruct\";\nimport possibleConstructorReturn from \"@babel/runtime/helpers/esm/possibleConstructorReturn\";\nexport default function _createSuper(Derived) {\n var hasNativeReflectConstruct = isNativeReflectConstruct();\n return function _createSuperInternal() {\n var Super = getPrototypeOf(Derived),\n result;\n\n if (hasNativeReflectConstruct) {\n var NewTarget = getPrototypeOf(this).constructor;\n result = Reflect.construct(Super, arguments, NewTarget);\n } else {\n result = Super.apply(this, arguments);\n }\n\n return possibleConstructorReturn(this, result);\n };\n}","export default function _isNativeReflectConstruct() {\n if (typeof Reflect === \"undefined\" || !Reflect.construct) return false;\n if (Reflect.construct.sham) return false;\n if (typeof Proxy === \"function\") return true;\n\n try {\n Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));\n return true;\n } catch (e) {\n return false;\n }\n}","export default function _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n\n for (var i = 0, arr2 = new Array(len); i < len; i++) {\n arr2[i] = arr[i];\n }\n\n return arr2;\n}","import unsupportedIterableToArray from \"@babel/runtime/helpers/esm/unsupportedIterableToArray\";\nexport default function _createForOfIteratorHelper(o, allowArrayLike) {\n var it;\n\n if (typeof Symbol === \"undefined\" || o[Symbol.iterator] == null) {\n if (Array.isArray(o) || (it = unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") {\n if (it) o = it;\n var i = 0;\n\n var F = function F() {};\n\n return {\n s: F,\n n: function n() {\n if (i >= o.length) return {\n done: true\n };\n return {\n done: false,\n value: o[i++]\n };\n },\n e: function e(_e) {\n throw _e;\n },\n f: F\n };\n }\n\n throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n }\n\n var normalCompletion = true,\n didErr = false,\n err;\n return {\n s: function s() {\n it = o[Symbol.iterator]();\n },\n n: function n() {\n var step = it.next();\n normalCompletion = step.done;\n return step;\n },\n e: function e(_e2) {\n didErr = true;\n err = _e2;\n },\n f: function f() {\n try {\n if (!normalCompletion && it[\"return\"] != null) it[\"return\"]();\n } finally {\n if (didErr) throw err;\n }\n }\n };\n}","import arrayLikeToArray from \"@babel/runtime/helpers/esm/arrayLikeToArray\";\nexport default function _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(o);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);\n}","export default function _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n}","import setPrototypeOf from \"@babel/runtime/helpers/esm/setPrototypeOf\";\nexport default function _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n });\n if (superClass) setPrototypeOf(subClass, superClass);\n}","/** @license React v17.0.1\n * react-jsx-runtime.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';require(\"object-assign\");var f=require(\"react\"),g=60103;exports.Fragment=60107;if(\"function\"===typeof Symbol&&Symbol.for){var h=Symbol.for;g=h(\"react.element\");exports.Fragment=h(\"react.fragment\")}var m=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,n=Object.prototype.hasOwnProperty,p={key:!0,ref:!0,__self:!0,__source:!0};\nfunction q(c,a,k){var b,d={},e=null,l=null;void 0!==k&&(e=\"\"+k);void 0!==a.key&&(e=\"\"+a.key);void 0!==a.ref&&(l=a.ref);for(b in a)n.call(a,b)&&!p.hasOwnProperty(b)&&(d[b]=a[b]);if(c&&c.defaultProps)for(b in a=c.defaultProps,a)void 0===d[b]&&(d[b]=a[b]);return{$$typeof:g,type:c,key:e,ref:l,props:d,_owner:m.current}}exports.jsx=q;exports.jsxs=q;\n","/** @license React v17.0.1\n * react.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';var l=require(\"object-assign\"),n=60103,p=60106;exports.Fragment=60107;exports.StrictMode=60108;exports.Profiler=60114;var q=60109,r=60110,t=60112;exports.Suspense=60113;var u=60115,v=60116;\nif(\"function\"===typeof Symbol&&Symbol.for){var w=Symbol.for;n=w(\"react.element\");p=w(\"react.portal\");exports.Fragment=w(\"react.fragment\");exports.StrictMode=w(\"react.strict_mode\");exports.Profiler=w(\"react.profiler\");q=w(\"react.provider\");r=w(\"react.context\");t=w(\"react.forward_ref\");exports.Suspense=w(\"react.suspense\");u=w(\"react.memo\");v=w(\"react.lazy\")}var x=\"function\"===typeof Symbol&&Symbol.iterator;\nfunction y(a){if(null===a||\"object\"!==typeof a)return null;a=x&&a[x]||a[\"@@iterator\"];return\"function\"===typeof a?a:null}function z(a){for(var b=\"https://reactjs.org/docs/error-decoder.html?invariant=\"+a,c=1;cb}return!1}function B(a,b,c,d,e,f,g){this.acceptsBooleans=2===b||3===b||4===b;this.attributeName=d;this.attributeNamespace=e;this.mustUseProperty=c;this.propertyName=a;this.type=b;this.sanitizeURL=f;this.removeEmptyString=g}var D={};\n\"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style\".split(\" \").forEach(function(a){D[a]=new B(a,0,!1,a,null,!1,!1)});[[\"acceptCharset\",\"accept-charset\"],[\"className\",\"class\"],[\"htmlFor\",\"for\"],[\"httpEquiv\",\"http-equiv\"]].forEach(function(a){var b=a[0];D[b]=new B(b,1,!1,a[1],null,!1,!1)});[\"contentEditable\",\"draggable\",\"spellCheck\",\"value\"].forEach(function(a){D[a]=new B(a,2,!1,a.toLowerCase(),null,!1,!1)});\n[\"autoReverse\",\"externalResourcesRequired\",\"focusable\",\"preserveAlpha\"].forEach(function(a){D[a]=new B(a,2,!1,a,null,!1,!1)});\"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope\".split(\" \").forEach(function(a){D[a]=new B(a,3,!1,a.toLowerCase(),null,!1,!1)});\n[\"checked\",\"multiple\",\"muted\",\"selected\"].forEach(function(a){D[a]=new B(a,3,!0,a,null,!1,!1)});[\"capture\",\"download\"].forEach(function(a){D[a]=new B(a,4,!1,a,null,!1,!1)});[\"cols\",\"rows\",\"size\",\"span\"].forEach(function(a){D[a]=new B(a,6,!1,a,null,!1,!1)});[\"rowSpan\",\"start\"].forEach(function(a){D[a]=new B(a,5,!1,a.toLowerCase(),null,!1,!1)});var oa=/[\\-:]([a-z])/g;function pa(a){return a[1].toUpperCase()}\n\"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height\".split(\" \").forEach(function(a){var b=a.replace(oa,\npa);D[b]=new B(b,1,!1,a,null,!1,!1)});\"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type\".split(\" \").forEach(function(a){var b=a.replace(oa,pa);D[b]=new B(b,1,!1,a,\"http://www.w3.org/1999/xlink\",!1,!1)});[\"xml:base\",\"xml:lang\",\"xml:space\"].forEach(function(a){var b=a.replace(oa,pa);D[b]=new B(b,1,!1,a,\"http://www.w3.org/XML/1998/namespace\",!1,!1)});[\"tabIndex\",\"crossOrigin\"].forEach(function(a){D[a]=new B(a,1,!1,a.toLowerCase(),null,!1,!1)});\nD.xlinkHref=new B(\"xlinkHref\",1,!1,\"xlink:href\",\"http://www.w3.org/1999/xlink\",!0,!1);[\"src\",\"href\",\"action\",\"formAction\"].forEach(function(a){D[a]=new B(a,1,!1,a.toLowerCase(),null,!0,!0)});\nfunction qa(a,b,c,d){var e=D.hasOwnProperty(b)?D[b]:null;var f=null!==e?0===e.type:d?!1:!(2h||e[g]!==f[h])return\"\\n\"+e[g].replace(\" at new \",\" at \");while(1<=g&&0<=h)}break}}}finally{Oa=!1,Error.prepareStackTrace=c}return(a=a?a.displayName||a.name:\"\")?Na(a):\"\"}\nfunction Qa(a){switch(a.tag){case 5:return Na(a.type);case 16:return Na(\"Lazy\");case 13:return Na(\"Suspense\");case 19:return Na(\"SuspenseList\");case 0:case 2:case 15:return a=Pa(a.type,!1),a;case 11:return a=Pa(a.type.render,!1),a;case 22:return a=Pa(a.type._render,!1),a;case 1:return a=Pa(a.type,!0),a;default:return\"\"}}\nfunction Ra(a){if(null==a)return null;if(\"function\"===typeof a)return a.displayName||a.name||null;if(\"string\"===typeof a)return a;switch(a){case ua:return\"Fragment\";case ta:return\"Portal\";case xa:return\"Profiler\";case wa:return\"StrictMode\";case Ba:return\"Suspense\";case Ca:return\"SuspenseList\"}if(\"object\"===typeof a)switch(a.$$typeof){case za:return(a.displayName||\"Context\")+\".Consumer\";case ya:return(a._context.displayName||\"Context\")+\".Provider\";case Aa:var b=a.render;b=b.displayName||b.name||\"\";\nreturn a.displayName||(\"\"!==b?\"ForwardRef(\"+b+\")\":\"ForwardRef\");case Da:return Ra(a.type);case Fa:return Ra(a._render);case Ea:b=a._payload;a=a._init;try{return Ra(a(b))}catch(c){}}return null}function Sa(a){switch(typeof a){case \"boolean\":case \"number\":case \"object\":case \"string\":case \"undefined\":return a;default:return\"\"}}function Ta(a){var b=a.type;return(a=a.nodeName)&&\"input\"===a.toLowerCase()&&(\"checkbox\"===b||\"radio\"===b)}\nfunction Ua(a){var b=Ta(a)?\"checked\":\"value\",c=Object.getOwnPropertyDescriptor(a.constructor.prototype,b),d=\"\"+a[b];if(!a.hasOwnProperty(b)&&\"undefined\"!==typeof c&&\"function\"===typeof c.get&&\"function\"===typeof c.set){var e=c.get,f=c.set;Object.defineProperty(a,b,{configurable:!0,get:function(){return e.call(this)},set:function(a){d=\"\"+a;f.call(this,a)}});Object.defineProperty(a,b,{enumerable:c.enumerable});return{getValue:function(){return d},setValue:function(a){d=\"\"+a},stopTracking:function(){a._valueTracker=\nnull;delete a[b]}}}}function Va(a){a._valueTracker||(a._valueTracker=Ua(a))}function Wa(a){if(!a)return!1;var b=a._valueTracker;if(!b)return!0;var c=b.getValue();var d=\"\";a&&(d=Ta(a)?a.checked?\"true\":\"false\":a.value);a=d;return a!==c?(b.setValue(a),!0):!1}function Xa(a){a=a||(\"undefined\"!==typeof document?document:void 0);if(\"undefined\"===typeof a)return null;try{return a.activeElement||a.body}catch(b){return a.body}}\nfunction Ya(a,b){var c=b.checked;return m({},b,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:null!=c?c:a._wrapperState.initialChecked})}function Za(a,b){var c=null==b.defaultValue?\"\":b.defaultValue,d=null!=b.checked?b.checked:b.defaultChecked;c=Sa(null!=b.value?b.value:c);a._wrapperState={initialChecked:d,initialValue:c,controlled:\"checkbox\"===b.type||\"radio\"===b.type?null!=b.checked:null!=b.value}}function $a(a,b){b=b.checked;null!=b&&qa(a,\"checked\",b,!1)}\nfunction ab(a,b){$a(a,b);var c=Sa(b.value),d=b.type;if(null!=c)if(\"number\"===d){if(0===c&&\"\"===a.value||a.value!=c)a.value=\"\"+c}else a.value!==\"\"+c&&(a.value=\"\"+c);else if(\"submit\"===d||\"reset\"===d){a.removeAttribute(\"value\");return}b.hasOwnProperty(\"value\")?bb(a,b.type,c):b.hasOwnProperty(\"defaultValue\")&&bb(a,b.type,Sa(b.defaultValue));null==b.checked&&null!=b.defaultChecked&&(a.defaultChecked=!!b.defaultChecked)}\nfunction cb(a,b,c){if(b.hasOwnProperty(\"value\")||b.hasOwnProperty(\"defaultValue\")){var d=b.type;if(!(\"submit\"!==d&&\"reset\"!==d||void 0!==b.value&&null!==b.value))return;b=\"\"+a._wrapperState.initialValue;c||b===a.value||(a.value=b);a.defaultValue=b}c=a.name;\"\"!==c&&(a.name=\"\");a.defaultChecked=!!a._wrapperState.initialChecked;\"\"!==c&&(a.name=c)}\nfunction bb(a,b,c){if(\"number\"!==b||Xa(a.ownerDocument)!==a)null==c?a.defaultValue=\"\"+a._wrapperState.initialValue:a.defaultValue!==\"\"+c&&(a.defaultValue=\"\"+c)}function db(a){var b=\"\";aa.Children.forEach(a,function(a){null!=a&&(b+=a)});return b}function eb(a,b){a=m({children:void 0},b);if(b=db(b.children))a.children=b;return a}\nfunction fb(a,b,c,d){a=a.options;if(b){b={};for(var e=0;e=c.length))throw Error(y(93));c=c[0]}b=c}null==b&&(b=\"\");c=b}a._wrapperState={initialValue:Sa(c)}}\nfunction ib(a,b){var c=Sa(b.value),d=Sa(b.defaultValue);null!=c&&(c=\"\"+c,c!==a.value&&(a.value=c),null==b.defaultValue&&a.defaultValue!==c&&(a.defaultValue=c));null!=d&&(a.defaultValue=\"\"+d)}function jb(a){var b=a.textContent;b===a._wrapperState.initialValue&&\"\"!==b&&null!==b&&(a.value=b)}var kb={html:\"http://www.w3.org/1999/xhtml\",mathml:\"http://www.w3.org/1998/Math/MathML\",svg:\"http://www.w3.org/2000/svg\"};\nfunction lb(a){switch(a){case \"svg\":return\"http://www.w3.org/2000/svg\";case \"math\":return\"http://www.w3.org/1998/Math/MathML\";default:return\"http://www.w3.org/1999/xhtml\"}}function mb(a,b){return null==a||\"http://www.w3.org/1999/xhtml\"===a?lb(b):\"http://www.w3.org/2000/svg\"===a&&\"foreignObject\"===b?\"http://www.w3.org/1999/xhtml\":a}\nvar nb,ob=function(a){return\"undefined\"!==typeof MSApp&&MSApp.execUnsafeLocalFunction?function(b,c,d,e){MSApp.execUnsafeLocalFunction(function(){return a(b,c,d,e)})}:a}(function(a,b){if(a.namespaceURI!==kb.svg||\"innerHTML\"in a)a.innerHTML=b;else{nb=nb||document.createElement(\"div\");nb.innerHTML=\"\"+b.valueOf().toString()+\"\";for(b=nb.firstChild;a.firstChild;)a.removeChild(a.firstChild);for(;b.firstChild;)a.appendChild(b.firstChild)}});\nfunction pb(a,b){if(b){var c=a.firstChild;if(c&&c===a.lastChild&&3===c.nodeType){c.nodeValue=b;return}}a.textContent=b}\nvar qb={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,\nfloodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},rb=[\"Webkit\",\"ms\",\"Moz\",\"O\"];Object.keys(qb).forEach(function(a){rb.forEach(function(b){b=b+a.charAt(0).toUpperCase()+a.substring(1);qb[b]=qb[a]})});function sb(a,b,c){return null==b||\"boolean\"===typeof b||\"\"===b?\"\":c||\"number\"!==typeof b||0===b||qb.hasOwnProperty(a)&&qb[a]?(\"\"+b).trim():b+\"px\"}\nfunction tb(a,b){a=a.style;for(var c in b)if(b.hasOwnProperty(c)){var d=0===c.indexOf(\"--\"),e=sb(c,b[c],d);\"float\"===c&&(c=\"cssFloat\");d?a.setProperty(c,e):a[c]=e}}var ub=m({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});\nfunction vb(a,b){if(b){if(ub[a]&&(null!=b.children||null!=b.dangerouslySetInnerHTML))throw Error(y(137,a));if(null!=b.dangerouslySetInnerHTML){if(null!=b.children)throw Error(y(60));if(!(\"object\"===typeof b.dangerouslySetInnerHTML&&\"__html\"in b.dangerouslySetInnerHTML))throw Error(y(61));}if(null!=b.style&&\"object\"!==typeof b.style)throw Error(y(62));}}\nfunction wb(a,b){if(-1===a.indexOf(\"-\"))return\"string\"===typeof b.is;switch(a){case \"annotation-xml\":case \"color-profile\":case \"font-face\":case \"font-face-src\":case \"font-face-uri\":case \"font-face-format\":case \"font-face-name\":case \"missing-glyph\":return!1;default:return!0}}function xb(a){a=a.target||a.srcElement||window;a.correspondingUseElement&&(a=a.correspondingUseElement);return 3===a.nodeType?a.parentNode:a}var yb=null,zb=null,Ab=null;\nfunction Bb(a){if(a=Cb(a)){if(\"function\"!==typeof yb)throw Error(y(280));var b=a.stateNode;b&&(b=Db(b),yb(a.stateNode,a.type,b))}}function Eb(a){zb?Ab?Ab.push(a):Ab=[a]:zb=a}function Fb(){if(zb){var a=zb,b=Ab;Ab=zb=null;Bb(a);if(b)for(a=0;ad?0:1<c;c++)b.push(a);return b}\nfunction $c(a,b,c){a.pendingLanes|=b;var d=b-1;a.suspendedLanes&=d;a.pingedLanes&=d;a=a.eventTimes;b=31-Vc(b);a[b]=c}var Vc=Math.clz32?Math.clz32:ad,bd=Math.log,cd=Math.LN2;function ad(a){return 0===a?32:31-(bd(a)/cd|0)|0}var dd=r.unstable_UserBlockingPriority,ed=r.unstable_runWithPriority,fd=!0;function gd(a,b,c,d){Kb||Ib();var e=hd,f=Kb;Kb=!0;try{Hb(e,a,b,c,d)}finally{(Kb=f)||Mb()}}function id(a,b,c,d){ed(dd,hd.bind(null,a,b,c,d))}\nfunction hd(a,b,c,d){if(fd){var e;if((e=0===(b&4))&&0=be),ee=String.fromCharCode(32),fe=!1;\nfunction ge(a,b){switch(a){case \"keyup\":return-1!==$d.indexOf(b.keyCode);case \"keydown\":return 229!==b.keyCode;case \"keypress\":case \"mousedown\":case \"focusout\":return!0;default:return!1}}function he(a){a=a.detail;return\"object\"===typeof a&&\"data\"in a?a.data:null}var ie=!1;function je(a,b){switch(a){case \"compositionend\":return he(b);case \"keypress\":if(32!==b.which)return null;fe=!0;return ee;case \"textInput\":return a=b.data,a===ee&&fe?null:a;default:return null}}\nfunction ke(a,b){if(ie)return\"compositionend\"===a||!ae&&ge(a,b)?(a=nd(),md=ld=kd=null,ie=!1,a):null;switch(a){case \"paste\":return null;case \"keypress\":if(!(b.ctrlKey||b.altKey||b.metaKey)||b.ctrlKey&&b.altKey){if(b.char&&1=b)return{node:c,offset:b-a};a=d}a:{for(;c;){if(c.nextSibling){c=c.nextSibling;break a}c=c.parentNode}c=void 0}c=Ke(c)}}function Me(a,b){return a&&b?a===b?!0:a&&3===a.nodeType?!1:b&&3===b.nodeType?Me(a,b.parentNode):\"contains\"in a?a.contains(b):a.compareDocumentPosition?!!(a.compareDocumentPosition(b)&16):!1:!1}\nfunction Ne(){for(var a=window,b=Xa();b instanceof a.HTMLIFrameElement;){try{var c=\"string\"===typeof b.contentWindow.location.href}catch(d){c=!1}if(c)a=b.contentWindow;else break;b=Xa(a.document)}return b}function Oe(a){var b=a&&a.nodeName&&a.nodeName.toLowerCase();return b&&(\"input\"===b&&(\"text\"===a.type||\"search\"===a.type||\"tel\"===a.type||\"url\"===a.type||\"password\"===a.type)||\"textarea\"===b||\"true\"===a.contentEditable)}\nvar Pe=fa&&\"documentMode\"in document&&11>=document.documentMode,Qe=null,Re=null,Se=null,Te=!1;\nfunction Ue(a,b,c){var d=c.window===c?c.document:9===c.nodeType?c:c.ownerDocument;Te||null==Qe||Qe!==Xa(d)||(d=Qe,\"selectionStart\"in d&&Oe(d)?d={start:d.selectionStart,end:d.selectionEnd}:(d=(d.ownerDocument&&d.ownerDocument.defaultView||window).getSelection(),d={anchorNode:d.anchorNode,anchorOffset:d.anchorOffset,focusNode:d.focusNode,focusOffset:d.focusOffset}),Se&&Je(Se,d)||(Se=d,d=oe(Re,\"onSelect\"),0Af||(a.current=zf[Af],zf[Af]=null,Af--)}function I(a,b){Af++;zf[Af]=a.current;a.current=b}var Cf={},M=Bf(Cf),N=Bf(!1),Df=Cf;\nfunction Ef(a,b){var c=a.type.contextTypes;if(!c)return Cf;var d=a.stateNode;if(d&&d.__reactInternalMemoizedUnmaskedChildContext===b)return d.__reactInternalMemoizedMaskedChildContext;var e={},f;for(f in c)e[f]=b[f];d&&(a=a.stateNode,a.__reactInternalMemoizedUnmaskedChildContext=b,a.__reactInternalMemoizedMaskedChildContext=e);return e}function Ff(a){a=a.childContextTypes;return null!==a&&void 0!==a}function Gf(){H(N);H(M)}function Hf(a,b,c){if(M.current!==Cf)throw Error(y(168));I(M,b);I(N,c)}\nfunction If(a,b,c){var d=a.stateNode;a=b.childContextTypes;if(\"function\"!==typeof d.getChildContext)return c;d=d.getChildContext();for(var e in d)if(!(e in a))throw Error(y(108,Ra(b)||\"Unknown\",e));return m({},c,d)}function Jf(a){a=(a=a.stateNode)&&a.__reactInternalMemoizedMergedChildContext||Cf;Df=M.current;I(M,a);I(N,N.current);return!0}function Kf(a,b,c){var d=a.stateNode;if(!d)throw Error(y(169));c?(a=If(a,b,Df),d.__reactInternalMemoizedMergedChildContext=a,H(N),H(M),I(M,a)):H(N);I(N,c)}\nvar Lf=null,Mf=null,Nf=r.unstable_runWithPriority,Of=r.unstable_scheduleCallback,Pf=r.unstable_cancelCallback,Qf=r.unstable_shouldYield,Rf=r.unstable_requestPaint,Sf=r.unstable_now,Tf=r.unstable_getCurrentPriorityLevel,Uf=r.unstable_ImmediatePriority,Vf=r.unstable_UserBlockingPriority,Wf=r.unstable_NormalPriority,Xf=r.unstable_LowPriority,Yf=r.unstable_IdlePriority,Zf={},$f=void 0!==Rf?Rf:function(){},ag=null,bg=null,cg=!1,dg=Sf(),O=1E4>dg?Sf:function(){return Sf()-dg};\nfunction eg(){switch(Tf()){case Uf:return 99;case Vf:return 98;case Wf:return 97;case Xf:return 96;case Yf:return 95;default:throw Error(y(332));}}function fg(a){switch(a){case 99:return Uf;case 98:return Vf;case 97:return Wf;case 96:return Xf;case 95:return Yf;default:throw Error(y(332));}}function gg(a,b){a=fg(a);return Nf(a,b)}function hg(a,b,c){a=fg(a);return Of(a,b,c)}function ig(){if(null!==bg){var a=bg;bg=null;Pf(a)}jg()}\nfunction jg(){if(!cg&&null!==ag){cg=!0;var a=0;try{var b=ag;gg(99,function(){for(;az?(q=u,u=null):q=u.sibling;var n=p(e,u,h[z],k);if(null===n){null===u&&(u=q);break}a&&u&&null===\nn.alternate&&b(e,u);g=f(n,g,z);null===t?l=n:t.sibling=n;t=n;u=q}if(z===h.length)return c(e,u),l;if(null===u){for(;zz?(q=u,u=null):q=u.sibling;var w=p(e,u,n.value,k);if(null===w){null===u&&(u=q);break}a&&u&&null===w.alternate&&b(e,u);g=f(w,g,z);null===t?l=w:t.sibling=w;t=w;u=q}if(n.done)return c(e,u),l;if(null===u){for(;!n.done;z++,n=h.next())n=A(e,n.value,k),null!==n&&(g=f(n,g,z),null===t?l=n:t.sibling=n,t=n);return l}for(u=d(e,u);!n.done;z++,n=h.next())n=C(u,e,z,n.value,k),null!==n&&(a&&null!==n.alternate&&\nu.delete(null===n.key?z:n.key),g=f(n,g,z),null===t?l=n:t.sibling=n,t=n);a&&u.forEach(function(a){return b(e,a)});return l}return function(a,d,f,h){var k=\"object\"===typeof f&&null!==f&&f.type===ua&&null===f.key;k&&(f=f.props.children);var l=\"object\"===typeof f&&null!==f;if(l)switch(f.$$typeof){case sa:a:{l=f.key;for(k=d;null!==k;){if(k.key===l){switch(k.tag){case 7:if(f.type===ua){c(a,k.sibling);d=e(k,f.props.children);d.return=a;a=d;break a}break;default:if(k.elementType===f.type){c(a,k.sibling);\nd=e(k,f.props);d.ref=Qg(a,k,f);d.return=a;a=d;break a}}c(a,k);break}else b(a,k);k=k.sibling}f.type===ua?(d=Xg(f.props.children,a.mode,h,f.key),d.return=a,a=d):(h=Vg(f.type,f.key,f.props,null,a.mode,h),h.ref=Qg(a,d,f),h.return=a,a=h)}return g(a);case ta:a:{for(k=f.key;null!==d;){if(d.key===k)if(4===d.tag&&d.stateNode.containerInfo===f.containerInfo&&d.stateNode.implementation===f.implementation){c(a,d.sibling);d=e(d,f.children||[]);d.return=a;a=d;break a}else{c(a,d);break}else b(a,d);d=d.sibling}d=\nWg(f,a.mode,h);d.return=a;a=d}return g(a)}if(\"string\"===typeof f||\"number\"===typeof f)return f=\"\"+f,null!==d&&6===d.tag?(c(a,d.sibling),d=e(d,f),d.return=a,a=d):(c(a,d),d=Ug(f,a.mode,h),d.return=a,a=d),g(a);if(Pg(f))return x(a,d,f,h);if(La(f))return w(a,d,f,h);l&&Rg(a,f);if(\"undefined\"===typeof f&&!k)switch(a.tag){case 1:case 22:case 0:case 11:case 15:throw Error(y(152,Ra(a.type)||\"Component\"));}return c(a,d)}}var Yg=Sg(!0),Zg=Sg(!1),$g={},ah=Bf($g),bh=Bf($g),ch=Bf($g);\nfunction dh(a){if(a===$g)throw Error(y(174));return a}function eh(a,b){I(ch,b);I(bh,a);I(ah,$g);a=b.nodeType;switch(a){case 9:case 11:b=(b=b.documentElement)?b.namespaceURI:mb(null,\"\");break;default:a=8===a?b.parentNode:b,b=a.namespaceURI||null,a=a.tagName,b=mb(b,a)}H(ah);I(ah,b)}function fh(){H(ah);H(bh);H(ch)}function gh(a){dh(ch.current);var b=dh(ah.current);var c=mb(b,a.type);b!==c&&(I(bh,a),I(ah,c))}function hh(a){bh.current===a&&(H(ah),H(bh))}var P=Bf(0);\nfunction ih(a){for(var b=a;null!==b;){if(13===b.tag){var c=b.memoizedState;if(null!==c&&(c=c.dehydrated,null===c||\"$?\"===c.data||\"$!\"===c.data))return b}else if(19===b.tag&&void 0!==b.memoizedProps.revealOrder){if(0!==(b.flags&64))return b}else if(null!==b.child){b.child.return=b;b=b.child;continue}if(b===a)break;for(;null===b.sibling;){if(null===b.return||b.return===a)return null;b=b.return}b.sibling.return=b.return;b=b.sibling}return null}var jh=null,kh=null,lh=!1;\nfunction mh(a,b){var c=nh(5,null,null,0);c.elementType=\"DELETED\";c.type=\"DELETED\";c.stateNode=b;c.return=a;c.flags=8;null!==a.lastEffect?(a.lastEffect.nextEffect=c,a.lastEffect=c):a.firstEffect=a.lastEffect=c}function oh(a,b){switch(a.tag){case 5:var c=a.type;b=1!==b.nodeType||c.toLowerCase()!==b.nodeName.toLowerCase()?null:b;return null!==b?(a.stateNode=b,!0):!1;case 6:return b=\"\"===a.pendingProps||3!==b.nodeType?null:b,null!==b?(a.stateNode=b,!0):!1;case 13:return!1;default:return!1}}\nfunction ph(a){if(lh){var b=kh;if(b){var c=b;if(!oh(a,b)){b=rf(c.nextSibling);if(!b||!oh(a,b)){a.flags=a.flags&-1025|2;lh=!1;jh=a;return}mh(jh,c)}jh=a;kh=rf(b.firstChild)}else a.flags=a.flags&-1025|2,lh=!1,jh=a}}function qh(a){for(a=a.return;null!==a&&5!==a.tag&&3!==a.tag&&13!==a.tag;)a=a.return;jh=a}\nfunction rh(a){if(a!==jh)return!1;if(!lh)return qh(a),lh=!0,!1;var b=a.type;if(5!==a.tag||\"head\"!==b&&\"body\"!==b&&!nf(b,a.memoizedProps))for(b=kh;b;)mh(a,b),b=rf(b.nextSibling);qh(a);if(13===a.tag){a=a.memoizedState;a=null!==a?a.dehydrated:null;if(!a)throw Error(y(317));a:{a=a.nextSibling;for(b=0;a;){if(8===a.nodeType){var c=a.data;if(\"/$\"===c){if(0===b){kh=rf(a.nextSibling);break a}b--}else\"$\"!==c&&\"$!\"!==c&&\"$?\"!==c||b++}a=a.nextSibling}kh=null}}else kh=jh?rf(a.stateNode.nextSibling):null;return!0}\nfunction sh(){kh=jh=null;lh=!1}var th=[];function uh(){for(var a=0;af))throw Error(y(301));f+=1;T=S=null;b.updateQueue=null;vh.current=Fh;a=c(d,e)}while(zh)}vh.current=Gh;b=null!==S&&null!==S.next;xh=0;T=S=R=null;yh=!1;if(b)throw Error(y(300));return a}function Hh(){var a={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};null===T?R.memoizedState=T=a:T=T.next=a;return T}\nfunction Ih(){if(null===S){var a=R.alternate;a=null!==a?a.memoizedState:null}else a=S.next;var b=null===T?R.memoizedState:T.next;if(null!==b)T=b,S=a;else{if(null===a)throw Error(y(310));S=a;a={memoizedState:S.memoizedState,baseState:S.baseState,baseQueue:S.baseQueue,queue:S.queue,next:null};null===T?R.memoizedState=T=a:T=T.next=a}return T}function Jh(a,b){return\"function\"===typeof b?b(a):b}\nfunction Kh(a){var b=Ih(),c=b.queue;if(null===c)throw Error(y(311));c.lastRenderedReducer=a;var d=S,e=d.baseQueue,f=c.pending;if(null!==f){if(null!==e){var g=e.next;e.next=f.next;f.next=g}d.baseQueue=e=f;c.pending=null}if(null!==e){e=e.next;d=d.baseState;var h=g=f=null,k=e;do{var l=k.lane;if((xh&l)===l)null!==h&&(h=h.next={lane:0,action:k.action,eagerReducer:k.eagerReducer,eagerState:k.eagerState,next:null}),d=k.eagerReducer===a?k.eagerState:a(d,k.action);else{var n={lane:l,action:k.action,eagerReducer:k.eagerReducer,\neagerState:k.eagerState,next:null};null===h?(g=h=n,f=d):h=h.next=n;R.lanes|=l;Dg|=l}k=k.next}while(null!==k&&k!==e);null===h?f=d:h.next=g;He(d,b.memoizedState)||(ug=!0);b.memoizedState=d;b.baseState=f;b.baseQueue=h;c.lastRenderedState=d}return[b.memoizedState,c.dispatch]}\nfunction Lh(a){var b=Ih(),c=b.queue;if(null===c)throw Error(y(311));c.lastRenderedReducer=a;var d=c.dispatch,e=c.pending,f=b.memoizedState;if(null!==e){c.pending=null;var g=e=e.next;do f=a(f,g.action),g=g.next;while(g!==e);He(f,b.memoizedState)||(ug=!0);b.memoizedState=f;null===b.baseQueue&&(b.baseState=f);c.lastRenderedState=f}return[f,d]}\nfunction Mh(a,b,c){var d=b._getVersion;d=d(b._source);var e=b._workInProgressVersionPrimary;if(null!==e)a=e===d;else if(a=a.mutableReadLanes,a=(xh&a)===a)b._workInProgressVersionPrimary=d,th.push(b);if(a)return c(b._source);th.push(b);throw Error(y(350));}\nfunction Nh(a,b,c,d){var e=U;if(null===e)throw Error(y(349));var f=b._getVersion,g=f(b._source),h=vh.current,k=h.useState(function(){return Mh(e,b,c)}),l=k[1],n=k[0];k=T;var A=a.memoizedState,p=A.refs,C=p.getSnapshot,x=A.source;A=A.subscribe;var w=R;a.memoizedState={refs:p,source:b,subscribe:d};h.useEffect(function(){p.getSnapshot=c;p.setSnapshot=l;var a=f(b._source);if(!He(g,a)){a=c(b._source);He(n,a)||(l(a),a=Ig(w),e.mutableReadLanes|=a&e.pendingLanes);a=e.mutableReadLanes;e.entangledLanes|=a;for(var d=\ne.entanglements,h=a;0c?98:c,function(){a(!0)});gg(97\\x3c/script>\",a=a.removeChild(a.firstChild)):\"string\"===typeof d.is?a=g.createElement(c,{is:d.is}):(a=g.createElement(c),\"select\"===c&&(g=a,d.multiple?g.multiple=!0:d.size&&(g.size=d.size))):a=g.createElementNS(a,c);a[wf]=b;a[xf]=d;Bi(a,b,!1,!1);b.stateNode=a;g=wb(c,d);switch(c){case \"dialog\":G(\"cancel\",a);G(\"close\",a);\ne=d;break;case \"iframe\":case \"object\":case \"embed\":G(\"load\",a);e=d;break;case \"video\":case \"audio\":for(e=0;eJi&&(b.flags|=64,f=!0,Fi(d,!1),b.lanes=33554432)}else{if(!f)if(a=ih(g),null!==a){if(b.flags|=64,f=!0,c=a.updateQueue,null!==c&&(b.updateQueue=c,b.flags|=4),Fi(d,!0),null===d.tail&&\"hidden\"===d.tailMode&&!g.alternate&&!lh)return b=b.lastEffect=d.lastEffect,null!==b&&(b.nextEffect=null),null}else 2*O()-d.renderingStartTime>Ji&&1073741824!==c&&(b.flags|=\n64,f=!0,Fi(d,!1),b.lanes=33554432);d.isBackwards?(g.sibling=b.child,b.child=g):(c=d.last,null!==c?c.sibling=g:b.child=g,d.last=g)}return null!==d.tail?(c=d.tail,d.rendering=c,d.tail=c.sibling,d.lastEffect=b.lastEffect,d.renderingStartTime=O(),c.sibling=null,b=P.current,I(P,f?b&1|2:b&1),c):null;case 23:case 24:return Ki(),null!==a&&null!==a.memoizedState!==(null!==b.memoizedState)&&\"unstable-defer-without-hiding\"!==d.mode&&(b.flags|=4),null}throw Error(y(156,b.tag));}\nfunction Li(a){switch(a.tag){case 1:Ff(a.type)&&Gf();var b=a.flags;return b&4096?(a.flags=b&-4097|64,a):null;case 3:fh();H(N);H(M);uh();b=a.flags;if(0!==(b&64))throw Error(y(285));a.flags=b&-4097|64;return a;case 5:return hh(a),null;case 13:return H(P),b=a.flags,b&4096?(a.flags=b&-4097|64,a):null;case 19:return H(P),null;case 4:return fh(),null;case 10:return rg(a),null;case 23:case 24:return Ki(),null;default:return null}}\nfunction Mi(a,b){try{var c=\"\",d=b;do c+=Qa(d),d=d.return;while(d);var e=c}catch(f){e=\"\\nError generating stack: \"+f.message+\"\\n\"+f.stack}return{value:a,source:b,stack:e}}function Ni(a,b){try{console.error(b.value)}catch(c){setTimeout(function(){throw c;})}}var Oi=\"function\"===typeof WeakMap?WeakMap:Map;function Pi(a,b,c){c=zg(-1,c);c.tag=3;c.payload={element:null};var d=b.value;c.callback=function(){Qi||(Qi=!0,Ri=d);Ni(a,b)};return c}\nfunction Si(a,b,c){c=zg(-1,c);c.tag=3;var d=a.type.getDerivedStateFromError;if(\"function\"===typeof d){var e=b.value;c.payload=function(){Ni(a,b);return d(e)}}var f=a.stateNode;null!==f&&\"function\"===typeof f.componentDidCatch&&(c.callback=function(){\"function\"!==typeof d&&(null===Ti?Ti=new Set([this]):Ti.add(this),Ni(a,b));var c=b.stack;this.componentDidCatch(b.value,{componentStack:null!==c?c:\"\"})});return c}var Ui=\"function\"===typeof WeakSet?WeakSet:Set;\nfunction Vi(a){var b=a.ref;if(null!==b)if(\"function\"===typeof b)try{b(null)}catch(c){Wi(a,c)}else b.current=null}function Xi(a,b){switch(b.tag){case 0:case 11:case 15:case 22:return;case 1:if(b.flags&256&&null!==a){var c=a.memoizedProps,d=a.memoizedState;a=b.stateNode;b=a.getSnapshotBeforeUpdate(b.elementType===b.type?c:lg(b.type,c),d);a.__reactInternalSnapshotBeforeUpdate=b}return;case 3:b.flags&256&&qf(b.stateNode.containerInfo);return;case 5:case 6:case 4:case 17:return}throw Error(y(163));}\nfunction Yi(a,b,c){switch(c.tag){case 0:case 11:case 15:case 22:b=c.updateQueue;b=null!==b?b.lastEffect:null;if(null!==b){a=b=b.next;do{if(3===(a.tag&3)){var d=a.create;a.destroy=d()}a=a.next}while(a!==b)}b=c.updateQueue;b=null!==b?b.lastEffect:null;if(null!==b){a=b=b.next;do{var e=a;d=e.next;e=e.tag;0!==(e&4)&&0!==(e&1)&&(Zi(c,a),$i(c,a));a=d}while(a!==b)}return;case 1:a=c.stateNode;c.flags&4&&(null===b?a.componentDidMount():(d=c.elementType===c.type?b.memoizedProps:lg(c.type,b.memoizedProps),a.componentDidUpdate(d,\nb.memoizedState,a.__reactInternalSnapshotBeforeUpdate)));b=c.updateQueue;null!==b&&Eg(c,b,a);return;case 3:b=c.updateQueue;if(null!==b){a=null;if(null!==c.child)switch(c.child.tag){case 5:a=c.child.stateNode;break;case 1:a=c.child.stateNode}Eg(c,b,a)}return;case 5:a=c.stateNode;null===b&&c.flags&4&&mf(c.type,c.memoizedProps)&&a.focus();return;case 6:return;case 4:return;case 12:return;case 13:null===c.memoizedState&&(c=c.alternate,null!==c&&(c=c.memoizedState,null!==c&&(c=c.dehydrated,null!==c&&Cc(c))));\nreturn;case 19:case 17:case 20:case 21:case 23:case 24:return}throw Error(y(163));}\nfunction aj(a,b){for(var c=a;;){if(5===c.tag){var d=c.stateNode;if(b)d=d.style,\"function\"===typeof d.setProperty?d.setProperty(\"display\",\"none\",\"important\"):d.display=\"none\";else{d=c.stateNode;var e=c.memoizedProps.style;e=void 0!==e&&null!==e&&e.hasOwnProperty(\"display\")?e.display:null;d.style.display=sb(\"display\",e)}}else if(6===c.tag)c.stateNode.nodeValue=b?\"\":c.memoizedProps;else if((23!==c.tag&&24!==c.tag||null===c.memoizedState||c===a)&&null!==c.child){c.child.return=c;c=c.child;continue}if(c===\na)break;for(;null===c.sibling;){if(null===c.return||c.return===a)return;c=c.return}c.sibling.return=c.return;c=c.sibling}}\nfunction bj(a,b){if(Mf&&\"function\"===typeof Mf.onCommitFiberUnmount)try{Mf.onCommitFiberUnmount(Lf,b)}catch(f){}switch(b.tag){case 0:case 11:case 14:case 15:case 22:a=b.updateQueue;if(null!==a&&(a=a.lastEffect,null!==a)){var c=a=a.next;do{var d=c,e=d.destroy;d=d.tag;if(void 0!==e)if(0!==(d&4))Zi(b,c);else{d=b;try{e()}catch(f){Wi(d,f)}}c=c.next}while(c!==a)}break;case 1:Vi(b);a=b.stateNode;if(\"function\"===typeof a.componentWillUnmount)try{a.props=b.memoizedProps,a.state=b.memoizedState,a.componentWillUnmount()}catch(f){Wi(b,\nf)}break;case 5:Vi(b);break;case 4:cj(a,b)}}function dj(a){a.alternate=null;a.child=null;a.dependencies=null;a.firstEffect=null;a.lastEffect=null;a.memoizedProps=null;a.memoizedState=null;a.pendingProps=null;a.return=null;a.updateQueue=null}function ej(a){return 5===a.tag||3===a.tag||4===a.tag}\nfunction fj(a){a:{for(var b=a.return;null!==b;){if(ej(b))break a;b=b.return}throw Error(y(160));}var c=b;b=c.stateNode;switch(c.tag){case 5:var d=!1;break;case 3:b=b.containerInfo;d=!0;break;case 4:b=b.containerInfo;d=!0;break;default:throw Error(y(161));}c.flags&16&&(pb(b,\"\"),c.flags&=-17);a:b:for(c=a;;){for(;null===c.sibling;){if(null===c.return||ej(c.return)){c=null;break a}c=c.return}c.sibling.return=c.return;for(c=c.sibling;5!==c.tag&&6!==c.tag&&18!==c.tag;){if(c.flags&2)continue b;if(null===\nc.child||4===c.tag)continue b;else c.child.return=c,c=c.child}if(!(c.flags&2)){c=c.stateNode;break a}}d?gj(a,c,b):hj(a,c,b)}\nfunction gj(a,b,c){var d=a.tag,e=5===d||6===d;if(e)a=e?a.stateNode:a.stateNode.instance,b?8===c.nodeType?c.parentNode.insertBefore(a,b):c.insertBefore(a,b):(8===c.nodeType?(b=c.parentNode,b.insertBefore(a,c)):(b=c,b.appendChild(a)),c=c._reactRootContainer,null!==c&&void 0!==c||null!==b.onclick||(b.onclick=jf));else if(4!==d&&(a=a.child,null!==a))for(gj(a,b,c),a=a.sibling;null!==a;)gj(a,b,c),a=a.sibling}\nfunction hj(a,b,c){var d=a.tag,e=5===d||6===d;if(e)a=e?a.stateNode:a.stateNode.instance,b?c.insertBefore(a,b):c.appendChild(a);else if(4!==d&&(a=a.child,null!==a))for(hj(a,b,c),a=a.sibling;null!==a;)hj(a,b,c),a=a.sibling}\nfunction cj(a,b){for(var c=b,d=!1,e,f;;){if(!d){d=c.return;a:for(;;){if(null===d)throw Error(y(160));e=d.stateNode;switch(d.tag){case 5:f=!1;break a;case 3:e=e.containerInfo;f=!0;break a;case 4:e=e.containerInfo;f=!0;break a}d=d.return}d=!0}if(5===c.tag||6===c.tag){a:for(var g=a,h=c,k=h;;)if(bj(g,k),null!==k.child&&4!==k.tag)k.child.return=k,k=k.child;else{if(k===h)break a;for(;null===k.sibling;){if(null===k.return||k.return===h)break a;k=k.return}k.sibling.return=k.return;k=k.sibling}f?(g=e,h=c.stateNode,\n8===g.nodeType?g.parentNode.removeChild(h):g.removeChild(h)):e.removeChild(c.stateNode)}else if(4===c.tag){if(null!==c.child){e=c.stateNode.containerInfo;f=!0;c.child.return=c;c=c.child;continue}}else if(bj(a,c),null!==c.child){c.child.return=c;c=c.child;continue}if(c===b)break;for(;null===c.sibling;){if(null===c.return||c.return===b)return;c=c.return;4===c.tag&&(d=!1)}c.sibling.return=c.return;c=c.sibling}}\nfunction ij(a,b){switch(b.tag){case 0:case 11:case 14:case 15:case 22:var c=b.updateQueue;c=null!==c?c.lastEffect:null;if(null!==c){var d=c=c.next;do 3===(d.tag&3)&&(a=d.destroy,d.destroy=void 0,void 0!==a&&a()),d=d.next;while(d!==c)}return;case 1:return;case 5:c=b.stateNode;if(null!=c){d=b.memoizedProps;var e=null!==a?a.memoizedProps:d;a=b.type;var f=b.updateQueue;b.updateQueue=null;if(null!==f){c[xf]=d;\"input\"===a&&\"radio\"===d.type&&null!=d.name&&$a(c,d);wb(a,e);b=wb(a,d);for(e=0;ee&&(e=g);c&=~f}c=e;c=O()-c;c=(120>c?120:480>c?480:1080>c?1080:1920>c?1920:3E3>c?3E3:4320>\nc?4320:1960*nj(c/1960))-c;if(10 component higher in the tree to provide a loading indicator or placeholder to display.\")}5!==V&&(V=2);k=Mi(k,h);p=\ng;do{switch(p.tag){case 3:f=k;p.flags|=4096;b&=-b;p.lanes|=b;var J=Pi(p,f,b);Bg(p,J);break a;case 1:f=k;var K=p.type,Q=p.stateNode;if(0===(p.flags&64)&&(\"function\"===typeof K.getDerivedStateFromError||null!==Q&&\"function\"===typeof Q.componentDidCatch&&(null===Ti||!Ti.has(Q)))){p.flags|=4096;b&=-b;p.lanes|=b;var L=Si(p,f,b);Bg(p,L);break a}}p=p.return}while(null!==p)}Zj(c)}catch(va){b=va;Y===c&&null!==c&&(Y=c=c.return);continue}break}while(1)}\nfunction Pj(){var a=oj.current;oj.current=Gh;return null===a?Gh:a}function Tj(a,b){var c=X;X|=16;var d=Pj();U===a&&W===b||Qj(a,b);do try{ak();break}catch(e){Sj(a,e)}while(1);qg();X=c;oj.current=d;if(null!==Y)throw Error(y(261));U=null;W=0;return V}function ak(){for(;null!==Y;)bk(Y)}function Rj(){for(;null!==Y&&!Qf();)bk(Y)}function bk(a){var b=ck(a.alternate,a,qj);a.memoizedProps=a.pendingProps;null===b?Zj(a):Y=b;pj.current=null}\nfunction Zj(a){var b=a;do{var c=b.alternate;a=b.return;if(0===(b.flags&2048)){c=Gi(c,b,qj);if(null!==c){Y=c;return}c=b;if(24!==c.tag&&23!==c.tag||null===c.memoizedState||0!==(qj&1073741824)||0===(c.mode&4)){for(var d=0,e=c.child;null!==e;)d|=e.lanes|e.childLanes,e=e.sibling;c.childLanes=d}null!==a&&0===(a.flags&2048)&&(null===a.firstEffect&&(a.firstEffect=b.firstEffect),null!==b.lastEffect&&(null!==a.lastEffect&&(a.lastEffect.nextEffect=b.firstEffect),a.lastEffect=b.lastEffect),1g&&(h=g,g=J,J=h),h=Le(t,J),f=Le(t,g),h&&f&&(1!==v.rangeCount||v.anchorNode!==h.node||v.anchorOffset!==h.offset||v.focusNode!==f.node||v.focusOffset!==f.offset)&&(q=q.createRange(),q.setStart(h.node,h.offset),v.removeAllRanges(),J>g?(v.addRange(q),v.extend(f.node,f.offset)):(q.setEnd(f.node,f.offset),v.addRange(q))))));q=[];for(v=t;v=v.parentNode;)1===v.nodeType&&q.push({element:v,left:v.scrollLeft,top:v.scrollTop});\"function\"===typeof t.focus&&t.focus();for(t=\n0;tO()-jj?Qj(a,0):uj|=c);Mj(a,b)}function lj(a,b){var c=a.stateNode;null!==c&&c.delete(b);b=0;0===b&&(b=a.mode,0===(b&2)?b=1:0===(b&4)?b=99===eg()?1:2:(0===Gj&&(Gj=tj),b=Yc(62914560&~Gj),0===b&&(b=4194304)));c=Hg();a=Kj(a,b);null!==a&&($c(a,b,c),Mj(a,c))}var ck;\nck=function(a,b,c){var d=b.lanes;if(null!==a)if(a.memoizedProps!==b.pendingProps||N.current)ug=!0;else if(0!==(c&d))ug=0!==(a.flags&16384)?!0:!1;else{ug=!1;switch(b.tag){case 3:ri(b);sh();break;case 5:gh(b);break;case 1:Ff(b.type)&&Jf(b);break;case 4:eh(b,b.stateNode.containerInfo);break;case 10:d=b.memoizedProps.value;var e=b.type._context;I(mg,e._currentValue);e._currentValue=d;break;case 13:if(null!==b.memoizedState){if(0!==(c&b.child.childLanes))return ti(a,b,c);I(P,P.current&1);b=hi(a,b,c);return null!==\nb?b.sibling:null}I(P,P.current&1);break;case 19:d=0!==(c&b.childLanes);if(0!==(a.flags&64)){if(d)return Ai(a,b,c);b.flags|=64}e=b.memoizedState;null!==e&&(e.rendering=null,e.tail=null,e.lastEffect=null);I(P,P.current);if(d)break;else return null;case 23:case 24:return b.lanes=0,mi(a,b,c)}return hi(a,b,c)}else ug=!1;b.lanes=0;switch(b.tag){case 2:d=b.type;null!==a&&(a.alternate=null,b.alternate=null,b.flags|=2);a=b.pendingProps;e=Ef(b,M.current);tg(b,c);e=Ch(null,b,d,a,e,c);b.flags|=1;if(\"object\"===\ntypeof e&&null!==e&&\"function\"===typeof e.render&&void 0===e.$$typeof){b.tag=1;b.memoizedState=null;b.updateQueue=null;if(Ff(d)){var f=!0;Jf(b)}else f=!1;b.memoizedState=null!==e.state&&void 0!==e.state?e.state:null;xg(b);var g=d.getDerivedStateFromProps;\"function\"===typeof g&&Gg(b,d,g,a);e.updater=Kg;b.stateNode=e;e._reactInternals=b;Og(b,d,a,c);b=qi(null,b,d,!0,f,c)}else b.tag=0,fi(null,b,e,c),b=b.child;return b;case 16:e=b.elementType;a:{null!==a&&(a.alternate=null,b.alternate=null,b.flags|=2);\na=b.pendingProps;f=e._init;e=f(e._payload);b.type=e;f=b.tag=hk(e);a=lg(e,a);switch(f){case 0:b=li(null,b,e,a,c);break a;case 1:b=pi(null,b,e,a,c);break a;case 11:b=gi(null,b,e,a,c);break a;case 14:b=ii(null,b,e,lg(e.type,a),d,c);break a}throw Error(y(306,e,\"\"));}return b;case 0:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:lg(d,e),li(a,b,d,e,c);case 1:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:lg(d,e),pi(a,b,d,e,c);case 3:ri(b);d=b.updateQueue;if(null===a||null===d)throw Error(y(282));\nd=b.pendingProps;e=b.memoizedState;e=null!==e?e.element:null;yg(a,b);Cg(b,d,null,c);d=b.memoizedState.element;if(d===e)sh(),b=hi(a,b,c);else{e=b.stateNode;if(f=e.hydrate)kh=rf(b.stateNode.containerInfo.firstChild),jh=b,f=lh=!0;if(f){a=e.mutableSourceEagerHydrationData;if(null!=a)for(e=0;e=\nE};k=function(){};exports.unstable_forceFrameRate=function(a){0>a||125>>1,e=a[d];if(void 0!==e&&0I(n,c))void 0!==r&&0>I(r,n)?(a[d]=r,a[v]=c,d=v):(a[d]=n,a[m]=c,d=m);else if(void 0!==r&&0>I(r,c))a[d]=r,a[v]=c,d=v;else break a}}return b}return null}function I(a,b){var c=a.sortIndex-b.sortIndex;return 0!==c?c:a.id-b.id}var L=[],M=[],N=1,O=null,P=3,Q=!1,R=!1,S=!1;\nfunction T(a){for(var b=J(M);null!==b;){if(null===b.callback)K(M);else if(b.startTime<=a)K(M),b.sortIndex=b.expirationTime,H(L,b);else break;b=J(M)}}function U(a){S=!1;T(a);if(!R)if(null!==J(L))R=!0,f(V);else{var b=J(M);null!==b&&g(U,b.startTime-a)}}\nfunction V(a,b){R=!1;S&&(S=!1,h());Q=!0;var c=P;try{T(b);for(O=J(L);null!==O&&(!(O.expirationTime>b)||a&&!exports.unstable_shouldYield());){var d=O.callback;if(\"function\"===typeof d){O.callback=null;P=O.priorityLevel;var e=d(O.expirationTime<=b);b=exports.unstable_now();\"function\"===typeof e?O.callback=e:O===J(L)&&K(L);T(b)}else K(L);O=J(L)}if(null!==O)var m=!0;else{var n=J(M);null!==n&&g(U,n.startTime-b);m=!1}return m}finally{O=null,P=c,Q=!1}}var W=k;exports.unstable_IdlePriority=5;\nexports.unstable_ImmediatePriority=1;exports.unstable_LowPriority=4;exports.unstable_NormalPriority=3;exports.unstable_Profiling=null;exports.unstable_UserBlockingPriority=2;exports.unstable_cancelCallback=function(a){a.callback=null};exports.unstable_continueExecution=function(){R||Q||(R=!0,f(V))};exports.unstable_getCurrentPriorityLevel=function(){return P};exports.unstable_getFirstCallbackNode=function(){return J(L)};\nexports.unstable_next=function(a){switch(P){case 1:case 2:case 3:var b=3;break;default:b=P}var c=P;P=b;try{return a()}finally{P=c}};exports.unstable_pauseExecution=function(){};exports.unstable_requestPaint=W;exports.unstable_runWithPriority=function(a,b){switch(a){case 1:case 2:case 3:case 4:case 5:break;default:a=3}var c=P;P=a;try{return b()}finally{P=c}};\nexports.unstable_scheduleCallback=function(a,b,c){var d=exports.unstable_now();\"object\"===typeof c&&null!==c?(c=c.delay,c=\"number\"===typeof c&&0d?(a.sortIndex=c,H(M,a),null===J(L)&&a===J(M)&&(S?h():S=!0,g(U,c-d))):(a.sortIndex=e,H(L,a),R||Q||(R=!0,f(V)));return a};\nexports.unstable_wrapCallback=function(a){var b=P;return function(){var c=P;P=b;try{return a.apply(this,arguments)}finally{P=c}}};\n","/**\n * Copyright (c) 2014-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nvar runtime = (function (exports) {\n \"use strict\";\n\n var Op = Object.prototype;\n var hasOwn = Op.hasOwnProperty;\n var undefined; // More compressible than void 0.\n var $Symbol = typeof Symbol === \"function\" ? Symbol : {};\n var iteratorSymbol = $Symbol.iterator || \"@@iterator\";\n var asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\";\n var toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\";\n\n function define(obj, key, value) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n return obj[key];\n }\n try {\n // IE 8 has a broken Object.defineProperty that only works on DOM objects.\n define({}, \"\");\n } catch (err) {\n define = function(obj, key, value) {\n return obj[key] = value;\n };\n }\n\n function wrap(innerFn, outerFn, self, tryLocsList) {\n // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.\n var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;\n var generator = Object.create(protoGenerator.prototype);\n var context = new Context(tryLocsList || []);\n\n // The ._invoke method unifies the implementations of the .next,\n // .throw, and .return methods.\n generator._invoke = makeInvokeMethod(innerFn, self, context);\n\n return generator;\n }\n exports.wrap = wrap;\n\n // Try/catch helper to minimize deoptimizations. Returns a completion\n // record like context.tryEntries[i].completion. This interface could\n // have been (and was previously) designed to take a closure to be\n // invoked without arguments, but in all the cases we care about we\n // already have an existing method we want to call, so there's no need\n // to create a new function object. We can even get away with assuming\n // the method takes exactly one argument, since that happens to be true\n // in every case, so we don't have to touch the arguments object. The\n // only additional allocation required is the completion record, which\n // has a stable shape and so hopefully should be cheap to allocate.\n function tryCatch(fn, obj, arg) {\n try {\n return { type: \"normal\", arg: fn.call(obj, arg) };\n } catch (err) {\n return { type: \"throw\", arg: err };\n }\n }\n\n var GenStateSuspendedStart = \"suspendedStart\";\n var GenStateSuspendedYield = \"suspendedYield\";\n var GenStateExecuting = \"executing\";\n var GenStateCompleted = \"completed\";\n\n // Returning this object from the innerFn has the same effect as\n // breaking out of the dispatch switch statement.\n var ContinueSentinel = {};\n\n // Dummy constructor functions that we use as the .constructor and\n // .constructor.prototype properties for functions that return Generator\n // objects. For full spec compliance, you may wish to configure your\n // minifier not to mangle the names of these two functions.\n function Generator() {}\n function GeneratorFunction() {}\n function GeneratorFunctionPrototype() {}\n\n // This is a polyfill for %IteratorPrototype% for environments that\n // don't natively support it.\n var IteratorPrototype = {};\n IteratorPrototype[iteratorSymbol] = function () {\n return this;\n };\n\n var getProto = Object.getPrototypeOf;\n var NativeIteratorPrototype = getProto && getProto(getProto(values([])));\n if (NativeIteratorPrototype &&\n NativeIteratorPrototype !== Op &&\n hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {\n // This environment has a native %IteratorPrototype%; use it instead\n // of the polyfill.\n IteratorPrototype = NativeIteratorPrototype;\n }\n\n var Gp = GeneratorFunctionPrototype.prototype =\n Generator.prototype = Object.create(IteratorPrototype);\n GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;\n GeneratorFunctionPrototype.constructor = GeneratorFunction;\n GeneratorFunction.displayName = define(\n GeneratorFunctionPrototype,\n toStringTagSymbol,\n \"GeneratorFunction\"\n );\n\n // Helper for defining the .next, .throw, and .return methods of the\n // Iterator interface in terms of a single ._invoke method.\n function defineIteratorMethods(prototype) {\n [\"next\", \"throw\", \"return\"].forEach(function(method) {\n define(prototype, method, function(arg) {\n return this._invoke(method, arg);\n });\n });\n }\n\n exports.isGeneratorFunction = function(genFun) {\n var ctor = typeof genFun === \"function\" && genFun.constructor;\n return ctor\n ? ctor === GeneratorFunction ||\n // For the native GeneratorFunction constructor, the best we can\n // do is to check its .name property.\n (ctor.displayName || ctor.name) === \"GeneratorFunction\"\n : false;\n };\n\n exports.mark = function(genFun) {\n if (Object.setPrototypeOf) {\n Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);\n } else {\n genFun.__proto__ = GeneratorFunctionPrototype;\n define(genFun, toStringTagSymbol, \"GeneratorFunction\");\n }\n genFun.prototype = Object.create(Gp);\n return genFun;\n };\n\n // Within the body of any async function, `await x` is transformed to\n // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test\n // `hasOwn.call(value, \"__await\")` to determine if the yielded value is\n // meant to be awaited.\n exports.awrap = function(arg) {\n return { __await: arg };\n };\n\n function AsyncIterator(generator, PromiseImpl) {\n function invoke(method, arg, resolve, reject) {\n var record = tryCatch(generator[method], generator, arg);\n if (record.type === \"throw\") {\n reject(record.arg);\n } else {\n var result = record.arg;\n var value = result.value;\n if (value &&\n typeof value === \"object\" &&\n hasOwn.call(value, \"__await\")) {\n return PromiseImpl.resolve(value.__await).then(function(value) {\n invoke(\"next\", value, resolve, reject);\n }, function(err) {\n invoke(\"throw\", err, resolve, reject);\n });\n }\n\n return PromiseImpl.resolve(value).then(function(unwrapped) {\n // When a yielded Promise is resolved, its final value becomes\n // the .value of the Promise<{value,done}> result for the\n // current iteration.\n result.value = unwrapped;\n resolve(result);\n }, function(error) {\n // If a rejected Promise was yielded, throw the rejection back\n // into the async generator function so it can be handled there.\n return invoke(\"throw\", error, resolve, reject);\n });\n }\n }\n\n var previousPromise;\n\n function enqueue(method, arg) {\n function callInvokeWithMethodAndArg() {\n return new PromiseImpl(function(resolve, reject) {\n invoke(method, arg, resolve, reject);\n });\n }\n\n return previousPromise =\n // If enqueue has been called before, then we want to wait until\n // all previous Promises have been resolved before calling invoke,\n // so that results are always delivered in the correct order. If\n // enqueue has not been called before, then it is important to\n // call invoke immediately, without waiting on a callback to fire,\n // so that the async generator function has the opportunity to do\n // any necessary setup in a predictable way. This predictability\n // is why the Promise constructor synchronously invokes its\n // executor callback, and why async functions synchronously\n // execute code before the first await. Since we implement simple\n // async functions in terms of async generators, it is especially\n // important to get this right, even though it requires care.\n previousPromise ? previousPromise.then(\n callInvokeWithMethodAndArg,\n // Avoid propagating failures to Promises returned by later\n // invocations of the iterator.\n callInvokeWithMethodAndArg\n ) : callInvokeWithMethodAndArg();\n }\n\n // Define the unified helper method that is used to implement .next,\n // .throw, and .return (see defineIteratorMethods).\n this._invoke = enqueue;\n }\n\n defineIteratorMethods(AsyncIterator.prototype);\n AsyncIterator.prototype[asyncIteratorSymbol] = function () {\n return this;\n };\n exports.AsyncIterator = AsyncIterator;\n\n // Note that simple async functions are implemented on top of\n // AsyncIterator objects; they just return a Promise for the value of\n // the final result produced by the iterator.\n exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {\n if (PromiseImpl === void 0) PromiseImpl = Promise;\n\n var iter = new AsyncIterator(\n wrap(innerFn, outerFn, self, tryLocsList),\n PromiseImpl\n );\n\n return exports.isGeneratorFunction(outerFn)\n ? iter // If outerFn is a generator, return the full iterator.\n : iter.next().then(function(result) {\n return result.done ? result.value : iter.next();\n });\n };\n\n function makeInvokeMethod(innerFn, self, context) {\n var state = GenStateSuspendedStart;\n\n return function invoke(method, arg) {\n if (state === GenStateExecuting) {\n throw new Error(\"Generator is already running\");\n }\n\n if (state === GenStateCompleted) {\n if (method === \"throw\") {\n throw arg;\n }\n\n // Be forgiving, per 25.3.3.3.3 of the spec:\n // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume\n return doneResult();\n }\n\n context.method = method;\n context.arg = arg;\n\n while (true) {\n var delegate = context.delegate;\n if (delegate) {\n var delegateResult = maybeInvokeDelegate(delegate, context);\n if (delegateResult) {\n if (delegateResult === ContinueSentinel) continue;\n return delegateResult;\n }\n }\n\n if (context.method === \"next\") {\n // Setting context._sent for legacy support of Babel's\n // function.sent implementation.\n context.sent = context._sent = context.arg;\n\n } else if (context.method === \"throw\") {\n if (state === GenStateSuspendedStart) {\n state = GenStateCompleted;\n throw context.arg;\n }\n\n context.dispatchException(context.arg);\n\n } else if (context.method === \"return\") {\n context.abrupt(\"return\", context.arg);\n }\n\n state = GenStateExecuting;\n\n var record = tryCatch(innerFn, self, context);\n if (record.type === \"normal\") {\n // If an exception is thrown from innerFn, we leave state ===\n // GenStateExecuting and loop back for another invocation.\n state = context.done\n ? GenStateCompleted\n : GenStateSuspendedYield;\n\n if (record.arg === ContinueSentinel) {\n continue;\n }\n\n return {\n value: record.arg,\n done: context.done\n };\n\n } else if (record.type === \"throw\") {\n state = GenStateCompleted;\n // Dispatch the exception by looping back around to the\n // context.dispatchException(context.arg) call above.\n context.method = \"throw\";\n context.arg = record.arg;\n }\n }\n };\n }\n\n // Call delegate.iterator[context.method](context.arg) and handle the\n // result, either by returning a { value, done } result from the\n // delegate iterator, or by modifying context.method and context.arg,\n // setting context.delegate to null, and returning the ContinueSentinel.\n function maybeInvokeDelegate(delegate, context) {\n var method = delegate.iterator[context.method];\n if (method === undefined) {\n // A .throw or .return when the delegate iterator has no .throw\n // method always terminates the yield* loop.\n context.delegate = null;\n\n if (context.method === \"throw\") {\n // Note: [\"return\"] must be used for ES3 parsing compatibility.\n if (delegate.iterator[\"return\"]) {\n // If the delegate iterator has a return method, give it a\n // chance to clean up.\n context.method = \"return\";\n context.arg = undefined;\n maybeInvokeDelegate(delegate, context);\n\n if (context.method === \"throw\") {\n // If maybeInvokeDelegate(context) changed context.method from\n // \"return\" to \"throw\", let that override the TypeError below.\n return ContinueSentinel;\n }\n }\n\n context.method = \"throw\";\n context.arg = new TypeError(\n \"The iterator does not provide a 'throw' method\");\n }\n\n return ContinueSentinel;\n }\n\n var record = tryCatch(method, delegate.iterator, context.arg);\n\n if (record.type === \"throw\") {\n context.method = \"throw\";\n context.arg = record.arg;\n context.delegate = null;\n return ContinueSentinel;\n }\n\n var info = record.arg;\n\n if (! info) {\n context.method = \"throw\";\n context.arg = new TypeError(\"iterator result is not an object\");\n context.delegate = null;\n return ContinueSentinel;\n }\n\n if (info.done) {\n // Assign the result of the finished delegate to the temporary\n // variable specified by delegate.resultName (see delegateYield).\n context[delegate.resultName] = info.value;\n\n // Resume execution at the desired location (see delegateYield).\n context.next = delegate.nextLoc;\n\n // If context.method was \"throw\" but the delegate handled the\n // exception, let the outer generator proceed normally. If\n // context.method was \"next\", forget context.arg since it has been\n // \"consumed\" by the delegate iterator. If context.method was\n // \"return\", allow the original .return call to continue in the\n // outer generator.\n if (context.method !== \"return\") {\n context.method = \"next\";\n context.arg = undefined;\n }\n\n } else {\n // Re-yield the result returned by the delegate method.\n return info;\n }\n\n // The delegate iterator is finished, so forget it and continue with\n // the outer generator.\n context.delegate = null;\n return ContinueSentinel;\n }\n\n // Define Generator.prototype.{next,throw,return} in terms of the\n // unified ._invoke helper method.\n defineIteratorMethods(Gp);\n\n define(Gp, toStringTagSymbol, \"Generator\");\n\n // A Generator should always return itself as the iterator object when the\n // @@iterator function is called on it. Some browsers' implementations of the\n // iterator prototype chain incorrectly implement this, causing the Generator\n // object to not be returned from this call. This ensures that doesn't happen.\n // See https://github.com/facebook/regenerator/issues/274 for more details.\n Gp[iteratorSymbol] = function() {\n return this;\n };\n\n Gp.toString = function() {\n return \"[object Generator]\";\n };\n\n function pushTryEntry(locs) {\n var entry = { tryLoc: locs[0] };\n\n if (1 in locs) {\n entry.catchLoc = locs[1];\n }\n\n if (2 in locs) {\n entry.finallyLoc = locs[2];\n entry.afterLoc = locs[3];\n }\n\n this.tryEntries.push(entry);\n }\n\n function resetTryEntry(entry) {\n var record = entry.completion || {};\n record.type = \"normal\";\n delete record.arg;\n entry.completion = record;\n }\n\n function Context(tryLocsList) {\n // The root entry object (effectively a try statement without a catch\n // or a finally block) gives us a place to store values thrown from\n // locations where there is no enclosing try statement.\n this.tryEntries = [{ tryLoc: \"root\" }];\n tryLocsList.forEach(pushTryEntry, this);\n this.reset(true);\n }\n\n exports.keys = function(object) {\n var keys = [];\n for (var key in object) {\n keys.push(key);\n }\n keys.reverse();\n\n // Rather than returning an object with a next method, we keep\n // things simple and return the next function itself.\n return function next() {\n while (keys.length) {\n var key = keys.pop();\n if (key in object) {\n next.value = key;\n next.done = false;\n return next;\n }\n }\n\n // To avoid creating an additional object, we just hang the .value\n // and .done properties off the next function object itself. This\n // also ensures that the minifier will not anonymize the function.\n next.done = true;\n return next;\n };\n };\n\n function values(iterable) {\n if (iterable) {\n var iteratorMethod = iterable[iteratorSymbol];\n if (iteratorMethod) {\n return iteratorMethod.call(iterable);\n }\n\n if (typeof iterable.next === \"function\") {\n return iterable;\n }\n\n if (!isNaN(iterable.length)) {\n var i = -1, next = function next() {\n while (++i < iterable.length) {\n if (hasOwn.call(iterable, i)) {\n next.value = iterable[i];\n next.done = false;\n return next;\n }\n }\n\n next.value = undefined;\n next.done = true;\n\n return next;\n };\n\n return next.next = next;\n }\n }\n\n // Return an iterator with no values.\n return { next: doneResult };\n }\n exports.values = values;\n\n function doneResult() {\n return { value: undefined, done: true };\n }\n\n Context.prototype = {\n constructor: Context,\n\n reset: function(skipTempReset) {\n this.prev = 0;\n this.next = 0;\n // Resetting context._sent for legacy support of Babel's\n // function.sent implementation.\n this.sent = this._sent = undefined;\n this.done = false;\n this.delegate = null;\n\n this.method = \"next\";\n this.arg = undefined;\n\n this.tryEntries.forEach(resetTryEntry);\n\n if (!skipTempReset) {\n for (var name in this) {\n // Not sure about the optimal order of these conditions:\n if (name.charAt(0) === \"t\" &&\n hasOwn.call(this, name) &&\n !isNaN(+name.slice(1))) {\n this[name] = undefined;\n }\n }\n }\n },\n\n stop: function() {\n this.done = true;\n\n var rootEntry = this.tryEntries[0];\n var rootRecord = rootEntry.completion;\n if (rootRecord.type === \"throw\") {\n throw rootRecord.arg;\n }\n\n return this.rval;\n },\n\n dispatchException: function(exception) {\n if (this.done) {\n throw exception;\n }\n\n var context = this;\n function handle(loc, caught) {\n record.type = \"throw\";\n record.arg = exception;\n context.next = loc;\n\n if (caught) {\n // If the dispatched exception was caught by a catch block,\n // then let that catch block handle the exception normally.\n context.method = \"next\";\n context.arg = undefined;\n }\n\n return !! caught;\n }\n\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n var record = entry.completion;\n\n if (entry.tryLoc === \"root\") {\n // Exception thrown outside of any try block that could handle\n // it, so set the completion value of the entire function to\n // throw the exception.\n return handle(\"end\");\n }\n\n if (entry.tryLoc <= this.prev) {\n var hasCatch = hasOwn.call(entry, \"catchLoc\");\n var hasFinally = hasOwn.call(entry, \"finallyLoc\");\n\n if (hasCatch && hasFinally) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n } else if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else if (hasCatch) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n }\n\n } else if (hasFinally) {\n if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else {\n throw new Error(\"try statement without catch or finally\");\n }\n }\n }\n },\n\n abrupt: function(type, arg) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc <= this.prev &&\n hasOwn.call(entry, \"finallyLoc\") &&\n this.prev < entry.finallyLoc) {\n var finallyEntry = entry;\n break;\n }\n }\n\n if (finallyEntry &&\n (type === \"break\" ||\n type === \"continue\") &&\n finallyEntry.tryLoc <= arg &&\n arg <= finallyEntry.finallyLoc) {\n // Ignore the finally entry if control is not jumping to a\n // location outside the try/catch block.\n finallyEntry = null;\n }\n\n var record = finallyEntry ? finallyEntry.completion : {};\n record.type = type;\n record.arg = arg;\n\n if (finallyEntry) {\n this.method = \"next\";\n this.next = finallyEntry.finallyLoc;\n return ContinueSentinel;\n }\n\n return this.complete(record);\n },\n\n complete: function(record, afterLoc) {\n if (record.type === \"throw\") {\n throw record.arg;\n }\n\n if (record.type === \"break\" ||\n record.type === \"continue\") {\n this.next = record.arg;\n } else if (record.type === \"return\") {\n this.rval = this.arg = record.arg;\n this.method = \"return\";\n this.next = \"end\";\n } else if (record.type === \"normal\" && afterLoc) {\n this.next = afterLoc;\n }\n\n return ContinueSentinel;\n },\n\n finish: function(finallyLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.finallyLoc === finallyLoc) {\n this.complete(entry.completion, entry.afterLoc);\n resetTryEntry(entry);\n return ContinueSentinel;\n }\n }\n },\n\n \"catch\": function(tryLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc === tryLoc) {\n var record = entry.completion;\n if (record.type === \"throw\") {\n var thrown = record.arg;\n resetTryEntry(entry);\n }\n return thrown;\n }\n }\n\n // The context.catch method must only be called with a location\n // argument that corresponds to a known catch block.\n throw new Error(\"illegal catch attempt\");\n },\n\n delegateYield: function(iterable, resultName, nextLoc) {\n this.delegate = {\n iterator: values(iterable),\n resultName: resultName,\n nextLoc: nextLoc\n };\n\n if (this.method === \"next\") {\n // Deliberately forget the last sent value so that we don't\n // accidentally pass it on to the delegate.\n this.arg = undefined;\n }\n\n return ContinueSentinel;\n }\n };\n\n // Regardless of whether this script is executing as a CommonJS module\n // or not, return the runtime object so that we can declare the variable\n // regeneratorRuntime in the outer scope, which allows this module to be\n // injected easily by `bin/regenerator --include-runtime script.js`.\n return exports;\n\n}(\n // If this script is executing as a CommonJS module, use module.exports\n // as the regeneratorRuntime namespace. Otherwise create a new empty\n // object. Either way, the resulting object will be used to initialize\n // the regeneratorRuntime variable at the top of this file.\n typeof module === \"object\" ? module.exports : {}\n));\n\ntry {\n regeneratorRuntime = runtime;\n} catch (accidentalStrictMode) {\n // This module should not be running in strict mode, so the above\n // assignment should always work unless something is misconfigured. Just\n // in case runtime.js accidentally runs in strict mode, we can escape\n // strict mode using a global Function call. This could conceivably fail\n // if a Content Security Policy forbids using Function, but in that case\n // the proper solution is to fix the accidental strict mode problem. If\n // you've misconfigured your bundler to force strict mode and applied a\n // CSP to forbid Function, and you're not willing to fix either of those\n // problems, please detail your unique predicament in a GitHub issue.\n Function(\"r\", \"regeneratorRuntime = r\")(runtime);\n}\n","module.exports =\n/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 4);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports, __webpack_require__) {\n\n/* WEBPACK VAR INJECTION */(function(global) {var require;var require;(function (f) {\n if (true) {\n module.exports = f();\n } else if (typeof define === \"function\" && define.amd) {\n define([], f);\n } else {\n var g;\n\n if (typeof window !== \"undefined\") {\n g = window;\n } else if (typeof global !== \"undefined\") {\n g = global;\n } else if (typeof self !== \"undefined\") {\n g = self;\n } else {\n g = this;\n }\n\n g.SF = f();\n }\n})(function () {\n var define, module, exports;\n return function () {\n function r(e, n, t) {\n function o(i, f) {\n if (!n[i]) {\n if (!e[i]) {\n var c = \"function\" == typeof require && require;\n if (!f && c) return require(i, !0);\n if (u) return u(i, !0);\n var a = new Error(\"Cannot find module '\" + i + \"'\");\n throw a.code = \"MODULE_NOT_FOUND\", a;\n }\n\n var p = n[i] = {\n exports: {}\n };\n e[i][0].call(p.exports, function (r) {\n var n = e[i][1][r];\n return o(n || r);\n }, p, p.exports, r, e, n, t);\n }\n\n return n[i].exports;\n }\n\n for (var u = \"function\" == typeof require && require, i = 0; i < t.length; i++) o(t[i]);\n\n return o;\n }\n\n return r;\n }()({\n 1: [function (require, module, exports) {\n (function (global) {\n /*\n CryptoJS v3.1.2\n code.google.com/p/crypto-js\n (c) 2009-2013 by Jeff Mott. All rights reserved.\n code.google.com/p/crypto-js/wiki/License\n */\n var CryptoJS = CryptoJS || function (u, p) {\n var d = {},\n l = d.lib = {},\n s = function () {},\n t = l.Base = {\n extend: function (a) {\n s.prototype = this;\n var c = new s();\n a && c.mixIn(a);\n c.hasOwnProperty(\"init\") || (c.init = function () {\n c.$super.init.apply(this, arguments);\n });\n c.init.prototype = c;\n c.$super = this;\n return c;\n },\n create: function () {\n var a = this.extend();\n a.init.apply(a, arguments);\n return a;\n },\n init: function () {},\n mixIn: function (a) {\n for (var c in a) a.hasOwnProperty(c) && (this[c] = a[c]);\n\n a.hasOwnProperty(\"toString\") && (this.toString = a.toString);\n },\n clone: function () {\n return this.init.prototype.extend(this);\n }\n },\n r = l.WordArray = t.extend({\n init: function (a, c) {\n a = this.words = a || [];\n this.sigBytes = c != p ? c : 4 * a.length;\n },\n toString: function (a) {\n return (a || v).stringify(this);\n },\n concat: function (a) {\n var c = this.words,\n e = a.words,\n j = this.sigBytes;\n a = a.sigBytes;\n this.clamp();\n if (j % 4) for (var k = 0; k < a; k++) c[j + k >>> 2] |= (e[k >>> 2] >>> 24 - 8 * (k % 4) & 255) << 24 - 8 * ((j + k) % 4);else if (65535 < e.length) for (k = 0; k < a; k += 4) c[j + k >>> 2] = e[k >>> 2];else c.push.apply(c, e);\n this.sigBytes += a;\n return this;\n },\n clamp: function () {\n var a = this.words,\n c = this.sigBytes;\n a[c >>> 2] &= 4294967295 << 32 - 8 * (c % 4);\n a.length = u.ceil(c / 4);\n },\n clone: function () {\n var a = t.clone.call(this);\n a.words = this.words.slice(0);\n return a;\n },\n random: function (a) {\n for (var c = [], e = 0; e < a; e += 4) c.push(4294967296 * u.random() | 0);\n\n return new r.init(c, a);\n }\n }),\n w = d.enc = {},\n v = w.Hex = {\n stringify: function (a) {\n var c = a.words;\n a = a.sigBytes;\n\n for (var e = [], j = 0; j < a; j++) {\n var k = c[j >>> 2] >>> 24 - 8 * (j % 4) & 255;\n e.push((k >>> 4).toString(16));\n e.push((k & 15).toString(16));\n }\n\n return e.join(\"\");\n },\n parse: function (a) {\n for (var c = a.length, e = [], j = 0; j < c; j += 2) e[j >>> 3] |= parseInt(a.substr(j, 2), 16) << 24 - 4 * (j % 8);\n\n return new r.init(e, c / 2);\n }\n },\n b = w.Latin1 = {\n stringify: function (a) {\n var c = a.words;\n a = a.sigBytes;\n\n for (var e = [], j = 0; j < a; j++) e.push(String.fromCharCode(c[j >>> 2] >>> 24 - 8 * (j % 4) & 255));\n\n return e.join(\"\");\n },\n parse: function (a) {\n for (var c = a.length, e = [], j = 0; j < c; j++) e[j >>> 2] |= (a.charCodeAt(j) & 255) << 24 - 8 * (j % 4);\n\n return new r.init(e, c);\n }\n },\n x = w.Utf8 = {\n stringify: function (a) {\n try {\n return decodeURIComponent(escape(b.stringify(a)));\n } catch (c) {\n throw Error(\"Malformed UTF-8 data\");\n }\n },\n parse: function (a) {\n return b.parse(unescape(encodeURIComponent(a)));\n }\n },\n q = l.BufferedBlockAlgorithm = t.extend({\n reset: function () {\n this._data = new r.init();\n this._nDataBytes = 0;\n },\n _append: function (a) {\n \"string\" == typeof a && (a = x.parse(a));\n\n this._data.concat(a);\n\n this._nDataBytes += a.sigBytes;\n },\n _process: function (a) {\n var c = this._data,\n e = c.words,\n j = c.sigBytes,\n k = this.blockSize,\n b = j / (4 * k),\n b = a ? u.ceil(b) : u.max((b | 0) - this._minBufferSize, 0);\n a = b * k;\n j = u.min(4 * a, j);\n\n if (a) {\n for (var q = 0; q < a; q += k) this._doProcessBlock(e, q);\n\n q = e.splice(0, a);\n c.sigBytes -= j;\n }\n\n return new r.init(q, j);\n },\n clone: function () {\n var a = t.clone.call(this);\n a._data = this._data.clone();\n return a;\n },\n _minBufferSize: 0\n });\n\n l.Hasher = q.extend({\n cfg: t.extend(),\n init: function (a) {\n this.cfg = this.cfg.extend(a);\n this.reset();\n },\n reset: function () {\n q.reset.call(this);\n\n this._doReset();\n },\n update: function (a) {\n this._append(a);\n\n this._process();\n\n return this;\n },\n finalize: function (a) {\n a && this._append(a);\n return this._doFinalize();\n },\n blockSize: 16,\n _createHelper: function (a) {\n return function (b, e) {\n return new a.init(e).finalize(b);\n };\n },\n _createHmacHelper: function (a) {\n return function (b, e) {\n return new n.HMAC.init(a, e).finalize(b);\n };\n }\n });\n var n = d.algo = {};\n return d;\n }(Math);\n\n (function () {\n var u = CryptoJS,\n p = u.lib.WordArray;\n u.enc.Base64 = {\n stringify: function (d) {\n var l = d.words,\n p = d.sigBytes,\n t = this._map;\n d.clamp();\n d = [];\n\n for (var r = 0; r < p; r += 3) for (var w = (l[r >>> 2] >>> 24 - 8 * (r % 4) & 255) << 16 | (l[r + 1 >>> 2] >>> 24 - 8 * ((r + 1) % 4) & 255) << 8 | l[r + 2 >>> 2] >>> 24 - 8 * ((r + 2) % 4) & 255, v = 0; 4 > v && r + 0.75 * v < p; v++) d.push(t.charAt(w >>> 6 * (3 - v) & 63));\n\n if (l = t.charAt(64)) for (; d.length % 4;) d.push(l);\n return d.join(\"\");\n },\n parse: function (d) {\n var l = d.length,\n s = this._map,\n t = s.charAt(64);\n t && (t = d.indexOf(t), -1 != t && (l = t));\n\n for (var t = [], r = 0, w = 0; w < l; w++) if (w % 4) {\n var v = s.indexOf(d.charAt(w - 1)) << 2 * (w % 4),\n b = s.indexOf(d.charAt(w)) >>> 6 - 2 * (w % 4);\n t[r >>> 2] |= (v | b) << 24 - 8 * (r % 4);\n r++;\n }\n\n return p.create(t, r);\n },\n _map: \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\"\n };\n })();\n\n (function (u) {\n function p(b, n, a, c, e, j, k) {\n b = b + (n & a | ~n & c) + e + k;\n return (b << j | b >>> 32 - j) + n;\n }\n\n function d(b, n, a, c, e, j, k) {\n b = b + (n & c | a & ~c) + e + k;\n return (b << j | b >>> 32 - j) + n;\n }\n\n function l(b, n, a, c, e, j, k) {\n b = b + (n ^ a ^ c) + e + k;\n return (b << j | b >>> 32 - j) + n;\n }\n\n function s(b, n, a, c, e, j, k) {\n b = b + (a ^ (n | ~c)) + e + k;\n return (b << j | b >>> 32 - j) + n;\n }\n\n for (var t = CryptoJS, r = t.lib, w = r.WordArray, v = r.Hasher, r = t.algo, b = [], x = 0; 64 > x; x++) b[x] = 4294967296 * u.abs(u.sin(x + 1)) | 0;\n\n r = r.MD5 = v.extend({\n _doReset: function () {\n this._hash = new w.init([1732584193, 4023233417, 2562383102, 271733878]);\n },\n _doProcessBlock: function (q, n) {\n for (var a = 0; 16 > a; a++) {\n var c = n + a,\n e = q[c];\n q[c] = (e << 8 | e >>> 24) & 16711935 | (e << 24 | e >>> 8) & 4278255360;\n }\n\n var a = this._hash.words,\n c = q[n + 0],\n e = q[n + 1],\n j = q[n + 2],\n k = q[n + 3],\n z = q[n + 4],\n r = q[n + 5],\n t = q[n + 6],\n w = q[n + 7],\n v = q[n + 8],\n A = q[n + 9],\n B = q[n + 10],\n C = q[n + 11],\n u = q[n + 12],\n D = q[n + 13],\n E = q[n + 14],\n x = q[n + 15],\n f = a[0],\n m = a[1],\n g = a[2],\n h = a[3],\n f = p(f, m, g, h, c, 7, b[0]),\n h = p(h, f, m, g, e, 12, b[1]),\n g = p(g, h, f, m, j, 17, b[2]),\n m = p(m, g, h, f, k, 22, b[3]),\n f = p(f, m, g, h, z, 7, b[4]),\n h = p(h, f, m, g, r, 12, b[5]),\n g = p(g, h, f, m, t, 17, b[6]),\n m = p(m, g, h, f, w, 22, b[7]),\n f = p(f, m, g, h, v, 7, b[8]),\n h = p(h, f, m, g, A, 12, b[9]),\n g = p(g, h, f, m, B, 17, b[10]),\n m = p(m, g, h, f, C, 22, b[11]),\n f = p(f, m, g, h, u, 7, b[12]),\n h = p(h, f, m, g, D, 12, b[13]),\n g = p(g, h, f, m, E, 17, b[14]),\n m = p(m, g, h, f, x, 22, b[15]),\n f = d(f, m, g, h, e, 5, b[16]),\n h = d(h, f, m, g, t, 9, b[17]),\n g = d(g, h, f, m, C, 14, b[18]),\n m = d(m, g, h, f, c, 20, b[19]),\n f = d(f, m, g, h, r, 5, b[20]),\n h = d(h, f, m, g, B, 9, b[21]),\n g = d(g, h, f, m, x, 14, b[22]),\n m = d(m, g, h, f, z, 20, b[23]),\n f = d(f, m, g, h, A, 5, b[24]),\n h = d(h, f, m, g, E, 9, b[25]),\n g = d(g, h, f, m, k, 14, b[26]),\n m = d(m, g, h, f, v, 20, b[27]),\n f = d(f, m, g, h, D, 5, b[28]),\n h = d(h, f, m, g, j, 9, b[29]),\n g = d(g, h, f, m, w, 14, b[30]),\n m = d(m, g, h, f, u, 20, b[31]),\n f = l(f, m, g, h, r, 4, b[32]),\n h = l(h, f, m, g, v, 11, b[33]),\n g = l(g, h, f, m, C, 16, b[34]),\n m = l(m, g, h, f, E, 23, b[35]),\n f = l(f, m, g, h, e, 4, b[36]),\n h = l(h, f, m, g, z, 11, b[37]),\n g = l(g, h, f, m, w, 16, b[38]),\n m = l(m, g, h, f, B, 23, b[39]),\n f = l(f, m, g, h, D, 4, b[40]),\n h = l(h, f, m, g, c, 11, b[41]),\n g = l(g, h, f, m, k, 16, b[42]),\n m = l(m, g, h, f, t, 23, b[43]),\n f = l(f, m, g, h, A, 4, b[44]),\n h = l(h, f, m, g, u, 11, b[45]),\n g = l(g, h, f, m, x, 16, b[46]),\n m = l(m, g, h, f, j, 23, b[47]),\n f = s(f, m, g, h, c, 6, b[48]),\n h = s(h, f, m, g, w, 10, b[49]),\n g = s(g, h, f, m, E, 15, b[50]),\n m = s(m, g, h, f, r, 21, b[51]),\n f = s(f, m, g, h, u, 6, b[52]),\n h = s(h, f, m, g, k, 10, b[53]),\n g = s(g, h, f, m, B, 15, b[54]),\n m = s(m, g, h, f, e, 21, b[55]),\n f = s(f, m, g, h, v, 6, b[56]),\n h = s(h, f, m, g, x, 10, b[57]),\n g = s(g, h, f, m, t, 15, b[58]),\n m = s(m, g, h, f, D, 21, b[59]),\n f = s(f, m, g, h, z, 6, b[60]),\n h = s(h, f, m, g, C, 10, b[61]),\n g = s(g, h, f, m, j, 15, b[62]),\n m = s(m, g, h, f, A, 21, b[63]);\n a[0] = a[0] + f | 0;\n a[1] = a[1] + m | 0;\n a[2] = a[2] + g | 0;\n a[3] = a[3] + h | 0;\n },\n _doFinalize: function () {\n var b = this._data,\n n = b.words,\n a = 8 * this._nDataBytes,\n c = 8 * b.sigBytes;\n n[c >>> 5] |= 128 << 24 - c % 32;\n var e = u.floor(a / 4294967296);\n n[(c + 64 >>> 9 << 4) + 15] = (e << 8 | e >>> 24) & 16711935 | (e << 24 | e >>> 8) & 4278255360;\n n[(c + 64 >>> 9 << 4) + 14] = (a << 8 | a >>> 24) & 16711935 | (a << 24 | a >>> 8) & 4278255360;\n b.sigBytes = 4 * (n.length + 1);\n\n this._process();\n\n b = this._hash;\n n = b.words;\n\n for (a = 0; 4 > a; a++) c = n[a], n[a] = (c << 8 | c >>> 24) & 16711935 | (c << 24 | c >>> 8) & 4278255360;\n\n return b;\n },\n clone: function () {\n var b = v.clone.call(this);\n b._hash = this._hash.clone();\n return b;\n }\n });\n t.MD5 = v._createHelper(r);\n t.HmacMD5 = v._createHmacHelper(r);\n })(Math);\n\n (function () {\n var u = CryptoJS,\n p = u.lib,\n d = p.Base,\n l = p.WordArray,\n p = u.algo,\n s = p.EvpKDF = d.extend({\n cfg: d.extend({\n keySize: 4,\n hasher: p.MD5,\n iterations: 1\n }),\n init: function (d) {\n this.cfg = this.cfg.extend(d);\n },\n compute: function (d, r) {\n for (var p = this.cfg, s = p.hasher.create(), b = l.create(), u = b.words, q = p.keySize, p = p.iterations; u.length < q;) {\n n && s.update(n);\n var n = s.update(d).finalize(r);\n s.reset();\n\n for (var a = 1; a < p; a++) n = s.finalize(n), s.reset();\n\n b.concat(n);\n }\n\n b.sigBytes = 4 * q;\n return b;\n }\n });\n\n u.EvpKDF = function (d, l, p) {\n return s.create(p).compute(d, l);\n };\n })();\n\n CryptoJS.lib.Cipher || function (u) {\n var p = CryptoJS,\n d = p.lib,\n l = d.Base,\n s = d.WordArray,\n t = d.BufferedBlockAlgorithm,\n r = p.enc.Base64,\n w = p.algo.EvpKDF,\n v = d.Cipher = t.extend({\n cfg: l.extend(),\n createEncryptor: function (e, a) {\n return this.create(this._ENC_XFORM_MODE, e, a);\n },\n createDecryptor: function (e, a) {\n return this.create(this._DEC_XFORM_MODE, e, a);\n },\n init: function (e, a, b) {\n this.cfg = this.cfg.extend(b);\n this._xformMode = e;\n this._key = a;\n this.reset();\n },\n reset: function () {\n t.reset.call(this);\n\n this._doReset();\n },\n process: function (e) {\n this._append(e);\n\n return this._process();\n },\n finalize: function (e) {\n e && this._append(e);\n return this._doFinalize();\n },\n keySize: 4,\n ivSize: 4,\n _ENC_XFORM_MODE: 1,\n _DEC_XFORM_MODE: 2,\n _createHelper: function (e) {\n return {\n encrypt: function (b, k, d) {\n return (\"string\" == typeof k ? c : a).encrypt(e, b, k, d);\n },\n decrypt: function (b, k, d) {\n return (\"string\" == typeof k ? c : a).decrypt(e, b, k, d);\n }\n };\n }\n });\n d.StreamCipher = v.extend({\n _doFinalize: function () {\n return this._process(!0);\n },\n blockSize: 1\n });\n\n var b = p.mode = {},\n x = function (e, a, b) {\n var c = this._iv;\n c ? this._iv = u : c = this._prevBlock;\n\n for (var d = 0; d < b; d++) e[a + d] ^= c[d];\n },\n q = (d.BlockCipherMode = l.extend({\n createEncryptor: function (e, a) {\n return this.Encryptor.create(e, a);\n },\n createDecryptor: function (e, a) {\n return this.Decryptor.create(e, a);\n },\n init: function (e, a) {\n this._cipher = e;\n this._iv = a;\n }\n })).extend();\n\n q.Encryptor = q.extend({\n processBlock: function (e, a) {\n var b = this._cipher,\n c = b.blockSize;\n x.call(this, e, a, c);\n b.encryptBlock(e, a);\n this._prevBlock = e.slice(a, a + c);\n }\n });\n q.Decryptor = q.extend({\n processBlock: function (e, a) {\n var b = this._cipher,\n c = b.blockSize,\n d = e.slice(a, a + c);\n b.decryptBlock(e, a);\n x.call(this, e, a, c);\n this._prevBlock = d;\n }\n });\n b = b.CBC = q;\n q = (p.pad = {}).Pkcs7 = {\n pad: function (a, b) {\n for (var c = 4 * b, c = c - a.sigBytes % c, d = c << 24 | c << 16 | c << 8 | c, l = [], n = 0; n < c; n += 4) l.push(d);\n\n c = s.create(l, c);\n a.concat(c);\n },\n unpad: function (a) {\n a.sigBytes -= a.words[a.sigBytes - 1 >>> 2] & 255;\n }\n };\n d.BlockCipher = v.extend({\n cfg: v.cfg.extend({\n mode: b,\n padding: q\n }),\n reset: function () {\n v.reset.call(this);\n var a = this.cfg,\n b = a.iv,\n a = a.mode;\n if (this._xformMode == this._ENC_XFORM_MODE) var c = a.createEncryptor;else c = a.createDecryptor, this._minBufferSize = 1;\n this._mode = c.call(a, this, b && b.words);\n },\n _doProcessBlock: function (a, b) {\n this._mode.processBlock(a, b);\n },\n _doFinalize: function () {\n var a = this.cfg.padding;\n\n if (this._xformMode == this._ENC_XFORM_MODE) {\n a.pad(this._data, this.blockSize);\n\n var b = this._process(!0);\n } else b = this._process(!0), a.unpad(b);\n\n return b;\n },\n blockSize: 4\n });\n var n = d.CipherParams = l.extend({\n init: function (a) {\n this.mixIn(a);\n },\n toString: function (a) {\n return (a || this.formatter).stringify(this);\n }\n }),\n b = (p.format = {}).OpenSSL = {\n stringify: function (a) {\n var b = a.ciphertext;\n a = a.salt;\n return (a ? s.create([1398893684, 1701076831]).concat(a).concat(b) : b).toString(r);\n },\n parse: function (a) {\n a = r.parse(a);\n var b = a.words;\n\n if (1398893684 == b[0] && 1701076831 == b[1]) {\n var c = s.create(b.slice(2, 4));\n b.splice(0, 4);\n a.sigBytes -= 16;\n }\n\n return n.create({\n ciphertext: a,\n salt: c\n });\n }\n },\n a = d.SerializableCipher = l.extend({\n cfg: l.extend({\n format: b\n }),\n encrypt: function (a, b, c, d) {\n d = this.cfg.extend(d);\n var l = a.createEncryptor(c, d);\n b = l.finalize(b);\n l = l.cfg;\n return n.create({\n ciphertext: b,\n key: c,\n iv: l.iv,\n algorithm: a,\n mode: l.mode,\n padding: l.padding,\n blockSize: a.blockSize,\n formatter: d.format\n });\n },\n decrypt: function (a, b, c, d) {\n d = this.cfg.extend(d);\n b = this._parse(b, d.format);\n return a.createDecryptor(c, d).finalize(b.ciphertext);\n },\n _parse: function (a, b) {\n return \"string\" == typeof a ? b.parse(a, this) : a;\n }\n }),\n p = (p.kdf = {}).OpenSSL = {\n execute: function (a, b, c, d) {\n d || (d = s.random(8));\n a = w.create({\n keySize: b + c\n }).compute(a, d);\n c = s.create(a.words.slice(b), 4 * c);\n a.sigBytes = 4 * b;\n return n.create({\n key: a,\n iv: c,\n salt: d\n });\n }\n },\n c = d.PasswordBasedCipher = a.extend({\n cfg: a.cfg.extend({\n kdf: p\n }),\n encrypt: function (b, c, d, l) {\n l = this.cfg.extend(l);\n d = l.kdf.execute(d, b.keySize, b.ivSize);\n l.iv = d.iv;\n b = a.encrypt.call(this, b, c, d.key, l);\n b.mixIn(d);\n return b;\n },\n decrypt: function (b, c, d, l) {\n l = this.cfg.extend(l);\n c = this._parse(c, l.format);\n d = l.kdf.execute(d, b.keySize, b.ivSize, c.salt);\n l.iv = d.iv;\n return a.decrypt.call(this, b, c, d.key, l);\n }\n });\n }();\n\n (function () {\n for (var u = CryptoJS, p = u.lib.BlockCipher, d = u.algo, l = [], s = [], t = [], r = [], w = [], v = [], b = [], x = [], q = [], n = [], a = [], c = 0; 256 > c; c++) a[c] = 128 > c ? c << 1 : c << 1 ^ 283;\n\n for (var e = 0, j = 0, c = 0; 256 > c; c++) {\n var k = j ^ j << 1 ^ j << 2 ^ j << 3 ^ j << 4,\n k = k >>> 8 ^ k & 255 ^ 99;\n l[e] = k;\n s[k] = e;\n var z = a[e],\n F = a[z],\n G = a[F],\n y = 257 * a[k] ^ 16843008 * k;\n t[e] = y << 24 | y >>> 8;\n r[e] = y << 16 | y >>> 16;\n w[e] = y << 8 | y >>> 24;\n v[e] = y;\n y = 16843009 * G ^ 65537 * F ^ 257 * z ^ 16843008 * e;\n b[k] = y << 24 | y >>> 8;\n x[k] = y << 16 | y >>> 16;\n q[k] = y << 8 | y >>> 24;\n n[k] = y;\n e ? (e = z ^ a[a[a[G ^ z]]], j ^= a[a[j]]) : e = j = 1;\n }\n\n var H = [0, 1, 2, 4, 8, 16, 32, 64, 128, 27, 54],\n d = d.AES = p.extend({\n _doReset: function () {\n for (var a = this._key, c = a.words, d = a.sigBytes / 4, a = 4 * ((this._nRounds = d + 6) + 1), e = this._keySchedule = [], j = 0; j < a; j++) if (j < d) e[j] = c[j];else {\n var k = e[j - 1];\n j % d ? 6 < d && 4 == j % d && (k = l[k >>> 24] << 24 | l[k >>> 16 & 255] << 16 | l[k >>> 8 & 255] << 8 | l[k & 255]) : (k = k << 8 | k >>> 24, k = l[k >>> 24] << 24 | l[k >>> 16 & 255] << 16 | l[k >>> 8 & 255] << 8 | l[k & 255], k ^= H[j / d | 0] << 24);\n e[j] = e[j - d] ^ k;\n }\n\n c = this._invKeySchedule = [];\n\n for (d = 0; d < a; d++) j = a - d, k = d % 4 ? e[j] : e[j - 4], c[d] = 4 > d || 4 >= j ? k : b[l[k >>> 24]] ^ x[l[k >>> 16 & 255]] ^ q[l[k >>> 8 & 255]] ^ n[l[k & 255]];\n },\n encryptBlock: function (a, b) {\n this._doCryptBlock(a, b, this._keySchedule, t, r, w, v, l);\n },\n decryptBlock: function (a, c) {\n var d = a[c + 1];\n a[c + 1] = a[c + 3];\n a[c + 3] = d;\n\n this._doCryptBlock(a, c, this._invKeySchedule, b, x, q, n, s);\n\n d = a[c + 1];\n a[c + 1] = a[c + 3];\n a[c + 3] = d;\n },\n _doCryptBlock: function (a, b, c, d, e, j, l, f) {\n for (var m = this._nRounds, g = a[b] ^ c[0], h = a[b + 1] ^ c[1], k = a[b + 2] ^ c[2], n = a[b + 3] ^ c[3], p = 4, r = 1; r < m; r++) var q = d[g >>> 24] ^ e[h >>> 16 & 255] ^ j[k >>> 8 & 255] ^ l[n & 255] ^ c[p++], s = d[h >>> 24] ^ e[k >>> 16 & 255] ^ j[n >>> 8 & 255] ^ l[g & 255] ^ c[p++], t = d[k >>> 24] ^ e[n >>> 16 & 255] ^ j[g >>> 8 & 255] ^ l[h & 255] ^ c[p++], n = d[n >>> 24] ^ e[g >>> 16 & 255] ^ j[h >>> 8 & 255] ^ l[k & 255] ^ c[p++], g = q, h = s, k = t;\n\n q = (f[g >>> 24] << 24 | f[h >>> 16 & 255] << 16 | f[k >>> 8 & 255] << 8 | f[n & 255]) ^ c[p++];\n s = (f[h >>> 24] << 24 | f[k >>> 16 & 255] << 16 | f[n >>> 8 & 255] << 8 | f[g & 255]) ^ c[p++];\n t = (f[k >>> 24] << 24 | f[n >>> 16 & 255] << 16 | f[g >>> 8 & 255] << 8 | f[h & 255]) ^ c[p++];\n n = (f[n >>> 24] << 24 | f[g >>> 16 & 255] << 16 | f[h >>> 8 & 255] << 8 | f[k & 255]) ^ c[p++];\n a[b] = q;\n a[b + 1] = s;\n a[b + 2] = t;\n a[b + 3] = n;\n },\n keySize: 8\n });\n u.AES = p._createHelper(d);\n })();\n\n ;\n /*\n CryptoJS v3.1.2\n code.google.com/p/crypto-js\n (c) 2009-2013 by Jeff Mott. All rights reserved.\n code.google.com/p/crypto-js/wiki/License\n */\n\n var CryptoJS = CryptoJS || function (h, s) {\n var f = {},\n g = f.lib = {},\n q = function () {},\n m = g.Base = {\n extend: function (a) {\n q.prototype = this;\n var c = new q();\n a && c.mixIn(a);\n c.hasOwnProperty(\"init\") || (c.init = function () {\n c.$super.init.apply(this, arguments);\n });\n c.init.prototype = c;\n c.$super = this;\n return c;\n },\n create: function () {\n var a = this.extend();\n a.init.apply(a, arguments);\n return a;\n },\n init: function () {},\n mixIn: function (a) {\n for (var c in a) a.hasOwnProperty(c) && (this[c] = a[c]);\n\n a.hasOwnProperty(\"toString\") && (this.toString = a.toString);\n },\n clone: function () {\n return this.init.prototype.extend(this);\n }\n },\n r = g.WordArray = m.extend({\n init: function (a, c) {\n a = this.words = a || [];\n this.sigBytes = c != s ? c : 4 * a.length;\n },\n toString: function (a) {\n return (a || k).stringify(this);\n },\n concat: function (a) {\n var c = this.words,\n d = a.words,\n b = this.sigBytes;\n a = a.sigBytes;\n this.clamp();\n if (b % 4) for (var e = 0; e < a; e++) c[b + e >>> 2] |= (d[e >>> 2] >>> 24 - 8 * (e % 4) & 255) << 24 - 8 * ((b + e) % 4);else if (65535 < d.length) for (e = 0; e < a; e += 4) c[b + e >>> 2] = d[e >>> 2];else c.push.apply(c, d);\n this.sigBytes += a;\n return this;\n },\n clamp: function () {\n var a = this.words,\n c = this.sigBytes;\n a[c >>> 2] &= 4294967295 << 32 - 8 * (c % 4);\n a.length = h.ceil(c / 4);\n },\n clone: function () {\n var a = m.clone.call(this);\n a.words = this.words.slice(0);\n return a;\n },\n random: function (a) {\n for (var c = [], d = 0; d < a; d += 4) c.push(4294967296 * h.random() | 0);\n\n return new r.init(c, a);\n }\n }),\n l = f.enc = {},\n k = l.Hex = {\n stringify: function (a) {\n var c = a.words;\n a = a.sigBytes;\n\n for (var d = [], b = 0; b < a; b++) {\n var e = c[b >>> 2] >>> 24 - 8 * (b % 4) & 255;\n d.push((e >>> 4).toString(16));\n d.push((e & 15).toString(16));\n }\n\n return d.join(\"\");\n },\n parse: function (a) {\n for (var c = a.length, d = [], b = 0; b < c; b += 2) d[b >>> 3] |= parseInt(a.substr(b, 2), 16) << 24 - 4 * (b % 8);\n\n return new r.init(d, c / 2);\n }\n },\n n = l.Latin1 = {\n stringify: function (a) {\n var c = a.words;\n a = a.sigBytes;\n\n for (var d = [], b = 0; b < a; b++) d.push(String.fromCharCode(c[b >>> 2] >>> 24 - 8 * (b % 4) & 255));\n\n return d.join(\"\");\n },\n parse: function (a) {\n for (var c = a.length, d = [], b = 0; b < c; b++) d[b >>> 2] |= (a.charCodeAt(b) & 255) << 24 - 8 * (b % 4);\n\n return new r.init(d, c);\n }\n },\n j = l.Utf8 = {\n stringify: function (a) {\n try {\n return decodeURIComponent(escape(n.stringify(a)));\n } catch (c) {\n throw Error(\"Malformed UTF-8 data\");\n }\n },\n parse: function (a) {\n return n.parse(unescape(encodeURIComponent(a)));\n }\n },\n u = g.BufferedBlockAlgorithm = m.extend({\n reset: function () {\n this._data = new r.init();\n this._nDataBytes = 0;\n },\n _append: function (a) {\n \"string\" == typeof a && (a = j.parse(a));\n\n this._data.concat(a);\n\n this._nDataBytes += a.sigBytes;\n },\n _process: function (a) {\n var c = this._data,\n d = c.words,\n b = c.sigBytes,\n e = this.blockSize,\n f = b / (4 * e),\n f = a ? h.ceil(f) : h.max((f | 0) - this._minBufferSize, 0);\n a = f * e;\n b = h.min(4 * a, b);\n\n if (a) {\n for (var g = 0; g < a; g += e) this._doProcessBlock(d, g);\n\n g = d.splice(0, a);\n c.sigBytes -= b;\n }\n\n return new r.init(g, b);\n },\n clone: function () {\n var a = m.clone.call(this);\n a._data = this._data.clone();\n return a;\n },\n _minBufferSize: 0\n });\n\n g.Hasher = u.extend({\n cfg: m.extend(),\n init: function (a) {\n this.cfg = this.cfg.extend(a);\n this.reset();\n },\n reset: function () {\n u.reset.call(this);\n\n this._doReset();\n },\n update: function (a) {\n this._append(a);\n\n this._process();\n\n return this;\n },\n finalize: function (a) {\n a && this._append(a);\n return this._doFinalize();\n },\n blockSize: 16,\n _createHelper: function (a) {\n return function (c, d) {\n return new a.init(d).finalize(c);\n };\n },\n _createHmacHelper: function (a) {\n return function (c, d) {\n return new t.HMAC.init(a, d).finalize(c);\n };\n }\n });\n var t = f.algo = {};\n return f;\n }(Math);\n\n (function (h) {\n for (var s = CryptoJS, f = s.lib, g = f.WordArray, q = f.Hasher, f = s.algo, m = [], r = [], l = function (a) {\n return 4294967296 * (a - (a | 0)) | 0;\n }, k = 2, n = 0; 64 > n;) {\n var j;\n\n a: {\n j = k;\n\n for (var u = h.sqrt(j), t = 2; t <= u; t++) if (!(j % t)) {\n j = !1;\n break a;\n }\n\n j = !0;\n }\n\n j && (8 > n && (m[n] = l(h.pow(k, 0.5))), r[n] = l(h.pow(k, 1 / 3)), n++);\n k++;\n }\n\n var a = [],\n f = f.SHA256 = q.extend({\n _doReset: function () {\n this._hash = new g.init(m.slice(0));\n },\n _doProcessBlock: function (c, d) {\n for (var b = this._hash.words, e = b[0], f = b[1], g = b[2], j = b[3], h = b[4], m = b[5], n = b[6], q = b[7], p = 0; 64 > p; p++) {\n if (16 > p) a[p] = c[d + p] | 0;else {\n var k = a[p - 15],\n l = a[p - 2];\n a[p] = ((k << 25 | k >>> 7) ^ (k << 14 | k >>> 18) ^ k >>> 3) + a[p - 7] + ((l << 15 | l >>> 17) ^ (l << 13 | l >>> 19) ^ l >>> 10) + a[p - 16];\n }\n k = q + ((h << 26 | h >>> 6) ^ (h << 21 | h >>> 11) ^ (h << 7 | h >>> 25)) + (h & m ^ ~h & n) + r[p] + a[p];\n l = ((e << 30 | e >>> 2) ^ (e << 19 | e >>> 13) ^ (e << 10 | e >>> 22)) + (e & f ^ e & g ^ f & g);\n q = n;\n n = m;\n m = h;\n h = j + k | 0;\n j = g;\n g = f;\n f = e;\n e = k + l | 0;\n }\n\n b[0] = b[0] + e | 0;\n b[1] = b[1] + f | 0;\n b[2] = b[2] + g | 0;\n b[3] = b[3] + j | 0;\n b[4] = b[4] + h | 0;\n b[5] = b[5] + m | 0;\n b[6] = b[6] + n | 0;\n b[7] = b[7] + q | 0;\n },\n _doFinalize: function () {\n var a = this._data,\n d = a.words,\n b = 8 * this._nDataBytes,\n e = 8 * a.sigBytes;\n d[e >>> 5] |= 128 << 24 - e % 32;\n d[(e + 64 >>> 9 << 4) + 14] = h.floor(b / 4294967296);\n d[(e + 64 >>> 9 << 4) + 15] = b;\n a.sigBytes = 4 * d.length;\n\n this._process();\n\n return this._hash;\n },\n clone: function () {\n var a = q.clone.call(this);\n a._hash = this._hash.clone();\n return a;\n }\n });\n s.SHA256 = q._createHelper(f);\n s.HmacSHA256 = q._createHmacHelper(f);\n })(Math);\n\n (function () {\n var h = CryptoJS,\n s = h.enc.Utf8;\n h.algo.HMAC = h.lib.Base.extend({\n init: function (f, g) {\n f = this._hasher = new f.init();\n \"string\" == typeof g && (g = s.parse(g));\n var h = f.blockSize,\n m = 4 * h;\n g.sigBytes > m && (g = f.finalize(g));\n g.clamp();\n\n for (var r = this._oKey = g.clone(), l = this._iKey = g.clone(), k = r.words, n = l.words, j = 0; j < h; j++) k[j] ^= 1549556828, n[j] ^= 909522486;\n\n r.sigBytes = l.sigBytes = m;\n this.reset();\n },\n reset: function () {\n var f = this._hasher;\n f.reset();\n f.update(this._iKey);\n },\n update: function (f) {\n this._hasher.update(f);\n\n return this;\n },\n finalize: function (f) {\n var g = this._hasher;\n f = g.finalize(f);\n g.reset();\n return g.finalize(this._oKey.clone().concat(f));\n }\n });\n })();\n\n ;\n /*\n CryptoJS v3.1.2\n code.google.com/p/crypto-js\n (c) 2009-2013 by Jeff Mott. All rights reserved.\n code.google.com/p/crypto-js/wiki/License\n */\n\n var CryptoJS = CryptoJS || function (a, j) {\n var c = {},\n b = c.lib = {},\n f = function () {},\n l = b.Base = {\n extend: function (a) {\n f.prototype = this;\n var d = new f();\n a && d.mixIn(a);\n d.hasOwnProperty(\"init\") || (d.init = function () {\n d.$super.init.apply(this, arguments);\n });\n d.init.prototype = d;\n d.$super = this;\n return d;\n },\n create: function () {\n var a = this.extend();\n a.init.apply(a, arguments);\n return a;\n },\n init: function () {},\n mixIn: function (a) {\n for (var d in a) a.hasOwnProperty(d) && (this[d] = a[d]);\n\n a.hasOwnProperty(\"toString\") && (this.toString = a.toString);\n },\n clone: function () {\n return this.init.prototype.extend(this);\n }\n },\n u = b.WordArray = l.extend({\n init: function (a, d) {\n a = this.words = a || [];\n this.sigBytes = d != j ? d : 4 * a.length;\n },\n toString: function (a) {\n return (a || m).stringify(this);\n },\n concat: function (a) {\n var d = this.words,\n M = a.words,\n e = this.sigBytes;\n a = a.sigBytes;\n this.clamp();\n if (e % 4) for (var b = 0; b < a; b++) d[e + b >>> 2] |= (M[b >>> 2] >>> 24 - 8 * (b % 4) & 255) << 24 - 8 * ((e + b) % 4);else if (65535 < M.length) for (b = 0; b < a; b += 4) d[e + b >>> 2] = M[b >>> 2];else d.push.apply(d, M);\n this.sigBytes += a;\n return this;\n },\n clamp: function () {\n var D = this.words,\n d = this.sigBytes;\n D[d >>> 2] &= 4294967295 << 32 - 8 * (d % 4);\n D.length = a.ceil(d / 4);\n },\n clone: function () {\n var a = l.clone.call(this);\n a.words = this.words.slice(0);\n return a;\n },\n random: function (D) {\n for (var d = [], b = 0; b < D; b += 4) d.push(4294967296 * a.random() | 0);\n\n return new u.init(d, D);\n }\n }),\n k = c.enc = {},\n m = k.Hex = {\n stringify: function (a) {\n var d = a.words;\n a = a.sigBytes;\n\n for (var b = [], e = 0; e < a; e++) {\n var c = d[e >>> 2] >>> 24 - 8 * (e % 4) & 255;\n b.push((c >>> 4).toString(16));\n b.push((c & 15).toString(16));\n }\n\n return b.join(\"\");\n },\n parse: function (a) {\n for (var d = a.length, b = [], e = 0; e < d; e += 2) b[e >>> 3] |= parseInt(a.substr(e, 2), 16) << 24 - 4 * (e % 8);\n\n return new u.init(b, d / 2);\n }\n },\n y = k.Latin1 = {\n stringify: function (a) {\n var b = a.words;\n a = a.sigBytes;\n\n for (var c = [], e = 0; e < a; e++) c.push(String.fromCharCode(b[e >>> 2] >>> 24 - 8 * (e % 4) & 255));\n\n return c.join(\"\");\n },\n parse: function (a) {\n for (var b = a.length, c = [], e = 0; e < b; e++) c[e >>> 2] |= (a.charCodeAt(e) & 255) << 24 - 8 * (e % 4);\n\n return new u.init(c, b);\n }\n },\n z = k.Utf8 = {\n stringify: function (a) {\n try {\n return decodeURIComponent(escape(y.stringify(a)));\n } catch (b) {\n throw Error(\"Malformed UTF-8 data\");\n }\n },\n parse: function (a) {\n return y.parse(unescape(encodeURIComponent(a)));\n }\n },\n x = b.BufferedBlockAlgorithm = l.extend({\n reset: function () {\n this._data = new u.init();\n this._nDataBytes = 0;\n },\n _append: function (a) {\n \"string\" == typeof a && (a = z.parse(a));\n\n this._data.concat(a);\n\n this._nDataBytes += a.sigBytes;\n },\n _process: function (b) {\n var d = this._data,\n c = d.words,\n e = d.sigBytes,\n l = this.blockSize,\n k = e / (4 * l),\n k = b ? a.ceil(k) : a.max((k | 0) - this._minBufferSize, 0);\n b = k * l;\n e = a.min(4 * b, e);\n\n if (b) {\n for (var x = 0; x < b; x += l) this._doProcessBlock(c, x);\n\n x = c.splice(0, b);\n d.sigBytes -= e;\n }\n\n return new u.init(x, e);\n },\n clone: function () {\n var a = l.clone.call(this);\n a._data = this._data.clone();\n return a;\n },\n _minBufferSize: 0\n });\n\n b.Hasher = x.extend({\n cfg: l.extend(),\n init: function (a) {\n this.cfg = this.cfg.extend(a);\n this.reset();\n },\n reset: function () {\n x.reset.call(this);\n\n this._doReset();\n },\n update: function (a) {\n this._append(a);\n\n this._process();\n\n return this;\n },\n finalize: function (a) {\n a && this._append(a);\n return this._doFinalize();\n },\n blockSize: 16,\n _createHelper: function (a) {\n return function (b, c) {\n return new a.init(c).finalize(b);\n };\n },\n _createHmacHelper: function (a) {\n return function (b, c) {\n return new ja.HMAC.init(a, c).finalize(b);\n };\n }\n });\n var ja = c.algo = {};\n return c;\n }(Math);\n\n (function (a) {\n var j = CryptoJS,\n c = j.lib,\n b = c.Base,\n f = c.WordArray,\n j = j.x64 = {};\n j.Word = b.extend({\n init: function (a, b) {\n this.high = a;\n this.low = b;\n }\n });\n j.WordArray = b.extend({\n init: function (b, c) {\n b = this.words = b || [];\n this.sigBytes = c != a ? c : 8 * b.length;\n },\n toX32: function () {\n for (var a = this.words, b = a.length, c = [], m = 0; m < b; m++) {\n var y = a[m];\n c.push(y.high);\n c.push(y.low);\n }\n\n return f.create(c, this.sigBytes);\n },\n clone: function () {\n for (var a = b.clone.call(this), c = a.words = this.words.slice(0), k = c.length, f = 0; f < k; f++) c[f] = c[f].clone();\n\n return a;\n }\n });\n })();\n\n (function () {\n function a() {\n return f.create.apply(f, arguments);\n }\n\n for (var j = CryptoJS, c = j.lib.Hasher, b = j.x64, f = b.Word, l = b.WordArray, b = j.algo, u = [a(1116352408, 3609767458), a(1899447441, 602891725), a(3049323471, 3964484399), a(3921009573, 2173295548), a(961987163, 4081628472), a(1508970993, 3053834265), a(2453635748, 2937671579), a(2870763221, 3664609560), a(3624381080, 2734883394), a(310598401, 1164996542), a(607225278, 1323610764), a(1426881987, 3590304994), a(1925078388, 4068182383), a(2162078206, 991336113), a(2614888103, 633803317), a(3248222580, 3479774868), a(3835390401, 2666613458), a(4022224774, 944711139), a(264347078, 2341262773), a(604807628, 2007800933), a(770255983, 1495990901), a(1249150122, 1856431235), a(1555081692, 3175218132), a(1996064986, 2198950837), a(2554220882, 3999719339), a(2821834349, 766784016), a(2952996808, 2566594879), a(3210313671, 3203337956), a(3336571891, 1034457026), a(3584528711, 2466948901), a(113926993, 3758326383), a(338241895, 168717936), a(666307205, 1188179964), a(773529912, 1546045734), a(1294757372, 1522805485), a(1396182291, 2643833823), a(1695183700, 2343527390), a(1986661051, 1014477480), a(2177026350, 1206759142), a(2456956037, 344077627), a(2730485921, 1290863460), a(2820302411, 3158454273), a(3259730800, 3505952657), a(3345764771, 106217008), a(3516065817, 3606008344), a(3600352804, 1432725776), a(4094571909, 1467031594), a(275423344, 851169720), a(430227734, 3100823752), a(506948616, 1363258195), a(659060556, 3750685593), a(883997877, 3785050280), a(958139571, 3318307427), a(1322822218, 3812723403), a(1537002063, 2003034995), a(1747873779, 3602036899), a(1955562222, 1575990012), a(2024104815, 1125592928), a(2227730452, 2716904306), a(2361852424, 442776044), a(2428436474, 593698344), a(2756734187, 3733110249), a(3204031479, 2999351573), a(3329325298, 3815920427), a(3391569614, 3928383900), a(3515267271, 566280711), a(3940187606, 3454069534), a(4118630271, 4000239992), a(116418474, 1914138554), a(174292421, 2731055270), a(289380356, 3203993006), a(460393269, 320620315), a(685471733, 587496836), a(852142971, 1086792851), a(1017036298, 365543100), a(1126000580, 2618297676), a(1288033470, 3409855158), a(1501505948, 4234509866), a(1607167915, 987167468), a(1816402316, 1246189591)], k = [], m = 0; 80 > m; m++) k[m] = a();\n\n b = b.SHA512 = c.extend({\n _doReset: function () {\n this._hash = new l.init([new f.init(1779033703, 4089235720), new f.init(3144134277, 2227873595), new f.init(1013904242, 4271175723), new f.init(2773480762, 1595750129), new f.init(1359893119, 2917565137), new f.init(2600822924, 725511199), new f.init(528734635, 4215389547), new f.init(1541459225, 327033209)]);\n },\n _doProcessBlock: function (a, b) {\n for (var c = this._hash.words, f = c[0], j = c[1], d = c[2], l = c[3], e = c[4], m = c[5], N = c[6], c = c[7], aa = f.high, O = f.low, ba = j.high, P = j.low, ca = d.high, Q = d.low, da = l.high, R = l.low, ea = e.high, S = e.low, fa = m.high, T = m.low, ga = N.high, U = N.low, ha = c.high, V = c.low, r = aa, n = O, G = ba, E = P, H = ca, F = Q, Y = da, I = R, s = ea, p = S, W = fa, J = T, X = ga, K = U, Z = ha, L = V, t = 0; 80 > t; t++) {\n var A = k[t];\n if (16 > t) var q = A.high = a[b + 2 * t] | 0,\n g = A.low = a[b + 2 * t + 1] | 0;else {\n var q = k[t - 15],\n g = q.high,\n v = q.low,\n q = (g >>> 1 | v << 31) ^ (g >>> 8 | v << 24) ^ g >>> 7,\n v = (v >>> 1 | g << 31) ^ (v >>> 8 | g << 24) ^ (v >>> 7 | g << 25),\n C = k[t - 2],\n g = C.high,\n h = C.low,\n C = (g >>> 19 | h << 13) ^ (g << 3 | h >>> 29) ^ g >>> 6,\n h = (h >>> 19 | g << 13) ^ (h << 3 | g >>> 29) ^ (h >>> 6 | g << 26),\n g = k[t - 7],\n $ = g.high,\n B = k[t - 16],\n w = B.high,\n B = B.low,\n g = v + g.low,\n q = q + $ + (g >>> 0 < v >>> 0 ? 1 : 0),\n g = g + h,\n q = q + C + (g >>> 0 < h >>> 0 ? 1 : 0),\n g = g + B,\n q = q + w + (g >>> 0 < B >>> 0 ? 1 : 0);\n A.high = q;\n A.low = g;\n }\n var $ = s & W ^ ~s & X,\n B = p & J ^ ~p & K,\n A = r & G ^ r & H ^ G & H,\n ka = n & E ^ n & F ^ E & F,\n v = (r >>> 28 | n << 4) ^ (r << 30 | n >>> 2) ^ (r << 25 | n >>> 7),\n C = (n >>> 28 | r << 4) ^ (n << 30 | r >>> 2) ^ (n << 25 | r >>> 7),\n h = u[t],\n la = h.high,\n ia = h.low,\n h = L + ((p >>> 14 | s << 18) ^ (p >>> 18 | s << 14) ^ (p << 23 | s >>> 9)),\n w = Z + ((s >>> 14 | p << 18) ^ (s >>> 18 | p << 14) ^ (s << 23 | p >>> 9)) + (h >>> 0 < L >>> 0 ? 1 : 0),\n h = h + B,\n w = w + $ + (h >>> 0 < B >>> 0 ? 1 : 0),\n h = h + ia,\n w = w + la + (h >>> 0 < ia >>> 0 ? 1 : 0),\n h = h + g,\n w = w + q + (h >>> 0 < g >>> 0 ? 1 : 0),\n g = C + ka,\n A = v + A + (g >>> 0 < C >>> 0 ? 1 : 0),\n Z = X,\n L = K,\n X = W,\n K = J,\n W = s,\n J = p,\n p = I + h | 0,\n s = Y + w + (p >>> 0 < I >>> 0 ? 1 : 0) | 0,\n Y = H,\n I = F,\n H = G,\n F = E,\n G = r,\n E = n,\n n = h + g | 0,\n r = w + A + (n >>> 0 < h >>> 0 ? 1 : 0) | 0;\n }\n\n O = f.low = O + n;\n f.high = aa + r + (O >>> 0 < n >>> 0 ? 1 : 0);\n P = j.low = P + E;\n j.high = ba + G + (P >>> 0 < E >>> 0 ? 1 : 0);\n Q = d.low = Q + F;\n d.high = ca + H + (Q >>> 0 < F >>> 0 ? 1 : 0);\n R = l.low = R + I;\n l.high = da + Y + (R >>> 0 < I >>> 0 ? 1 : 0);\n S = e.low = S + p;\n e.high = ea + s + (S >>> 0 < p >>> 0 ? 1 : 0);\n T = m.low = T + J;\n m.high = fa + W + (T >>> 0 < J >>> 0 ? 1 : 0);\n U = N.low = U + K;\n N.high = ga + X + (U >>> 0 < K >>> 0 ? 1 : 0);\n V = c.low = V + L;\n c.high = ha + Z + (V >>> 0 < L >>> 0 ? 1 : 0);\n },\n _doFinalize: function () {\n var a = this._data,\n b = a.words,\n c = 8 * this._nDataBytes,\n f = 8 * a.sigBytes;\n b[f >>> 5] |= 128 << 24 - f % 32;\n b[(f + 128 >>> 10 << 5) + 30] = Math.floor(c / 4294967296);\n b[(f + 128 >>> 10 << 5) + 31] = c;\n a.sigBytes = 4 * b.length;\n\n this._process();\n\n return this._hash.toX32();\n },\n clone: function () {\n var a = c.clone.call(this);\n a._hash = this._hash.clone();\n return a;\n },\n blockSize: 32\n });\n j.SHA512 = c._createHelper(b);\n j.HmacSHA512 = c._createHmacHelper(b);\n })();\n\n (function () {\n var a = CryptoJS,\n j = a.enc.Utf8;\n a.algo.HMAC = a.lib.Base.extend({\n init: function (a, b) {\n a = this._hasher = new a.init();\n \"string\" == typeof b && (b = j.parse(b));\n var f = a.blockSize,\n l = 4 * f;\n b.sigBytes > l && (b = a.finalize(b));\n b.clamp();\n\n for (var u = this._oKey = b.clone(), k = this._iKey = b.clone(), m = u.words, y = k.words, z = 0; z < f; z++) m[z] ^= 1549556828, y[z] ^= 909522486;\n\n u.sigBytes = k.sigBytes = l;\n this.reset();\n },\n reset: function () {\n var a = this._hasher;\n a.reset();\n a.update(this._iKey);\n },\n update: function (a) {\n this._hasher.update(a);\n\n return this;\n },\n finalize: function (a) {\n var b = this._hasher;\n a = b.finalize(a);\n b.reset();\n return b.finalize(this._oKey.clone().concat(a));\n }\n });\n })();\n\n ;\n /*\n CryptoJS v3.1.2\n code.google.com/p/crypto-js\n (c) 2009-2013 by Jeff Mott. All rights reserved.\n code.google.com/p/crypto-js/wiki/License\n */\n\n var CryptoJS = CryptoJS || function (g, j) {\n var e = {},\n d = e.lib = {},\n m = function () {},\n n = d.Base = {\n extend: function (a) {\n m.prototype = this;\n var c = new m();\n a && c.mixIn(a);\n c.hasOwnProperty(\"init\") || (c.init = function () {\n c.$super.init.apply(this, arguments);\n });\n c.init.prototype = c;\n c.$super = this;\n return c;\n },\n create: function () {\n var a = this.extend();\n a.init.apply(a, arguments);\n return a;\n },\n init: function () {},\n mixIn: function (a) {\n for (var c in a) a.hasOwnProperty(c) && (this[c] = a[c]);\n\n a.hasOwnProperty(\"toString\") && (this.toString = a.toString);\n },\n clone: function () {\n return this.init.prototype.extend(this);\n }\n },\n q = d.WordArray = n.extend({\n init: function (a, c) {\n a = this.words = a || [];\n this.sigBytes = c != j ? c : 4 * a.length;\n },\n toString: function (a) {\n return (a || l).stringify(this);\n },\n concat: function (a) {\n var c = this.words,\n p = a.words,\n f = this.sigBytes;\n a = a.sigBytes;\n this.clamp();\n if (f % 4) for (var b = 0; b < a; b++) c[f + b >>> 2] |= (p[b >>> 2] >>> 24 - 8 * (b % 4) & 255) << 24 - 8 * ((f + b) % 4);else if (65535 < p.length) for (b = 0; b < a; b += 4) c[f + b >>> 2] = p[b >>> 2];else c.push.apply(c, p);\n this.sigBytes += a;\n return this;\n },\n clamp: function () {\n var a = this.words,\n c = this.sigBytes;\n a[c >>> 2] &= 4294967295 << 32 - 8 * (c % 4);\n a.length = g.ceil(c / 4);\n },\n clone: function () {\n var a = n.clone.call(this);\n a.words = this.words.slice(0);\n return a;\n },\n random: function (a) {\n for (var c = [], b = 0; b < a; b += 4) c.push(4294967296 * g.random() | 0);\n\n return new q.init(c, a);\n }\n }),\n b = e.enc = {},\n l = b.Hex = {\n stringify: function (a) {\n var c = a.words;\n a = a.sigBytes;\n\n for (var b = [], f = 0; f < a; f++) {\n var d = c[f >>> 2] >>> 24 - 8 * (f % 4) & 255;\n b.push((d >>> 4).toString(16));\n b.push((d & 15).toString(16));\n }\n\n return b.join(\"\");\n },\n parse: function (a) {\n for (var c = a.length, b = [], f = 0; f < c; f += 2) b[f >>> 3] |= parseInt(a.substr(f, 2), 16) << 24 - 4 * (f % 8);\n\n return new q.init(b, c / 2);\n }\n },\n k = b.Latin1 = {\n stringify: function (a) {\n var c = a.words;\n a = a.sigBytes;\n\n for (var b = [], f = 0; f < a; f++) b.push(String.fromCharCode(c[f >>> 2] >>> 24 - 8 * (f % 4) & 255));\n\n return b.join(\"\");\n },\n parse: function (a) {\n for (var c = a.length, b = [], f = 0; f < c; f++) b[f >>> 2] |= (a.charCodeAt(f) & 255) << 24 - 8 * (f % 4);\n\n return new q.init(b, c);\n }\n },\n h = b.Utf8 = {\n stringify: function (a) {\n try {\n return decodeURIComponent(escape(k.stringify(a)));\n } catch (b) {\n throw Error(\"Malformed UTF-8 data\");\n }\n },\n parse: function (a) {\n return k.parse(unescape(encodeURIComponent(a)));\n }\n },\n u = d.BufferedBlockAlgorithm = n.extend({\n reset: function () {\n this._data = new q.init();\n this._nDataBytes = 0;\n },\n _append: function (a) {\n \"string\" == typeof a && (a = h.parse(a));\n\n this._data.concat(a);\n\n this._nDataBytes += a.sigBytes;\n },\n _process: function (a) {\n var b = this._data,\n d = b.words,\n f = b.sigBytes,\n l = this.blockSize,\n e = f / (4 * l),\n e = a ? g.ceil(e) : g.max((e | 0) - this._minBufferSize, 0);\n a = e * l;\n f = g.min(4 * a, f);\n\n if (a) {\n for (var h = 0; h < a; h += l) this._doProcessBlock(d, h);\n\n h = d.splice(0, a);\n b.sigBytes -= f;\n }\n\n return new q.init(h, f);\n },\n clone: function () {\n var a = n.clone.call(this);\n a._data = this._data.clone();\n return a;\n },\n _minBufferSize: 0\n });\n\n d.Hasher = u.extend({\n cfg: n.extend(),\n init: function (a) {\n this.cfg = this.cfg.extend(a);\n this.reset();\n },\n reset: function () {\n u.reset.call(this);\n\n this._doReset();\n },\n update: function (a) {\n this._append(a);\n\n this._process();\n\n return this;\n },\n finalize: function (a) {\n a && this._append(a);\n return this._doFinalize();\n },\n blockSize: 16,\n _createHelper: function (a) {\n return function (b, d) {\n return new a.init(d).finalize(b);\n };\n },\n _createHmacHelper: function (a) {\n return function (b, d) {\n return new w.HMAC.init(a, d).finalize(b);\n };\n }\n });\n var w = e.algo = {};\n return e;\n }(Math);\n\n (function () {\n var g = CryptoJS,\n j = g.lib,\n e = j.WordArray,\n d = j.Hasher,\n m = [],\n j = g.algo.SHA1 = d.extend({\n _doReset: function () {\n this._hash = new e.init([1732584193, 4023233417, 2562383102, 271733878, 3285377520]);\n },\n _doProcessBlock: function (d, e) {\n for (var b = this._hash.words, l = b[0], k = b[1], h = b[2], g = b[3], j = b[4], a = 0; 80 > a; a++) {\n if (16 > a) m[a] = d[e + a] | 0;else {\n var c = m[a - 3] ^ m[a - 8] ^ m[a - 14] ^ m[a - 16];\n m[a] = c << 1 | c >>> 31;\n }\n c = (l << 5 | l >>> 27) + j + m[a];\n c = 20 > a ? c + ((k & h | ~k & g) + 1518500249) : 40 > a ? c + ((k ^ h ^ g) + 1859775393) : 60 > a ? c + ((k & h | k & g | h & g) - 1894007588) : c + ((k ^ h ^ g) - 899497514);\n j = g;\n g = h;\n h = k << 30 | k >>> 2;\n k = l;\n l = c;\n }\n\n b[0] = b[0] + l | 0;\n b[1] = b[1] + k | 0;\n b[2] = b[2] + h | 0;\n b[3] = b[3] + g | 0;\n b[4] = b[4] + j | 0;\n },\n _doFinalize: function () {\n var d = this._data,\n e = d.words,\n b = 8 * this._nDataBytes,\n l = 8 * d.sigBytes;\n e[l >>> 5] |= 128 << 24 - l % 32;\n e[(l + 64 >>> 9 << 4) + 14] = Math.floor(b / 4294967296);\n e[(l + 64 >>> 9 << 4) + 15] = b;\n d.sigBytes = 4 * e.length;\n\n this._process();\n\n return this._hash;\n },\n clone: function () {\n var e = d.clone.call(this);\n e._hash = this._hash.clone();\n return e;\n }\n });\n g.SHA1 = d._createHelper(j);\n g.HmacSHA1 = d._createHmacHelper(j);\n })();\n\n (function () {\n var g = CryptoJS,\n j = g.enc.Utf8;\n g.algo.HMAC = g.lib.Base.extend({\n init: function (e, d) {\n e = this._hasher = new e.init();\n \"string\" == typeof d && (d = j.parse(d));\n var g = e.blockSize,\n n = 4 * g;\n d.sigBytes > n && (d = e.finalize(d));\n d.clamp();\n\n for (var q = this._oKey = d.clone(), b = this._iKey = d.clone(), l = q.words, k = b.words, h = 0; h < g; h++) l[h] ^= 1549556828, k[h] ^= 909522486;\n\n q.sigBytes = b.sigBytes = n;\n this.reset();\n },\n reset: function () {\n var e = this._hasher;\n e.reset();\n e.update(this._iKey);\n },\n update: function (e) {\n this._hasher.update(e);\n\n return this;\n },\n finalize: function (e) {\n var d = this._hasher;\n e = d.finalize(e);\n d.reset();\n return d.finalize(this._oKey.clone().concat(e));\n }\n });\n })();\n\n (function () {\n var g = CryptoJS,\n j = g.lib,\n e = j.Base,\n d = j.WordArray,\n j = g.algo,\n m = j.HMAC,\n n = j.PBKDF2 = e.extend({\n cfg: e.extend({\n keySize: 4,\n hasher: j.SHA1,\n iterations: 1\n }),\n init: function (d) {\n this.cfg = this.cfg.extend(d);\n },\n compute: function (e, b) {\n for (var g = this.cfg, k = m.create(g.hasher, e), h = d.create(), j = d.create([1]), n = h.words, a = j.words, c = g.keySize, g = g.iterations; n.length < c;) {\n var p = k.update(b).finalize(j);\n k.reset();\n\n for (var f = p.words, v = f.length, s = p, t = 1; t < g; t++) {\n s = k.finalize(s);\n k.reset();\n\n for (var x = s.words, r = 0; r < v; r++) f[r] ^= x[r];\n }\n\n h.concat(p);\n a[0]++;\n }\n\n h.sigBytes = 4 * c;\n return h;\n }\n });\n\n g.PBKDF2 = function (d, b, e) {\n return n.create(e).compute(d, b);\n };\n })();\n\n ;\n /*\n CryptoJS v3.1.2\n code.google.com/p/crypto-js\n (c) 2009-2013 by Jeff Mott. All rights reserved.\n code.google.com/p/crypto-js/wiki/License\n */\n\n var CryptoJS = CryptoJS || function (e, m) {\n var p = {},\n j = p.lib = {},\n l = function () {},\n f = j.Base = {\n extend: function (a) {\n l.prototype = this;\n var c = new l();\n a && c.mixIn(a);\n c.hasOwnProperty(\"init\") || (c.init = function () {\n c.$super.init.apply(this, arguments);\n });\n c.init.prototype = c;\n c.$super = this;\n return c;\n },\n create: function () {\n var a = this.extend();\n a.init.apply(a, arguments);\n return a;\n },\n init: function () {},\n mixIn: function (a) {\n for (var c in a) a.hasOwnProperty(c) && (this[c] = a[c]);\n\n a.hasOwnProperty(\"toString\") && (this.toString = a.toString);\n },\n clone: function () {\n return this.init.prototype.extend(this);\n }\n },\n n = j.WordArray = f.extend({\n init: function (a, c) {\n a = this.words = a || [];\n this.sigBytes = c != m ? c : 4 * a.length;\n },\n toString: function (a) {\n return (a || h).stringify(this);\n },\n concat: function (a) {\n var c = this.words,\n q = a.words,\n d = this.sigBytes;\n a = a.sigBytes;\n this.clamp();\n if (d % 4) for (var b = 0; b < a; b++) c[d + b >>> 2] |= (q[b >>> 2] >>> 24 - 8 * (b % 4) & 255) << 24 - 8 * ((d + b) % 4);else if (65535 < q.length) for (b = 0; b < a; b += 4) c[d + b >>> 2] = q[b >>> 2];else c.push.apply(c, q);\n this.sigBytes += a;\n return this;\n },\n clamp: function () {\n var a = this.words,\n c = this.sigBytes;\n a[c >>> 2] &= 4294967295 << 32 - 8 * (c % 4);\n a.length = e.ceil(c / 4);\n },\n clone: function () {\n var a = f.clone.call(this);\n a.words = this.words.slice(0);\n return a;\n },\n random: function (a) {\n for (var c = [], b = 0; b < a; b += 4) c.push(4294967296 * e.random() | 0);\n\n return new n.init(c, a);\n }\n }),\n b = p.enc = {},\n h = b.Hex = {\n stringify: function (a) {\n var c = a.words;\n a = a.sigBytes;\n\n for (var b = [], d = 0; d < a; d++) {\n var f = c[d >>> 2] >>> 24 - 8 * (d % 4) & 255;\n b.push((f >>> 4).toString(16));\n b.push((f & 15).toString(16));\n }\n\n return b.join(\"\");\n },\n parse: function (a) {\n for (var c = a.length, b = [], d = 0; d < c; d += 2) b[d >>> 3] |= parseInt(a.substr(d, 2), 16) << 24 - 4 * (d % 8);\n\n return new n.init(b, c / 2);\n }\n },\n g = b.Latin1 = {\n stringify: function (a) {\n var c = a.words;\n a = a.sigBytes;\n\n for (var b = [], d = 0; d < a; d++) b.push(String.fromCharCode(c[d >>> 2] >>> 24 - 8 * (d % 4) & 255));\n\n return b.join(\"\");\n },\n parse: function (a) {\n for (var c = a.length, b = [], d = 0; d < c; d++) b[d >>> 2] |= (a.charCodeAt(d) & 255) << 24 - 8 * (d % 4);\n\n return new n.init(b, c);\n }\n },\n r = b.Utf8 = {\n stringify: function (a) {\n try {\n return decodeURIComponent(escape(g.stringify(a)));\n } catch (c) {\n throw Error(\"Malformed UTF-8 data\");\n }\n },\n parse: function (a) {\n return g.parse(unescape(encodeURIComponent(a)));\n }\n },\n k = j.BufferedBlockAlgorithm = f.extend({\n reset: function () {\n this._data = new n.init();\n this._nDataBytes = 0;\n },\n _append: function (a) {\n \"string\" == typeof a && (a = r.parse(a));\n\n this._data.concat(a);\n\n this._nDataBytes += a.sigBytes;\n },\n _process: function (a) {\n var c = this._data,\n b = c.words,\n d = c.sigBytes,\n f = this.blockSize,\n h = d / (4 * f),\n h = a ? e.ceil(h) : e.max((h | 0) - this._minBufferSize, 0);\n a = h * f;\n d = e.min(4 * a, d);\n\n if (a) {\n for (var g = 0; g < a; g += f) this._doProcessBlock(b, g);\n\n g = b.splice(0, a);\n c.sigBytes -= d;\n }\n\n return new n.init(g, d);\n },\n clone: function () {\n var a = f.clone.call(this);\n a._data = this._data.clone();\n return a;\n },\n _minBufferSize: 0\n });\n\n j.Hasher = k.extend({\n cfg: f.extend(),\n init: function (a) {\n this.cfg = this.cfg.extend(a);\n this.reset();\n },\n reset: function () {\n k.reset.call(this);\n\n this._doReset();\n },\n update: function (a) {\n this._append(a);\n\n this._process();\n\n return this;\n },\n finalize: function (a) {\n a && this._append(a);\n return this._doFinalize();\n },\n blockSize: 16,\n _createHelper: function (a) {\n return function (c, b) {\n return new a.init(b).finalize(c);\n };\n },\n _createHmacHelper: function (a) {\n return function (b, f) {\n return new s.HMAC.init(a, f).finalize(b);\n };\n }\n });\n var s = p.algo = {};\n return p;\n }(Math);\n\n (function () {\n var e = CryptoJS,\n m = e.lib,\n p = m.WordArray,\n j = m.Hasher,\n l = [],\n m = e.algo.SHA1 = j.extend({\n _doReset: function () {\n this._hash = new p.init([1732584193, 4023233417, 2562383102, 271733878, 3285377520]);\n },\n _doProcessBlock: function (f, n) {\n for (var b = this._hash.words, h = b[0], g = b[1], e = b[2], k = b[3], j = b[4], a = 0; 80 > a; a++) {\n if (16 > a) l[a] = f[n + a] | 0;else {\n var c = l[a - 3] ^ l[a - 8] ^ l[a - 14] ^ l[a - 16];\n l[a] = c << 1 | c >>> 31;\n }\n c = (h << 5 | h >>> 27) + j + l[a];\n c = 20 > a ? c + ((g & e | ~g & k) + 1518500249) : 40 > a ? c + ((g ^ e ^ k) + 1859775393) : 60 > a ? c + ((g & e | g & k | e & k) - 1894007588) : c + ((g ^ e ^ k) - 899497514);\n j = k;\n k = e;\n e = g << 30 | g >>> 2;\n g = h;\n h = c;\n }\n\n b[0] = b[0] + h | 0;\n b[1] = b[1] + g | 0;\n b[2] = b[2] + e | 0;\n b[3] = b[3] + k | 0;\n b[4] = b[4] + j | 0;\n },\n _doFinalize: function () {\n var f = this._data,\n e = f.words,\n b = 8 * this._nDataBytes,\n h = 8 * f.sigBytes;\n e[h >>> 5] |= 128 << 24 - h % 32;\n e[(h + 64 >>> 9 << 4) + 14] = Math.floor(b / 4294967296);\n e[(h + 64 >>> 9 << 4) + 15] = b;\n f.sigBytes = 4 * e.length;\n\n this._process();\n\n return this._hash;\n },\n clone: function () {\n var e = j.clone.call(this);\n e._hash = this._hash.clone();\n return e;\n }\n });\n e.SHA1 = j._createHelper(m);\n e.HmacSHA1 = j._createHmacHelper(m);\n })();\n\n ;\n \"use strict\";\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n exports.StandardFile = exports.SFItemTransformer = exports.SFCryptoWeb = exports.SFCryptoJS = exports.SFAbstractCrypto = exports.SFItemHistoryEntry = exports.SFItemHistory = exports.SFHistorySession = exports.SFPrivileges = exports.SFPredicate = exports.SFItemParams = exports.SFItem = exports.SFSyncManager = exports.SFStorageManager = exports.SFSingletonManager = exports.SFSessionHistoryManager = exports.SFPrivilegesManager = exports.SFModelManager = exports.SFMigrationManager = exports.SFHttpManager = exports.SFAuthManager = exports.SFAlertManager = void 0;\n\n function _possibleConstructorReturn(self, call) {\n if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) {\n return call;\n }\n\n return _assertThisInitialized(self);\n }\n\n function _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n }\n\n function _getPrototypeOf(o) {\n _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n };\n return _getPrototypeOf(o);\n }\n\n function _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n });\n if (superClass) _setPrototypeOf(subClass, superClass);\n }\n\n function _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n }\n\n function _slicedToArray(arr, i) {\n return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();\n }\n\n function _nonIterableRest() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance\");\n }\n\n function _iterableToArrayLimit(arr, i) {\n if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === \"[object Arguments]\")) {\n return;\n }\n\n var _arr = [];\n var _n = true;\n var _d = false;\n var _e = undefined;\n\n try {\n for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {\n _arr.push(_s.value);\n\n if (i && _arr.length === i) break;\n }\n } catch (err) {\n _d = true;\n _e = err;\n } finally {\n try {\n if (!_n && _i[\"return\"] != null) _i[\"return\"]();\n } finally {\n if (_d) throw _e;\n }\n }\n\n return _arr;\n }\n\n function _arrayWithHoles(arr) {\n if (Array.isArray(arr)) return arr;\n }\n\n function _typeof(obj) {\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n _typeof = function _typeof(obj) {\n return typeof obj;\n };\n } else {\n _typeof = function _typeof(obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n }\n\n return _typeof(obj);\n }\n\n function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {\n try {\n var info = gen[key](arg);\n var value = info.value;\n } catch (error) {\n reject(error);\n return;\n }\n\n if (info.done) {\n resolve(value);\n } else {\n Promise.resolve(value).then(_next, _throw);\n }\n }\n\n function _asyncToGenerator(fn) {\n return function () {\n var self = this,\n args = arguments;\n return new Promise(function (resolve, reject) {\n var gen = fn.apply(self, args);\n\n function _next(value) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value);\n }\n\n function _throw(err) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err);\n }\n\n _next(undefined);\n });\n };\n }\n\n function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n }\n\n function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n }\n\n function _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n }\n\n var SFAlertManager =\n /*#__PURE__*/\n function () {\n function SFAlertManager() {\n _classCallCheck(this, SFAlertManager);\n }\n\n _createClass(SFAlertManager, [{\n key: \"alert\",\n value: function () {\n var _alert = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee(params) {\n return regeneratorRuntime.wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n return _context.abrupt(\"return\", new Promise(function (resolve, reject) {\n window.alert(params.text);\n resolve();\n }));\n\n case 1:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee);\n }));\n\n function alert(_x) {\n return _alert.apply(this, arguments);\n }\n\n return alert;\n }()\n }, {\n key: \"confirm\",\n value: function () {\n var _confirm = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee2(params) {\n return regeneratorRuntime.wrap(function _callee2$(_context2) {\n while (1) {\n switch (_context2.prev = _context2.next) {\n case 0:\n return _context2.abrupt(\"return\", new Promise(function (resolve, reject) {\n if (window.confirm(params.text)) {\n resolve();\n } else {\n reject();\n }\n }));\n\n case 1:\n case \"end\":\n return _context2.stop();\n }\n }\n }, _callee2);\n }));\n\n function confirm(_x2) {\n return _confirm.apply(this, arguments);\n }\n\n return confirm;\n }()\n }]);\n\n return SFAlertManager;\n }();\n\n exports.SFAlertManager = SFAlertManager;\n ;\n\n var SFAuthManager =\n /*#__PURE__*/\n function () {\n function SFAuthManager(storageManager, httpManager, alertManager, timeout) {\n _classCallCheck(this, SFAuthManager);\n\n SFAuthManager.DidSignOutEvent = \"DidSignOutEvent\";\n SFAuthManager.WillSignInEvent = \"WillSignInEvent\";\n SFAuthManager.DidSignInEvent = \"DidSignInEvent\";\n this.httpManager = httpManager;\n this.storageManager = storageManager;\n this.alertManager = alertManager || new SFAlertManager();\n this.$timeout = timeout || setTimeout.bind(window);\n this.eventHandlers = [];\n }\n\n _createClass(SFAuthManager, [{\n key: \"addEventHandler\",\n value: function addEventHandler(handler) {\n this.eventHandlers.push(handler);\n return handler;\n }\n }, {\n key: \"removeEventHandler\",\n value: function removeEventHandler(handler) {\n _.pull(this.eventHandlers, handler);\n }\n }, {\n key: \"notifyEvent\",\n value: function notifyEvent(event, data) {\n var _iteratorNormalCompletion = true;\n var _didIteratorError = false;\n var _iteratorError = undefined;\n\n try {\n for (var _iterator = this.eventHandlers[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var handler = _step.value;\n handler(event, data || {});\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator[\"return\"] != null) {\n _iterator[\"return\"]();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n }\n }, {\n key: \"saveKeys\",\n value: function () {\n var _saveKeys = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee3(keys) {\n return regeneratorRuntime.wrap(function _callee3$(_context3) {\n while (1) {\n switch (_context3.prev = _context3.next) {\n case 0:\n this._keys = keys;\n _context3.next = 3;\n return this.storageManager.setItem(\"mk\", keys.mk);\n\n case 3:\n _context3.next = 5;\n return this.storageManager.setItem(\"ak\", keys.ak);\n\n case 5:\n case \"end\":\n return _context3.stop();\n }\n }\n }, _callee3, this);\n }));\n\n function saveKeys(_x3) {\n return _saveKeys.apply(this, arguments);\n }\n\n return saveKeys;\n }()\n }, {\n key: \"signout\",\n value: function () {\n var _signout = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee4(clearAllData) {\n var _this = this;\n\n return regeneratorRuntime.wrap(function _callee4$(_context4) {\n while (1) {\n switch (_context4.prev = _context4.next) {\n case 0:\n this._keys = null;\n this._authParams = null;\n\n if (!clearAllData) {\n _context4.next = 6;\n break;\n }\n\n return _context4.abrupt(\"return\", this.storageManager.clearAllData().then(function () {\n _this.notifyEvent(SFAuthManager.DidSignOutEvent);\n }));\n\n case 6:\n this.notifyEvent(SFAuthManager.DidSignOutEvent);\n\n case 7:\n case \"end\":\n return _context4.stop();\n }\n }\n }, _callee4, this);\n }));\n\n function signout(_x4) {\n return _signout.apply(this, arguments);\n }\n\n return signout;\n }()\n }, {\n key: \"keys\",\n value: function () {\n var _keys = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee5() {\n var mk;\n return regeneratorRuntime.wrap(function _callee5$(_context5) {\n while (1) {\n switch (_context5.prev = _context5.next) {\n case 0:\n if (this._keys) {\n _context5.next = 11;\n break;\n }\n\n _context5.next = 3;\n return this.storageManager.getItem(\"mk\");\n\n case 3:\n mk = _context5.sent;\n\n if (mk) {\n _context5.next = 6;\n break;\n }\n\n return _context5.abrupt(\"return\", null);\n\n case 6:\n _context5.t0 = mk;\n _context5.next = 9;\n return this.storageManager.getItem(\"ak\");\n\n case 9:\n _context5.t1 = _context5.sent;\n this._keys = {\n mk: _context5.t0,\n ak: _context5.t1\n };\n\n case 11:\n return _context5.abrupt(\"return\", this._keys);\n\n case 12:\n case \"end\":\n return _context5.stop();\n }\n }\n }, _callee5, this);\n }));\n\n function keys() {\n return _keys.apply(this, arguments);\n }\n\n return keys;\n }()\n }, {\n key: \"getAuthParams\",\n value: function () {\n var _getAuthParams = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee6() {\n var data;\n return regeneratorRuntime.wrap(function _callee6$(_context6) {\n while (1) {\n switch (_context6.prev = _context6.next) {\n case 0:\n if (this._authParams) {\n _context6.next = 5;\n break;\n }\n\n _context6.next = 3;\n return this.storageManager.getItem(\"auth_params\");\n\n case 3:\n data = _context6.sent;\n this._authParams = JSON.parse(data);\n\n case 5:\n if (!(this._authParams && !this._authParams.version)) {\n _context6.next = 9;\n break;\n }\n\n _context6.next = 8;\n return this.defaultProtocolVersion();\n\n case 8:\n this._authParams.version = _context6.sent;\n\n case 9:\n return _context6.abrupt(\"return\", this._authParams);\n\n case 10:\n case \"end\":\n return _context6.stop();\n }\n }\n }, _callee6, this);\n }));\n\n function getAuthParams() {\n return _getAuthParams.apply(this, arguments);\n }\n\n return getAuthParams;\n }()\n }, {\n key: \"defaultProtocolVersion\",\n value: function () {\n var _defaultProtocolVersion = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee7() {\n var keys;\n return regeneratorRuntime.wrap(function _callee7$(_context7) {\n while (1) {\n switch (_context7.prev = _context7.next) {\n case 0:\n _context7.next = 2;\n return this.keys();\n\n case 2:\n keys = _context7.sent;\n\n if (!(keys && keys.ak)) {\n _context7.next = 7;\n break;\n }\n\n return _context7.abrupt(\"return\", \"002\");\n\n case 7:\n return _context7.abrupt(\"return\", \"001\");\n\n case 8:\n case \"end\":\n return _context7.stop();\n }\n }\n }, _callee7, this);\n }));\n\n function defaultProtocolVersion() {\n return _defaultProtocolVersion.apply(this, arguments);\n }\n\n return defaultProtocolVersion;\n }()\n }, {\n key: \"protocolVersion\",\n value: function () {\n var _protocolVersion = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee8() {\n var authParams;\n return regeneratorRuntime.wrap(function _callee8$(_context8) {\n while (1) {\n switch (_context8.prev = _context8.next) {\n case 0:\n _context8.next = 2;\n return this.getAuthParams();\n\n case 2:\n authParams = _context8.sent;\n\n if (!(authParams && authParams.version)) {\n _context8.next = 5;\n break;\n }\n\n return _context8.abrupt(\"return\", authParams.version);\n\n case 5:\n return _context8.abrupt(\"return\", this.defaultProtocolVersion());\n\n case 6:\n case \"end\":\n return _context8.stop();\n }\n }\n }, _callee8, this);\n }));\n\n function protocolVersion() {\n return _protocolVersion.apply(this, arguments);\n }\n\n return protocolVersion;\n }()\n }, {\n key: \"getAuthParamsForEmail\",\n value: function () {\n var _getAuthParamsForEmail = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee9(url, email, extraParams) {\n var _this2 = this;\n\n var params;\n return regeneratorRuntime.wrap(function _callee9$(_context9) {\n while (1) {\n switch (_context9.prev = _context9.next) {\n case 0:\n params = _.merge({\n email: email\n }, extraParams);\n params['api'] = SFHttpManager.getApiVersion();\n return _context9.abrupt(\"return\", new Promise(function (resolve, reject) {\n var requestUrl = url + \"/auth/params\";\n\n _this2.httpManager.getAbsolute(requestUrl, params, function (response) {\n resolve(response);\n }, function (response) {\n console.error(\"Error getting auth params\", response);\n\n if (_typeof(response) !== 'object') {\n response = {\n error: {\n message: \"A server error occurred while trying to sign in. Please try again.\"\n }\n };\n }\n\n resolve(response);\n });\n }));\n\n case 3:\n case \"end\":\n return _context9.stop();\n }\n }\n }, _callee9);\n }));\n\n function getAuthParamsForEmail(_x5, _x6, _x7) {\n return _getAuthParamsForEmail.apply(this, arguments);\n }\n\n return getAuthParamsForEmail;\n }()\n }, {\n key: \"lock\",\n value: function lock() {\n this.locked = true;\n }\n }, {\n key: \"unlock\",\n value: function unlock() {\n this.locked = false;\n }\n }, {\n key: \"isLocked\",\n value: function isLocked() {\n return this.locked == true;\n }\n }, {\n key: \"unlockAndResolve\",\n value: function unlockAndResolve(resolve, param) {\n this.unlock();\n resolve(param);\n }\n }, {\n key: \"login\",\n value: function () {\n var _login = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee12(url, email, password, strictSignin, extraParams) {\n var _this3 = this;\n\n return regeneratorRuntime.wrap(function _callee12$(_context12) {\n while (1) {\n switch (_context12.prev = _context12.next) {\n case 0:\n return _context12.abrupt(\"return\", new Promise(\n /*#__PURE__*/\n function () {\n var _ref = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee11(resolve, reject) {\n var existingKeys, authParams, message, _message, abort, _message2, minimum, _message3, latestVersion, _message4, keys, requestUrl, params;\n\n return regeneratorRuntime.wrap(function _callee11$(_context11) {\n while (1) {\n switch (_context11.prev = _context11.next) {\n case 0:\n _context11.next = 2;\n return _this3.keys();\n\n case 2:\n existingKeys = _context11.sent;\n\n if (!(existingKeys != null)) {\n _context11.next = 6;\n break;\n }\n\n resolve({\n error: {\n message: \"Cannot log in because already signed in.\"\n }\n });\n return _context11.abrupt(\"return\");\n\n case 6:\n if (!_this3.isLocked()) {\n _context11.next = 9;\n break;\n }\n\n resolve({\n error: {\n message: \"Login already in progress.\"\n }\n });\n return _context11.abrupt(\"return\");\n\n case 9:\n _this3.lock();\n\n _this3.notifyEvent(SFAuthManager.WillSignInEvent);\n\n _context11.next = 13;\n return _this3.getAuthParamsForEmail(url, email, extraParams);\n\n case 13:\n authParams = _context11.sent; // SF3 requires a unique identifier in the auth params\n\n authParams.identifier = email;\n\n if (!authParams.error) {\n _context11.next = 18;\n break;\n }\n\n _this3.unlockAndResolve(resolve, authParams);\n\n return _context11.abrupt(\"return\");\n\n case 18:\n if (!(!authParams || !authParams.pw_cost)) {\n _context11.next = 21;\n break;\n }\n\n _this3.unlockAndResolve(resolve, {\n error: {\n message: \"Invalid email or password.\"\n }\n });\n\n return _context11.abrupt(\"return\");\n\n case 21:\n if (SFJS.supportedVersions().includes(authParams.version)) {\n _context11.next = 25;\n break;\n }\n\n if (SFJS.isVersionNewerThanLibraryVersion(authParams.version)) {\n // The user has a new account type, but is signing in to an older client.\n message = \"This version of the application does not support your newer account type. Please upgrade to the latest version of Standard Notes to sign in.\";\n } else {\n // The user has a very old account type, which is no longer supported by this client\n message = \"The protocol version associated with your account is outdated and no longer supported by this application. Please visit standardnotes.org/help/security for more information.\";\n }\n\n _this3.unlockAndResolve(resolve, {\n error: {\n message: message\n }\n });\n\n return _context11.abrupt(\"return\");\n\n case 25:\n if (!SFJS.isProtocolVersionOutdated(authParams.version)) {\n _context11.next = 32;\n break;\n }\n\n _message = \"The encryption version for your account, \".concat(authParams.version, \", is outdated and requires upgrade. You may proceed with login, but are advised to perform a security update using the web or desktop application. Please visit standardnotes.org/help/security for more information.\");\n abort = false;\n _context11.next = 30;\n return _this3.alertManager.confirm({\n title: \"Update Needed\",\n text: _message,\n confirmButtonText: \"Sign In\"\n })[\"catch\"](function () {\n _this3.unlockAndResolve(resolve, {\n error: {}\n });\n\n abort = true;\n });\n\n case 30:\n if (!abort) {\n _context11.next = 32;\n break;\n }\n\n return _context11.abrupt(\"return\");\n\n case 32:\n if (SFJS.supportsPasswordDerivationCost(authParams.pw_cost)) {\n _context11.next = 36;\n break;\n }\n\n _message2 = \"Your account was created on a platform with higher security capabilities than this browser supports. \" + \"If we attempted to generate your login keys here, it would take hours. \" + \"Please use a browser with more up to date security capabilities, like Google Chrome or Firefox, to log in.\";\n\n _this3.unlockAndResolve(resolve, {\n error: {\n message: _message2\n }\n });\n\n return _context11.abrupt(\"return\");\n\n case 36:\n minimum = SFJS.costMinimumForVersion(authParams.version);\n\n if (!(authParams.pw_cost < minimum)) {\n _context11.next = 41;\n break;\n }\n\n _message3 = \"Unable to login due to insecure password parameters. Please visit standardnotes.org/help/security for more information.\";\n\n _this3.unlockAndResolve(resolve, {\n error: {\n message: _message3\n }\n });\n\n return _context11.abrupt(\"return\");\n\n case 41:\n if (!strictSignin) {\n _context11.next = 47;\n break;\n } // Refuse sign in if authParams.version is anything but the latest version\n\n\n latestVersion = SFJS.version();\n\n if (!(authParams.version !== latestVersion)) {\n _context11.next = 47;\n break;\n }\n\n _message4 = \"Strict sign in refused server sign in parameters. The latest security version is \".concat(latestVersion, \", but your account is reported to have version \").concat(authParams.version, \". If you'd like to proceed with sign in anyway, please disable strict sign in and try again.\");\n\n _this3.unlockAndResolve(resolve, {\n error: {\n message: _message4\n }\n });\n\n return _context11.abrupt(\"return\");\n\n case 47:\n _context11.next = 49;\n return SFJS.crypto.computeEncryptionKeysForUser(password, authParams);\n\n case 49:\n keys = _context11.sent;\n requestUrl = url + \"/auth/sign_in\";\n params = _.merge({\n password: keys.pw,\n email: email\n }, extraParams);\n params['api'] = SFHttpManager.getApiVersion();\n\n _this3.httpManager.postAbsolute(requestUrl, params,\n /*#__PURE__*/\n function () {\n var _ref2 = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee10(response) {\n return regeneratorRuntime.wrap(function _callee10$(_context10) {\n while (1) {\n switch (_context10.prev = _context10.next) {\n case 0:\n _context10.next = 2;\n return _this3.handleAuthResponse(response, email, url, authParams, keys);\n\n case 2:\n _this3.notifyEvent(SFAuthManager.DidSignInEvent);\n\n _this3.$timeout(function () {\n return _this3.unlockAndResolve(resolve, response);\n });\n\n case 4:\n case \"end\":\n return _context10.stop();\n }\n }\n }, _callee10);\n }));\n\n return function (_x15) {\n return _ref2.apply(this, arguments);\n };\n }(), function (response) {\n console.error(\"Error logging in\", response);\n\n if (_typeof(response) !== 'object') {\n response = {\n error: {\n message: \"A server error occurred while trying to sign in. Please try again.\"\n }\n };\n }\n\n _this3.$timeout(function () {\n return _this3.unlockAndResolve(resolve, response);\n });\n });\n\n case 54:\n case \"end\":\n return _context11.stop();\n }\n }\n }, _callee11);\n }));\n\n return function (_x13, _x14) {\n return _ref.apply(this, arguments);\n };\n }()));\n\n case 1:\n case \"end\":\n return _context12.stop();\n }\n }\n }, _callee12);\n }));\n\n function login(_x8, _x9, _x10, _x11, _x12) {\n return _login.apply(this, arguments);\n }\n\n return login;\n }()\n }, {\n key: \"register\",\n value: function register(url, email, password) {\n var _this4 = this;\n\n return new Promise(\n /*#__PURE__*/\n function () {\n var _ref3 = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee14(resolve, reject) {\n var MinPasswordLength, message, results, keys, authParams, requestUrl, params;\n return regeneratorRuntime.wrap(function _callee14$(_context14) {\n while (1) {\n switch (_context14.prev = _context14.next) {\n case 0:\n if (!_this4.isLocked()) {\n _context14.next = 3;\n break;\n }\n\n resolve({\n error: {\n message: \"Register already in progress.\"\n }\n });\n return _context14.abrupt(\"return\");\n\n case 3:\n MinPasswordLength = 8;\n\n if (!(password.length < MinPasswordLength)) {\n _context14.next = 8;\n break;\n }\n\n message = \"Your password must be at least \".concat(MinPasswordLength, \" characters in length. For your security, please choose a longer password or, ideally, a passphrase, and try again.\");\n resolve({\n error: {\n message: message\n }\n });\n return _context14.abrupt(\"return\");\n\n case 8:\n _this4.lock();\n\n _context14.next = 11;\n return SFJS.crypto.generateInitialKeysAndAuthParamsForUser(email, password);\n\n case 11:\n results = _context14.sent;\n keys = results.keys;\n authParams = results.authParams;\n requestUrl = url + \"/auth\";\n params = _.merge({\n password: keys.pw,\n email: email\n }, authParams);\n params['api'] = SFHttpManager.getApiVersion();\n\n _this4.httpManager.postAbsolute(requestUrl, params,\n /*#__PURE__*/\n function () {\n var _ref4 = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee13(response) {\n return regeneratorRuntime.wrap(function _callee13$(_context13) {\n while (1) {\n switch (_context13.prev = _context13.next) {\n case 0:\n _context13.next = 2;\n return _this4.handleAuthResponse(response, email, url, authParams, keys);\n\n case 2:\n _this4.unlockAndResolve(resolve, response);\n\n case 3:\n case \"end\":\n return _context13.stop();\n }\n }\n }, _callee13);\n }));\n\n return function (_x18) {\n return _ref4.apply(this, arguments);\n };\n }(), function (response) {\n console.error(\"Registration error\", response);\n\n if (_typeof(response) !== 'object') {\n response = {\n error: {\n message: \"A server error occurred while trying to register. Please try again.\"\n }\n };\n }\n\n _this4.unlockAndResolve(resolve, response);\n });\n\n case 18:\n case \"end\":\n return _context14.stop();\n }\n }\n }, _callee14);\n }));\n\n return function (_x16, _x17) {\n return _ref3.apply(this, arguments);\n };\n }());\n }\n }, {\n key: \"changePassword\",\n value: function () {\n var _changePassword = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee17(url, email, current_server_pw, newKeys, newAuthParams) {\n var _this5 = this;\n\n return regeneratorRuntime.wrap(function _callee17$(_context17) {\n while (1) {\n switch (_context17.prev = _context17.next) {\n case 0:\n return _context17.abrupt(\"return\", new Promise(\n /*#__PURE__*/\n function () {\n var _ref5 = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee16(resolve, reject) {\n var newServerPw, requestUrl, params;\n return regeneratorRuntime.wrap(function _callee16$(_context16) {\n while (1) {\n switch (_context16.prev = _context16.next) {\n case 0:\n if (!_this5.isLocked()) {\n _context16.next = 3;\n break;\n }\n\n resolve({\n error: {\n message: \"Change password already in progress.\"\n }\n });\n return _context16.abrupt(\"return\");\n\n case 3:\n _this5.lock();\n\n newServerPw = newKeys.pw;\n requestUrl = url + \"/auth/change_pw\";\n params = _.merge({\n new_password: newServerPw,\n current_password: current_server_pw\n }, newAuthParams);\n params['api'] = SFHttpManager.getApiVersion();\n\n _this5.httpManager.postAuthenticatedAbsolute(requestUrl, params,\n /*#__PURE__*/\n function () {\n var _ref6 = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee15(response) {\n return regeneratorRuntime.wrap(function _callee15$(_context15) {\n while (1) {\n switch (_context15.prev = _context15.next) {\n case 0:\n _context15.next = 2;\n return _this5.handleAuthResponse(response, email, null, newAuthParams, newKeys);\n\n case 2:\n _this5.unlockAndResolve(resolve, response);\n\n case 3:\n case \"end\":\n return _context15.stop();\n }\n }\n }, _callee15);\n }));\n\n return function (_x26) {\n return _ref6.apply(this, arguments);\n };\n }(), function (response) {\n if (_typeof(response) !== 'object') {\n response = {\n error: {\n message: \"Something went wrong while changing your password. Your password was not changed. Please try again.\"\n }\n };\n }\n\n _this5.unlockAndResolve(resolve, response);\n });\n\n case 9:\n case \"end\":\n return _context16.stop();\n }\n }\n }, _callee16);\n }));\n\n return function (_x24, _x25) {\n return _ref5.apply(this, arguments);\n };\n }()));\n\n case 1:\n case \"end\":\n return _context17.stop();\n }\n }\n }, _callee17);\n }));\n\n function changePassword(_x19, _x20, _x21, _x22, _x23) {\n return _changePassword.apply(this, arguments);\n }\n\n return changePassword;\n }()\n }, {\n key: \"handleAuthResponse\",\n value: function () {\n var _handleAuthResponse = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee18(response, email, url, authParams, keys) {\n return regeneratorRuntime.wrap(function _callee18$(_context18) {\n while (1) {\n switch (_context18.prev = _context18.next) {\n case 0:\n if (!url) {\n _context18.next = 3;\n break;\n }\n\n _context18.next = 3;\n return this.storageManager.setItem(\"server\", url);\n\n case 3:\n this._authParams = authParams;\n _context18.next = 6;\n return this.storageManager.setItem(\"auth_params\", JSON.stringify(authParams));\n\n case 6:\n _context18.next = 8;\n return this.storageManager.setItem(\"jwt\", response.token);\n\n case 8:\n return _context18.abrupt(\"return\", this.saveKeys(keys));\n\n case 9:\n case \"end\":\n return _context18.stop();\n }\n }\n }, _callee18, this);\n }));\n\n function handleAuthResponse(_x27, _x28, _x29, _x30, _x31) {\n return _handleAuthResponse.apply(this, arguments);\n }\n\n return handleAuthResponse;\n }()\n }]);\n\n return SFAuthManager;\n }();\n\n exports.SFAuthManager = SFAuthManager;\n ;\n var globalScope = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : null;\n\n var SFHttpManager =\n /*#__PURE__*/\n function () {\n _createClass(SFHttpManager, null, [{\n key: \"getApiVersion\",\n value: function getApiVersion() {\n // Applicable only to Standard File requests. Requests to external acitons should not use this.\n // syncManager and authManager must include this API version as part of its request params.\n return \"20190520\";\n }\n }]);\n\n function SFHttpManager(timeout, apiVersion) {\n _classCallCheck(this, SFHttpManager); // calling callbacks in a $timeout allows UI to update\n\n\n this.$timeout = timeout || setTimeout.bind(globalScope);\n }\n\n _createClass(SFHttpManager, [{\n key: \"setJWTRequestHandler\",\n value: function setJWTRequestHandler(handler) {\n this.jwtRequestHandler = handler;\n }\n }, {\n key: \"setAuthHeadersForRequest\",\n value: function () {\n var _setAuthHeadersForRequest = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee19(request) {\n var token;\n return regeneratorRuntime.wrap(function _callee19$(_context19) {\n while (1) {\n switch (_context19.prev = _context19.next) {\n case 0:\n _context19.next = 2;\n return this.jwtRequestHandler();\n\n case 2:\n token = _context19.sent;\n\n if (token) {\n request.setRequestHeader('Authorization', 'Bearer ' + token);\n }\n\n case 4:\n case \"end\":\n return _context19.stop();\n }\n }\n }, _callee19, this);\n }));\n\n function setAuthHeadersForRequest(_x32) {\n return _setAuthHeadersForRequest.apply(this, arguments);\n }\n\n return setAuthHeadersForRequest;\n }()\n }, {\n key: \"postAbsolute\",\n value: function () {\n var _postAbsolute = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee20(url, params, onsuccess, onerror) {\n return regeneratorRuntime.wrap(function _callee20$(_context20) {\n while (1) {\n switch (_context20.prev = _context20.next) {\n case 0:\n return _context20.abrupt(\"return\", this.httpRequest(\"post\", url, params, onsuccess, onerror));\n\n case 1:\n case \"end\":\n return _context20.stop();\n }\n }\n }, _callee20, this);\n }));\n\n function postAbsolute(_x33, _x34, _x35, _x36) {\n return _postAbsolute.apply(this, arguments);\n }\n\n return postAbsolute;\n }()\n }, {\n key: \"postAuthenticatedAbsolute\",\n value: function () {\n var _postAuthenticatedAbsolute = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee21(url, params, onsuccess, onerror) {\n return regeneratorRuntime.wrap(function _callee21$(_context21) {\n while (1) {\n switch (_context21.prev = _context21.next) {\n case 0:\n return _context21.abrupt(\"return\", this.httpRequest(\"post\", url, params, onsuccess, onerror, true));\n\n case 1:\n case \"end\":\n return _context21.stop();\n }\n }\n }, _callee21, this);\n }));\n\n function postAuthenticatedAbsolute(_x37, _x38, _x39, _x40) {\n return _postAuthenticatedAbsolute.apply(this, arguments);\n }\n\n return postAuthenticatedAbsolute;\n }()\n }, {\n key: \"patchAbsolute\",\n value: function () {\n var _patchAbsolute = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee22(url, params, onsuccess, onerror) {\n return regeneratorRuntime.wrap(function _callee22$(_context22) {\n while (1) {\n switch (_context22.prev = _context22.next) {\n case 0:\n return _context22.abrupt(\"return\", this.httpRequest(\"patch\", url, params, onsuccess, onerror));\n\n case 1:\n case \"end\":\n return _context22.stop();\n }\n }\n }, _callee22, this);\n }));\n\n function patchAbsolute(_x41, _x42, _x43, _x44) {\n return _patchAbsolute.apply(this, arguments);\n }\n\n return patchAbsolute;\n }()\n }, {\n key: \"getAbsolute\",\n value: function () {\n var _getAbsolute = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee23(url, params, onsuccess, onerror) {\n return regeneratorRuntime.wrap(function _callee23$(_context23) {\n while (1) {\n switch (_context23.prev = _context23.next) {\n case 0:\n return _context23.abrupt(\"return\", this.httpRequest(\"get\", url, params, onsuccess, onerror));\n\n case 1:\n case \"end\":\n return _context23.stop();\n }\n }\n }, _callee23, this);\n }));\n\n function getAbsolute(_x45, _x46, _x47, _x48) {\n return _getAbsolute.apply(this, arguments);\n }\n\n return getAbsolute;\n }()\n }, {\n key: \"httpRequest\",\n value: function () {\n var _httpRequest = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee25(verb, url, params, onsuccess, onerror) {\n var _this6 = this;\n\n var authenticated,\n _args25 = arguments;\n return regeneratorRuntime.wrap(function _callee25$(_context25) {\n while (1) {\n switch (_context25.prev = _context25.next) {\n case 0:\n authenticated = _args25.length > 5 && _args25[5] !== undefined ? _args25[5] : false;\n return _context25.abrupt(\"return\", new Promise(\n /*#__PURE__*/\n function () {\n var _ref7 = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee24(resolve, reject) {\n var xmlhttp;\n return regeneratorRuntime.wrap(function _callee24$(_context24) {\n while (1) {\n switch (_context24.prev = _context24.next) {\n case 0:\n xmlhttp = new XMLHttpRequest();\n\n xmlhttp.onreadystatechange = function () {\n if (xmlhttp.readyState == 4) {\n var response = xmlhttp.responseText;\n\n if (response) {\n try {\n response = JSON.parse(response);\n } catch (e) {}\n }\n\n if (xmlhttp.status >= 200 && xmlhttp.status <= 299) {\n _this6.$timeout(function () {\n onsuccess(response);\n resolve(response);\n });\n } else {\n console.error(\"Request error:\", response);\n\n _this6.$timeout(function () {\n onerror(response, xmlhttp.status);\n reject(response);\n });\n }\n }\n };\n\n if (verb == \"get\" && Object.keys(params).length > 0) {\n url = _this6.urlForUrlAndParams(url, params);\n }\n\n xmlhttp.open(verb, url, true);\n xmlhttp.setRequestHeader('Content-type', 'application/json');\n\n if (!authenticated) {\n _context24.next = 8;\n break;\n }\n\n _context24.next = 8;\n return _this6.setAuthHeadersForRequest(xmlhttp);\n\n case 8:\n if (verb == \"post\" || verb == \"patch\") {\n xmlhttp.send(JSON.stringify(params));\n } else {\n xmlhttp.send();\n }\n\n case 9:\n case \"end\":\n return _context24.stop();\n }\n }\n }, _callee24);\n }));\n\n return function (_x54, _x55) {\n return _ref7.apply(this, arguments);\n };\n }()));\n\n case 2:\n case \"end\":\n return _context25.stop();\n }\n }\n }, _callee25);\n }));\n\n function httpRequest(_x49, _x50, _x51, _x52, _x53) {\n return _httpRequest.apply(this, arguments);\n }\n\n return httpRequest;\n }()\n }, {\n key: \"urlForUrlAndParams\",\n value: function urlForUrlAndParams(url, params) {\n var keyValueString = Object.keys(params).map(function (key) {\n return key + \"=\" + encodeURIComponent(params[key]);\n }).join(\"&\");\n\n if (url.includes(\"?\")) {\n return url + \"&\" + keyValueString;\n } else {\n return url + \"?\" + keyValueString;\n }\n }\n }]);\n\n return SFHttpManager;\n }();\n\n exports.SFHttpManager = SFHttpManager;\n ;\n\n var SFMigrationManager =\n /*#__PURE__*/\n function () {\n function SFMigrationManager(modelManager, syncManager, storageManager, authManager) {\n var _this7 = this;\n\n _classCallCheck(this, SFMigrationManager);\n\n this.modelManager = modelManager;\n this.syncManager = syncManager;\n this.storageManager = storageManager;\n this.completionHandlers = [];\n this.loadMigrations(); // The syncManager used to dispatch a param called 'initialSync' in the 'sync:completed' event\n // to let us know of the first sync completion after login.\n // however it was removed as it was deemed to be unreliable (returned wrong value when a single sync request repeats on completion for pagination)\n // We'll now use authManager's events instead\n\n var didReceiveSignInEvent = false;\n var signInHandler = authManager.addEventHandler(function (event) {\n if (event == SFAuthManager.DidSignInEvent) {\n didReceiveSignInEvent = true;\n }\n });\n this.receivedLocalDataEvent = syncManager.initialDataLoaded();\n this.syncManager.addEventHandler(\n /*#__PURE__*/\n function () {\n var _ref8 = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee26(event, data) {\n var dataLoadedEvent, syncCompleteEvent, completedList, _iteratorNormalCompletion2, _didIteratorError2, _iteratorError2, _iterator2, _step2, migrationName, migration;\n\n return regeneratorRuntime.wrap(function _callee26$(_context26) {\n while (1) {\n switch (_context26.prev = _context26.next) {\n case 0:\n dataLoadedEvent = event == \"local-data-loaded\";\n syncCompleteEvent = event == \"sync:completed\";\n\n if (!(dataLoadedEvent || syncCompleteEvent)) {\n _context26.next = 40;\n break;\n }\n\n if (dataLoadedEvent) {\n _this7.receivedLocalDataEvent = true;\n } else if (syncCompleteEvent) {\n _this7.receivedSyncCompletedEvent = true;\n } // We want to run pending migrations only after local data has been loaded, and a sync has been completed.\n\n\n if (!(_this7.receivedLocalDataEvent && _this7.receivedSyncCompletedEvent)) {\n _context26.next = 40;\n break;\n }\n\n if (!didReceiveSignInEvent) {\n _context26.next = 39;\n break;\n } // Reset our collected state about sign in\n\n\n didReceiveSignInEvent = false;\n authManager.removeEventHandler(signInHandler); // If initial online sync, clear any completed migrations that occurred while offline,\n // so they can run again now that we have updated user items. Only clear migrations that\n // don't have `runOnlyOnce` set\n\n _context26.next = 10;\n return _this7.getCompletedMigrations();\n\n case 10:\n completedList = _context26.sent.slice();\n _iteratorNormalCompletion2 = true;\n _didIteratorError2 = false;\n _iteratorError2 = undefined;\n _context26.prev = 14;\n _iterator2 = completedList[Symbol.iterator]();\n\n case 16:\n if (_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done) {\n _context26.next = 25;\n break;\n }\n\n migrationName = _step2.value;\n _context26.next = 20;\n return _this7.migrationForEncodedName(migrationName);\n\n case 20:\n migration = _context26.sent;\n\n if (!migration.runOnlyOnce) {\n _.pull(_this7._completed, migrationName);\n }\n\n case 22:\n _iteratorNormalCompletion2 = true;\n _context26.next = 16;\n break;\n\n case 25:\n _context26.next = 31;\n break;\n\n case 27:\n _context26.prev = 27;\n _context26.t0 = _context26[\"catch\"](14);\n _didIteratorError2 = true;\n _iteratorError2 = _context26.t0;\n\n case 31:\n _context26.prev = 31;\n _context26.prev = 32;\n\n if (!_iteratorNormalCompletion2 && _iterator2[\"return\"] != null) {\n _iterator2[\"return\"]();\n }\n\n case 34:\n _context26.prev = 34;\n\n if (!_didIteratorError2) {\n _context26.next = 37;\n break;\n }\n\n throw _iteratorError2;\n\n case 37:\n return _context26.finish(34);\n\n case 38:\n return _context26.finish(31);\n\n case 39:\n _this7.runPendingMigrations();\n\n case 40:\n case \"end\":\n return _context26.stop();\n }\n }\n }, _callee26, null, [[14, 27, 31, 39], [32,, 34, 38]]);\n }));\n\n return function (_x56, _x57) {\n return _ref8.apply(this, arguments);\n };\n }());\n }\n\n _createClass(SFMigrationManager, [{\n key: \"addCompletionHandler\",\n value: function addCompletionHandler(handler) {\n this.completionHandlers.push(handler);\n }\n }, {\n key: \"removeCompletionHandler\",\n value: function removeCompletionHandler(handler) {\n _.pull(this.completionHandlers, handler);\n }\n }, {\n key: \"migrationForEncodedName\",\n value: function () {\n var _migrationForEncodedName = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee27(name) {\n var decoded;\n return regeneratorRuntime.wrap(function _callee27$(_context27) {\n while (1) {\n switch (_context27.prev = _context27.next) {\n case 0:\n _context27.next = 2;\n return this.decode(name);\n\n case 2:\n decoded = _context27.sent;\n return _context27.abrupt(\"return\", this.migrations.find(function (migration) {\n return migration.name == decoded;\n }));\n\n case 4:\n case \"end\":\n return _context27.stop();\n }\n }\n }, _callee27, this);\n }));\n\n function migrationForEncodedName(_x58) {\n return _migrationForEncodedName.apply(this, arguments);\n }\n\n return migrationForEncodedName;\n }()\n }, {\n key: \"loadMigrations\",\n value: function loadMigrations() {\n this.migrations = this.registeredMigrations();\n }\n }, {\n key: \"registeredMigrations\",\n value: function registeredMigrations() {// Subclasses should return an array of migrations here.\n // Migrations should have a unique `name`, `content_type`,\n // and `handler`, which is a function that accepts an array of matching items to migration.\n }\n }, {\n key: \"runPendingMigrations\",\n value: function () {\n var _runPendingMigrations = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee28() {\n var pending, _iteratorNormalCompletion3, _didIteratorError3, _iteratorError3, _iterator3, _step3, migration, _iteratorNormalCompletion4, _didIteratorError4, _iteratorError4, _iterator4, _step4, item, _iteratorNormalCompletion7, _didIteratorError7, _iteratorError7, _iterator7, _step7, _iteratorNormalCompletion5, _didIteratorError5, _iteratorError5, _iterator5, _step5, _iteratorNormalCompletion6, _didIteratorError6, _iteratorError6, _iterator6, _step6, handler;\n\n return regeneratorRuntime.wrap(function _callee28$(_context28) {\n while (1) {\n switch (_context28.prev = _context28.next) {\n case 0:\n _context28.next = 2;\n return this.getPendingMigrations();\n\n case 2:\n pending = _context28.sent; // run in pre loop, keeping in mind that a migration may be run twice: when offline then again when signing in.\n // we need to reset the items to a new array.\n\n _iteratorNormalCompletion3 = true;\n _didIteratorError3 = false;\n _iteratorError3 = undefined;\n _context28.prev = 6;\n\n for (_iterator3 = pending[Symbol.iterator](); !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {\n migration = _step3.value;\n migration.items = [];\n }\n\n _context28.next = 14;\n break;\n\n case 10:\n _context28.prev = 10;\n _context28.t0 = _context28[\"catch\"](6);\n _didIteratorError3 = true;\n _iteratorError3 = _context28.t0;\n\n case 14:\n _context28.prev = 14;\n _context28.prev = 15;\n\n if (!_iteratorNormalCompletion3 && _iterator3[\"return\"] != null) {\n _iterator3[\"return\"]();\n }\n\n case 17:\n _context28.prev = 17;\n\n if (!_didIteratorError3) {\n _context28.next = 20;\n break;\n }\n\n throw _iteratorError3;\n\n case 20:\n return _context28.finish(17);\n\n case 21:\n return _context28.finish(14);\n\n case 22:\n _iteratorNormalCompletion4 = true;\n _didIteratorError4 = false;\n _iteratorError4 = undefined;\n _context28.prev = 25;\n _iterator4 = this.modelManager.allNondummyItems[Symbol.iterator]();\n\n case 27:\n if (_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done) {\n _context28.next = 51;\n break;\n }\n\n item = _step4.value;\n _iteratorNormalCompletion7 = true;\n _didIteratorError7 = false;\n _iteratorError7 = undefined;\n _context28.prev = 32;\n\n for (_iterator7 = pending[Symbol.iterator](); !(_iteratorNormalCompletion7 = (_step7 = _iterator7.next()).done); _iteratorNormalCompletion7 = true) {\n migration = _step7.value;\n\n if (item.content_type == migration.content_type) {\n migration.items.push(item);\n }\n }\n\n _context28.next = 40;\n break;\n\n case 36:\n _context28.prev = 36;\n _context28.t1 = _context28[\"catch\"](32);\n _didIteratorError7 = true;\n _iteratorError7 = _context28.t1;\n\n case 40:\n _context28.prev = 40;\n _context28.prev = 41;\n\n if (!_iteratorNormalCompletion7 && _iterator7[\"return\"] != null) {\n _iterator7[\"return\"]();\n }\n\n case 43:\n _context28.prev = 43;\n\n if (!_didIteratorError7) {\n _context28.next = 46;\n break;\n }\n\n throw _iteratorError7;\n\n case 46:\n return _context28.finish(43);\n\n case 47:\n return _context28.finish(40);\n\n case 48:\n _iteratorNormalCompletion4 = true;\n _context28.next = 27;\n break;\n\n case 51:\n _context28.next = 57;\n break;\n\n case 53:\n _context28.prev = 53;\n _context28.t2 = _context28[\"catch\"](25);\n _didIteratorError4 = true;\n _iteratorError4 = _context28.t2;\n\n case 57:\n _context28.prev = 57;\n _context28.prev = 58;\n\n if (!_iteratorNormalCompletion4 && _iterator4[\"return\"] != null) {\n _iterator4[\"return\"]();\n }\n\n case 60:\n _context28.prev = 60;\n\n if (!_didIteratorError4) {\n _context28.next = 63;\n break;\n }\n\n throw _iteratorError4;\n\n case 63:\n return _context28.finish(60);\n\n case 64:\n return _context28.finish(57);\n\n case 65:\n _iteratorNormalCompletion5 = true;\n _didIteratorError5 = false;\n _iteratorError5 = undefined;\n _context28.prev = 68;\n _iterator5 = pending[Symbol.iterator]();\n\n case 70:\n if (_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done) {\n _context28.next = 81;\n break;\n }\n\n migration = _step5.value;\n\n if (!(migration.items && migration.items.length > 0 || migration.customHandler)) {\n _context28.next = 77;\n break;\n }\n\n _context28.next = 75;\n return this.runMigration(migration, migration.items);\n\n case 75:\n _context28.next = 78;\n break;\n\n case 77:\n this.markMigrationCompleted(migration);\n\n case 78:\n _iteratorNormalCompletion5 = true;\n _context28.next = 70;\n break;\n\n case 81:\n _context28.next = 87;\n break;\n\n case 83:\n _context28.prev = 83;\n _context28.t3 = _context28[\"catch\"](68);\n _didIteratorError5 = true;\n _iteratorError5 = _context28.t3;\n\n case 87:\n _context28.prev = 87;\n _context28.prev = 88;\n\n if (!_iteratorNormalCompletion5 && _iterator5[\"return\"] != null) {\n _iterator5[\"return\"]();\n }\n\n case 90:\n _context28.prev = 90;\n\n if (!_didIteratorError5) {\n _context28.next = 93;\n break;\n }\n\n throw _iteratorError5;\n\n case 93:\n return _context28.finish(90);\n\n case 94:\n return _context28.finish(87);\n\n case 95:\n _iteratorNormalCompletion6 = true;\n _didIteratorError6 = false;\n _iteratorError6 = undefined;\n _context28.prev = 98;\n\n for (_iterator6 = this.completionHandlers[Symbol.iterator](); !(_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done); _iteratorNormalCompletion6 = true) {\n handler = _step6.value;\n handler();\n }\n\n _context28.next = 106;\n break;\n\n case 102:\n _context28.prev = 102;\n _context28.t4 = _context28[\"catch\"](98);\n _didIteratorError6 = true;\n _iteratorError6 = _context28.t4;\n\n case 106:\n _context28.prev = 106;\n _context28.prev = 107;\n\n if (!_iteratorNormalCompletion6 && _iterator6[\"return\"] != null) {\n _iterator6[\"return\"]();\n }\n\n case 109:\n _context28.prev = 109;\n\n if (!_didIteratorError6) {\n _context28.next = 112;\n break;\n }\n\n throw _iteratorError6;\n\n case 112:\n return _context28.finish(109);\n\n case 113:\n return _context28.finish(106);\n\n case 114:\n case \"end\":\n return _context28.stop();\n }\n }\n }, _callee28, this, [[6, 10, 14, 22], [15,, 17, 21], [25, 53, 57, 65], [32, 36, 40, 48], [41,, 43, 47], [58,, 60, 64], [68, 83, 87, 95], [88,, 90, 94], [98, 102, 106, 114], [107,, 109, 113]]);\n }));\n\n function runPendingMigrations() {\n return _runPendingMigrations.apply(this, arguments);\n }\n\n return runPendingMigrations;\n }()\n }, {\n key: \"encode\",\n value: function () {\n var _encode = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee29(text) {\n return regeneratorRuntime.wrap(function _callee29$(_context29) {\n while (1) {\n switch (_context29.prev = _context29.next) {\n case 0:\n return _context29.abrupt(\"return\", window.btoa(text));\n\n case 1:\n case \"end\":\n return _context29.stop();\n }\n }\n }, _callee29);\n }));\n\n function encode(_x59) {\n return _encode.apply(this, arguments);\n }\n\n return encode;\n }()\n }, {\n key: \"decode\",\n value: function () {\n var _decode = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee30(text) {\n return regeneratorRuntime.wrap(function _callee30$(_context30) {\n while (1) {\n switch (_context30.prev = _context30.next) {\n case 0:\n return _context30.abrupt(\"return\", window.atob(text));\n\n case 1:\n case \"end\":\n return _context30.stop();\n }\n }\n }, _callee30);\n }));\n\n function decode(_x60) {\n return _decode.apply(this, arguments);\n }\n\n return decode;\n }()\n }, {\n key: \"getCompletedMigrations\",\n value: function () {\n var _getCompletedMigrations = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee31() {\n var rawCompleted;\n return regeneratorRuntime.wrap(function _callee31$(_context31) {\n while (1) {\n switch (_context31.prev = _context31.next) {\n case 0:\n if (this._completed) {\n _context31.next = 5;\n break;\n }\n\n _context31.next = 3;\n return this.storageManager.getItem(\"migrations\");\n\n case 3:\n rawCompleted = _context31.sent;\n\n if (rawCompleted) {\n this._completed = JSON.parse(rawCompleted);\n } else {\n this._completed = [];\n }\n\n case 5:\n return _context31.abrupt(\"return\", this._completed);\n\n case 6:\n case \"end\":\n return _context31.stop();\n }\n }\n }, _callee31, this);\n }));\n\n function getCompletedMigrations() {\n return _getCompletedMigrations.apply(this, arguments);\n }\n\n return getCompletedMigrations;\n }()\n }, {\n key: \"getPendingMigrations\",\n value: function () {\n var _getPendingMigrations = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee32() {\n var completed, pending, _iteratorNormalCompletion8, _didIteratorError8, _iteratorError8, _iterator8, _step8, migration;\n\n return regeneratorRuntime.wrap(function _callee32$(_context32) {\n while (1) {\n switch (_context32.prev = _context32.next) {\n case 0:\n _context32.next = 2;\n return this.getCompletedMigrations();\n\n case 2:\n completed = _context32.sent;\n pending = [];\n _iteratorNormalCompletion8 = true;\n _didIteratorError8 = false;\n _iteratorError8 = undefined;\n _context32.prev = 7;\n _iterator8 = this.migrations[Symbol.iterator]();\n\n case 9:\n if (_iteratorNormalCompletion8 = (_step8 = _iterator8.next()).done) {\n _context32.next = 22;\n break;\n }\n\n migration = _step8.value;\n _context32.t0 = completed;\n _context32.next = 14;\n return this.encode(migration.name);\n\n case 14:\n _context32.t1 = _context32.sent;\n _context32.t2 = _context32.t0.indexOf.call(_context32.t0, _context32.t1);\n _context32.t3 = -1;\n\n if (!(_context32.t2 == _context32.t3)) {\n _context32.next = 19;\n break;\n }\n\n pending.push(migration);\n\n case 19:\n _iteratorNormalCompletion8 = true;\n _context32.next = 9;\n break;\n\n case 22:\n _context32.next = 28;\n break;\n\n case 24:\n _context32.prev = 24;\n _context32.t4 = _context32[\"catch\"](7);\n _didIteratorError8 = true;\n _iteratorError8 = _context32.t4;\n\n case 28:\n _context32.prev = 28;\n _context32.prev = 29;\n\n if (!_iteratorNormalCompletion8 && _iterator8[\"return\"] != null) {\n _iterator8[\"return\"]();\n }\n\n case 31:\n _context32.prev = 31;\n\n if (!_didIteratorError8) {\n _context32.next = 34;\n break;\n }\n\n throw _iteratorError8;\n\n case 34:\n return _context32.finish(31);\n\n case 35:\n return _context32.finish(28);\n\n case 36:\n return _context32.abrupt(\"return\", pending);\n\n case 37:\n case \"end\":\n return _context32.stop();\n }\n }\n }, _callee32, this, [[7, 24, 28, 36], [29,, 31, 35]]);\n }));\n\n function getPendingMigrations() {\n return _getPendingMigrations.apply(this, arguments);\n }\n\n return getPendingMigrations;\n }()\n }, {\n key: \"markMigrationCompleted\",\n value: function () {\n var _markMigrationCompleted = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee33(migration) {\n var completed;\n return regeneratorRuntime.wrap(function _callee33$(_context33) {\n while (1) {\n switch (_context33.prev = _context33.next) {\n case 0:\n _context33.next = 2;\n return this.getCompletedMigrations();\n\n case 2:\n completed = _context33.sent;\n _context33.t0 = completed;\n _context33.next = 6;\n return this.encode(migration.name);\n\n case 6:\n _context33.t1 = _context33.sent;\n\n _context33.t0.push.call(_context33.t0, _context33.t1);\n\n this.storageManager.setItem(\"migrations\", JSON.stringify(completed));\n migration.running = false;\n\n case 10:\n case \"end\":\n return _context33.stop();\n }\n }\n }, _callee33, this);\n }));\n\n function markMigrationCompleted(_x61) {\n return _markMigrationCompleted.apply(this, arguments);\n }\n\n return markMigrationCompleted;\n }()\n }, {\n key: \"runMigration\",\n value: function () {\n var _runMigration = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee34(migration, items) {\n var _this8 = this;\n\n return regeneratorRuntime.wrap(function _callee34$(_context34) {\n while (1) {\n switch (_context34.prev = _context34.next) {\n case 0:\n if (!migration.running) {\n _context34.next = 2;\n break;\n }\n\n return _context34.abrupt(\"return\");\n\n case 2:\n console.log(\"Running migration:\", migration.name);\n migration.running = true;\n\n if (!migration.customHandler) {\n _context34.next = 8;\n break;\n }\n\n return _context34.abrupt(\"return\", migration.customHandler().then(function () {\n _this8.markMigrationCompleted(migration);\n }));\n\n case 8:\n return _context34.abrupt(\"return\", migration.handler(items).then(function () {\n _this8.markMigrationCompleted(migration);\n }));\n\n case 9:\n case \"end\":\n return _context34.stop();\n }\n }\n }, _callee34);\n }));\n\n function runMigration(_x62, _x63) {\n return _runMigration.apply(this, arguments);\n }\n\n return runMigration;\n }()\n }]);\n\n return SFMigrationManager;\n }();\n\n exports.SFMigrationManager = SFMigrationManager;\n ;\n\n var SFModelManager =\n /*#__PURE__*/\n function () {\n function SFModelManager(timeout) {\n _classCallCheck(this, SFModelManager);\n\n SFModelManager.MappingSourceRemoteRetrieved = \"MappingSourceRemoteRetrieved\";\n SFModelManager.MappingSourceRemoteSaved = \"MappingSourceRemoteSaved\";\n SFModelManager.MappingSourceLocalSaved = \"MappingSourceLocalSaved\";\n SFModelManager.MappingSourceLocalRetrieved = \"MappingSourceLocalRetrieved\";\n SFModelManager.MappingSourceLocalDirtied = \"MappingSourceLocalDirtied\";\n SFModelManager.MappingSourceComponentRetrieved = \"MappingSourceComponentRetrieved\";\n SFModelManager.MappingSourceDesktopInstalled = \"MappingSourceDesktopInstalled\"; // When a component is installed by the desktop and some of its values change\n\n SFModelManager.MappingSourceRemoteActionRetrieved = \"MappingSourceRemoteActionRetrieved\";\n /* aciton-based Extensions like note history */\n\n SFModelManager.MappingSourceFileImport = \"MappingSourceFileImport\";\n\n SFModelManager.isMappingSourceRetrieved = function (source) {\n return [SFModelManager.MappingSourceRemoteRetrieved, SFModelManager.MappingSourceComponentRetrieved, SFModelManager.MappingSourceRemoteActionRetrieved].includes(source);\n };\n\n this.$timeout = timeout || setTimeout.bind(window);\n this.itemSyncObservers = [];\n this.items = [];\n this.itemsHash = {};\n this.missedReferences = {};\n this.uuidChangeObservers = [];\n }\n\n _createClass(SFModelManager, [{\n key: \"handleSignout\",\n value: function handleSignout() {\n this.items.length = 0;\n this.itemsHash = {};\n this.missedReferences = {};\n }\n }, {\n key: \"addModelUuidChangeObserver\",\n value: function addModelUuidChangeObserver(id, callback) {\n this.uuidChangeObservers.push({\n id: id,\n callback: callback\n });\n }\n }, {\n key: \"notifyObserversOfUuidChange\",\n value: function notifyObserversOfUuidChange(oldItem, newItem) {\n var _iteratorNormalCompletion9 = true;\n var _didIteratorError9 = false;\n var _iteratorError9 = undefined;\n\n try {\n for (var _iterator9 = this.uuidChangeObservers[Symbol.iterator](), _step9; !(_iteratorNormalCompletion9 = (_step9 = _iterator9.next()).done); _iteratorNormalCompletion9 = true) {\n var observer = _step9.value;\n\n try {\n observer.callback(oldItem, newItem);\n } catch (e) {\n console.error(\"Notify observers of uuid change exception:\", e);\n }\n }\n } catch (err) {\n _didIteratorError9 = true;\n _iteratorError9 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion9 && _iterator9[\"return\"] != null) {\n _iterator9[\"return\"]();\n }\n } finally {\n if (_didIteratorError9) {\n throw _iteratorError9;\n }\n }\n }\n }\n }, {\n key: \"alternateUUIDForItem\",\n value: function () {\n var _alternateUUIDForItem = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee35(item) {\n var newItem, _iteratorNormalCompletion10, _didIteratorError10, _iteratorError10, _iterator10, _step10, referencingObject;\n\n return regeneratorRuntime.wrap(function _callee35$(_context35) {\n while (1) {\n switch (_context35.prev = _context35.next) {\n case 0:\n // We need to clone this item and give it a new uuid, then delete item with old uuid from db (you can't modify uuid's in our indexeddb setup)\n newItem = this.createItem(item);\n _context35.next = 3;\n return SFJS.crypto.generateUUID();\n\n case 3:\n newItem.uuid = _context35.sent; // Update uuids of relationships\n\n newItem.informReferencesOfUUIDChange(item.uuid, newItem.uuid);\n this.informModelsOfUUIDChangeForItem(newItem, item.uuid, newItem.uuid); // the new item should inherit the original's relationships\n\n _iteratorNormalCompletion10 = true;\n _didIteratorError10 = false;\n _iteratorError10 = undefined;\n _context35.prev = 9;\n\n for (_iterator10 = item.referencingObjects[Symbol.iterator](); !(_iteratorNormalCompletion10 = (_step10 = _iterator10.next()).done); _iteratorNormalCompletion10 = true) {\n referencingObject = _step10.value;\n referencingObject.setIsNoLongerBeingReferencedBy(item);\n item.setIsNoLongerBeingReferencedBy(referencingObject);\n referencingObject.addItemAsRelationship(newItem);\n }\n\n _context35.next = 17;\n break;\n\n case 13:\n _context35.prev = 13;\n _context35.t0 = _context35[\"catch\"](9);\n _didIteratorError10 = true;\n _iteratorError10 = _context35.t0;\n\n case 17:\n _context35.prev = 17;\n _context35.prev = 18;\n\n if (!_iteratorNormalCompletion10 && _iterator10[\"return\"] != null) {\n _iterator10[\"return\"]();\n }\n\n case 20:\n _context35.prev = 20;\n\n if (!_didIteratorError10) {\n _context35.next = 23;\n break;\n }\n\n throw _iteratorError10;\n\n case 23:\n return _context35.finish(20);\n\n case 24:\n return _context35.finish(17);\n\n case 25:\n this.setItemsDirty(item.referencingObjects, true); // Used to set up referencingObjects for new item (so that other items can now properly reference this new item)\n\n this.resolveReferencesForItem(newItem);\n\n if (this.loggingEnabled) {\n console.log(item.uuid, \"-->\", newItem.uuid);\n } // Set to deleted, then run through mapping function so that observers can be notified\n\n\n item.deleted = true;\n item.content.references = []; // Don't set dirty, because we don't need to sync old item. alternating uuid only occurs in two cases:\n // signing in and merging offline data, or when a uuid-conflict occurs. In both cases, the original item never\n // saves to a server, so doesn't need to be synced.\n // informModelsOfUUIDChangeForItem may set this object to dirty, but we want to undo that here, so that the item gets deleted\n // right away through the mapping function.\n\n this.setItemDirty(item, false, false, SFModelManager.MappingSourceLocalSaved);\n _context35.next = 33;\n return this.mapResponseItemsToLocalModels([item], SFModelManager.MappingSourceLocalSaved);\n\n case 33:\n // add new item\n this.addItem(newItem);\n this.setItemDirty(newItem, true, true, SFModelManager.MappingSourceLocalSaved);\n this.notifyObserversOfUuidChange(item, newItem);\n return _context35.abrupt(\"return\", newItem);\n\n case 37:\n case \"end\":\n return _context35.stop();\n }\n }\n }, _callee35, this, [[9, 13, 17, 25], [18,, 20, 24]]);\n }));\n\n function alternateUUIDForItem(_x64) {\n return _alternateUUIDForItem.apply(this, arguments);\n }\n\n return alternateUUIDForItem;\n }()\n }, {\n key: \"informModelsOfUUIDChangeForItem\",\n value: function informModelsOfUUIDChangeForItem(newItem, oldUUID, newUUID) {\n // some models that only have one-way relationships might be interested to hear that an item has changed its uuid\n // for example, editors have a one way relationship with notes. When a note changes its UUID, it has no way to inform the editor\n // to update its relationships\n var _iteratorNormalCompletion11 = true;\n var _didIteratorError11 = false;\n var _iteratorError11 = undefined;\n\n try {\n for (var _iterator11 = this.items[Symbol.iterator](), _step11; !(_iteratorNormalCompletion11 = (_step11 = _iterator11.next()).done); _iteratorNormalCompletion11 = true) {\n var model = _step11.value;\n model.potentialItemOfInterestHasChangedItsUUID(newItem, oldUUID, newUUID);\n }\n } catch (err) {\n _didIteratorError11 = true;\n _iteratorError11 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion11 && _iterator11[\"return\"] != null) {\n _iterator11[\"return\"]();\n }\n } finally {\n if (_didIteratorError11) {\n throw _iteratorError11;\n }\n }\n }\n }\n }, {\n key: \"didSyncModelsOffline\",\n value: function didSyncModelsOffline(items) {\n this.notifySyncObserversOfModels(items, SFModelManager.MappingSourceLocalSaved);\n }\n }, {\n key: \"mapResponseItemsToLocalModels\",\n value: function () {\n var _mapResponseItemsToLocalModels = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee36(items, source, sourceKey) {\n return regeneratorRuntime.wrap(function _callee36$(_context36) {\n while (1) {\n switch (_context36.prev = _context36.next) {\n case 0:\n return _context36.abrupt(\"return\", this.mapResponseItemsToLocalModelsWithOptions({\n items: items,\n source: source,\n sourceKey: sourceKey\n }));\n\n case 1:\n case \"end\":\n return _context36.stop();\n }\n }\n }, _callee36, this);\n }));\n\n function mapResponseItemsToLocalModels(_x65, _x66, _x67) {\n return _mapResponseItemsToLocalModels.apply(this, arguments);\n }\n\n return mapResponseItemsToLocalModels;\n }()\n }, {\n key: \"mapResponseItemsToLocalModelsOmittingFields\",\n value: function () {\n var _mapResponseItemsToLocalModelsOmittingFields = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee37(items, omitFields, source, sourceKey) {\n return regeneratorRuntime.wrap(function _callee37$(_context37) {\n while (1) {\n switch (_context37.prev = _context37.next) {\n case 0:\n return _context37.abrupt(\"return\", this.mapResponseItemsToLocalModelsWithOptions({\n items: items,\n omitFields: omitFields,\n source: source,\n sourceKey: sourceKey\n }));\n\n case 1:\n case \"end\":\n return _context37.stop();\n }\n }\n }, _callee37, this);\n }));\n\n function mapResponseItemsToLocalModelsOmittingFields(_x68, _x69, _x70, _x71) {\n return _mapResponseItemsToLocalModelsOmittingFields.apply(this, arguments);\n }\n\n return mapResponseItemsToLocalModelsOmittingFields;\n }()\n }, {\n key: \"mapResponseItemsToLocalModelsWithOptions\",\n value: function () {\n var _mapResponseItemsToLocalModelsWithOptions = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee38(_ref9) {\n var items, omitFields, source, sourceKey, options, models, processedObjects, modelsToNotifyObserversOf, _iteratorNormalCompletion12, _didIteratorError12, _iteratorError12, _iterator12, _step12, json_obj, isMissingContent, isCorrupt, _iteratorNormalCompletion15, _didIteratorError15, _iteratorError15, _iterator15, _step15, key, item, contentType, unknownContentType, isDirtyItemPendingDelete, _iteratorNormalCompletion13, _didIteratorError13, _iteratorError13, _iterator13, _step13, _step13$value, index, _json_obj, model, missedRefs, _iteratorNormalCompletion14, _didIteratorError14, _iteratorError14, _loop, _iterator14, _step14;\n\n return regeneratorRuntime.wrap(function _callee38$(_context38) {\n while (1) {\n switch (_context38.prev = _context38.next) {\n case 0:\n items = _ref9.items, omitFields = _ref9.omitFields, source = _ref9.source, sourceKey = _ref9.sourceKey, options = _ref9.options;\n models = [], processedObjects = [], modelsToNotifyObserversOf = []; // first loop should add and process items\n\n _iteratorNormalCompletion12 = true;\n _didIteratorError12 = false;\n _iteratorError12 = undefined;\n _context38.prev = 5;\n _iterator12 = items[Symbol.iterator]();\n\n case 7:\n if (_iteratorNormalCompletion12 = (_step12 = _iterator12.next()).done) {\n _context38.next = 58;\n break;\n }\n\n json_obj = _step12.value;\n\n if (json_obj) {\n _context38.next = 11;\n break;\n }\n\n return _context38.abrupt(\"continue\", 55);\n\n case 11:\n // content is missing if it has been sucessfullly decrypted but no content\n isMissingContent = !json_obj.content && !json_obj.errorDecrypting;\n isCorrupt = !json_obj.content_type || !json_obj.uuid;\n\n if (!((isCorrupt || isMissingContent) && !json_obj.deleted)) {\n _context38.next = 16;\n break;\n } // An item that is not deleted should never have empty content\n\n\n console.error(\"Server response item is corrupt:\", json_obj);\n return _context38.abrupt(\"continue\", 55);\n\n case 16:\n if (!Array.isArray(omitFields)) {\n _context38.next = 36;\n break;\n }\n\n _iteratorNormalCompletion15 = true;\n _didIteratorError15 = false;\n _iteratorError15 = undefined;\n _context38.prev = 20;\n\n for (_iterator15 = omitFields[Symbol.iterator](); !(_iteratorNormalCompletion15 = (_step15 = _iterator15.next()).done); _iteratorNormalCompletion15 = true) {\n key = _step15.value;\n delete json_obj[key];\n }\n\n _context38.next = 28;\n break;\n\n case 24:\n _context38.prev = 24;\n _context38.t0 = _context38[\"catch\"](20);\n _didIteratorError15 = true;\n _iteratorError15 = _context38.t0;\n\n case 28:\n _context38.prev = 28;\n _context38.prev = 29;\n\n if (!_iteratorNormalCompletion15 && _iterator15[\"return\"] != null) {\n _iterator15[\"return\"]();\n }\n\n case 31:\n _context38.prev = 31;\n\n if (!_didIteratorError15) {\n _context38.next = 34;\n break;\n }\n\n throw _iteratorError15;\n\n case 34:\n return _context38.finish(31);\n\n case 35:\n return _context38.finish(28);\n\n case 36:\n item = this.findItem(json_obj.uuid);\n\n if (item) {\n item.updateFromJSON(json_obj); // If an item goes through mapping, it can no longer be a dummy.\n\n item.dummy = false;\n }\n\n contentType = json_obj[\"content_type\"] || item && item.content_type;\n unknownContentType = this.acceptableContentTypes && !this.acceptableContentTypes.includes(contentType);\n\n if (!unknownContentType) {\n _context38.next = 42;\n break;\n }\n\n return _context38.abrupt(\"continue\", 55);\n\n case 42:\n isDirtyItemPendingDelete = false;\n\n if (!(json_obj.deleted == true)) {\n _context38.next = 50;\n break;\n }\n\n if (!json_obj.dirty) {\n _context38.next = 48;\n break;\n } // Item was marked as deleted but not yet synced (in offline scenario)\n // We need to create this item as usual, but just not add it to individual arrays\n // i.e add to this.items but not this.notes (so that it can be retrieved with getDirtyItems)\n\n\n isDirtyItemPendingDelete = true;\n _context38.next = 50;\n break;\n\n case 48:\n if (item) {\n // We still want to return this item to the caller so they know it was handled.\n models.push(item);\n modelsToNotifyObserversOf.push(item);\n this.removeItemLocally(item);\n }\n\n return _context38.abrupt(\"continue\", 55);\n\n case 50:\n if (!item) {\n item = this.createItem(json_obj);\n }\n\n this.addItem(item, isDirtyItemPendingDelete); // Observers do not need to handle items that errored while decrypting.\n\n if (!item.errorDecrypting) {\n modelsToNotifyObserversOf.push(item);\n }\n\n models.push(item);\n processedObjects.push(json_obj);\n\n case 55:\n _iteratorNormalCompletion12 = true;\n _context38.next = 7;\n break;\n\n case 58:\n _context38.next = 64;\n break;\n\n case 60:\n _context38.prev = 60;\n _context38.t1 = _context38[\"catch\"](5);\n _didIteratorError12 = true;\n _iteratorError12 = _context38.t1;\n\n case 64:\n _context38.prev = 64;\n _context38.prev = 65;\n\n if (!_iteratorNormalCompletion12 && _iterator12[\"return\"] != null) {\n _iterator12[\"return\"]();\n }\n\n case 67:\n _context38.prev = 67;\n\n if (!_didIteratorError12) {\n _context38.next = 70;\n break;\n }\n\n throw _iteratorError12;\n\n case 70:\n return _context38.finish(67);\n\n case 71:\n return _context38.finish(64);\n\n case 72:\n // second loop should process references\n _iteratorNormalCompletion13 = true;\n _didIteratorError13 = false;\n _iteratorError13 = undefined;\n _context38.prev = 75;\n\n for (_iterator13 = processedObjects.entries()[Symbol.iterator](); !(_iteratorNormalCompletion13 = (_step13 = _iterator13.next()).done); _iteratorNormalCompletion13 = true) {\n _step13$value = _slicedToArray(_step13.value, 2), index = _step13$value[0], _json_obj = _step13$value[1];\n model = models[index];\n\n if (_json_obj.content) {\n this.resolveReferencesForItem(model);\n }\n\n model.didFinishSyncing();\n }\n\n _context38.next = 83;\n break;\n\n case 79:\n _context38.prev = 79;\n _context38.t2 = _context38[\"catch\"](75);\n _didIteratorError13 = true;\n _iteratorError13 = _context38.t2;\n\n case 83:\n _context38.prev = 83;\n _context38.prev = 84;\n\n if (!_iteratorNormalCompletion13 && _iterator13[\"return\"] != null) {\n _iterator13[\"return\"]();\n }\n\n case 86:\n _context38.prev = 86;\n\n if (!_didIteratorError13) {\n _context38.next = 89;\n break;\n }\n\n throw _iteratorError13;\n\n case 89:\n return _context38.finish(86);\n\n case 90:\n return _context38.finish(83);\n\n case 91:\n missedRefs = this.popMissedReferenceStructsForObjects(processedObjects);\n _iteratorNormalCompletion14 = true;\n _didIteratorError14 = false;\n _iteratorError14 = undefined;\n _context38.prev = 95;\n\n _loop = function _loop() {\n var ref = _step14.value;\n var model = models.find(function (candidate) {\n return candidate.uuid == ref.reference_uuid;\n }); // Model should 100% be defined here, but let's not be too overconfident\n\n if (model) {\n var itemWaitingForTheValueInThisCurrentLoop = ref.for_item;\n itemWaitingForTheValueInThisCurrentLoop.addItemAsRelationship(model);\n }\n };\n\n for (_iterator14 = missedRefs[Symbol.iterator](); !(_iteratorNormalCompletion14 = (_step14 = _iterator14.next()).done); _iteratorNormalCompletion14 = true) {\n _loop();\n }\n\n _context38.next = 104;\n break;\n\n case 100:\n _context38.prev = 100;\n _context38.t3 = _context38[\"catch\"](95);\n _didIteratorError14 = true;\n _iteratorError14 = _context38.t3;\n\n case 104:\n _context38.prev = 104;\n _context38.prev = 105;\n\n if (!_iteratorNormalCompletion14 && _iterator14[\"return\"] != null) {\n _iterator14[\"return\"]();\n }\n\n case 107:\n _context38.prev = 107;\n\n if (!_didIteratorError14) {\n _context38.next = 110;\n break;\n }\n\n throw _iteratorError14;\n\n case 110:\n return _context38.finish(107);\n\n case 111:\n return _context38.finish(104);\n\n case 112:\n _context38.next = 114;\n return this.notifySyncObserversOfModels(modelsToNotifyObserversOf, source, sourceKey);\n\n case 114:\n return _context38.abrupt(\"return\", models);\n\n case 115:\n case \"end\":\n return _context38.stop();\n }\n }\n }, _callee38, this, [[5, 60, 64, 72], [20, 24, 28, 36], [29,, 31, 35], [65,, 67, 71], [75, 79, 83, 91], [84,, 86, 90], [95, 100, 104, 112], [105,, 107, 111]]);\n }));\n\n function mapResponseItemsToLocalModelsWithOptions(_x72) {\n return _mapResponseItemsToLocalModelsWithOptions.apply(this, arguments);\n }\n\n return mapResponseItemsToLocalModelsWithOptions;\n }()\n }, {\n key: \"missedReferenceBuildKey\",\n value: function missedReferenceBuildKey(referenceId, objectId) {\n return \"\".concat(referenceId, \":\").concat(objectId);\n }\n }, {\n key: \"popMissedReferenceStructsForObjects\",\n value: function popMissedReferenceStructsForObjects(objects) {\n if (!objects || objects.length == 0) {\n return [];\n }\n\n var results = [];\n var toDelete = [];\n var uuids = objects.map(function (item) {\n return item.uuid;\n });\n var genericUuidLength = uuids[0].length;\n var keys = Object.keys(this.missedReferences);\n\n for (var _i2 = 0, _keys2 = keys; _i2 < _keys2.length; _i2++) {\n var candidateKey = _keys2[_i2];\n /*\n We used to do string.split to get at the UUID, but surprisingly,\n the performance of this was about 20x worse then just getting the substring.\n let matches = candidateKey.split(\":\")[0] == object.uuid;\n */\n\n var matches = uuids.includes(candidateKey.substring(0, genericUuidLength));\n\n if (matches) {\n results.push(this.missedReferences[candidateKey]);\n toDelete.push(candidateKey);\n }\n } // remove from hash\n\n\n for (var _i3 = 0, _toDelete = toDelete; _i3 < _toDelete.length; _i3++) {\n var key = _toDelete[_i3];\n delete this.missedReferences[key];\n }\n\n return results;\n }\n }, {\n key: \"resolveReferencesForItem\",\n value: function resolveReferencesForItem(item) {\n var markReferencesDirty = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n\n if (item.errorDecrypting) {\n return;\n }\n\n var contentObject = item.contentObject; // If another client removes an item's references, this client won't pick up the removal unless\n // we remove everything not present in the current list of references\n\n item.updateLocalRelationships();\n\n if (!contentObject.references) {\n return;\n }\n\n var references = contentObject.references.slice(); // make copy, references will be modified in array\n\n var referencesIds = references.map(function (ref) {\n return ref.uuid;\n });\n var includeBlanks = true;\n var referencesObjectResults = this.findItems(referencesIds, includeBlanks);\n var _iteratorNormalCompletion16 = true;\n var _didIteratorError16 = false;\n var _iteratorError16 = undefined;\n\n try {\n for (var _iterator16 = referencesObjectResults.entries()[Symbol.iterator](), _step16; !(_iteratorNormalCompletion16 = (_step16 = _iterator16.next()).done); _iteratorNormalCompletion16 = true) {\n var _step16$value = _slicedToArray(_step16.value, 2),\n index = _step16$value[0],\n referencedItem = _step16$value[1];\n\n if (referencedItem) {\n item.addItemAsRelationship(referencedItem);\n\n if (markReferencesDirty) {\n this.setItemDirty(referencedItem, true);\n }\n } else {\n var missingRefId = referencesIds[index]; // Allows mapper to check when missing reference makes it through the loop,\n // and then runs resolveReferencesForItem again for the original item.\n\n var mappingKey = this.missedReferenceBuildKey(missingRefId, item.uuid);\n\n if (!this.missedReferences[mappingKey]) {\n var missedRef = {\n reference_uuid: missingRefId,\n for_item: item\n };\n this.missedReferences[mappingKey] = missedRef;\n }\n }\n }\n } catch (err) {\n _didIteratorError16 = true;\n _iteratorError16 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion16 && _iterator16[\"return\"] != null) {\n _iterator16[\"return\"]();\n }\n } finally {\n if (_didIteratorError16) {\n throw _iteratorError16;\n }\n }\n }\n }\n /* Note that this function is public, and can also be called manually (desktopManager uses it) */\n\n }, {\n key: \"notifySyncObserversOfModels\",\n value: function () {\n var _notifySyncObserversOfModels = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee39(models, source, sourceKey) {\n var _this9 = this;\n\n var observers, _iteratorNormalCompletion17, _didIteratorError17, _iteratorError17, _loop2, _iterator17, _step17;\n\n return regeneratorRuntime.wrap(function _callee39$(_context40) {\n while (1) {\n switch (_context40.prev = _context40.next) {\n case 0:\n // Make sure `let` is used in the for loops instead of `var`, as we will be using a timeout below.\n observers = this.itemSyncObservers.sort(function (a, b) {\n // sort by priority\n return a.priority < b.priority ? -1 : 1;\n });\n _iteratorNormalCompletion17 = true;\n _didIteratorError17 = false;\n _iteratorError17 = undefined;\n _context40.prev = 4;\n _loop2 =\n /*#__PURE__*/\n regeneratorRuntime.mark(function _loop2() {\n var observer, allRelevantItems, validItems, deletedItems, _iteratorNormalCompletion18, _didIteratorError18, _iteratorError18, _iterator18, _step18, item;\n\n return regeneratorRuntime.wrap(function _loop2$(_context39) {\n while (1) {\n switch (_context39.prev = _context39.next) {\n case 0:\n observer = _step17.value;\n allRelevantItems = observer.types.includes(\"*\") ? models : models.filter(function (item) {\n return observer.types.includes(item.content_type);\n });\n validItems = [], deletedItems = [];\n _iteratorNormalCompletion18 = true;\n _didIteratorError18 = false;\n _iteratorError18 = undefined;\n _context39.prev = 6;\n\n for (_iterator18 = allRelevantItems[Symbol.iterator](); !(_iteratorNormalCompletion18 = (_step18 = _iterator18.next()).done); _iteratorNormalCompletion18 = true) {\n item = _step18.value;\n\n if (item.deleted) {\n deletedItems.push(item);\n } else {\n validItems.push(item);\n }\n }\n\n _context39.next = 14;\n break;\n\n case 10:\n _context39.prev = 10;\n _context39.t0 = _context39[\"catch\"](6);\n _didIteratorError18 = true;\n _iteratorError18 = _context39.t0;\n\n case 14:\n _context39.prev = 14;\n _context39.prev = 15;\n\n if (!_iteratorNormalCompletion18 && _iterator18[\"return\"] != null) {\n _iterator18[\"return\"]();\n }\n\n case 17:\n _context39.prev = 17;\n\n if (!_didIteratorError18) {\n _context39.next = 20;\n break;\n }\n\n throw _iteratorError18;\n\n case 20:\n return _context39.finish(17);\n\n case 21:\n return _context39.finish(14);\n\n case 22:\n if (!(allRelevantItems.length > 0)) {\n _context39.next = 25;\n break;\n }\n\n _context39.next = 25;\n return _this9._callSyncObserverCallbackWithTimeout(observer, allRelevantItems, validItems, deletedItems, source, sourceKey);\n\n case 25:\n case \"end\":\n return _context39.stop();\n }\n }\n }, _loop2, null, [[6, 10, 14, 22], [15,, 17, 21]]);\n });\n _iterator17 = observers[Symbol.iterator]();\n\n case 7:\n if (_iteratorNormalCompletion17 = (_step17 = _iterator17.next()).done) {\n _context40.next = 12;\n break;\n }\n\n return _context40.delegateYield(_loop2(), \"t0\", 9);\n\n case 9:\n _iteratorNormalCompletion17 = true;\n _context40.next = 7;\n break;\n\n case 12:\n _context40.next = 18;\n break;\n\n case 14:\n _context40.prev = 14;\n _context40.t1 = _context40[\"catch\"](4);\n _didIteratorError17 = true;\n _iteratorError17 = _context40.t1;\n\n case 18:\n _context40.prev = 18;\n _context40.prev = 19;\n\n if (!_iteratorNormalCompletion17 && _iterator17[\"return\"] != null) {\n _iterator17[\"return\"]();\n }\n\n case 21:\n _context40.prev = 21;\n\n if (!_didIteratorError17) {\n _context40.next = 24;\n break;\n }\n\n throw _iteratorError17;\n\n case 24:\n return _context40.finish(21);\n\n case 25:\n return _context40.finish(18);\n\n case 26:\n case \"end\":\n return _context40.stop();\n }\n }\n }, _callee39, this, [[4, 14, 18, 26], [19,, 21, 25]]);\n }));\n\n function notifySyncObserversOfModels(_x73, _x74, _x75) {\n return _notifySyncObserversOfModels.apply(this, arguments);\n }\n\n return notifySyncObserversOfModels;\n }()\n /*\n Rather than running this inline in a for loop, which causes problems and requires all variables to be declared with `let`,\n we'll do it here so it's more explicit and less confusing.\n */\n\n }, {\n key: \"_callSyncObserverCallbackWithTimeout\",\n value: function () {\n var _callSyncObserverCallbackWithTimeout2 = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee40(observer, allRelevantItems, validItems, deletedItems, source, sourceKey) {\n var _this10 = this;\n\n return regeneratorRuntime.wrap(function _callee40$(_context41) {\n while (1) {\n switch (_context41.prev = _context41.next) {\n case 0:\n return _context41.abrupt(\"return\", new Promise(function (resolve, reject) {\n _this10.$timeout(function () {\n try {\n observer.callback(allRelevantItems, validItems, deletedItems, source, sourceKey);\n } catch (e) {\n console.error(\"Sync observer exception\", e);\n } finally {\n resolve();\n }\n });\n }));\n\n case 1:\n case \"end\":\n return _context41.stop();\n }\n }\n }, _callee40);\n }));\n\n function _callSyncObserverCallbackWithTimeout(_x76, _x77, _x78, _x79, _x80, _x81) {\n return _callSyncObserverCallbackWithTimeout2.apply(this, arguments);\n }\n\n return _callSyncObserverCallbackWithTimeout;\n }() // When a client sets an item as dirty, it means its values has changed, and everyone should know about it.\n // Particularly extensions. For example, if you edit the title of a note, extensions won't be notified until the save sync completes.\n // With this, they'll be notified immediately.\n\n }, {\n key: \"setItemDirty\",\n value: function setItemDirty(item) {\n var dirty = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;\n var updateClientDate = arguments.length > 2 ? arguments[2] : undefined;\n var source = arguments.length > 3 ? arguments[3] : undefined;\n var sourceKey = arguments.length > 4 ? arguments[4] : undefined;\n this.setItemsDirty([item], dirty, updateClientDate, source, sourceKey);\n }\n }, {\n key: \"setItemsDirty\",\n value: function setItemsDirty(items) {\n var dirty = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;\n var updateClientDate = arguments.length > 2 ? arguments[2] : undefined;\n var source = arguments.length > 3 ? arguments[3] : undefined;\n var sourceKey = arguments.length > 4 ? arguments[4] : undefined;\n var _iteratorNormalCompletion19 = true;\n var _didIteratorError19 = false;\n var _iteratorError19 = undefined;\n\n try {\n for (var _iterator19 = items[Symbol.iterator](), _step19; !(_iteratorNormalCompletion19 = (_step19 = _iterator19.next()).done); _iteratorNormalCompletion19 = true) {\n var item = _step19.value;\n item.setDirty(dirty, updateClientDate);\n }\n } catch (err) {\n _didIteratorError19 = true;\n _iteratorError19 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion19 && _iterator19[\"return\"] != null) {\n _iterator19[\"return\"]();\n }\n } finally {\n if (_didIteratorError19) {\n throw _iteratorError19;\n }\n }\n }\n\n this.notifySyncObserversOfModels(items, source || SFModelManager.MappingSourceLocalDirtied, sourceKey);\n }\n }, {\n key: \"createItem\",\n value: function createItem(json_obj) {\n var itemClass = SFModelManager.ContentTypeClassMapping && SFModelManager.ContentTypeClassMapping[json_obj.content_type];\n\n if (!itemClass) {\n itemClass = SFItem;\n }\n\n var item = new itemClass(json_obj);\n return item;\n }\n /*\n Be sure itemResponse is a generic Javascript object, and not an Item.\n An Item needs to collapse its properties into its content object before it can be duplicated.\n Note: the reason we need this function is specificallty for the call to resolveReferencesForItem.\n This method creates but does not add the item to the global inventory. It's used by syncManager\n to check if this prospective duplicate item is identical to another item, including the references.\n */\n\n }, {\n key: \"createDuplicateItemFromResponseItem\",\n value: function () {\n var _createDuplicateItemFromResponseItem = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee41(itemResponse) {\n var itemResponseCopy, duplicate;\n return regeneratorRuntime.wrap(function _callee41$(_context42) {\n while (1) {\n switch (_context42.prev = _context42.next) {\n case 0:\n if (!(typeof itemResponse.setDirty === 'function')) {\n _context42.next = 3;\n break;\n } // You should never pass in objects here, as we will modify the itemResponse's uuid below (update: we now make a copy of input value).\n\n\n console.error(\"Attempting to create conflicted copy of non-response item.\");\n return _context42.abrupt(\"return\", null);\n\n case 3:\n // Make a copy so we don't modify input value.\n itemResponseCopy = JSON.parse(JSON.stringify(itemResponse));\n _context42.next = 6;\n return SFJS.crypto.generateUUID();\n\n case 6:\n itemResponseCopy.uuid = _context42.sent;\n duplicate = this.createItem(itemResponseCopy);\n return _context42.abrupt(\"return\", duplicate);\n\n case 9:\n case \"end\":\n return _context42.stop();\n }\n }\n }, _callee41, this);\n }));\n\n function createDuplicateItemFromResponseItem(_x82) {\n return _createDuplicateItemFromResponseItem.apply(this, arguments);\n }\n\n return createDuplicateItemFromResponseItem;\n }()\n }, {\n key: \"duplicateItemAndAddAsConflict\",\n value: function duplicateItemAndAddAsConflict(duplicateOf) {\n return this.duplicateItemWithCustomContentAndAddAsConflict({\n content: duplicateOf.content,\n duplicateOf: duplicateOf\n });\n }\n }, {\n key: \"duplicateItemWithCustomContentAndAddAsConflict\",\n value: function duplicateItemWithCustomContentAndAddAsConflict(_ref10) {\n var content = _ref10.content,\n duplicateOf = _ref10.duplicateOf;\n var copy = this.duplicateItemWithCustomContent({\n content: content,\n duplicateOf: duplicateOf\n });\n this.addDuplicatedItemAsConflict({\n duplicate: copy,\n duplicateOf: duplicateOf\n });\n return copy;\n }\n }, {\n key: \"addDuplicatedItemAsConflict\",\n value: function addDuplicatedItemAsConflict(_ref11) {\n var duplicate = _ref11.duplicate,\n duplicateOf = _ref11.duplicateOf;\n this.addDuplicatedItem(duplicate, duplicateOf);\n duplicate.content.conflict_of = duplicateOf.uuid;\n }\n }, {\n key: \"duplicateItemWithCustomContent\",\n value: function duplicateItemWithCustomContent(_ref12) {\n var content = _ref12.content,\n duplicateOf = _ref12.duplicateOf;\n var copy = new duplicateOf.constructor({\n content: content\n });\n copy.created_at = duplicateOf.created_at;\n\n if (!copy.content_type) {\n copy.content_type = duplicateOf.content_type;\n }\n\n return copy;\n }\n }, {\n key: \"duplicateItemAndAdd\",\n value: function duplicateItemAndAdd(item) {\n var copy = this.duplicateItemWithoutAdding(item);\n this.addDuplicatedItem(copy, item);\n return copy;\n }\n }, {\n key: \"duplicateItemWithoutAdding\",\n value: function duplicateItemWithoutAdding(item) {\n var copy = new item.constructor({\n content: item.content\n });\n copy.created_at = item.created_at;\n\n if (!copy.content_type) {\n copy.content_type = item.content_type;\n }\n\n return copy;\n }\n }, {\n key: \"addDuplicatedItem\",\n value: function addDuplicatedItem(duplicate, original) {\n this.addItem(duplicate); // the duplicate should inherit the original's relationships\n\n var _iteratorNormalCompletion20 = true;\n var _didIteratorError20 = false;\n var _iteratorError20 = undefined;\n\n try {\n for (var _iterator20 = original.referencingObjects[Symbol.iterator](), _step20; !(_iteratorNormalCompletion20 = (_step20 = _iterator20.next()).done); _iteratorNormalCompletion20 = true) {\n var referencingObject = _step20.value;\n referencingObject.addItemAsRelationship(duplicate);\n this.setItemDirty(referencingObject, true);\n }\n } catch (err) {\n _didIteratorError20 = true;\n _iteratorError20 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion20 && _iterator20[\"return\"] != null) {\n _iterator20[\"return\"]();\n }\n } finally {\n if (_didIteratorError20) {\n throw _iteratorError20;\n }\n }\n }\n\n this.resolveReferencesForItem(duplicate);\n this.setItemDirty(duplicate, true);\n }\n }, {\n key: \"addItem\",\n value: function addItem(item) {\n var globalOnly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n this.addItems([item], globalOnly);\n }\n }, {\n key: \"addItems\",\n value: function addItems(items) {\n var _this11 = this;\n\n var globalOnly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n items.forEach(function (item) {\n if (!_this11.itemsHash[item.uuid]) {\n _this11.itemsHash[item.uuid] = item;\n\n _this11.items.push(item);\n }\n });\n }\n /* Notifies observers when an item has been synced or mapped from a remote response */\n\n }, {\n key: \"addItemSyncObserver\",\n value: function addItemSyncObserver(id, types, callback) {\n this.addItemSyncObserverWithPriority({\n id: id,\n types: types,\n callback: callback,\n priority: 1\n });\n }\n }, {\n key: \"addItemSyncObserverWithPriority\",\n value: function addItemSyncObserverWithPriority(_ref13) {\n var id = _ref13.id,\n priority = _ref13.priority,\n types = _ref13.types,\n callback = _ref13.callback;\n\n if (!Array.isArray(types)) {\n types = [types];\n }\n\n this.itemSyncObservers.push({\n id: id,\n types: types,\n priority: priority,\n callback: callback\n });\n }\n }, {\n key: \"removeItemSyncObserver\",\n value: function removeItemSyncObserver(id) {\n _.remove(this.itemSyncObservers, _.find(this.itemSyncObservers, {\n id: id\n }));\n }\n }, {\n key: \"getDirtyItems\",\n value: function getDirtyItems() {\n return this.items.filter(function (item) {\n // An item that has an error decrypting can be synced only if it is being deleted.\n // Otherwise, we don't want to send corrupt content up to the server.\n return item.dirty == true && !item.dummy && (!item.errorDecrypting || item.deleted);\n });\n }\n }, {\n key: \"clearDirtyItems\",\n value: function clearDirtyItems(items) {\n var _iteratorNormalCompletion21 = true;\n var _didIteratorError21 = false;\n var _iteratorError21 = undefined;\n\n try {\n for (var _iterator21 = items[Symbol.iterator](), _step21; !(_iteratorNormalCompletion21 = (_step21 = _iterator21.next()).done); _iteratorNormalCompletion21 = true) {\n var item = _step21.value;\n item.setDirty(false);\n }\n } catch (err) {\n _didIteratorError21 = true;\n _iteratorError21 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion21 && _iterator21[\"return\"] != null) {\n _iterator21[\"return\"]();\n }\n } finally {\n if (_didIteratorError21) {\n throw _iteratorError21;\n }\n }\n }\n }\n }, {\n key: \"removeAndDirtyAllRelationshipsForItem\",\n value: function removeAndDirtyAllRelationshipsForItem(item) {\n // Handle direct relationships\n // An item with errorDecrypting will not have valid content field\n if (!item.errorDecrypting) {\n var _iteratorNormalCompletion22 = true;\n var _didIteratorError22 = false;\n var _iteratorError22 = undefined;\n\n try {\n for (var _iterator22 = item.content.references[Symbol.iterator](), _step22; !(_iteratorNormalCompletion22 = (_step22 = _iterator22.next()).done); _iteratorNormalCompletion22 = true) {\n var reference = _step22.value;\n var relationship = this.findItem(reference.uuid);\n\n if (relationship) {\n item.removeItemAsRelationship(relationship);\n\n if (relationship.hasRelationshipWithItem(item)) {\n relationship.removeItemAsRelationship(item);\n this.setItemDirty(relationship, true);\n }\n }\n }\n } catch (err) {\n _didIteratorError22 = true;\n _iteratorError22 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion22 && _iterator22[\"return\"] != null) {\n _iterator22[\"return\"]();\n }\n } finally {\n if (_didIteratorError22) {\n throw _iteratorError22;\n }\n }\n }\n } // Handle indirect relationships\n\n\n var _iteratorNormalCompletion23 = true;\n var _didIteratorError23 = false;\n var _iteratorError23 = undefined;\n\n try {\n for (var _iterator23 = item.referencingObjects[Symbol.iterator](), _step23; !(_iteratorNormalCompletion23 = (_step23 = _iterator23.next()).done); _iteratorNormalCompletion23 = true) {\n var object = _step23.value;\n object.removeItemAsRelationship(item);\n this.setItemDirty(object, true);\n }\n } catch (err) {\n _didIteratorError23 = true;\n _iteratorError23 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion23 && _iterator23[\"return\"] != null) {\n _iterator23[\"return\"]();\n }\n } finally {\n if (_didIteratorError23) {\n throw _iteratorError23;\n }\n }\n }\n\n item.referencingObjects = [];\n }\n /* Used when changing encryption key */\n\n }, {\n key: \"setAllItemsDirty\",\n value: function setAllItemsDirty() {\n var relevantItems = this.allItems;\n this.setItemsDirty(relevantItems, true);\n }\n }, {\n key: \"setItemToBeDeleted\",\n value: function setItemToBeDeleted(item) {\n item.deleted = true;\n\n if (!item.dummy) {\n this.setItemDirty(item, true);\n }\n\n this.removeAndDirtyAllRelationshipsForItem(item);\n }\n }, {\n key: \"removeItemLocally\",\n value: function () {\n var _removeItemLocally = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee42(item) {\n return regeneratorRuntime.wrap(function _callee42$(_context43) {\n while (1) {\n switch (_context43.prev = _context43.next) {\n case 0:\n _.remove(this.items, {\n uuid: item.uuid\n });\n\n delete this.itemsHash[item.uuid];\n item.isBeingRemovedLocally();\n\n case 3:\n case \"end\":\n return _context43.stop();\n }\n }\n }, _callee42, this);\n }));\n\n function removeItemLocally(_x83) {\n return _removeItemLocally.apply(this, arguments);\n }\n\n return removeItemLocally;\n }()\n /* Searching */\n\n }, {\n key: \"allItemsMatchingTypes\",\n value: function allItemsMatchingTypes(contentTypes) {\n return this.allItems.filter(function (item) {\n return (_.includes(contentTypes, item.content_type) || _.includes(contentTypes, \"*\")) && !item.dummy;\n });\n }\n }, {\n key: \"invalidItems\",\n value: function invalidItems() {\n return this.allItems.filter(function (item) {\n return item.errorDecrypting;\n });\n }\n }, {\n key: \"validItemsForContentType\",\n value: function validItemsForContentType(contentType) {\n return this.allItems.filter(function (item) {\n return item.content_type == contentType && !item.errorDecrypting;\n });\n }\n }, {\n key: \"findItem\",\n value: function findItem(itemId) {\n return this.itemsHash[itemId];\n }\n }, {\n key: \"findItems\",\n value: function findItems(ids) {\n var includeBlanks = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n var results = [];\n var _iteratorNormalCompletion24 = true;\n var _didIteratorError24 = false;\n var _iteratorError24 = undefined;\n\n try {\n for (var _iterator24 = ids[Symbol.iterator](), _step24; !(_iteratorNormalCompletion24 = (_step24 = _iterator24.next()).done); _iteratorNormalCompletion24 = true) {\n var id = _step24.value;\n var item = this.itemsHash[id];\n\n if (item || includeBlanks) {\n results.push(item);\n }\n }\n } catch (err) {\n _didIteratorError24 = true;\n _iteratorError24 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion24 && _iterator24[\"return\"] != null) {\n _iterator24[\"return\"]();\n }\n } finally {\n if (_didIteratorError24) {\n throw _iteratorError24;\n }\n }\n }\n\n return results;\n }\n }, {\n key: \"itemsMatchingPredicate\",\n value: function itemsMatchingPredicate(predicate) {\n return this.itemsMatchingPredicates([predicate]);\n }\n }, {\n key: \"itemsMatchingPredicates\",\n value: function itemsMatchingPredicates(predicates) {\n return this.filterItemsWithPredicates(this.allItems, predicates);\n }\n }, {\n key: \"filterItemsWithPredicates\",\n value: function filterItemsWithPredicates(items, predicates) {\n var results = items.filter(function (item) {\n var _iteratorNormalCompletion25 = true;\n var _didIteratorError25 = false;\n var _iteratorError25 = undefined;\n\n try {\n for (var _iterator25 = predicates[Symbol.iterator](), _step25; !(_iteratorNormalCompletion25 = (_step25 = _iterator25.next()).done); _iteratorNormalCompletion25 = true) {\n var predicate = _step25.value;\n\n if (!item.satisfiesPredicate(predicate)) {\n return false;\n }\n }\n } catch (err) {\n _didIteratorError25 = true;\n _iteratorError25 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion25 && _iterator25[\"return\"] != null) {\n _iterator25[\"return\"]();\n }\n } finally {\n if (_didIteratorError25) {\n throw _iteratorError25;\n }\n }\n }\n\n return true;\n });\n return results;\n }\n /*\n Archives\n */\n\n }, {\n key: \"importItems\",\n value: function () {\n var _importItems = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee43(externalItems) {\n var itemsToBeMapped, localValues, _iteratorNormalCompletion26, _didIteratorError26, _iteratorError26, _iterator26, _step26, itemData, localItem, frozenValue, _iteratorNormalCompletion27, _didIteratorError27, _iteratorError27, _iterator27, _step27, _itemData, _localValues$_itemDat, _frozenValue, itemRef, duplicate, items, _iteratorNormalCompletion28, _didIteratorError28, _iteratorError28, _iterator28, _step28, item;\n\n return regeneratorRuntime.wrap(function _callee43$(_context44) {\n while (1) {\n switch (_context44.prev = _context44.next) {\n case 0:\n itemsToBeMapped = []; // Get local values before doing any processing. This way, if a note change below modifies a tag,\n // and the tag is going to be iterated on in the same loop, then we don't want this change to be compared\n // to the local value.\n\n localValues = {};\n _iteratorNormalCompletion26 = true;\n _didIteratorError26 = false;\n _iteratorError26 = undefined;\n _context44.prev = 5;\n _iterator26 = externalItems[Symbol.iterator]();\n\n case 7:\n if (_iteratorNormalCompletion26 = (_step26 = _iterator26.next()).done) {\n _context44.next = 18;\n break;\n }\n\n itemData = _step26.value;\n localItem = this.findItem(itemData.uuid);\n\n if (localItem) {\n _context44.next = 13;\n break;\n }\n\n localValues[itemData.uuid] = {};\n return _context44.abrupt(\"continue\", 15);\n\n case 13:\n frozenValue = this.duplicateItemWithoutAdding(localItem);\n localValues[itemData.uuid] = {\n frozenValue: frozenValue,\n itemRef: localItem\n };\n\n case 15:\n _iteratorNormalCompletion26 = true;\n _context44.next = 7;\n break;\n\n case 18:\n _context44.next = 24;\n break;\n\n case 20:\n _context44.prev = 20;\n _context44.t0 = _context44[\"catch\"](5);\n _didIteratorError26 = true;\n _iteratorError26 = _context44.t0;\n\n case 24:\n _context44.prev = 24;\n _context44.prev = 25;\n\n if (!_iteratorNormalCompletion26 && _iterator26[\"return\"] != null) {\n _iterator26[\"return\"]();\n }\n\n case 27:\n _context44.prev = 27;\n\n if (!_didIteratorError26) {\n _context44.next = 30;\n break;\n }\n\n throw _iteratorError26;\n\n case 30:\n return _context44.finish(27);\n\n case 31:\n return _context44.finish(24);\n\n case 32:\n _iteratorNormalCompletion27 = true;\n _didIteratorError27 = false;\n _iteratorError27 = undefined;\n _context44.prev = 35;\n _iterator27 = externalItems[Symbol.iterator]();\n\n case 37:\n if (_iteratorNormalCompletion27 = (_step27 = _iterator27.next()).done) {\n _context44.next = 52;\n break;\n }\n\n _itemData = _step27.value;\n _localValues$_itemDat = localValues[_itemData.uuid], _frozenValue = _localValues$_itemDat.frozenValue, itemRef = _localValues$_itemDat.itemRef;\n\n if (!(_frozenValue && !itemRef.errorDecrypting)) {\n _context44.next = 47;\n break;\n }\n\n _context44.next = 43;\n return this.createDuplicateItemFromResponseItem(_itemData);\n\n case 43:\n duplicate = _context44.sent;\n\n if (!_itemData.deleted && !_frozenValue.isItemContentEqualWith(duplicate)) {\n // Data differs\n this.addDuplicatedItemAsConflict({\n duplicate: duplicate,\n duplicateOf: itemRef\n });\n itemsToBeMapped.push(duplicate);\n }\n\n _context44.next = 49;\n break;\n\n case 47:\n // it doesn't exist, push it into items to be mapped\n itemsToBeMapped.push(_itemData);\n\n if (itemRef && itemRef.errorDecrypting) {\n itemRef.errorDecrypting = false;\n }\n\n case 49:\n _iteratorNormalCompletion27 = true;\n _context44.next = 37;\n break;\n\n case 52:\n _context44.next = 58;\n break;\n\n case 54:\n _context44.prev = 54;\n _context44.t1 = _context44[\"catch\"](35);\n _didIteratorError27 = true;\n _iteratorError27 = _context44.t1;\n\n case 58:\n _context44.prev = 58;\n _context44.prev = 59;\n\n if (!_iteratorNormalCompletion27 && _iterator27[\"return\"] != null) {\n _iterator27[\"return\"]();\n }\n\n case 61:\n _context44.prev = 61;\n\n if (!_didIteratorError27) {\n _context44.next = 64;\n break;\n }\n\n throw _iteratorError27;\n\n case 64:\n return _context44.finish(61);\n\n case 65:\n return _context44.finish(58);\n\n case 66:\n _context44.next = 68;\n return this.mapResponseItemsToLocalModels(itemsToBeMapped, SFModelManager.MappingSourceFileImport);\n\n case 68:\n items = _context44.sent;\n _iteratorNormalCompletion28 = true;\n _didIteratorError28 = false;\n _iteratorError28 = undefined;\n _context44.prev = 72;\n\n for (_iterator28 = items[Symbol.iterator](); !(_iteratorNormalCompletion28 = (_step28 = _iterator28.next()).done); _iteratorNormalCompletion28 = true) {\n item = _step28.value;\n this.setItemDirty(item, true, false);\n item.deleted = false;\n }\n\n _context44.next = 80;\n break;\n\n case 76:\n _context44.prev = 76;\n _context44.t2 = _context44[\"catch\"](72);\n _didIteratorError28 = true;\n _iteratorError28 = _context44.t2;\n\n case 80:\n _context44.prev = 80;\n _context44.prev = 81;\n\n if (!_iteratorNormalCompletion28 && _iterator28[\"return\"] != null) {\n _iterator28[\"return\"]();\n }\n\n case 83:\n _context44.prev = 83;\n\n if (!_didIteratorError28) {\n _context44.next = 86;\n break;\n }\n\n throw _iteratorError28;\n\n case 86:\n return _context44.finish(83);\n\n case 87:\n return _context44.finish(80);\n\n case 88:\n return _context44.abrupt(\"return\", items);\n\n case 89:\n case \"end\":\n return _context44.stop();\n }\n }\n }, _callee43, this, [[5, 20, 24, 32], [25,, 27, 31], [35, 54, 58, 66], [59,, 61, 65], [72, 76, 80, 88], [81,, 83, 87]]);\n }));\n\n function importItems(_x84) {\n return _importItems.apply(this, arguments);\n }\n\n return importItems;\n }()\n }, {\n key: \"getAllItemsJSONData\",\n value: function () {\n var _getAllItemsJSONData = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee44(keys, authParams, returnNullIfEmpty) {\n return regeneratorRuntime.wrap(function _callee44$(_context45) {\n while (1) {\n switch (_context45.prev = _context45.next) {\n case 0:\n return _context45.abrupt(\"return\", this.getJSONDataForItems(this.allItems, keys, authParams, returnNullIfEmpty));\n\n case 1:\n case \"end\":\n return _context45.stop();\n }\n }\n }, _callee44, this);\n }));\n\n function getAllItemsJSONData(_x85, _x86, _x87) {\n return _getAllItemsJSONData.apply(this, arguments);\n }\n\n return getAllItemsJSONData;\n }()\n }, {\n key: \"getJSONDataForItems\",\n value: function () {\n var _getJSONDataForItems = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee45(items, keys, authParams, returnNullIfEmpty) {\n return regeneratorRuntime.wrap(function _callee45$(_context46) {\n while (1) {\n switch (_context46.prev = _context46.next) {\n case 0:\n return _context46.abrupt(\"return\", Promise.all(items.map(function (item) {\n var itemParams = new SFItemParams(item, keys, authParams);\n return itemParams.paramsForExportFile();\n })).then(function (items) {\n if (returnNullIfEmpty && items.length == 0) {\n return null;\n }\n\n var data = {\n items: items\n };\n\n if (keys) {\n // auth params are only needed when encrypted with a standard file key\n data[\"auth_params\"] = authParams;\n }\n\n return JSON.stringify(data, null, 2\n /* pretty print */\n );\n }));\n\n case 1:\n case \"end\":\n return _context46.stop();\n }\n }\n }, _callee45);\n }));\n\n function getJSONDataForItems(_x88, _x89, _x90, _x91) {\n return _getJSONDataForItems.apply(this, arguments);\n }\n\n return getJSONDataForItems;\n }()\n }, {\n key: \"computeDataIntegrityHash\",\n value: function () {\n var _computeDataIntegrityHash = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee46() {\n var items, dates, string, hash;\n return regeneratorRuntime.wrap(function _callee46$(_context47) {\n while (1) {\n switch (_context47.prev = _context47.next) {\n case 0:\n _context47.prev = 0;\n items = this.allNondummyItems.sort(function (a, b) {\n return b.updated_at - a.updated_at;\n });\n dates = items.map(function (item) {\n return item.updatedAtTimestamp();\n });\n string = dates.join(\",\");\n _context47.next = 6;\n return SFJS.crypto.sha256(string);\n\n case 6:\n hash = _context47.sent;\n return _context47.abrupt(\"return\", hash);\n\n case 10:\n _context47.prev = 10;\n _context47.t0 = _context47[\"catch\"](0);\n console.error(\"Error computing data integrity hash\", _context47.t0);\n return _context47.abrupt(\"return\", null);\n\n case 14:\n case \"end\":\n return _context47.stop();\n }\n }\n }, _callee46, this, [[0, 10]]);\n }));\n\n function computeDataIntegrityHash() {\n return _computeDataIntegrityHash.apply(this, arguments);\n }\n\n return computeDataIntegrityHash;\n }()\n }, {\n key: \"allItems\",\n get: function get() {\n return this.items.slice();\n }\n }, {\n key: \"allNondummyItems\",\n get: function get() {\n return this.items.filter(function (item) {\n return !item.dummy;\n });\n }\n }]);\n\n return SFModelManager;\n }();\n\n exports.SFModelManager = SFModelManager;\n ;\n\n var SFPrivilegesManager =\n /*#__PURE__*/\n function () {\n function SFPrivilegesManager(modelManager, syncManager, singletonManager) {\n _classCallCheck(this, SFPrivilegesManager);\n\n this.modelManager = modelManager;\n this.syncManager = syncManager;\n this.singletonManager = singletonManager;\n this.loadPrivileges();\n SFPrivilegesManager.CredentialAccountPassword = \"CredentialAccountPassword\";\n SFPrivilegesManager.CredentialLocalPasscode = \"CredentialLocalPasscode\";\n SFPrivilegesManager.ActionManageExtensions = \"ActionManageExtensions\";\n SFPrivilegesManager.ActionManageBackups = \"ActionManageBackups\";\n SFPrivilegesManager.ActionViewProtectedNotes = \"ActionViewProtectedNotes\";\n SFPrivilegesManager.ActionManagePrivileges = \"ActionManagePrivileges\";\n SFPrivilegesManager.ActionManagePasscode = \"ActionManagePasscode\";\n SFPrivilegesManager.ActionDeleteNote = \"ActionDeleteNote\";\n SFPrivilegesManager.SessionExpiresAtKey = \"SessionExpiresAtKey\";\n SFPrivilegesManager.SessionLengthKey = \"SessionLengthKey\";\n SFPrivilegesManager.SessionLengthNone = 0;\n SFPrivilegesManager.SessionLengthFiveMinutes = 300;\n SFPrivilegesManager.SessionLengthOneHour = 3600;\n SFPrivilegesManager.SessionLengthOneWeek = 604800;\n this.availableActions = [SFPrivilegesManager.ActionViewProtectedNotes, SFPrivilegesManager.ActionDeleteNote, SFPrivilegesManager.ActionManagePasscode, SFPrivilegesManager.ActionManageBackups, SFPrivilegesManager.ActionManageExtensions, SFPrivilegesManager.ActionManagePrivileges];\n this.availableCredentials = [SFPrivilegesManager.CredentialAccountPassword, SFPrivilegesManager.CredentialLocalPasscode];\n this.sessionLengths = [SFPrivilegesManager.SessionLengthNone, SFPrivilegesManager.SessionLengthFiveMinutes, SFPrivilegesManager.SessionLengthOneHour, SFPrivilegesManager.SessionLengthOneWeek, SFPrivilegesManager.SessionLengthIndefinite];\n }\n /*\n async delegate.isOffline()\n async delegate.hasLocalPasscode()\n async delegate.saveToStorage(key, value)\n async delegate.getFromStorage(key)\n async delegate.verifyAccountPassword\n async delegate.verifyLocalPasscode\n */\n\n\n _createClass(SFPrivilegesManager, [{\n key: \"setDelegate\",\n value: function setDelegate(delegate) {\n this.delegate = delegate;\n }\n }, {\n key: \"getAvailableActions\",\n value: function getAvailableActions() {\n return this.availableActions;\n }\n }, {\n key: \"getAvailableCredentials\",\n value: function getAvailableCredentials() {\n return this.availableCredentials;\n }\n }, {\n key: \"netCredentialsForAction\",\n value: function () {\n var _netCredentialsForAction = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee47(action) {\n var credentials, netCredentials, _iteratorNormalCompletion29, _didIteratorError29, _iteratorError29, _iterator29, _step29, cred, isOffline, hasLocalPasscode;\n\n return regeneratorRuntime.wrap(function _callee47$(_context48) {\n while (1) {\n switch (_context48.prev = _context48.next) {\n case 0:\n _context48.next = 2;\n return this.getPrivileges();\n\n case 2:\n _context48.t0 = action;\n credentials = _context48.sent.getCredentialsForAction(_context48.t0);\n netCredentials = [];\n _iteratorNormalCompletion29 = true;\n _didIteratorError29 = false;\n _iteratorError29 = undefined;\n _context48.prev = 8;\n _iterator29 = credentials[Symbol.iterator]();\n\n case 10:\n if (_iteratorNormalCompletion29 = (_step29 = _iterator29.next()).done) {\n _context48.next = 27;\n break;\n }\n\n cred = _step29.value;\n\n if (!(cred == SFPrivilegesManager.CredentialAccountPassword)) {\n _context48.next = 19;\n break;\n }\n\n _context48.next = 15;\n return this.delegate.isOffline();\n\n case 15:\n isOffline = _context48.sent;\n\n if (!isOffline) {\n netCredentials.push(cred);\n }\n\n _context48.next = 24;\n break;\n\n case 19:\n if (!(cred == SFPrivilegesManager.CredentialLocalPasscode)) {\n _context48.next = 24;\n break;\n }\n\n _context48.next = 22;\n return this.delegate.hasLocalPasscode();\n\n case 22:\n hasLocalPasscode = _context48.sent;\n\n if (hasLocalPasscode) {\n netCredentials.push(cred);\n }\n\n case 24:\n _iteratorNormalCompletion29 = true;\n _context48.next = 10;\n break;\n\n case 27:\n _context48.next = 33;\n break;\n\n case 29:\n _context48.prev = 29;\n _context48.t1 = _context48[\"catch\"](8);\n _didIteratorError29 = true;\n _iteratorError29 = _context48.t1;\n\n case 33:\n _context48.prev = 33;\n _context48.prev = 34;\n\n if (!_iteratorNormalCompletion29 && _iterator29[\"return\"] != null) {\n _iterator29[\"return\"]();\n }\n\n case 36:\n _context48.prev = 36;\n\n if (!_didIteratorError29) {\n _context48.next = 39;\n break;\n }\n\n throw _iteratorError29;\n\n case 39:\n return _context48.finish(36);\n\n case 40:\n return _context48.finish(33);\n\n case 41:\n return _context48.abrupt(\"return\", netCredentials);\n\n case 42:\n case \"end\":\n return _context48.stop();\n }\n }\n }, _callee47, this, [[8, 29, 33, 41], [34,, 36, 40]]);\n }));\n\n function netCredentialsForAction(_x92) {\n return _netCredentialsForAction.apply(this, arguments);\n }\n\n return netCredentialsForAction;\n }()\n }, {\n key: \"loadPrivileges\",\n value: function () {\n var _loadPrivileges = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee49() {\n var _this12 = this;\n\n return regeneratorRuntime.wrap(function _callee49$(_context50) {\n while (1) {\n switch (_context50.prev = _context50.next) {\n case 0:\n if (!this.loadPromise) {\n _context50.next = 2;\n break;\n }\n\n return _context50.abrupt(\"return\", this.loadPromise);\n\n case 2:\n this.loadPromise = new Promise(function (resolve, reject) {\n var privsContentType = SFPrivileges.contentType();\n var contentTypePredicate = new SFPredicate(\"content_type\", \"=\", privsContentType);\n\n _this12.singletonManager.registerSingleton([contentTypePredicate], function (resolvedSingleton) {\n _this12.privileges = resolvedSingleton;\n resolve(resolvedSingleton);\n },\n /*#__PURE__*/\n function () {\n var _ref14 = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee48(valueCallback) {\n var privs;\n return regeneratorRuntime.wrap(function _callee48$(_context49) {\n while (1) {\n switch (_context49.prev = _context49.next) {\n case 0:\n // Safe to create. Create and return object.\n privs = new SFPrivileges({\n content_type: privsContentType\n });\n\n if (SFJS.crypto.generateUUIDSync) {\n _context49.next = 4;\n break;\n }\n\n _context49.next = 4;\n return privs.initUUID();\n\n case 4:\n _this12.modelManager.addItem(privs);\n\n _this12.modelManager.setItemDirty(privs, true);\n\n _this12.syncManager.sync();\n\n valueCallback(privs);\n resolve(privs);\n\n case 9:\n case \"end\":\n return _context49.stop();\n }\n }\n }, _callee48);\n }));\n\n return function (_x93) {\n return _ref14.apply(this, arguments);\n };\n }());\n });\n return _context50.abrupt(\"return\", this.loadPromise);\n\n case 4:\n case \"end\":\n return _context50.stop();\n }\n }\n }, _callee49, this);\n }));\n\n function loadPrivileges() {\n return _loadPrivileges.apply(this, arguments);\n }\n\n return loadPrivileges;\n }()\n }, {\n key: \"getPrivileges\",\n value: function () {\n var _getPrivileges = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee50() {\n return regeneratorRuntime.wrap(function _callee50$(_context51) {\n while (1) {\n switch (_context51.prev = _context51.next) {\n case 0:\n if (!this.privileges) {\n _context51.next = 4;\n break;\n }\n\n return _context51.abrupt(\"return\", this.privileges);\n\n case 4:\n return _context51.abrupt(\"return\", this.loadPrivileges());\n\n case 5:\n case \"end\":\n return _context51.stop();\n }\n }\n }, _callee50, this);\n }));\n\n function getPrivileges() {\n return _getPrivileges.apply(this, arguments);\n }\n\n return getPrivileges;\n }()\n }, {\n key: \"displayInfoForCredential\",\n value: function displayInfoForCredential(credential) {\n var metadata = {};\n metadata[SFPrivilegesManager.CredentialAccountPassword] = {\n label: \"Account Password\",\n prompt: \"Please enter your account password.\"\n };\n metadata[SFPrivilegesManager.CredentialLocalPasscode] = {\n label: \"Local Passcode\",\n prompt: \"Please enter your local passcode.\"\n };\n return metadata[credential];\n }\n }, {\n key: \"displayInfoForAction\",\n value: function displayInfoForAction(action) {\n var metadata = {};\n metadata[SFPrivilegesManager.ActionManageExtensions] = {\n label: \"Manage Extensions\"\n };\n metadata[SFPrivilegesManager.ActionManageBackups] = {\n label: \"Download/Import Backups\"\n };\n metadata[SFPrivilegesManager.ActionViewProtectedNotes] = {\n label: \"View Protected Notes\"\n };\n metadata[SFPrivilegesManager.ActionManagePrivileges] = {\n label: \"Manage Privileges\"\n };\n metadata[SFPrivilegesManager.ActionManagePasscode] = {\n label: \"Manage Passcode\"\n };\n metadata[SFPrivilegesManager.ActionDeleteNote] = {\n label: \"Delete Notes\"\n };\n return metadata[action];\n }\n }, {\n key: \"getSessionLengthOptions\",\n value: function getSessionLengthOptions() {\n return [{\n value: SFPrivilegesManager.SessionLengthNone,\n label: \"Don't Remember\"\n }, {\n value: SFPrivilegesManager.SessionLengthFiveMinutes,\n label: \"5 Minutes\"\n }, {\n value: SFPrivilegesManager.SessionLengthOneHour,\n label: \"1 Hour\"\n }, {\n value: SFPrivilegesManager.SessionLengthOneWeek,\n label: \"1 Week\"\n }];\n }\n }, {\n key: \"setSessionLength\",\n value: function () {\n var _setSessionLength = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee51(length) {\n var addToNow, expiresAt;\n return regeneratorRuntime.wrap(function _callee51$(_context52) {\n while (1) {\n switch (_context52.prev = _context52.next) {\n case 0:\n addToNow = function addToNow(seconds) {\n var date = new Date();\n date.setSeconds(date.getSeconds() + seconds);\n return date;\n };\n\n expiresAt = addToNow(length);\n return _context52.abrupt(\"return\", Promise.all([this.delegate.saveToStorage(SFPrivilegesManager.SessionExpiresAtKey, JSON.stringify(expiresAt)), this.delegate.saveToStorage(SFPrivilegesManager.SessionLengthKey, JSON.stringify(length))]));\n\n case 3:\n case \"end\":\n return _context52.stop();\n }\n }\n }, _callee51, this);\n }));\n\n function setSessionLength(_x94) {\n return _setSessionLength.apply(this, arguments);\n }\n\n return setSessionLength;\n }()\n }, {\n key: \"clearSession\",\n value: function () {\n var _clearSession = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee52() {\n return regeneratorRuntime.wrap(function _callee52$(_context53) {\n while (1) {\n switch (_context53.prev = _context53.next) {\n case 0:\n return _context53.abrupt(\"return\", this.setSessionLength(SFPrivilegesManager.SessionLengthNone));\n\n case 1:\n case \"end\":\n return _context53.stop();\n }\n }\n }, _callee52, this);\n }));\n\n function clearSession() {\n return _clearSession.apply(this, arguments);\n }\n\n return clearSession;\n }()\n }, {\n key: \"getSelectedSessionLength\",\n value: function () {\n var _getSelectedSessionLength = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee53() {\n var length;\n return regeneratorRuntime.wrap(function _callee53$(_context54) {\n while (1) {\n switch (_context54.prev = _context54.next) {\n case 0:\n _context54.next = 2;\n return this.delegate.getFromStorage(SFPrivilegesManager.SessionLengthKey);\n\n case 2:\n length = _context54.sent;\n\n if (!length) {\n _context54.next = 7;\n break;\n }\n\n return _context54.abrupt(\"return\", JSON.parse(length));\n\n case 7:\n return _context54.abrupt(\"return\", SFPrivilegesManager.SessionLengthNone);\n\n case 8:\n case \"end\":\n return _context54.stop();\n }\n }\n }, _callee53, this);\n }));\n\n function getSelectedSessionLength() {\n return _getSelectedSessionLength.apply(this, arguments);\n }\n\n return getSelectedSessionLength;\n }()\n }, {\n key: \"getSessionExpirey\",\n value: function () {\n var _getSessionExpirey = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee54() {\n var expiresAt;\n return regeneratorRuntime.wrap(function _callee54$(_context55) {\n while (1) {\n switch (_context55.prev = _context55.next) {\n case 0:\n _context55.next = 2;\n return this.delegate.getFromStorage(SFPrivilegesManager.SessionExpiresAtKey);\n\n case 2:\n expiresAt = _context55.sent;\n\n if (!expiresAt) {\n _context55.next = 7;\n break;\n }\n\n return _context55.abrupt(\"return\", new Date(JSON.parse(expiresAt)));\n\n case 7:\n return _context55.abrupt(\"return\", new Date());\n\n case 8:\n case \"end\":\n return _context55.stop();\n }\n }\n }, _callee54, this);\n }));\n\n function getSessionExpirey() {\n return _getSessionExpirey.apply(this, arguments);\n }\n\n return getSessionExpirey;\n }()\n }, {\n key: \"actionHasPrivilegesConfigured\",\n value: function () {\n var _actionHasPrivilegesConfigured = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee55(action) {\n return regeneratorRuntime.wrap(function _callee55$(_context56) {\n while (1) {\n switch (_context56.prev = _context56.next) {\n case 0:\n _context56.next = 2;\n return this.netCredentialsForAction(action);\n\n case 2:\n _context56.t0 = _context56.sent.length;\n return _context56.abrupt(\"return\", _context56.t0 > 0);\n\n case 4:\n case \"end\":\n return _context56.stop();\n }\n }\n }, _callee55, this);\n }));\n\n function actionHasPrivilegesConfigured(_x95) {\n return _actionHasPrivilegesConfigured.apply(this, arguments);\n }\n\n return actionHasPrivilegesConfigured;\n }()\n }, {\n key: \"actionRequiresPrivilege\",\n value: function () {\n var _actionRequiresPrivilege = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee56(action) {\n var expiresAt, netCredentials;\n return regeneratorRuntime.wrap(function _callee56$(_context57) {\n while (1) {\n switch (_context57.prev = _context57.next) {\n case 0:\n _context57.next = 2;\n return this.getSessionExpirey();\n\n case 2:\n expiresAt = _context57.sent;\n\n if (!(expiresAt > new Date())) {\n _context57.next = 5;\n break;\n }\n\n return _context57.abrupt(\"return\", false);\n\n case 5:\n _context57.next = 7;\n return this.netCredentialsForAction(action);\n\n case 7:\n netCredentials = _context57.sent;\n return _context57.abrupt(\"return\", netCredentials.length > 0);\n\n case 9:\n case \"end\":\n return _context57.stop();\n }\n }\n }, _callee56, this);\n }));\n\n function actionRequiresPrivilege(_x96) {\n return _actionRequiresPrivilege.apply(this, arguments);\n }\n\n return actionRequiresPrivilege;\n }()\n }, {\n key: \"savePrivileges\",\n value: function () {\n var _savePrivileges = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee57() {\n var privs;\n return regeneratorRuntime.wrap(function _callee57$(_context58) {\n while (1) {\n switch (_context58.prev = _context58.next) {\n case 0:\n _context58.next = 2;\n return this.getPrivileges();\n\n case 2:\n privs = _context58.sent;\n this.modelManager.setItemDirty(privs, true);\n this.syncManager.sync();\n\n case 5:\n case \"end\":\n return _context58.stop();\n }\n }\n }, _callee57, this);\n }));\n\n function savePrivileges() {\n return _savePrivileges.apply(this, arguments);\n }\n\n return savePrivileges;\n }()\n }, {\n key: \"authenticateAction\",\n value: function () {\n var _authenticateAction = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee58(action, credentialAuthMapping) {\n var requiredCredentials, successfulCredentials, failedCredentials, _iteratorNormalCompletion30, _didIteratorError30, _iteratorError30, _iterator30, _step30, requiredCredential, passesAuth;\n\n return regeneratorRuntime.wrap(function _callee58$(_context59) {\n while (1) {\n switch (_context59.prev = _context59.next) {\n case 0:\n _context59.next = 2;\n return this.netCredentialsForAction(action);\n\n case 2:\n requiredCredentials = _context59.sent;\n successfulCredentials = [], failedCredentials = [];\n _iteratorNormalCompletion30 = true;\n _didIteratorError30 = false;\n _iteratorError30 = undefined;\n _context59.prev = 7;\n _iterator30 = requiredCredentials[Symbol.iterator]();\n\n case 9:\n if (_iteratorNormalCompletion30 = (_step30 = _iterator30.next()).done) {\n _context59.next = 18;\n break;\n }\n\n requiredCredential = _step30.value;\n _context59.next = 13;\n return this._verifyAuthenticationParameters(requiredCredential, credentialAuthMapping[requiredCredential]);\n\n case 13:\n passesAuth = _context59.sent;\n\n if (passesAuth) {\n successfulCredentials.push(requiredCredential);\n } else {\n failedCredentials.push(requiredCredential);\n }\n\n case 15:\n _iteratorNormalCompletion30 = true;\n _context59.next = 9;\n break;\n\n case 18:\n _context59.next = 24;\n break;\n\n case 20:\n _context59.prev = 20;\n _context59.t0 = _context59[\"catch\"](7);\n _didIteratorError30 = true;\n _iteratorError30 = _context59.t0;\n\n case 24:\n _context59.prev = 24;\n _context59.prev = 25;\n\n if (!_iteratorNormalCompletion30 && _iterator30[\"return\"] != null) {\n _iterator30[\"return\"]();\n }\n\n case 27:\n _context59.prev = 27;\n\n if (!_didIteratorError30) {\n _context59.next = 30;\n break;\n }\n\n throw _iteratorError30;\n\n case 30:\n return _context59.finish(27);\n\n case 31:\n return _context59.finish(24);\n\n case 32:\n return _context59.abrupt(\"return\", {\n success: failedCredentials.length == 0,\n successfulCredentials: successfulCredentials,\n failedCredentials: failedCredentials\n });\n\n case 33:\n case \"end\":\n return _context59.stop();\n }\n }\n }, _callee58, this, [[7, 20, 24, 32], [25,, 27, 31]]);\n }));\n\n function authenticateAction(_x97, _x98) {\n return _authenticateAction.apply(this, arguments);\n }\n\n return authenticateAction;\n }()\n }, {\n key: \"_verifyAuthenticationParameters\",\n value: function () {\n var _verifyAuthenticationParameters2 = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee61(credential, value) {\n var _this13 = this;\n\n var verifyAccountPassword, verifyLocalPasscode;\n return regeneratorRuntime.wrap(function _callee61$(_context62) {\n while (1) {\n switch (_context62.prev = _context62.next) {\n case 0:\n verifyAccountPassword =\n /*#__PURE__*/\n function () {\n var _ref15 = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee59(password) {\n return regeneratorRuntime.wrap(function _callee59$(_context60) {\n while (1) {\n switch (_context60.prev = _context60.next) {\n case 0:\n return _context60.abrupt(\"return\", _this13.delegate.verifyAccountPassword(password));\n\n case 1:\n case \"end\":\n return _context60.stop();\n }\n }\n }, _callee59);\n }));\n\n return function verifyAccountPassword(_x101) {\n return _ref15.apply(this, arguments);\n };\n }();\n\n verifyLocalPasscode =\n /*#__PURE__*/\n function () {\n var _ref16 = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee60(passcode) {\n return regeneratorRuntime.wrap(function _callee60$(_context61) {\n while (1) {\n switch (_context61.prev = _context61.next) {\n case 0:\n return _context61.abrupt(\"return\", _this13.delegate.verifyLocalPasscode(passcode));\n\n case 1:\n case \"end\":\n return _context61.stop();\n }\n }\n }, _callee60);\n }));\n\n return function verifyLocalPasscode(_x102) {\n return _ref16.apply(this, arguments);\n };\n }();\n\n if (!(credential == SFPrivilegesManager.CredentialAccountPassword)) {\n _context62.next = 6;\n break;\n }\n\n return _context62.abrupt(\"return\", verifyAccountPassword(value));\n\n case 6:\n if (!(credential == SFPrivilegesManager.CredentialLocalPasscode)) {\n _context62.next = 8;\n break;\n }\n\n return _context62.abrupt(\"return\", verifyLocalPasscode(value));\n\n case 8:\n case \"end\":\n return _context62.stop();\n }\n }\n }, _callee61);\n }));\n\n function _verifyAuthenticationParameters(_x99, _x100) {\n return _verifyAuthenticationParameters2.apply(this, arguments);\n }\n\n return _verifyAuthenticationParameters;\n }()\n }]);\n\n return SFPrivilegesManager;\n }();\n\n exports.SFPrivilegesManager = SFPrivilegesManager;\n ;\n var SessionHistoryPersistKey = \"sessionHistory_persist\";\n var SessionHistoryRevisionsKey = \"sessionHistory_revisions\";\n var SessionHistoryAutoOptimizeKey = \"sessionHistory_autoOptimize\";\n\n var SFSessionHistoryManager =\n /*#__PURE__*/\n function () {\n function SFSessionHistoryManager(modelManager, storageManager, keyRequestHandler, contentTypes, timeout) {\n var _this14 = this;\n\n _classCallCheck(this, SFSessionHistoryManager);\n\n this.modelManager = modelManager;\n this.storageManager = storageManager;\n this.$timeout = timeout || setTimeout.bind(window); // Required to persist the encrypted form of SFHistorySession\n\n this.keyRequestHandler = keyRequestHandler;\n this.loadFromDisk().then(function () {\n _this14.modelManager.addItemSyncObserver(\"session-history\", contentTypes, function (allItems, validItems, deletedItems, source, sourceKey) {\n if (source === SFModelManager.MappingSourceLocalDirtied) {\n return;\n }\n\n var _iteratorNormalCompletion31 = true;\n var _didIteratorError31 = false;\n var _iteratorError31 = undefined;\n\n try {\n for (var _iterator31 = allItems[Symbol.iterator](), _step31; !(_iteratorNormalCompletion31 = (_step31 = _iterator31.next()).done); _iteratorNormalCompletion31 = true) {\n var item = _step31.value;\n\n try {\n _this14.addHistoryEntryForItem(item);\n } catch (e) {\n console.log(\"Caught exception while trying to add item history entry\", e);\n }\n }\n } catch (err) {\n _didIteratorError31 = true;\n _iteratorError31 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion31 && _iterator31[\"return\"] != null) {\n _iterator31[\"return\"]();\n }\n } finally {\n if (_didIteratorError31) {\n throw _iteratorError31;\n }\n }\n }\n });\n });\n }\n\n _createClass(SFSessionHistoryManager, [{\n key: \"encryptionParams\",\n value: function () {\n var _encryptionParams = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee62() {\n return regeneratorRuntime.wrap(function _callee62$(_context63) {\n while (1) {\n switch (_context63.prev = _context63.next) {\n case 0:\n return _context63.abrupt(\"return\", this.keyRequestHandler());\n\n case 1:\n case \"end\":\n return _context63.stop();\n }\n }\n }, _callee62, this);\n }));\n\n function encryptionParams() {\n return _encryptionParams.apply(this, arguments);\n }\n\n return encryptionParams;\n }()\n }, {\n key: \"addHistoryEntryForItem\",\n value: function addHistoryEntryForItem(item) {\n var _this15 = this;\n\n var persistableItemParams = {\n uuid: item.uuid,\n content_type: item.content_type,\n updated_at: item.updated_at,\n content: item.getContentCopy()\n };\n var entry = this.historySession.addEntryForItem(persistableItemParams);\n\n if (this.autoOptimize) {\n this.historySession.optimizeHistoryForItem(item);\n }\n\n if (entry && this.diskEnabled) {\n // Debounce, clear existing timeout\n if (this.diskTimeout) {\n if (this.$timeout.hasOwnProperty(\"cancel\")) {\n this.$timeout.cancel(this.diskTimeout);\n } else {\n clearTimeout(this.diskTimeout);\n }\n }\n\n ;\n this.diskTimeout = this.$timeout(function () {\n _this15.saveToDisk();\n }, 2000);\n }\n }\n }, {\n key: \"historyForItem\",\n value: function historyForItem(item) {\n return this.historySession.historyForItem(item);\n }\n }, {\n key: \"clearHistoryForItem\",\n value: function () {\n var _clearHistoryForItem = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee63(item) {\n return regeneratorRuntime.wrap(function _callee63$(_context64) {\n while (1) {\n switch (_context64.prev = _context64.next) {\n case 0:\n this.historySession.clearItemHistory(item);\n return _context64.abrupt(\"return\", this.saveToDisk());\n\n case 2:\n case \"end\":\n return _context64.stop();\n }\n }\n }, _callee63, this);\n }));\n\n function clearHistoryForItem(_x103) {\n return _clearHistoryForItem.apply(this, arguments);\n }\n\n return clearHistoryForItem;\n }()\n }, {\n key: \"clearAllHistory\",\n value: function () {\n var _clearAllHistory = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee64() {\n return regeneratorRuntime.wrap(function _callee64$(_context65) {\n while (1) {\n switch (_context65.prev = _context65.next) {\n case 0:\n this.historySession.clearAllHistory();\n return _context65.abrupt(\"return\", this.storageManager.removeItem(SessionHistoryRevisionsKey));\n\n case 2:\n case \"end\":\n return _context65.stop();\n }\n }\n }, _callee64, this);\n }));\n\n function clearAllHistory() {\n return _clearAllHistory.apply(this, arguments);\n }\n\n return clearAllHistory;\n }()\n }, {\n key: \"toggleDiskSaving\",\n value: function () {\n var _toggleDiskSaving = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee65() {\n return regeneratorRuntime.wrap(function _callee65$(_context66) {\n while (1) {\n switch (_context66.prev = _context66.next) {\n case 0:\n this.diskEnabled = !this.diskEnabled;\n\n if (!this.diskEnabled) {\n _context66.next = 6;\n break;\n }\n\n this.storageManager.setItem(SessionHistoryPersistKey, JSON.stringify(true));\n this.saveToDisk();\n _context66.next = 8;\n break;\n\n case 6:\n this.storageManager.setItem(SessionHistoryPersistKey, JSON.stringify(false));\n return _context66.abrupt(\"return\", this.storageManager.removeItem(SessionHistoryRevisionsKey));\n\n case 8:\n case \"end\":\n return _context66.stop();\n }\n }\n }, _callee65, this);\n }));\n\n function toggleDiskSaving() {\n return _toggleDiskSaving.apply(this, arguments);\n }\n\n return toggleDiskSaving;\n }()\n }, {\n key: \"saveToDisk\",\n value: function () {\n var _saveToDisk = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee66() {\n var _this16 = this;\n\n var encryptionParams, itemParams;\n return regeneratorRuntime.wrap(function _callee66$(_context67) {\n while (1) {\n switch (_context67.prev = _context67.next) {\n case 0:\n if (this.diskEnabled) {\n _context67.next = 2;\n break;\n }\n\n return _context67.abrupt(\"return\");\n\n case 2:\n _context67.next = 4;\n return this.encryptionParams();\n\n case 4:\n encryptionParams = _context67.sent;\n itemParams = new SFItemParams(this.historySession, encryptionParams.keys, encryptionParams.auth_params);\n itemParams.paramsForSync().then(function (syncParams) {\n // console.log(\"Saving to disk\", syncParams);\n _this16.storageManager.setItem(SessionHistoryRevisionsKey, JSON.stringify(syncParams));\n });\n\n case 7:\n case \"end\":\n return _context67.stop();\n }\n }\n }, _callee66, this);\n }));\n\n function saveToDisk() {\n return _saveToDisk.apply(this, arguments);\n }\n\n return saveToDisk;\n }()\n }, {\n key: \"loadFromDisk\",\n value: function () {\n var _loadFromDisk = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee67() {\n var diskValue, historyValue, encryptionParams, historySession, autoOptimizeValue;\n return regeneratorRuntime.wrap(function _callee67$(_context68) {\n while (1) {\n switch (_context68.prev = _context68.next) {\n case 0:\n _context68.next = 2;\n return this.storageManager.getItem(SessionHistoryPersistKey);\n\n case 2:\n diskValue = _context68.sent;\n\n if (diskValue) {\n this.diskEnabled = JSON.parse(diskValue);\n }\n\n _context68.next = 6;\n return this.storageManager.getItem(SessionHistoryRevisionsKey);\n\n case 6:\n historyValue = _context68.sent;\n\n if (!historyValue) {\n _context68.next = 18;\n break;\n }\n\n historyValue = JSON.parse(historyValue);\n _context68.next = 11;\n return this.encryptionParams();\n\n case 11:\n encryptionParams = _context68.sent;\n _context68.next = 14;\n return SFJS.itemTransformer.decryptItem(historyValue, encryptionParams.keys);\n\n case 14:\n historySession = new SFHistorySession(historyValue);\n this.historySession = historySession;\n _context68.next = 19;\n break;\n\n case 18:\n this.historySession = new SFHistorySession();\n\n case 19:\n _context68.next = 21;\n return this.storageManager.getItem(SessionHistoryAutoOptimizeKey);\n\n case 21:\n autoOptimizeValue = _context68.sent;\n\n if (autoOptimizeValue) {\n this.autoOptimize = JSON.parse(autoOptimizeValue);\n } else {\n // default value is true\n this.autoOptimize = true;\n }\n\n case 23:\n case \"end\":\n return _context68.stop();\n }\n }\n }, _callee67, this);\n }));\n\n function loadFromDisk() {\n return _loadFromDisk.apply(this, arguments);\n }\n\n return loadFromDisk;\n }()\n }, {\n key: \"toggleAutoOptimize\",\n value: function () {\n var _toggleAutoOptimize = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee68() {\n return regeneratorRuntime.wrap(function _callee68$(_context69) {\n while (1) {\n switch (_context69.prev = _context69.next) {\n case 0:\n this.autoOptimize = !this.autoOptimize;\n\n if (this.autoOptimize) {\n this.storageManager.setItem(SessionHistoryAutoOptimizeKey, JSON.stringify(true));\n } else {\n this.storageManager.setItem(SessionHistoryAutoOptimizeKey, JSON.stringify(false));\n }\n\n case 2:\n case \"end\":\n return _context69.stop();\n }\n }\n }, _callee68, this);\n }));\n\n function toggleAutoOptimize() {\n return _toggleAutoOptimize.apply(this, arguments);\n }\n\n return toggleAutoOptimize;\n }()\n }]);\n\n return SFSessionHistoryManager;\n }();\n\n exports.SFSessionHistoryManager = SFSessionHistoryManager;\n ;\n /*\n The SingletonManager allows controllers to register an item as a singleton, which means only one instance of that model\n should exist, both on the server and on the client. When the SingletonManager detects multiple items matching the singleton predicate,\n the oldest ones will be deleted, leaving the newest ones. (See 4/28/18 update. We now choose the earliest created one as the winner.).\n (This no longer fully applies, See 4/28/18 update.) We will treat the model most recently arrived from the server as the most recent one. The reason for this is,\n if you're offline, a singleton can be created, as in the case of UserPreferneces. Then when you sign in, you'll retrieve your actual user preferences.\n In that case, even though the offline singleton has a more recent updated_at, the server retreived value is the one we care more about.\n 4/28/18: I'm seeing this issue: if you have the app open in one window, then in another window sign in, and during sign in,\n click Refresh (or autorefresh occurs) in the original signed in window, then you will happen to receive from the server the newly created\n Extensions singleton, and it will be mistaken (it just looks like a regular retrieved item, since nothing is in saved) for a fresh, latest copy, and replace the current instance.\n This has happened to me and many users.\n A puzzling issue, but what if instead of resolving singletons by choosing the one most recently modified, we choose the one with the earliest create date?\n This way, we don't care when it was modified, but we always, always choose the item that was created first. This way, we always deal with the same item.\n */\n\n var SFSingletonManager =\n /*#__PURE__*/\n function () {\n function SFSingletonManager(modelManager, syncManager) {\n var _this17 = this;\n\n _classCallCheck(this, SFSingletonManager);\n\n this.syncManager = syncManager;\n this.modelManager = modelManager;\n this.singletonHandlers = []; // We use sync observer instead of syncEvent `local-data-incremental-load`, because we want singletons\n // to resolve with the first priority, because they generally dictate app state.\n // If we used local-data-incremental-load, and 1 item was important singleton and 99 were heavy components,\n // then given the random nature of notifiying observers, the heavy components would spend a lot of time loading first,\n // here, we priortize ours loading as most important\n\n modelManager.addItemSyncObserverWithPriority({\n id: \"sf-singleton-manager\",\n types: \"*\",\n priority: -1,\n callback: function callback(allItems, validItems, deletedItems, source, sourceKey) {\n // Inside resolveSingletons, we are going to set items as dirty. If we don't stop here it will be infinite recursion.\n if (source === SFModelManager.MappingSourceLocalDirtied) {\n return;\n }\n\n _this17.resolveSingletons(modelManager.allNondummyItems, null, true);\n }\n });\n syncManager.addEventHandler(function (syncEvent, data) {\n if (syncEvent == \"local-data-loaded\") {\n _this17.resolveSingletons(modelManager.allNondummyItems, null, true);\n\n _this17.initialDataLoaded = true;\n } else if (syncEvent == \"sync:completed\") {\n // Wait for initial data load before handling any sync. If we don't want for initial data load,\n // then the singleton resolver won't have the proper items to work with to determine whether to resolve or create.\n if (!_this17.initialDataLoaded) {\n return;\n } // The reason we also need to consider savedItems in consolidating singletons is in case of sync conflicts,\n // a new item can be created, but is never processed through \"retrievedItems\" since it is only created locally then saved.\n // HOWEVER, by considering savedItems, we are now ruining everything, especially during sign in. A singleton can be created\n // offline, and upon sign in, will sync all items to the server, and by combining retrievedItems & savedItems, and only choosing\n // the latest, you are now resolving to the most recent one, which is in the savedItems list and not retrieved items, defeating\n // the whole purpose of this thing.\n // Updated solution: resolveSingletons will now evaluate both of these arrays separately.\n\n\n _this17.resolveSingletons(data.retrievedItems, data.savedItems);\n }\n });\n /*\n If an item alternates its uuid on registration, singletonHandlers might need to update\n their local reference to the object, since the object reference will change on uuid alternation\n */\n\n modelManager.addModelUuidChangeObserver(\"singleton-manager\", function (oldModel, newModel) {\n var _iteratorNormalCompletion32 = true;\n var _didIteratorError32 = false;\n var _iteratorError32 = undefined;\n\n try {\n for (var _iterator32 = _this17.singletonHandlers[Symbol.iterator](), _step32; !(_iteratorNormalCompletion32 = (_step32 = _iterator32.next()).done); _iteratorNormalCompletion32 = true) {\n var handler = _step32.value;\n\n if (handler.singleton && SFPredicate.ItemSatisfiesPredicates(newModel, handler.predicates)) {\n // Reference is now invalid, calling resolveSingleton should update it\n handler.singleton = null;\n\n _this17.resolveSingletons([newModel]);\n }\n }\n } catch (err) {\n _didIteratorError32 = true;\n _iteratorError32 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion32 && _iterator32[\"return\"] != null) {\n _iterator32[\"return\"]();\n }\n } finally {\n if (_didIteratorError32) {\n throw _iteratorError32;\n }\n }\n }\n });\n }\n\n _createClass(SFSingletonManager, [{\n key: \"registerSingleton\",\n value: function registerSingleton(predicates, resolveCallback, createBlock) {\n /*\n predicate: a key/value pair that specifies properties that should match in order for an item to be considered a predicate\n resolveCallback: called when one or more items are deleted and a new item becomes the reigning singleton\n createBlock: called when a sync is complete and no items are found. The createBlock should create the item and return it.\n */\n this.singletonHandlers.push({\n predicates: predicates,\n resolutionCallback: resolveCallback,\n createBlock: createBlock\n });\n }\n }, {\n key: \"resolveSingletons\",\n value: function resolveSingletons(retrievedItems, savedItems, initialLoad) {\n var _this18 = this;\n\n retrievedItems = retrievedItems || [];\n savedItems = savedItems || [];\n var _iteratorNormalCompletion33 = true;\n var _didIteratorError33 = false;\n var _iteratorError33 = undefined;\n\n try {\n var _loop3 = function _loop3() {\n var singletonHandler = _step33.value;\n var predicates = singletonHandler.predicates.slice();\n\n var retrievedSingletonItems = _this18.modelManager.filterItemsWithPredicates(retrievedItems, predicates);\n\n var handleCreation = function handleCreation() {\n if (singletonHandler.createBlock) {\n singletonHandler.pendingCreateBlockCallback = true;\n singletonHandler.createBlock(function (created) {\n singletonHandler.singleton = created;\n singletonHandler.pendingCreateBlockCallback = false;\n singletonHandler.resolutionCallback && singletonHandler.resolutionCallback(created);\n });\n }\n }; // We only want to consider saved items count to see if it's more than 0, and do nothing else with it.\n // This way we know there was some action and things need to be resolved. The saved items will come up\n // in filterItemsWithPredicate(this.modelManager.allNondummyItems) and be deleted anyway\n\n\n var savedSingletonItemsCount = _this18.modelManager.filterItemsWithPredicates(savedItems, predicates).length;\n\n if (retrievedSingletonItems.length > 0 || savedSingletonItemsCount > 0) {\n /*\n Check local inventory and make sure only 1 similar item exists. If more than 1, delete newest\n Note that this local inventory will also contain whatever is in retrievedItems.\n */\n var allExtantItemsMatchingPredicate = _this18.modelManager.itemsMatchingPredicates(predicates);\n /*\n Delete all but the earliest created\n */\n\n\n if (allExtantItemsMatchingPredicate.length >= 2) {\n var sorted = allExtantItemsMatchingPredicate.sort(function (a, b) {\n /*\n If compareFunction(a, b) is less than 0, sort a to an index lower than b, i.e. a comes first.\n If compareFunction(a, b) is greater than 0, sort b to an index lower than a, i.e. b comes first.\n */\n if (a.errorDecrypting) {\n return 1;\n }\n\n if (b.errorDecrypting) {\n return -1;\n }\n\n return a.created_at < b.created_at ? -1 : 1;\n }); // The item that will be chosen to be kept\n\n var winningItem = sorted[0]; // Items that will be deleted\n // Delete everything but the first one\n\n var toDelete = sorted.slice(1, sorted.length);\n var _iteratorNormalCompletion34 = true;\n var _didIteratorError34 = false;\n var _iteratorError34 = undefined;\n\n try {\n for (var _iterator34 = toDelete[Symbol.iterator](), _step34; !(_iteratorNormalCompletion34 = (_step34 = _iterator34.next()).done); _iteratorNormalCompletion34 = true) {\n var d = _step34.value;\n\n _this18.modelManager.setItemToBeDeleted(d);\n }\n } catch (err) {\n _didIteratorError34 = true;\n _iteratorError34 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion34 && _iterator34[\"return\"] != null) {\n _iterator34[\"return\"]();\n }\n } finally {\n if (_didIteratorError34) {\n throw _iteratorError34;\n }\n }\n }\n\n _this18.syncManager.sync(); // Send remaining item to callback\n\n\n singletonHandler.singleton = winningItem;\n singletonHandler.resolutionCallback && singletonHandler.resolutionCallback(winningItem);\n } else if (allExtantItemsMatchingPredicate.length == 1) {\n var singleton = allExtantItemsMatchingPredicate[0];\n\n if (singleton.errorDecrypting) {\n // Delete the current singleton and create a new one\n _this18.modelManager.setItemToBeDeleted(singleton);\n\n handleCreation();\n } else if (!singletonHandler.singleton || singletonHandler.singleton !== singleton) {\n // Not yet notified interested parties of object\n singletonHandler.singleton = singleton;\n singletonHandler.resolutionCallback && singletonHandler.resolutionCallback(singleton);\n }\n }\n } else {\n // Retrieved items does not include any items of interest. If we don't have a singleton registered to this handler,\n // we need to create one. Only do this on actual sync completetions and not on initial data load. Because we want\n // to get the latest from the server before making the decision to create a new item\n if (!singletonHandler.singleton && !initialLoad && !singletonHandler.pendingCreateBlockCallback) {\n handleCreation();\n }\n }\n };\n\n for (var _iterator33 = this.singletonHandlers[Symbol.iterator](), _step33; !(_iteratorNormalCompletion33 = (_step33 = _iterator33.next()).done); _iteratorNormalCompletion33 = true) {\n _loop3();\n }\n } catch (err) {\n _didIteratorError33 = true;\n _iteratorError33 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion33 && _iterator33[\"return\"] != null) {\n _iterator33[\"return\"]();\n }\n } finally {\n if (_didIteratorError33) {\n throw _iteratorError33;\n }\n }\n }\n }\n }]);\n\n return SFSingletonManager;\n }();\n\n exports.SFSingletonManager = SFSingletonManager;\n ; // SFStorageManager should be subclassed, and all the methods below overwritten.\n\n var SFStorageManager =\n /*#__PURE__*/\n function () {\n function SFStorageManager() {\n _classCallCheck(this, SFStorageManager);\n }\n\n _createClass(SFStorageManager, [{\n key: \"setItem\",\n\n /* Simple Key/Value Storage */\n value: function () {\n var _setItem = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee69(key, value) {\n return regeneratorRuntime.wrap(function _callee69$(_context70) {\n while (1) {\n switch (_context70.prev = _context70.next) {\n case 0:\n case \"end\":\n return _context70.stop();\n }\n }\n }, _callee69);\n }));\n\n function setItem(_x104, _x105) {\n return _setItem.apply(this, arguments);\n }\n\n return setItem;\n }()\n }, {\n key: \"getItem\",\n value: function () {\n var _getItem = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee70(key) {\n return regeneratorRuntime.wrap(function _callee70$(_context71) {\n while (1) {\n switch (_context71.prev = _context71.next) {\n case 0:\n case \"end\":\n return _context71.stop();\n }\n }\n }, _callee70);\n }));\n\n function getItem(_x106) {\n return _getItem.apply(this, arguments);\n }\n\n return getItem;\n }()\n }, {\n key: \"removeItem\",\n value: function () {\n var _removeItem = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee71(key) {\n return regeneratorRuntime.wrap(function _callee71$(_context72) {\n while (1) {\n switch (_context72.prev = _context72.next) {\n case 0:\n case \"end\":\n return _context72.stop();\n }\n }\n }, _callee71);\n }));\n\n function removeItem(_x107) {\n return _removeItem.apply(this, arguments);\n }\n\n return removeItem;\n }()\n }, {\n key: \"clear\",\n value: function () {\n var _clear = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee72() {\n return regeneratorRuntime.wrap(function _callee72$(_context73) {\n while (1) {\n switch (_context73.prev = _context73.next) {\n case 0:\n case \"end\":\n return _context73.stop();\n }\n }\n }, _callee72);\n }));\n\n function clear() {\n return _clear.apply(this, arguments);\n }\n\n return clear;\n }()\n }, {\n key: \"getAllModels\",\n\n /*\n Model Storage\n */\n value: function () {\n var _getAllModels = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee73() {\n return regeneratorRuntime.wrap(function _callee73$(_context74) {\n while (1) {\n switch (_context74.prev = _context74.next) {\n case 0:\n case \"end\":\n return _context74.stop();\n }\n }\n }, _callee73);\n }));\n\n function getAllModels() {\n return _getAllModels.apply(this, arguments);\n }\n\n return getAllModels;\n }()\n }, {\n key: \"saveModel\",\n value: function () {\n var _saveModel = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee74(item) {\n return regeneratorRuntime.wrap(function _callee74$(_context75) {\n while (1) {\n switch (_context75.prev = _context75.next) {\n case 0:\n return _context75.abrupt(\"return\", this.saveModels([item]));\n\n case 1:\n case \"end\":\n return _context75.stop();\n }\n }\n }, _callee74, this);\n }));\n\n function saveModel(_x108) {\n return _saveModel.apply(this, arguments);\n }\n\n return saveModel;\n }()\n }, {\n key: \"saveModels\",\n value: function () {\n var _saveModels = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee75(items) {\n return regeneratorRuntime.wrap(function _callee75$(_context76) {\n while (1) {\n switch (_context76.prev = _context76.next) {\n case 0:\n case \"end\":\n return _context76.stop();\n }\n }\n }, _callee75);\n }));\n\n function saveModels(_x109) {\n return _saveModels.apply(this, arguments);\n }\n\n return saveModels;\n }()\n }, {\n key: \"deleteModel\",\n value: function () {\n var _deleteModel = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee76(item) {\n return regeneratorRuntime.wrap(function _callee76$(_context77) {\n while (1) {\n switch (_context77.prev = _context77.next) {\n case 0:\n case \"end\":\n return _context77.stop();\n }\n }\n }, _callee76);\n }));\n\n function deleteModel(_x110) {\n return _deleteModel.apply(this, arguments);\n }\n\n return deleteModel;\n }()\n }, {\n key: \"clearAllModels\",\n value: function () {\n var _clearAllModels = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee77() {\n return regeneratorRuntime.wrap(function _callee77$(_context78) {\n while (1) {\n switch (_context78.prev = _context78.next) {\n case 0:\n case \"end\":\n return _context78.stop();\n }\n }\n }, _callee77);\n }));\n\n function clearAllModels() {\n return _clearAllModels.apply(this, arguments);\n }\n\n return clearAllModels;\n }()\n }, {\n key: \"clearAllData\",\n\n /* General */\n value: function () {\n var _clearAllData = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee78() {\n return regeneratorRuntime.wrap(function _callee78$(_context79) {\n while (1) {\n switch (_context79.prev = _context79.next) {\n case 0:\n return _context79.abrupt(\"return\", Promise.all([this.clear(), this.clearAllModels()]));\n\n case 1:\n case \"end\":\n return _context79.stop();\n }\n }\n }, _callee78, this);\n }));\n\n function clearAllData() {\n return _clearAllData.apply(this, arguments);\n }\n\n return clearAllData;\n }()\n }]);\n\n return SFStorageManager;\n }();\n\n exports.SFStorageManager = SFStorageManager;\n ;\n\n var SFSyncManager =\n /*#__PURE__*/\n function () {\n function SFSyncManager(modelManager, storageManager, httpManager, timeout, interval) {\n _classCallCheck(this, SFSyncManager);\n\n SFSyncManager.KeyRequestLoadLocal = \"KeyRequestLoadLocal\";\n SFSyncManager.KeyRequestSaveLocal = \"KeyRequestSaveLocal\";\n SFSyncManager.KeyRequestLoadSaveAccount = \"KeyRequestLoadSaveAccount\";\n this.httpManager = httpManager;\n this.modelManager = modelManager;\n this.storageManager = storageManager; // Allows you to set your own interval/timeout function (i.e if you're using angular and want to use $timeout)\n\n this.$interval = interval || setInterval.bind(window);\n this.$timeout = timeout || setTimeout.bind(window);\n this.syncStatus = {};\n this.syncStatusObservers = [];\n this.eventHandlers = []; // this.loggingEnabled = true;\n\n this.PerSyncItemUploadLimit = 150;\n this.ServerItemDownloadLimit = 150; // The number of changed items that constitute a major change\n // This is used by the desktop app to create backups\n\n this.MajorDataChangeThreshold = 15; // Sync integrity checking\n // If X consective sync requests return mismatching hashes, then we officially enter out-of-sync.\n\n this.MaxDiscordanceBeforeOutOfSync = 5; // How many consective sync results have had mismatching hashes. This value can never exceed this.MaxDiscordanceBeforeOutOfSync.\n\n this.syncDiscordance = 0;\n this.outOfSync = false;\n }\n\n _createClass(SFSyncManager, [{\n key: \"handleServerIntegrityHash\",\n value: function () {\n var _handleServerIntegrityHash = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee79(serverHash) {\n var localHash;\n return regeneratorRuntime.wrap(function _callee79$(_context80) {\n while (1) {\n switch (_context80.prev = _context80.next) {\n case 0:\n if (!(!serverHash || serverHash.length == 0)) {\n _context80.next = 2;\n break;\n }\n\n return _context80.abrupt(\"return\", true);\n\n case 2:\n _context80.next = 4;\n return this.modelManager.computeDataIntegrityHash();\n\n case 4:\n localHash = _context80.sent;\n\n if (localHash) {\n _context80.next = 7;\n break;\n }\n\n return _context80.abrupt(\"return\", true);\n\n case 7:\n if (!(localHash !== serverHash)) {\n _context80.next = 13;\n break;\n }\n\n this.syncDiscordance++;\n\n if (this.syncDiscordance >= this.MaxDiscordanceBeforeOutOfSync) {\n if (!this.outOfSync) {\n this.outOfSync = true;\n this.notifyEvent(\"enter-out-of-sync\");\n }\n }\n\n return _context80.abrupt(\"return\", false);\n\n case 13:\n // Integrity matches\n if (this.outOfSync) {\n this.outOfSync = false;\n this.notifyEvent(\"exit-out-of-sync\");\n }\n\n this.syncDiscordance = 0;\n return _context80.abrupt(\"return\", true);\n\n case 16:\n case \"end\":\n return _context80.stop();\n }\n }\n }, _callee79, this);\n }));\n\n function handleServerIntegrityHash(_x111) {\n return _handleServerIntegrityHash.apply(this, arguments);\n }\n\n return handleServerIntegrityHash;\n }()\n }, {\n key: \"isOutOfSync\",\n value: function isOutOfSync() {\n // Once we are outOfSync, it's up to the client to display UI to the user to instruct them\n // to take action. The client should present a reconciliation wizard.\n return this.outOfSync;\n }\n }, {\n key: \"getServerURL\",\n value: function () {\n var _getServerURL = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee80() {\n return regeneratorRuntime.wrap(function _callee80$(_context81) {\n while (1) {\n switch (_context81.prev = _context81.next) {\n case 0:\n _context81.next = 2;\n return this.storageManager.getItem(\"server\");\n\n case 2:\n _context81.t0 = _context81.sent;\n\n if (_context81.t0) {\n _context81.next = 5;\n break;\n }\n\n _context81.t0 = window._default_sf_server;\n\n case 5:\n return _context81.abrupt(\"return\", _context81.t0);\n\n case 6:\n case \"end\":\n return _context81.stop();\n }\n }\n }, _callee80, this);\n }));\n\n function getServerURL() {\n return _getServerURL.apply(this, arguments);\n }\n\n return getServerURL;\n }()\n }, {\n key: \"getSyncURL\",\n value: function () {\n var _getSyncURL = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee81() {\n return regeneratorRuntime.wrap(function _callee81$(_context82) {\n while (1) {\n switch (_context82.prev = _context82.next) {\n case 0:\n _context82.next = 2;\n return this.getServerURL();\n\n case 2:\n _context82.t0 = _context82.sent;\n return _context82.abrupt(\"return\", _context82.t0 + \"/items/sync\");\n\n case 4:\n case \"end\":\n return _context82.stop();\n }\n }\n }, _callee81, this);\n }));\n\n function getSyncURL() {\n return _getSyncURL.apply(this, arguments);\n }\n\n return getSyncURL;\n }()\n }, {\n key: \"registerSyncStatusObserver\",\n value: function registerSyncStatusObserver(callback) {\n var observer = {\n key: new Date(),\n callback: callback\n };\n this.syncStatusObservers.push(observer);\n return observer;\n }\n }, {\n key: \"removeSyncStatusObserver\",\n value: function removeSyncStatusObserver(observer) {\n _.pull(this.syncStatusObservers, observer);\n }\n }, {\n key: \"syncStatusDidChange\",\n value: function syncStatusDidChange() {\n var _this19 = this;\n\n this.syncStatusObservers.forEach(function (observer) {\n observer.callback(_this19.syncStatus);\n });\n }\n }, {\n key: \"addEventHandler\",\n value: function addEventHandler(handler) {\n /*\n Possible Events:\n sync:completed\n sync:taking-too-long\n sync:updated_token\n sync:error\n major-data-change\n local-data-loaded\n sync-session-invalid\n sync-exception\n */\n this.eventHandlers.push(handler);\n return handler;\n }\n }, {\n key: \"removeEventHandler\",\n value: function removeEventHandler(handler) {\n _.pull(this.eventHandlers, handler);\n }\n }, {\n key: \"notifyEvent\",\n value: function notifyEvent(syncEvent, data) {\n var _iteratorNormalCompletion35 = true;\n var _didIteratorError35 = false;\n var _iteratorError35 = undefined;\n\n try {\n for (var _iterator35 = this.eventHandlers[Symbol.iterator](), _step35; !(_iteratorNormalCompletion35 = (_step35 = _iterator35.next()).done); _iteratorNormalCompletion35 = true) {\n var handler = _step35.value;\n handler(syncEvent, data || {});\n }\n } catch (err) {\n _didIteratorError35 = true;\n _iteratorError35 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion35 && _iterator35[\"return\"] != null) {\n _iterator35[\"return\"]();\n }\n } finally {\n if (_didIteratorError35) {\n throw _iteratorError35;\n }\n }\n }\n }\n }, {\n key: \"setKeyRequestHandler\",\n value: function setKeyRequestHandler(handler) {\n this.keyRequestHandler = handler;\n }\n }, {\n key: \"getActiveKeyInfo\",\n value: function () {\n var _getActiveKeyInfo = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee82(request) {\n return regeneratorRuntime.wrap(function _callee82$(_context83) {\n while (1) {\n switch (_context83.prev = _context83.next) {\n case 0:\n return _context83.abrupt(\"return\", this.keyRequestHandler(request));\n\n case 1:\n case \"end\":\n return _context83.stop();\n }\n }\n }, _callee82, this);\n }));\n\n function getActiveKeyInfo(_x112) {\n return _getActiveKeyInfo.apply(this, arguments);\n }\n\n return getActiveKeyInfo;\n }()\n }, {\n key: \"initialDataLoaded\",\n value: function initialDataLoaded() {\n return this._initialDataLoaded === true;\n }\n }, {\n key: \"_sortLocalItems\",\n value: function _sortLocalItems(items) {\n var _this20 = this;\n\n return items.sort(function (a, b) {\n var dateResult = new Date(b.updated_at) - new Date(a.updated_at);\n var priorityList = _this20.contentTypeLoadPriority;\n var aPriority = 0,\n bPriority = 0;\n\n if (priorityList) {\n aPriority = priorityList.indexOf(a.content_type);\n bPriority = priorityList.indexOf(b.content_type);\n\n if (aPriority == -1) {\n // Not found in list, not prioritized. Set it to max value\n aPriority = priorityList.length;\n }\n\n if (bPriority == -1) {\n // Not found in list, not prioritized. Set it to max value\n bPriority = priorityList.length;\n }\n }\n\n if (aPriority == bPriority) {\n return dateResult;\n }\n\n if (aPriority < bPriority) {\n return -1;\n } else {\n return 1;\n } // aPriority < bPriority means a should come first\n\n\n return aPriority < bPriority ? -1 : 1;\n });\n }\n }, {\n key: \"loadLocalItems\",\n value: function () {\n var _loadLocalItems = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee84() {\n var _this21 = this;\n\n var _ref17,\n incrementalCallback,\n batchSize,\n options,\n latency,\n _args85 = arguments;\n\n return regeneratorRuntime.wrap(function _callee84$(_context85) {\n while (1) {\n switch (_context85.prev = _context85.next) {\n case 0:\n _ref17 = _args85.length > 0 && _args85[0] !== undefined ? _args85[0] : {}, incrementalCallback = _ref17.incrementalCallback, batchSize = _ref17.batchSize, options = _ref17.options;\n\n if (!(options && options.simulateHighLatency)) {\n _context85.next = 5;\n break;\n }\n\n latency = options.simulatedLatency || 1000;\n _context85.next = 5;\n return this._awaitSleep(latency);\n\n case 5:\n if (!this.loadLocalDataPromise) {\n _context85.next = 7;\n break;\n }\n\n return _context85.abrupt(\"return\", this.loadLocalDataPromise);\n\n case 7:\n if (!batchSize) {\n batchSize = 100;\n }\n\n this.loadLocalDataPromise = this.storageManager.getAllModels().then(function (items) {\n // put most recently updated at beginning, sorted by priority\n items = _this21._sortLocalItems(items); // Filter out any items that exist in the local model mapping and have a lower dirtied date than the local dirtiedDate.\n\n items = items.filter(function (nonDecryptedItem) {\n var localItem = _this21.modelManager.findItem(nonDecryptedItem.uuid);\n\n if (!localItem) {\n return true;\n }\n\n return new Date(nonDecryptedItem.dirtiedDate) > localItem.dirtiedDate;\n }); // break it up into chunks to make interface more responsive for large item counts\n\n var total = items.length;\n var current = 0;\n var processed = [];\n\n var decryptNext =\n /*#__PURE__*/\n function () {\n var _ref18 = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee83() {\n var subitems, processedSubitems;\n return regeneratorRuntime.wrap(function _callee83$(_context84) {\n while (1) {\n switch (_context84.prev = _context84.next) {\n case 0:\n subitems = items.slice(current, current + batchSize);\n _context84.next = 3;\n return _this21.handleItemsResponse(subitems, null, SFModelManager.MappingSourceLocalRetrieved, SFSyncManager.KeyRequestLoadLocal);\n\n case 3:\n processedSubitems = _context84.sent;\n processed.push(processedSubitems);\n current += subitems.length;\n\n if (!(current < total)) {\n _context84.next = 10;\n break;\n }\n\n return _context84.abrupt(\"return\", new Promise(function (innerResolve, innerReject) {\n _this21.$timeout(function () {\n _this21.notifyEvent(\"local-data-incremental-load\");\n\n incrementalCallback && incrementalCallback(current, total);\n decryptNext().then(innerResolve);\n });\n }));\n\n case 10:\n // Completed\n _this21._initialDataLoaded = true;\n\n _this21.notifyEvent(\"local-data-loaded\");\n\n case 12:\n case \"end\":\n return _context84.stop();\n }\n }\n }, _callee83);\n }));\n\n return function decryptNext() {\n return _ref18.apply(this, arguments);\n };\n }();\n\n return decryptNext();\n });\n return _context85.abrupt(\"return\", this.loadLocalDataPromise);\n\n case 10:\n case \"end\":\n return _context85.stop();\n }\n }\n }, _callee84, this);\n }));\n\n function loadLocalItems() {\n return _loadLocalItems.apply(this, arguments);\n }\n\n return loadLocalItems;\n }()\n }, {\n key: \"writeItemsToLocalStorage\",\n value: function () {\n var _writeItemsToLocalStorage = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee88(items, offlineOnly) {\n var _this22 = this;\n\n return regeneratorRuntime.wrap(function _callee88$(_context89) {\n while (1) {\n switch (_context89.prev = _context89.next) {\n case 0:\n if (!(items.length == 0)) {\n _context89.next = 2;\n break;\n }\n\n return _context89.abrupt(\"return\");\n\n case 2:\n return _context89.abrupt(\"return\", new Promise(\n /*#__PURE__*/\n function () {\n var _ref19 = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee87(resolve, reject) {\n var nonDeletedItems, deletedItems, _iteratorNormalCompletion36, _didIteratorError36, _iteratorError36, _iterator36, _step36, item, info, params;\n\n return regeneratorRuntime.wrap(function _callee87$(_context88) {\n while (1) {\n switch (_context88.prev = _context88.next) {\n case 0:\n nonDeletedItems = [], deletedItems = [];\n _iteratorNormalCompletion36 = true;\n _didIteratorError36 = false;\n _iteratorError36 = undefined;\n _context88.prev = 4;\n\n for (_iterator36 = items[Symbol.iterator](); !(_iteratorNormalCompletion36 = (_step36 = _iterator36.next()).done); _iteratorNormalCompletion36 = true) {\n item = _step36.value; // if the item is deleted and dirty it means we still need to sync it.\n\n if (item.deleted === true && !item.dirty) {\n deletedItems.push(item);\n } else {\n nonDeletedItems.push(item);\n }\n }\n\n _context88.next = 12;\n break;\n\n case 8:\n _context88.prev = 8;\n _context88.t0 = _context88[\"catch\"](4);\n _didIteratorError36 = true;\n _iteratorError36 = _context88.t0;\n\n case 12:\n _context88.prev = 12;\n _context88.prev = 13;\n\n if (!_iteratorNormalCompletion36 && _iterator36[\"return\"] != null) {\n _iterator36[\"return\"]();\n }\n\n case 15:\n _context88.prev = 15;\n\n if (!_didIteratorError36) {\n _context88.next = 18;\n break;\n }\n\n throw _iteratorError36;\n\n case 18:\n return _context88.finish(15);\n\n case 19:\n return _context88.finish(12);\n\n case 20:\n if (!(deletedItems.length > 0)) {\n _context88.next = 23;\n break;\n }\n\n _context88.next = 23;\n return Promise.all(deletedItems.map(\n /*#__PURE__*/\n function () {\n var _ref20 = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee85(deletedItem) {\n return regeneratorRuntime.wrap(function _callee85$(_context86) {\n while (1) {\n switch (_context86.prev = _context86.next) {\n case 0:\n return _context86.abrupt(\"return\", _this22.storageManager.deleteModel(deletedItem));\n\n case 1:\n case \"end\":\n return _context86.stop();\n }\n }\n }, _callee85);\n }));\n\n return function (_x117) {\n return _ref20.apply(this, arguments);\n };\n }()));\n\n case 23:\n _context88.next = 25;\n return _this22.getActiveKeyInfo(SFSyncManager.KeyRequestSaveLocal);\n\n case 25:\n info = _context88.sent;\n\n if (!(nonDeletedItems.length > 0)) {\n _context88.next = 33;\n break;\n }\n\n _context88.next = 29;\n return Promise.all(nonDeletedItems.map(\n /*#__PURE__*/\n function () {\n var _ref21 = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee86(item) {\n var itemParams;\n return regeneratorRuntime.wrap(function _callee86$(_context87) {\n while (1) {\n switch (_context87.prev = _context87.next) {\n case 0:\n itemParams = new SFItemParams(item, info.keys, info.auth_params);\n _context87.next = 3;\n return itemParams.paramsForLocalStorage();\n\n case 3:\n itemParams = _context87.sent;\n\n if (offlineOnly) {\n delete itemParams.dirty;\n }\n\n return _context87.abrupt(\"return\", itemParams);\n\n case 6:\n case \"end\":\n return _context87.stop();\n }\n }\n }, _callee86);\n }));\n\n return function (_x118) {\n return _ref21.apply(this, arguments);\n };\n }()))[\"catch\"](function (e) {\n return reject(e);\n });\n\n case 29:\n params = _context88.sent;\n _context88.next = 32;\n return _this22.storageManager.saveModels(params)[\"catch\"](function (error) {\n console.error(\"Error writing items\", error);\n _this22.syncStatus.localError = error;\n\n _this22.syncStatusDidChange();\n\n reject();\n });\n\n case 32:\n // on success\n if (_this22.syncStatus.localError) {\n _this22.syncStatus.localError = null;\n\n _this22.syncStatusDidChange();\n }\n\n case 33:\n resolve();\n\n case 34:\n case \"end\":\n return _context88.stop();\n }\n }\n }, _callee87, null, [[4, 8, 12, 20], [13,, 15, 19]]);\n }));\n\n return function (_x115, _x116) {\n return _ref19.apply(this, arguments);\n };\n }()));\n\n case 3:\n case \"end\":\n return _context89.stop();\n }\n }\n }, _callee88);\n }));\n\n function writeItemsToLocalStorage(_x113, _x114) {\n return _writeItemsToLocalStorage.apply(this, arguments);\n }\n\n return writeItemsToLocalStorage;\n }()\n }, {\n key: \"syncOffline\",\n value: function () {\n var _syncOffline = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee89(items) {\n var _this23 = this;\n\n var _iteratorNormalCompletion37, _didIteratorError37, _iteratorError37, _iterator37, _step37, item;\n\n return regeneratorRuntime.wrap(function _callee89$(_context90) {\n while (1) {\n switch (_context90.prev = _context90.next) {\n case 0:\n // Update all items updated_at to now\n _iteratorNormalCompletion37 = true;\n _didIteratorError37 = false;\n _iteratorError37 = undefined;\n _context90.prev = 3;\n\n for (_iterator37 = items[Symbol.iterator](); !(_iteratorNormalCompletion37 = (_step37 = _iterator37.next()).done); _iteratorNormalCompletion37 = true) {\n item = _step37.value;\n item.updated_at = new Date();\n }\n\n _context90.next = 11;\n break;\n\n case 7:\n _context90.prev = 7;\n _context90.t0 = _context90[\"catch\"](3);\n _didIteratorError37 = true;\n _iteratorError37 = _context90.t0;\n\n case 11:\n _context90.prev = 11;\n _context90.prev = 12;\n\n if (!_iteratorNormalCompletion37 && _iterator37[\"return\"] != null) {\n _iterator37[\"return\"]();\n }\n\n case 14:\n _context90.prev = 14;\n\n if (!_didIteratorError37) {\n _context90.next = 17;\n break;\n }\n\n throw _iteratorError37;\n\n case 17:\n return _context90.finish(14);\n\n case 18:\n return _context90.finish(11);\n\n case 19:\n return _context90.abrupt(\"return\", this.writeItemsToLocalStorage(items, true).then(function (responseItems) {\n // delete anything needing to be deleted\n var _iteratorNormalCompletion38 = true;\n var _didIteratorError38 = false;\n var _iteratorError38 = undefined;\n\n try {\n for (var _iterator38 = items[Symbol.iterator](), _step38; !(_iteratorNormalCompletion38 = (_step38 = _iterator38.next()).done); _iteratorNormalCompletion38 = true) {\n var item = _step38.value;\n\n if (item.deleted) {\n _this23.modelManager.removeItemLocally(item);\n }\n }\n } catch (err) {\n _didIteratorError38 = true;\n _iteratorError38 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion38 && _iterator38[\"return\"] != null) {\n _iterator38[\"return\"]();\n }\n } finally {\n if (_didIteratorError38) {\n throw _iteratorError38;\n }\n }\n }\n\n _this23.modelManager.clearDirtyItems(items); // Required in order for modelManager to notify sync observers\n\n\n _this23.modelManager.didSyncModelsOffline(items);\n\n _this23.notifyEvent(\"sync:completed\", {\n savedItems: items\n });\n\n return {\n saved_items: items\n };\n }));\n\n case 20:\n case \"end\":\n return _context90.stop();\n }\n }\n }, _callee89, this, [[3, 7, 11, 19], [12,, 14, 18]]);\n }));\n\n function syncOffline(_x119) {\n return _syncOffline.apply(this, arguments);\n }\n\n return syncOffline;\n }()\n /*\n In the case of signing in and merging local data, we alternative UUIDs\n to avoid overwriting data a user may retrieve that has the same UUID.\n Alternating here forces us to to create duplicates of the items instead.\n */\n\n }, {\n key: \"markAllItemsDirtyAndSaveOffline\",\n value: function () {\n var _markAllItemsDirtyAndSaveOffline = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee90(alternateUUIDs) {\n var originalItems, _iteratorNormalCompletion39, _didIteratorError39, _iteratorError39, _iterator39, _step39, item, allItems, _iteratorNormalCompletion40, _didIteratorError40, _iteratorError40, _iterator40, _step40, _item;\n\n return regeneratorRuntime.wrap(function _callee90$(_context91) {\n while (1) {\n switch (_context91.prev = _context91.next) {\n case 0:\n if (!alternateUUIDs) {\n _context91.next = 28;\n break;\n } // use a copy, as alternating uuid will affect array\n\n\n originalItems = this.modelManager.allNondummyItems.filter(function (item) {\n return !item.errorDecrypting;\n }).slice();\n _iteratorNormalCompletion39 = true;\n _didIteratorError39 = false;\n _iteratorError39 = undefined;\n _context91.prev = 5;\n _iterator39 = originalItems[Symbol.iterator]();\n\n case 7:\n if (_iteratorNormalCompletion39 = (_step39 = _iterator39.next()).done) {\n _context91.next = 14;\n break;\n }\n\n item = _step39.value;\n _context91.next = 11;\n return this.modelManager.alternateUUIDForItem(item);\n\n case 11:\n _iteratorNormalCompletion39 = true;\n _context91.next = 7;\n break;\n\n case 14:\n _context91.next = 20;\n break;\n\n case 16:\n _context91.prev = 16;\n _context91.t0 = _context91[\"catch\"](5);\n _didIteratorError39 = true;\n _iteratorError39 = _context91.t0;\n\n case 20:\n _context91.prev = 20;\n _context91.prev = 21;\n\n if (!_iteratorNormalCompletion39 && _iterator39[\"return\"] != null) {\n _iterator39[\"return\"]();\n }\n\n case 23:\n _context91.prev = 23;\n\n if (!_didIteratorError39) {\n _context91.next = 26;\n break;\n }\n\n throw _iteratorError39;\n\n case 26:\n return _context91.finish(23);\n\n case 27:\n return _context91.finish(20);\n\n case 28:\n allItems = this.modelManager.allNondummyItems;\n _iteratorNormalCompletion40 = true;\n _didIteratorError40 = false;\n _iteratorError40 = undefined;\n _context91.prev = 32;\n\n for (_iterator40 = allItems[Symbol.iterator](); !(_iteratorNormalCompletion40 = (_step40 = _iterator40.next()).done); _iteratorNormalCompletion40 = true) {\n _item = _step40.value;\n\n _item.setDirty(true);\n }\n\n _context91.next = 40;\n break;\n\n case 36:\n _context91.prev = 36;\n _context91.t1 = _context91[\"catch\"](32);\n _didIteratorError40 = true;\n _iteratorError40 = _context91.t1;\n\n case 40:\n _context91.prev = 40;\n _context91.prev = 41;\n\n if (!_iteratorNormalCompletion40 && _iterator40[\"return\"] != null) {\n _iterator40[\"return\"]();\n }\n\n case 43:\n _context91.prev = 43;\n\n if (!_didIteratorError40) {\n _context91.next = 46;\n break;\n }\n\n throw _iteratorError40;\n\n case 46:\n return _context91.finish(43);\n\n case 47:\n return _context91.finish(40);\n\n case 48:\n return _context91.abrupt(\"return\", this.writeItemsToLocalStorage(allItems, false));\n\n case 49:\n case \"end\":\n return _context91.stop();\n }\n }\n }, _callee90, this, [[5, 16, 20, 28], [21,, 23, 27], [32, 36, 40, 48], [41,, 43, 47]]);\n }));\n\n function markAllItemsDirtyAndSaveOffline(_x120) {\n return _markAllItemsDirtyAndSaveOffline.apply(this, arguments);\n }\n\n return markAllItemsDirtyAndSaveOffline;\n }()\n }, {\n key: \"setSyncToken\",\n value: function () {\n var _setSyncToken = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee91(token) {\n return regeneratorRuntime.wrap(function _callee91$(_context92) {\n while (1) {\n switch (_context92.prev = _context92.next) {\n case 0:\n this._syncToken = token;\n _context92.next = 3;\n return this.storageManager.setItem(\"syncToken\", token);\n\n case 3:\n case \"end\":\n return _context92.stop();\n }\n }\n }, _callee91, this);\n }));\n\n function setSyncToken(_x121) {\n return _setSyncToken.apply(this, arguments);\n }\n\n return setSyncToken;\n }()\n }, {\n key: \"getSyncToken\",\n value: function () {\n var _getSyncToken = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee92() {\n return regeneratorRuntime.wrap(function _callee92$(_context93) {\n while (1) {\n switch (_context93.prev = _context93.next) {\n case 0:\n if (this._syncToken) {\n _context93.next = 4;\n break;\n }\n\n _context93.next = 3;\n return this.storageManager.getItem(\"syncToken\");\n\n case 3:\n this._syncToken = _context93.sent;\n\n case 4:\n return _context93.abrupt(\"return\", this._syncToken);\n\n case 5:\n case \"end\":\n return _context93.stop();\n }\n }\n }, _callee92, this);\n }));\n\n function getSyncToken() {\n return _getSyncToken.apply(this, arguments);\n }\n\n return getSyncToken;\n }()\n }, {\n key: \"setCursorToken\",\n value: function () {\n var _setCursorToken = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee93(token) {\n return regeneratorRuntime.wrap(function _callee93$(_context94) {\n while (1) {\n switch (_context94.prev = _context94.next) {\n case 0:\n this._cursorToken = token;\n\n if (!token) {\n _context94.next = 6;\n break;\n }\n\n _context94.next = 4;\n return this.storageManager.setItem(\"cursorToken\", token);\n\n case 4:\n _context94.next = 8;\n break;\n\n case 6:\n _context94.next = 8;\n return this.storageManager.removeItem(\"cursorToken\");\n\n case 8:\n case \"end\":\n return _context94.stop();\n }\n }\n }, _callee93, this);\n }));\n\n function setCursorToken(_x122) {\n return _setCursorToken.apply(this, arguments);\n }\n\n return setCursorToken;\n }()\n }, {\n key: \"getCursorToken\",\n value: function () {\n var _getCursorToken = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee94() {\n return regeneratorRuntime.wrap(function _callee94$(_context95) {\n while (1) {\n switch (_context95.prev = _context95.next) {\n case 0:\n if (this._cursorToken) {\n _context95.next = 4;\n break;\n }\n\n _context95.next = 3;\n return this.storageManager.getItem(\"cursorToken\");\n\n case 3:\n this._cursorToken = _context95.sent;\n\n case 4:\n return _context95.abrupt(\"return\", this._cursorToken);\n\n case 5:\n case \"end\":\n return _context95.stop();\n }\n }\n }, _callee94, this);\n }));\n\n function getCursorToken() {\n return _getCursorToken.apply(this, arguments);\n }\n\n return getCursorToken;\n }()\n }, {\n key: \"clearQueuedCallbacks\",\n value: function clearQueuedCallbacks() {\n this._queuedCallbacks = [];\n }\n }, {\n key: \"callQueuedCallbacks\",\n value: function callQueuedCallbacks(response) {\n var allCallbacks = this.queuedCallbacks;\n\n if (allCallbacks.length) {\n var _iteratorNormalCompletion41 = true;\n var _didIteratorError41 = false;\n var _iteratorError41 = undefined;\n\n try {\n for (var _iterator41 = allCallbacks[Symbol.iterator](), _step41; !(_iteratorNormalCompletion41 = (_step41 = _iterator41.next()).done); _iteratorNormalCompletion41 = true) {\n var eachCallback = _step41.value;\n eachCallback(response);\n }\n } catch (err) {\n _didIteratorError41 = true;\n _iteratorError41 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion41 && _iterator41[\"return\"] != null) {\n _iterator41[\"return\"]();\n }\n } finally {\n if (_didIteratorError41) {\n throw _iteratorError41;\n }\n }\n }\n\n this.clearQueuedCallbacks();\n }\n }\n }, {\n key: \"beginCheckingIfSyncIsTakingTooLong\",\n value: function beginCheckingIfSyncIsTakingTooLong() {\n if (this.syncStatus.checker) {\n this.stopCheckingIfSyncIsTakingTooLong();\n }\n\n this.syncStatus.checker = this.$interval(function () {\n // check to see if the ongoing sync is taking too long, alert the user\n var secondsPassed = (new Date() - this.syncStatus.syncStart) / 1000;\n var warningThreshold = 5.0; // seconds\n\n if (secondsPassed > warningThreshold) {\n this.notifyEvent(\"sync:taking-too-long\");\n this.stopCheckingIfSyncIsTakingTooLong();\n }\n }.bind(this), 500);\n }\n }, {\n key: \"stopCheckingIfSyncIsTakingTooLong\",\n value: function stopCheckingIfSyncIsTakingTooLong() {\n if (this.$interval.hasOwnProperty(\"cancel\")) {\n this.$interval.cancel(this.syncStatus.checker);\n } else {\n clearInterval(this.syncStatus.checker);\n }\n\n this.syncStatus.checker = null;\n }\n }, {\n key: \"lockSyncing\",\n value: function lockSyncing() {\n this.syncLocked = true;\n }\n }, {\n key: \"unlockSyncing\",\n value: function unlockSyncing() {\n this.syncLocked = false;\n }\n }, {\n key: \"sync\",\n value: function () {\n var _sync = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee96() {\n var _this24 = this;\n\n var options,\n _args97 = arguments;\n return regeneratorRuntime.wrap(function _callee96$(_context97) {\n while (1) {\n switch (_context97.prev = _context97.next) {\n case 0:\n options = _args97.length > 0 && _args97[0] !== undefined ? _args97[0] : {};\n\n if (!this.syncLocked) {\n _context97.next = 4;\n break;\n }\n\n console.log(\"Sync Locked, Returning;\");\n return _context97.abrupt(\"return\");\n\n case 4:\n return _context97.abrupt(\"return\", new Promise(\n /*#__PURE__*/\n function () {\n var _ref22 = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee95(resolve, reject) {\n var allDirtyItems, dirtyItemsNotYetSaved, info, isSyncInProgress, initialDataLoaded, isContinuationSync, submitLimit, subItems, params, _iteratorNormalCompletion42, _didIteratorError42, _iteratorError42, _iterator42, _step42, item;\n\n return regeneratorRuntime.wrap(function _callee95$(_context96) {\n while (1) {\n switch (_context96.prev = _context96.next) {\n case 0:\n if (!options) options = {};\n allDirtyItems = _this24.modelManager.getDirtyItems();\n dirtyItemsNotYetSaved = allDirtyItems.filter(function (candidate) {\n return !_this24.lastDirtyItemsSave || candidate.dirtiedDate > _this24.lastDirtyItemsSave;\n });\n _context96.next = 5;\n return _this24.getActiveKeyInfo(SFSyncManager.KeyRequestLoadSaveAccount);\n\n case 5:\n info = _context96.sent;\n isSyncInProgress = _this24.syncStatus.syncOpInProgress;\n initialDataLoaded = _this24.initialDataLoaded();\n\n if (!(isSyncInProgress || !initialDataLoaded)) {\n _context96.next = 16;\n break;\n }\n\n _this24.performSyncAgainOnCompletion = true;\n _this24.lastDirtyItemsSave = new Date();\n _context96.next = 13;\n return _this24.writeItemsToLocalStorage(dirtyItemsNotYetSaved, false);\n\n case 13:\n if (isSyncInProgress) {\n _this24.queuedCallbacks.push(resolve);\n\n if (_this24.loggingEnabled) {\n console.warn(\"Attempting to sync while existing sync is in progress.\");\n }\n }\n\n if (!initialDataLoaded) {\n if (_this24.loggingEnabled) {\n console.warn(\"(1) Attempting to perform online sync before local data has loaded\");\n } // Resolve right away, as we can't be sure when local data will be called by consumer.\n\n\n resolve();\n }\n\n return _context96.abrupt(\"return\");\n\n case 16:\n // Set this value immediately after checking it above, to avoid race conditions.\n _this24.syncStatus.syncOpInProgress = true;\n\n if (!info.offline) {\n _context96.next = 19;\n break;\n }\n\n return _context96.abrupt(\"return\", _this24.syncOffline(allDirtyItems).then(function (response) {\n _this24.syncStatus.syncOpInProgress = false;\n resolve(response);\n })[\"catch\"](function (e) {\n _this24.notifyEvent(\"sync-exception\", e);\n }));\n\n case 19:\n if (_this24.initialDataLoaded()) {\n _context96.next = 22;\n break;\n }\n\n console.error(\"Attempting to perform online sync before local data has loaded\");\n return _context96.abrupt(\"return\");\n\n case 22:\n if (_this24.loggingEnabled) {\n console.log(\"Syncing online user.\");\n }\n\n isContinuationSync = _this24.syncStatus.needsMoreSync;\n _this24.syncStatus.syncStart = new Date();\n\n _this24.beginCheckingIfSyncIsTakingTooLong();\n\n submitLimit = _this24.PerSyncItemUploadLimit;\n subItems = allDirtyItems.slice(0, submitLimit);\n\n if (subItems.length < allDirtyItems.length) {\n // more items left to be synced, repeat\n _this24.syncStatus.needsMoreSync = true;\n } else {\n _this24.syncStatus.needsMoreSync = false;\n }\n\n if (!isContinuationSync) {\n _this24.syncStatus.total = allDirtyItems.length;\n _this24.syncStatus.current = 0;\n } // If items are marked as dirty during a long running sync request, total isn't updated\n // This happens mostly in the case of large imports and sync conflicts where duplicated items are created\n\n\n if (_this24.syncStatus.current > _this24.syncStatus.total) {\n _this24.syncStatus.total = _this24.syncStatus.current;\n }\n\n _this24.syncStatusDidChange(); // Perform save after you've updated all status signals above. Presync save can take several seconds in some cases.\n // Write to local storage before beginning sync.\n // This way, if they close the browser before the sync request completes, local changes will not be lost\n\n\n _context96.next = 34;\n return _this24.writeItemsToLocalStorage(dirtyItemsNotYetSaved, false);\n\n case 34:\n _this24.lastDirtyItemsSave = new Date();\n\n if (options.onPreSyncSave) {\n options.onPreSyncSave();\n } // when doing a sync request that returns items greater than the limit, and thus subsequent syncs are required,\n // we want to keep track of all retreived items, then save to local storage only once all items have been retrieved,\n // so that relationships remain intact\n // Update 12/18: I don't think we need to do this anymore, since relationships will now retroactively resolve their relationships,\n // if an item they were looking for hasn't been pulled in yet.\n\n\n if (!_this24.allRetreivedItems) {\n _this24.allRetreivedItems = [];\n } // We also want to do this for savedItems\n\n\n if (!_this24.allSavedItems) {\n _this24.allSavedItems = [];\n }\n\n params = {};\n params.limit = _this24.ServerItemDownloadLimit;\n\n if (options.performIntegrityCheck) {\n params.compute_integrity = true;\n }\n\n _context96.prev = 41;\n _context96.next = 44;\n return Promise.all(subItems.map(function (item) {\n var itemParams = new SFItemParams(item, info.keys, info.auth_params);\n itemParams.additionalFields = options.additionalFields;\n return itemParams.paramsForSync();\n })).then(function (itemsParams) {\n params.items = itemsParams;\n });\n\n case 44:\n _context96.next = 49;\n break;\n\n case 46:\n _context96.prev = 46;\n _context96.t0 = _context96[\"catch\"](41);\n\n _this24.notifyEvent(\"sync-exception\", _context96.t0);\n\n case 49:\n _iteratorNormalCompletion42 = true;\n _didIteratorError42 = false;\n _iteratorError42 = undefined;\n _context96.prev = 52;\n\n for (_iterator42 = subItems[Symbol.iterator](); !(_iteratorNormalCompletion42 = (_step42 = _iterator42.next()).done); _iteratorNormalCompletion42 = true) {\n item = _step42.value; // Reset dirty counter to 0, since we're about to sync it.\n // This means anyone marking the item as dirty after this will cause it so sync again and not be cleared on sync completion.\n\n item.dirtyCount = 0;\n }\n\n _context96.next = 60;\n break;\n\n case 56:\n _context96.prev = 56;\n _context96.t1 = _context96[\"catch\"](52);\n _didIteratorError42 = true;\n _iteratorError42 = _context96.t1;\n\n case 60:\n _context96.prev = 60;\n _context96.prev = 61;\n\n if (!_iteratorNormalCompletion42 && _iterator42[\"return\"] != null) {\n _iterator42[\"return\"]();\n }\n\n case 63:\n _context96.prev = 63;\n\n if (!_didIteratorError42) {\n _context96.next = 66;\n break;\n }\n\n throw _iteratorError42;\n\n case 66:\n return _context96.finish(63);\n\n case 67:\n return _context96.finish(60);\n\n case 68:\n _context96.next = 70;\n return _this24.getSyncToken();\n\n case 70:\n params.sync_token = _context96.sent;\n _context96.next = 73;\n return _this24.getCursorToken();\n\n case 73:\n params.cursor_token = _context96.sent;\n params['api'] = SFHttpManager.getApiVersion();\n\n if (_this24.loggingEnabled) {\n console.log(\"Syncing with params\", params);\n }\n\n _context96.prev = 76;\n _context96.t2 = _this24.httpManager;\n _context96.next = 80;\n return _this24.getSyncURL();\n\n case 80:\n _context96.t3 = _context96.sent;\n _context96.t4 = params;\n\n _context96.t5 = function (response) {\n _this24.handleSyncSuccess(subItems, response, options).then(function () {\n resolve(response);\n })[\"catch\"](function (e) {\n console.log(\"Caught sync success exception:\", e);\n\n _this24.handleSyncError(e, null, allDirtyItems).then(function (errorResponse) {\n _this24.notifyEvent(\"sync-exception\", e);\n\n resolve(errorResponse);\n });\n });\n };\n\n _context96.t6 = function (response, statusCode) {\n _this24.handleSyncError(response, statusCode, allDirtyItems).then(function (errorResponse) {\n resolve(errorResponse);\n });\n };\n\n _context96.t2.postAuthenticatedAbsolute.call(_context96.t2, _context96.t3, _context96.t4, _context96.t5, _context96.t6);\n\n _context96.next = 90;\n break;\n\n case 87:\n _context96.prev = 87;\n _context96.t7 = _context96[\"catch\"](76);\n console.log(\"Sync exception caught:\", _context96.t7);\n\n case 90:\n case \"end\":\n return _context96.stop();\n }\n }\n }, _callee95, null, [[41, 46], [52, 56, 60, 68], [61,, 63, 67], [76, 87]]);\n }));\n\n return function (_x123, _x124) {\n return _ref22.apply(this, arguments);\n };\n }()));\n\n case 5:\n case \"end\":\n return _context97.stop();\n }\n }\n }, _callee96, this);\n }));\n\n function sync() {\n return _sync.apply(this, arguments);\n }\n\n return sync;\n }()\n }, {\n key: \"_awaitSleep\",\n value: function () {\n var _awaitSleep2 = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee97(durationInMs) {\n return regeneratorRuntime.wrap(function _callee97$(_context98) {\n while (1) {\n switch (_context98.prev = _context98.next) {\n case 0:\n console.warn(\"Simulating high latency sync request\", durationInMs);\n return _context98.abrupt(\"return\", new Promise(function (resolve, reject) {\n setTimeout(function () {\n resolve();\n }, durationInMs);\n }));\n\n case 2:\n case \"end\":\n return _context98.stop();\n }\n }\n }, _callee97);\n }));\n\n function _awaitSleep(_x125) {\n return _awaitSleep2.apply(this, arguments);\n }\n\n return _awaitSleep;\n }()\n }, {\n key: \"handleSyncSuccess\",\n value: function () {\n var _handleSyncSuccess = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee98(syncedItems, response, options) {\n var _this25 = this;\n\n var latency, allSavedUUIDs, currentRequestSavedUUIDs, itemsToClearAsDirty, _iteratorNormalCompletion43, _didIteratorError43, _iteratorError43, _iterator43, _step43, item, retrieved, omitFields, saved, deprecated_unsaved, conflicts, conflictsNeedSync, matches, cursorToken;\n\n return regeneratorRuntime.wrap(function _callee98$(_context99) {\n while (1) {\n switch (_context99.prev = _context99.next) {\n case 0:\n if (!options.simulateHighLatency) {\n _context99.next = 4;\n break;\n }\n\n latency = options.simulatedLatency || 1000;\n _context99.next = 4;\n return this._awaitSleep(latency);\n\n case 4:\n this.syncStatus.error = null;\n\n if (this.loggingEnabled) {\n console.log(\"Sync response\", response);\n }\n\n allSavedUUIDs = this.allSavedItems.map(function (item) {\n return item.uuid;\n });\n currentRequestSavedUUIDs = response.saved_items.map(function (savedResponse) {\n return savedResponse.uuid;\n });\n response.retrieved_items = response.retrieved_items.filter(function (retrievedItem) {\n var isInPreviousSaved = allSavedUUIDs.includes(retrievedItem.uuid);\n var isInCurrentSaved = currentRequestSavedUUIDs.includes(retrievedItem.uuid);\n\n if (isInPreviousSaved || isInCurrentSaved) {\n return false;\n }\n\n var localItem = _this25.modelManager.findItem(retrievedItem.uuid);\n\n if (localItem && localItem.dirty) {\n return false;\n }\n\n return true;\n }); // Clear dirty items after we've finish filtering retrieved_items above, since that depends on dirty items.\n // Check to make sure any subItem hasn't been marked as dirty again while a sync was ongoing\n\n itemsToClearAsDirty = [];\n _iteratorNormalCompletion43 = true;\n _didIteratorError43 = false;\n _iteratorError43 = undefined;\n _context99.prev = 13;\n\n for (_iterator43 = syncedItems[Symbol.iterator](); !(_iteratorNormalCompletion43 = (_step43 = _iterator43.next()).done); _iteratorNormalCompletion43 = true) {\n item = _step43.value;\n\n if (item.dirtyCount == 0) {\n // Safe to clear as dirty\n itemsToClearAsDirty.push(item);\n }\n }\n\n _context99.next = 21;\n break;\n\n case 17:\n _context99.prev = 17;\n _context99.t0 = _context99[\"catch\"](13);\n _didIteratorError43 = true;\n _iteratorError43 = _context99.t0;\n\n case 21:\n _context99.prev = 21;\n _context99.prev = 22;\n\n if (!_iteratorNormalCompletion43 && _iterator43[\"return\"] != null) {\n _iterator43[\"return\"]();\n }\n\n case 24:\n _context99.prev = 24;\n\n if (!_didIteratorError43) {\n _context99.next = 27;\n break;\n }\n\n throw _iteratorError43;\n\n case 27:\n return _context99.finish(24);\n\n case 28:\n return _context99.finish(21);\n\n case 29:\n this.modelManager.clearDirtyItems(itemsToClearAsDirty); // Map retrieved items to local data\n // Note that deleted items will not be returned\n\n _context99.next = 32;\n return this.handleItemsResponse(response.retrieved_items, null, SFModelManager.MappingSourceRemoteRetrieved, SFSyncManager.KeyRequestLoadSaveAccount);\n\n case 32:\n retrieved = _context99.sent; // Append items to master list of retrieved items for this ongoing sync operation\n\n this.allRetreivedItems = this.allRetreivedItems.concat(retrieved);\n this.syncStatus.retrievedCount = this.allRetreivedItems.length; // Merge only metadata for saved items\n // we write saved items to disk now because it clears their dirty status then saves\n // if we saved items before completion, we had have to save them as dirty and save them again on success as clean\n\n omitFields = [\"content\", \"auth_hash\"]; // Map saved items to local data\n\n _context99.next = 38;\n return this.handleItemsResponse(response.saved_items, omitFields, SFModelManager.MappingSourceRemoteSaved, SFSyncManager.KeyRequestLoadSaveAccount);\n\n case 38:\n saved = _context99.sent; // Append items to master list of saved items for this ongoing sync operation\n\n this.allSavedItems = this.allSavedItems.concat(saved); // 'unsaved' is deprecated and replaced with 'conflicts' in newer version.\n\n deprecated_unsaved = response.unsaved;\n _context99.next = 43;\n return this.deprecated_handleUnsavedItemsResponse(deprecated_unsaved);\n\n case 43:\n _context99.next = 45;\n return this.handleConflictsResponse(response.conflicts);\n\n case 45:\n conflicts = _context99.sent;\n conflictsNeedSync = conflicts && conflicts.length > 0;\n\n if (!conflicts) {\n _context99.next = 50;\n break;\n }\n\n _context99.next = 50;\n return this.writeItemsToLocalStorage(conflicts, false);\n\n case 50:\n _context99.next = 52;\n return this.writeItemsToLocalStorage(saved, false);\n\n case 52:\n _context99.next = 54;\n return this.writeItemsToLocalStorage(retrieved, false);\n\n case 54:\n if (!(response.integrity_hash && !response.cursor_token)) {\n _context99.next = 59;\n break;\n }\n\n _context99.next = 57;\n return this.handleServerIntegrityHash(response.integrity_hash);\n\n case 57:\n matches = _context99.sent;\n\n if (!matches) {\n // If the server hash doesn't match our local hash, we want to continue syncing until we reach\n // the max discordance threshold\n if (this.syncDiscordance < this.MaxDiscordanceBeforeOutOfSync) {\n this.performSyncAgainOnCompletion = true;\n }\n }\n\n case 59:\n this.syncStatus.syncOpInProgress = false;\n this.syncStatus.current += syncedItems.length;\n this.syncStatusDidChange(); // set the sync token at the end, so that if any errors happen above, you can resync\n\n this.setSyncToken(response.sync_token);\n this.setCursorToken(response.cursor_token);\n this.stopCheckingIfSyncIsTakingTooLong();\n _context99.next = 67;\n return this.getCursorToken();\n\n case 67:\n cursorToken = _context99.sent;\n\n if (!(cursorToken || this.syncStatus.needsMoreSync)) {\n _context99.next = 72;\n break;\n }\n\n return _context99.abrupt(\"return\", new Promise(function (resolve, reject) {\n setTimeout(function () {\n this.sync(options).then(resolve);\n }.bind(_this25), 10); // wait 10ms to allow UI to update\n }));\n\n case 72:\n if (!conflictsNeedSync) {\n _context99.next = 77;\n break;\n } // We'll use the conflict sync as the next sync, so performSyncAgainOnCompletion can be turned off.\n\n\n this.performSyncAgainOnCompletion = false; // Include as part of await/resolve chain\n\n return _context99.abrupt(\"return\", new Promise(function (resolve, reject) {\n setTimeout(function () {\n _this25.sync(options).then(resolve);\n }, 10); // wait 10ms to allow UI to update\n }));\n\n case 77:\n this.syncStatus.retrievedCount = 0; // current and total represent what's going up, not what's come down or saved.\n\n this.syncStatus.current = 0;\n this.syncStatus.total = 0;\n this.syncStatusDidChange();\n\n if (this.allRetreivedItems.length >= this.majorDataChangeThreshold || saved.length >= this.majorDataChangeThreshold || deprecated_unsaved && deprecated_unsaved.length >= this.majorDataChangeThreshold || conflicts && conflicts.length >= this.majorDataChangeThreshold) {\n this.notifyEvent(\"major-data-change\");\n }\n\n this.callQueuedCallbacks(response);\n this.notifyEvent(\"sync:completed\", {\n retrievedItems: this.allRetreivedItems,\n savedItems: this.allSavedItems\n });\n this.allRetreivedItems = [];\n this.allSavedItems = [];\n\n if (this.performSyncAgainOnCompletion) {\n this.performSyncAgainOnCompletion = false;\n setTimeout(function () {\n _this25.sync(options);\n }, 10); // wait 10ms to allow UI to update\n }\n\n return _context99.abrupt(\"return\", response);\n\n case 88:\n case \"end\":\n return _context99.stop();\n }\n }\n }, _callee98, this, [[13, 17, 21, 29], [22,, 24, 28]]);\n }));\n\n function handleSyncSuccess(_x126, _x127, _x128) {\n return _handleSyncSuccess.apply(this, arguments);\n }\n\n return handleSyncSuccess;\n }()\n }, {\n key: \"handleSyncError\",\n value: function () {\n var _handleSyncError = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee99(response, statusCode, allDirtyItems) {\n return regeneratorRuntime.wrap(function _callee99$(_context100) {\n while (1) {\n switch (_context100.prev = _context100.next) {\n case 0:\n console.log(\"Sync error: \", response);\n\n if (statusCode == 401) {\n this.notifyEvent(\"sync-session-invalid\");\n }\n\n if (!response) {\n response = {\n error: {\n message: \"Could not connect to server.\"\n }\n };\n } else if (typeof response == 'string') {\n response = {\n error: {\n message: response\n }\n };\n }\n\n this.syncStatus.syncOpInProgress = false;\n this.syncStatus.error = response.error;\n this.syncStatusDidChange();\n this.writeItemsToLocalStorage(allDirtyItems, false);\n this.modelManager.didSyncModelsOffline(allDirtyItems);\n this.stopCheckingIfSyncIsTakingTooLong();\n this.notifyEvent(\"sync:error\", response.error);\n this.callQueuedCallbacks({\n error: \"Sync error\"\n });\n return _context100.abrupt(\"return\", response);\n\n case 12:\n case \"end\":\n return _context100.stop();\n }\n }\n }, _callee99, this);\n }));\n\n function handleSyncError(_x129, _x130, _x131) {\n return _handleSyncError.apply(this, arguments);\n }\n\n return handleSyncError;\n }()\n }, {\n key: \"handleItemsResponse\",\n value: function () {\n var _handleItemsResponse = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee100(responseItems, omitFields, source, keyRequest) {\n var keys, items, itemsWithErrorStatusChange;\n return regeneratorRuntime.wrap(function _callee100$(_context101) {\n while (1) {\n switch (_context101.prev = _context101.next) {\n case 0:\n _context101.next = 2;\n return this.getActiveKeyInfo(keyRequest);\n\n case 2:\n keys = _context101.sent.keys;\n _context101.next = 5;\n return SFJS.itemTransformer.decryptMultipleItems(responseItems, keys);\n\n case 5:\n _context101.next = 7;\n return this.modelManager.mapResponseItemsToLocalModelsOmittingFields(responseItems, omitFields, source);\n\n case 7:\n items = _context101.sent; // During the decryption process, items may be marked as \"errorDecrypting\". If so, we want to be sure\n // to persist this new state by writing these items back to local storage. When an item's \"errorDecrypting\"\n // flag is changed, its \"errorDecryptingValueChanged\" flag will be set, so we can find these items by filtering (then unsetting) below:\n\n itemsWithErrorStatusChange = items.filter(function (item) {\n var valueChanged = item.errorDecryptingValueChanged; // unset after consuming value\n\n item.errorDecryptingValueChanged = false;\n return valueChanged;\n });\n\n if (itemsWithErrorStatusChange.length > 0) {\n this.writeItemsToLocalStorage(itemsWithErrorStatusChange, false);\n }\n\n return _context101.abrupt(\"return\", items);\n\n case 11:\n case \"end\":\n return _context101.stop();\n }\n }\n }, _callee100, this);\n }));\n\n function handleItemsResponse(_x132, _x133, _x134, _x135) {\n return _handleItemsResponse.apply(this, arguments);\n }\n\n return handleItemsResponse;\n }()\n }, {\n key: \"refreshErroredItems\",\n value: function () {\n var _refreshErroredItems = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee101() {\n var erroredItems;\n return regeneratorRuntime.wrap(function _callee101$(_context102) {\n while (1) {\n switch (_context102.prev = _context102.next) {\n case 0:\n erroredItems = this.modelManager.allNondummyItems.filter(function (item) {\n return item.errorDecrypting == true;\n });\n\n if (!(erroredItems.length > 0)) {\n _context102.next = 3;\n break;\n }\n\n return _context102.abrupt(\"return\", this.handleItemsResponse(erroredItems, null, SFModelManager.MappingSourceLocalRetrieved, SFSyncManager.KeyRequestLoadSaveAccount));\n\n case 3:\n case \"end\":\n return _context102.stop();\n }\n }\n }, _callee101, this);\n }));\n\n function refreshErroredItems() {\n return _refreshErroredItems.apply(this, arguments);\n }\n\n return refreshErroredItems;\n }()\n /*\n The difference between 'unsaved' (deprecated_handleUnsavedItemsResponse) and 'conflicts' (handleConflictsResponse) is that\n with unsaved items, the local copy is triumphant on the server, and we check the server copy to see if we should\n create it as a duplicate. This is for the legacy API where it would save what you sent the server no matter its value,\n and the client would decide what to do with the previous server value.\n handleConflictsResponse on the other hand handles where the local copy save was not triumphant on the server.\n Instead the conflict includes the server item. Here we immediately map the server value onto our local value,\n but before that, we give our local value a chance to duplicate itself if it differs from the server value.\n */\n\n }, {\n key: \"handleConflictsResponse\",\n value: function () {\n var _handleConflictsResponse = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee102(conflicts) {\n var localValues, _iteratorNormalCompletion44, _didIteratorError44, _iteratorError44, _iterator44, _step44, conflict, serverItemResponse, localItem, frozenContent, itemsNeedingLocalSave, _iteratorNormalCompletion45, _didIteratorError45, _iteratorError45, _iterator45, _step45, _conflict, _serverItemResponse, _localValues$_serverI, _frozenContent, itemRef, newItem, tempServerItem, _tempItemWithFrozenValues, frozenContentDiffers, currentContentDiffers, duplicateLocal, duplicateServer, keepLocal, keepServer, IsActiveItemSecondsThreshold, isActivelyBeingEdited, contentExcludingReferencesDiffers, isOnlyReferenceChange, localDuplicate;\n\n return regeneratorRuntime.wrap(function _callee102$(_context103) {\n while (1) {\n switch (_context103.prev = _context103.next) {\n case 0:\n if (!(!conflicts || conflicts.length == 0)) {\n _context103.next = 2;\n break;\n }\n\n return _context103.abrupt(\"return\");\n\n case 2:\n if (this.loggingEnabled) {\n console.log(\"Handle Conflicted Items:\", conflicts);\n } // Get local values before doing any processing. This way, if a note change below modifies a tag,\n // and the tag is going to be iterated on in the same loop, then we don't want this change to be compared\n // to the local value.\n\n\n localValues = {};\n _iteratorNormalCompletion44 = true;\n _didIteratorError44 = false;\n _iteratorError44 = undefined;\n _context103.prev = 7;\n _iterator44 = conflicts[Symbol.iterator]();\n\n case 9:\n if (_iteratorNormalCompletion44 = (_step44 = _iterator44.next()).done) {\n _context103.next = 21;\n break;\n }\n\n conflict = _step44.value;\n serverItemResponse = conflict.server_item || conflict.unsaved_item;\n localItem = this.modelManager.findItem(serverItemResponse.uuid);\n\n if (localItem) {\n _context103.next = 16;\n break;\n }\n\n localValues[serverItemResponse.uuid] = {};\n return _context103.abrupt(\"continue\", 18);\n\n case 16:\n frozenContent = localItem.getContentCopy();\n localValues[serverItemResponse.uuid] = {\n frozenContent: frozenContent,\n itemRef: localItem\n };\n\n case 18:\n _iteratorNormalCompletion44 = true;\n _context103.next = 9;\n break;\n\n case 21:\n _context103.next = 27;\n break;\n\n case 23:\n _context103.prev = 23;\n _context103.t0 = _context103[\"catch\"](7);\n _didIteratorError44 = true;\n _iteratorError44 = _context103.t0;\n\n case 27:\n _context103.prev = 27;\n _context103.prev = 28;\n\n if (!_iteratorNormalCompletion44 && _iterator44[\"return\"] != null) {\n _iterator44[\"return\"]();\n }\n\n case 30:\n _context103.prev = 30;\n\n if (!_didIteratorError44) {\n _context103.next = 33;\n break;\n }\n\n throw _iteratorError44;\n\n case 33:\n return _context103.finish(30);\n\n case 34:\n return _context103.finish(27);\n\n case 35:\n // Any item that's newly created here or updated will need to be persisted\n itemsNeedingLocalSave = [];\n _iteratorNormalCompletion45 = true;\n _didIteratorError45 = false;\n _iteratorError45 = undefined;\n _context103.prev = 39;\n _iterator45 = conflicts[Symbol.iterator]();\n\n case 41:\n if (_iteratorNormalCompletion45 = (_step45 = _iterator45.next()).done) {\n _context103.next = 91;\n break;\n }\n\n _conflict = _step45.value; // if sync_conflict, we receive conflict.server_item.\n // If uuid_conflict, we receive the value we attempted to save.\n\n _serverItemResponse = _conflict.server_item || _conflict.unsaved_item;\n _context103.t1 = SFJS.itemTransformer;\n _context103.t2 = [_serverItemResponse];\n _context103.next = 48;\n return this.getActiveKeyInfo(SFSyncManager.KeyRequestLoadSaveAccount);\n\n case 48:\n _context103.t3 = _context103.sent.keys;\n _context103.next = 51;\n return _context103.t1.decryptMultipleItems.call(_context103.t1, _context103.t2, _context103.t3);\n\n case 51:\n _localValues$_serverI = localValues[_serverItemResponse.uuid], _frozenContent = _localValues$_serverI.frozenContent, itemRef = _localValues$_serverI.itemRef; // Could be deleted\n\n if (itemRef) {\n _context103.next = 54;\n break;\n }\n\n return _context103.abrupt(\"continue\", 88);\n\n case 54:\n // Item ref is always added, since it's value will have changed below, either by mapping, being set to dirty,\n // or being set undirty by the caller but the caller not saving because they're waiting on us.\n itemsNeedingLocalSave.push(itemRef);\n\n if (!(_conflict.type === \"uuid_conflict\")) {\n _context103.next = 62;\n break;\n }\n\n _context103.next = 58;\n return this.modelManager.alternateUUIDForItem(itemRef);\n\n case 58:\n newItem = _context103.sent;\n itemsNeedingLocalSave.push(newItem);\n _context103.next = 88;\n break;\n\n case 62:\n if (!(_conflict.type === \"sync_conflict\")) {\n _context103.next = 86;\n break;\n }\n\n _context103.next = 65;\n return this.modelManager.createDuplicateItemFromResponseItem(_serverItemResponse);\n\n case 65:\n tempServerItem = _context103.sent; // Convert to an object simply so we can have access to the `isItemContentEqualWith` function.\n\n _tempItemWithFrozenValues = this.modelManager.duplicateItemWithCustomContent({\n content: _frozenContent,\n duplicateOf: itemRef\n }); // if !frozenContentDiffers && currentContentDiffers, it means values have changed as we were looping through conflicts here.\n\n frozenContentDiffers = !_tempItemWithFrozenValues.isItemContentEqualWith(tempServerItem);\n currentContentDiffers = !itemRef.isItemContentEqualWith(tempServerItem);\n duplicateLocal = false;\n duplicateServer = false;\n keepLocal = false;\n keepServer = false;\n\n if (_serverItemResponse.deleted || itemRef.deleted) {\n keepServer = true;\n } else if (frozenContentDiffers) {\n IsActiveItemSecondsThreshold = 20;\n isActivelyBeingEdited = (new Date() - itemRef.client_updated_at) / 1000 < IsActiveItemSecondsThreshold;\n\n if (isActivelyBeingEdited) {\n keepLocal = true;\n duplicateServer = true;\n } else {\n duplicateLocal = true;\n keepServer = true;\n }\n } else if (currentContentDiffers) {\n contentExcludingReferencesDiffers = !SFItem.AreItemContentsEqual({\n leftContent: itemRef.content,\n rightContent: tempServerItem.content,\n keysToIgnore: itemRef.keysToIgnoreWhenCheckingContentEquality().concat([\"references\"]),\n appDataKeysToIgnore: itemRef.appDataKeysToIgnoreWhenCheckingContentEquality()\n });\n isOnlyReferenceChange = !contentExcludingReferencesDiffers;\n\n if (isOnlyReferenceChange) {\n keepLocal = true;\n } else {\n duplicateLocal = true;\n keepServer = true;\n }\n } else {\n // items are exactly equal\n keepServer = true;\n }\n\n if (!duplicateLocal) {\n _context103.next = 79;\n break;\n }\n\n _context103.next = 77;\n return this.modelManager.duplicateItemWithCustomContentAndAddAsConflict({\n content: _frozenContent,\n duplicateOf: itemRef\n });\n\n case 77:\n localDuplicate = _context103.sent;\n itemsNeedingLocalSave.push(localDuplicate);\n\n case 79:\n if (duplicateServer) {\n this.modelManager.addDuplicatedItemAsConflict({\n duplicate: tempServerItem,\n duplicateOf: itemRef\n });\n itemsNeedingLocalSave.push(tempServerItem);\n }\n\n if (!keepServer) {\n _context103.next = 83;\n break;\n }\n\n _context103.next = 83;\n return this.modelManager.mapResponseItemsToLocalModelsOmittingFields([_serverItemResponse], null, SFModelManager.MappingSourceRemoteRetrieved);\n\n case 83:\n if (keepLocal) {\n itemRef.updated_at = tempServerItem.updated_at;\n itemRef.setDirty(true);\n }\n\n _context103.next = 88;\n break;\n\n case 86:\n console.error(\"Unsupported conflict type\", _conflict.type);\n return _context103.abrupt(\"continue\", 88);\n\n case 88:\n _iteratorNormalCompletion45 = true;\n _context103.next = 41;\n break;\n\n case 91:\n _context103.next = 97;\n break;\n\n case 93:\n _context103.prev = 93;\n _context103.t4 = _context103[\"catch\"](39);\n _didIteratorError45 = true;\n _iteratorError45 = _context103.t4;\n\n case 97:\n _context103.prev = 97;\n _context103.prev = 98;\n\n if (!_iteratorNormalCompletion45 && _iterator45[\"return\"] != null) {\n _iterator45[\"return\"]();\n }\n\n case 100:\n _context103.prev = 100;\n\n if (!_didIteratorError45) {\n _context103.next = 103;\n break;\n }\n\n throw _iteratorError45;\n\n case 103:\n return _context103.finish(100);\n\n case 104:\n return _context103.finish(97);\n\n case 105:\n return _context103.abrupt(\"return\", itemsNeedingLocalSave);\n\n case 106:\n case \"end\":\n return _context103.stop();\n }\n }\n }, _callee102, this, [[7, 23, 27, 35], [28,, 30, 34], [39, 93, 97, 105], [98,, 100, 104]]);\n }));\n\n function handleConflictsResponse(_x136) {\n return _handleConflictsResponse.apply(this, arguments);\n }\n\n return handleConflictsResponse;\n }() // Legacy API\n\n }, {\n key: \"deprecated_handleUnsavedItemsResponse\",\n value: function () {\n var _deprecated_handleUnsavedItemsResponse = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee103(unsaved) {\n var _iteratorNormalCompletion46, _didIteratorError46, _iteratorError46, _iterator46, _step46, mapping, itemResponse, item, error, dup;\n\n return regeneratorRuntime.wrap(function _callee103$(_context104) {\n while (1) {\n switch (_context104.prev = _context104.next) {\n case 0:\n if (!(!unsaved || unsaved.length == 0)) {\n _context104.next = 2;\n break;\n }\n\n return _context104.abrupt(\"return\");\n\n case 2:\n if (this.loggingEnabled) {\n console.log(\"Handle Unsaved Items:\", unsaved);\n }\n\n _iteratorNormalCompletion46 = true;\n _didIteratorError46 = false;\n _iteratorError46 = undefined;\n _context104.prev = 6;\n _iterator46 = unsaved[Symbol.iterator]();\n\n case 8:\n if (_iteratorNormalCompletion46 = (_step46 = _iterator46.next()).done) {\n _context104.next = 35;\n break;\n }\n\n mapping = _step46.value;\n itemResponse = mapping.item;\n _context104.t0 = SFJS.itemTransformer;\n _context104.t1 = [itemResponse];\n _context104.next = 15;\n return this.getActiveKeyInfo(SFSyncManager.KeyRequestLoadSaveAccount);\n\n case 15:\n _context104.t2 = _context104.sent.keys;\n _context104.next = 18;\n return _context104.t0.decryptMultipleItems.call(_context104.t0, _context104.t1, _context104.t2);\n\n case 18:\n item = this.modelManager.findItem(itemResponse.uuid); // Could be deleted\n\n if (item) {\n _context104.next = 21;\n break;\n }\n\n return _context104.abrupt(\"continue\", 32);\n\n case 21:\n error = mapping.error;\n\n if (!(error.tag === \"uuid_conflict\")) {\n _context104.next = 27;\n break;\n }\n\n _context104.next = 25;\n return this.modelManager.alternateUUIDForItem(item);\n\n case 25:\n _context104.next = 32;\n break;\n\n case 27:\n if (!(error.tag === \"sync_conflict\")) {\n _context104.next = 32;\n break;\n }\n\n _context104.next = 30;\n return this.modelManager.createDuplicateItemFromResponseItem(itemResponse);\n\n case 30:\n dup = _context104.sent;\n\n if (!itemResponse.deleted && !item.isItemContentEqualWith(dup)) {\n this.modelManager.addDuplicatedItemAsConflict({\n duplicate: dup,\n duplicateOf: item\n });\n }\n\n case 32:\n _iteratorNormalCompletion46 = true;\n _context104.next = 8;\n break;\n\n case 35:\n _context104.next = 41;\n break;\n\n case 37:\n _context104.prev = 37;\n _context104.t3 = _context104[\"catch\"](6);\n _didIteratorError46 = true;\n _iteratorError46 = _context104.t3;\n\n case 41:\n _context104.prev = 41;\n _context104.prev = 42;\n\n if (!_iteratorNormalCompletion46 && _iterator46[\"return\"] != null) {\n _iterator46[\"return\"]();\n }\n\n case 44:\n _context104.prev = 44;\n\n if (!_didIteratorError46) {\n _context104.next = 47;\n break;\n }\n\n throw _iteratorError46;\n\n case 47:\n return _context104.finish(44);\n\n case 48:\n return _context104.finish(41);\n\n case 49:\n case \"end\":\n return _context104.stop();\n }\n }\n }, _callee103, this, [[6, 37, 41, 49], [42,, 44, 48]]);\n }));\n\n function deprecated_handleUnsavedItemsResponse(_x137) {\n return _deprecated_handleUnsavedItemsResponse.apply(this, arguments);\n }\n\n return deprecated_handleUnsavedItemsResponse;\n }()\n /*\n Executes a sync request with a blank sync token and high download limit. It will download all items,\n but won't do anything with them other than decrypting, creating respective objects, and returning them to caller. (it does not map them nor establish their relationships)\n The use case came primarly for clients who had ignored a certain content_type in sync, but later issued an update\n indicated they actually did want to start handling that content type. In that case, they would need to download all items\n freshly from the server.\n */\n\n }, {\n key: \"stateless_downloadAllItems\",\n value: function stateless_downloadAllItems() {\n var _this26 = this;\n\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n return new Promise(\n /*#__PURE__*/\n function () {\n var _ref23 = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee105(resolve, reject) {\n var params;\n return regeneratorRuntime.wrap(function _callee105$(_context106) {\n while (1) {\n switch (_context106.prev = _context106.next) {\n case 0:\n params = {\n limit: options.limit || 500,\n sync_token: options.syncToken,\n cursor_token: options.cursorToken,\n content_type: options.contentType,\n event: options.event,\n api: SFHttpManager.getApiVersion()\n };\n _context106.prev = 1;\n _context106.t0 = _this26.httpManager;\n _context106.next = 5;\n return _this26.getSyncURL();\n\n case 5:\n _context106.t1 = _context106.sent;\n _context106.t2 = params;\n\n _context106.t3 =\n /*#__PURE__*/\n function () {\n var _ref24 = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee104(response) {\n var incomingItems, keys;\n return regeneratorRuntime.wrap(function _callee104$(_context105) {\n while (1) {\n switch (_context105.prev = _context105.next) {\n case 0:\n if (!options.retrievedItems) {\n options.retrievedItems = [];\n }\n\n incomingItems = response.retrieved_items;\n _context105.next = 4;\n return _this26.getActiveKeyInfo(SFSyncManager.KeyRequestLoadSaveAccount);\n\n case 4:\n keys = _context105.sent.keys;\n _context105.next = 7;\n return SFJS.itemTransformer.decryptMultipleItems(incomingItems, keys);\n\n case 7:\n options.retrievedItems = options.retrievedItems.concat(incomingItems.map(function (incomingItem) {\n // Create model classes\n return _this26.modelManager.createItem(incomingItem);\n }));\n options.syncToken = response.sync_token;\n options.cursorToken = response.cursor_token;\n\n if (options.cursorToken) {\n _this26.stateless_downloadAllItems(options).then(resolve);\n } else {\n resolve(options.retrievedItems);\n }\n\n case 11:\n case \"end\":\n return _context105.stop();\n }\n }\n }, _callee104);\n }));\n\n return function (_x140) {\n return _ref24.apply(this, arguments);\n };\n }();\n\n _context106.t4 = function (response, statusCode) {\n reject(response);\n };\n\n _context106.t0.postAuthenticatedAbsolute.call(_context106.t0, _context106.t1, _context106.t2, _context106.t3, _context106.t4);\n\n _context106.next = 16;\n break;\n\n case 12:\n _context106.prev = 12;\n _context106.t5 = _context106[\"catch\"](1);\n console.log(\"Download all items exception caught:\", _context106.t5);\n reject(_context106.t5);\n\n case 16:\n case \"end\":\n return _context106.stop();\n }\n }\n }, _callee105, null, [[1, 12]]);\n }));\n\n return function (_x138, _x139) {\n return _ref23.apply(this, arguments);\n };\n }());\n }\n }, {\n key: \"resolveOutOfSync\",\n value: function () {\n var _resolveOutOfSync = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee107() {\n var _this27 = this;\n\n return regeneratorRuntime.wrap(function _callee107$(_context108) {\n while (1) {\n switch (_context108.prev = _context108.next) {\n case 0:\n return _context108.abrupt(\"return\", this.stateless_downloadAllItems({\n event: \"resolve-out-of-sync\"\n }).then(\n /*#__PURE__*/\n function () {\n var _ref25 = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee106(downloadedItems) {\n var itemsToMap, _iteratorNormalCompletion47, _didIteratorError47, _iteratorError47, _iterator47, _step47, downloadedItem, existingItem, contentDoesntMatch;\n\n return regeneratorRuntime.wrap(function _callee106$(_context107) {\n while (1) {\n switch (_context107.prev = _context107.next) {\n case 0:\n itemsToMap = [];\n _iteratorNormalCompletion47 = true;\n _didIteratorError47 = false;\n _iteratorError47 = undefined;\n _context107.prev = 4;\n _iterator47 = downloadedItems[Symbol.iterator]();\n\n case 6:\n if (_iteratorNormalCompletion47 = (_step47 = _iterator47.next()).done) {\n _context107.next = 18;\n break;\n }\n\n downloadedItem = _step47.value; // Note that deleted items will not be sent back by the server.\n\n existingItem = _this27.modelManager.findItem(downloadedItem.uuid);\n\n if (!existingItem) {\n _context107.next = 14;\n break;\n } // Check if the content differs. If it does, create a new item, and do not map downloadedItem.\n\n\n contentDoesntMatch = !downloadedItem.isItemContentEqualWith(existingItem);\n\n if (!contentDoesntMatch) {\n _context107.next = 14;\n break;\n }\n\n _context107.next = 14;\n return _this27.modelManager.duplicateItemAndAddAsConflict(existingItem);\n\n case 14:\n // Map the downloadedItem as authoritive content. If client copy at all differed, we would have created a duplicate of it above and synced it.\n // This is also neccessary to map the updated_at value from the server\n itemsToMap.push(downloadedItem);\n\n case 15:\n _iteratorNormalCompletion47 = true;\n _context107.next = 6;\n break;\n\n case 18:\n _context107.next = 24;\n break;\n\n case 20:\n _context107.prev = 20;\n _context107.t0 = _context107[\"catch\"](4);\n _didIteratorError47 = true;\n _iteratorError47 = _context107.t0;\n\n case 24:\n _context107.prev = 24;\n _context107.prev = 25;\n\n if (!_iteratorNormalCompletion47 && _iterator47[\"return\"] != null) {\n _iterator47[\"return\"]();\n }\n\n case 27:\n _context107.prev = 27;\n\n if (!_didIteratorError47) {\n _context107.next = 30;\n break;\n }\n\n throw _iteratorError47;\n\n case 30:\n return _context107.finish(27);\n\n case 31:\n return _context107.finish(24);\n\n case 32:\n _context107.next = 34;\n return _this27.modelManager.mapResponseItemsToLocalModelsWithOptions({\n items: itemsToMap,\n source: SFModelManager.MappingSourceRemoteRetrieved\n });\n\n case 34:\n _context107.next = 36;\n return _this27.writeItemsToLocalStorage(_this27.modelManager.allNondummyItems);\n\n case 36:\n return _context107.abrupt(\"return\", _this27.sync({\n performIntegrityCheck: true\n }));\n\n case 37:\n case \"end\":\n return _context107.stop();\n }\n }\n }, _callee106, null, [[4, 20, 24, 32], [25,, 27, 31]]);\n }));\n\n return function (_x141) {\n return _ref25.apply(this, arguments);\n };\n }()));\n\n case 1:\n case \"end\":\n return _context108.stop();\n }\n }\n }, _callee107, this);\n }));\n\n function resolveOutOfSync() {\n return _resolveOutOfSync.apply(this, arguments);\n }\n\n return resolveOutOfSync;\n }()\n }, {\n key: \"handleSignout\",\n value: function () {\n var _handleSignout = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee108() {\n return regeneratorRuntime.wrap(function _callee108$(_context109) {\n while (1) {\n switch (_context109.prev = _context109.next) {\n case 0:\n this.outOfSync = false;\n this.loadLocalDataPromise = null;\n this.performSyncAgainOnCompletion = false;\n this.syncStatus.syncOpInProgress = false;\n this._queuedCallbacks = [];\n this.syncStatus = {};\n return _context109.abrupt(\"return\", this.clearSyncToken());\n\n case 7:\n case \"end\":\n return _context109.stop();\n }\n }\n }, _callee108, this);\n }));\n\n function handleSignout() {\n return _handleSignout.apply(this, arguments);\n }\n\n return handleSignout;\n }()\n }, {\n key: \"clearSyncToken\",\n value: function () {\n var _clearSyncToken = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee109() {\n return regeneratorRuntime.wrap(function _callee109$(_context110) {\n while (1) {\n switch (_context110.prev = _context110.next) {\n case 0:\n this._syncToken = null;\n this._cursorToken = null;\n return _context110.abrupt(\"return\", this.storageManager.removeItem(\"syncToken\"));\n\n case 3:\n case \"end\":\n return _context110.stop();\n }\n }\n }, _callee109, this);\n }));\n\n function clearSyncToken() {\n return _clearSyncToken.apply(this, arguments);\n }\n\n return clearSyncToken;\n }() // Only used by unit test\n\n }, {\n key: \"__setLocalDataNotLoaded\",\n value: function __setLocalDataNotLoaded() {\n this.loadLocalDataPromise = null;\n this._initialDataLoaded = false;\n }\n }, {\n key: \"queuedCallbacks\",\n get: function get() {\n if (!this._queuedCallbacks) {\n this._queuedCallbacks = [];\n }\n\n return this._queuedCallbacks;\n }\n }]);\n\n return SFSyncManager;\n }();\n\n exports.SFSyncManager = SFSyncManager;\n ;\n var dateFormatter;\n\n var SFItem =\n /*#__PURE__*/\n function () {\n function SFItem() {\n var json_obj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n _classCallCheck(this, SFItem);\n\n this.content = {};\n this.referencingObjects = [];\n this.updateFromJSON(json_obj);\n\n if (!this.uuid) {\n // on React Native, this method will not exist. UUID gen will be handled manually via async methods.\n if (typeof SFJS !== \"undefined\" && SFJS.crypto.generateUUIDSync) {\n this.uuid = SFJS.crypto.generateUUIDSync();\n }\n }\n\n if (_typeof(this.content) === 'object' && !this.content.references) {\n this.content.references = [];\n }\n } // On some platforms, syncrounous uuid generation is not available.\n // Those platforms (mobile) must call this function manually.\n\n\n _createClass(SFItem, [{\n key: \"initUUID\",\n value: function () {\n var _initUUID = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee110() {\n return regeneratorRuntime.wrap(function _callee110$(_context111) {\n while (1) {\n switch (_context111.prev = _context111.next) {\n case 0:\n if (this.uuid) {\n _context111.next = 4;\n break;\n }\n\n _context111.next = 3;\n return SFJS.crypto.generateUUID();\n\n case 3:\n this.uuid = _context111.sent;\n\n case 4:\n case \"end\":\n return _context111.stop();\n }\n }\n }, _callee110, this);\n }));\n\n function initUUID() {\n return _initUUID.apply(this, arguments);\n }\n\n return initUUID;\n }()\n }, {\n key: \"updateFromJSON\",\n value: function updateFromJSON(json) {\n // Don't expect this to ever be the case but we're having a crash with Android and this is the only suspect.\n if (!json) {\n return;\n }\n\n this.deleted = json.deleted;\n this.uuid = json.uuid;\n this.enc_item_key = json.enc_item_key;\n this.auth_hash = json.auth_hash;\n this.auth_params = json.auth_params; // When updating from server response (as opposed to local json response), these keys will be missing.\n // So we only want to update these values if they are explicitly present.\n\n var clientKeys = [\"errorDecrypting\", \"dirty\", \"dirtyCount\", \"dirtiedDate\", \"dummy\"];\n\n for (var _i4 = 0, _clientKeys = clientKeys; _i4 < _clientKeys.length; _i4++) {\n var key = _clientKeys[_i4];\n\n if (json[key] !== undefined) {\n this[key] = json[key];\n }\n }\n\n if (this.dirtiedDate && typeof this.dirtiedDate === 'string') {\n this.dirtiedDate = new Date(this.dirtiedDate);\n } // Check if object has getter for content_type, and if so, skip\n\n\n if (!this.content_type) {\n this.content_type = json.content_type;\n } // this.content = json.content will copy it by reference rather than value. So we need to do a deep merge after.\n // json.content can still be a string here. We copy it to this.content, then do a deep merge to transfer over all values.\n\n\n if (json.errorDecrypting) {\n this.content = json.content;\n } else {\n try {\n var parsedContent = typeof json.content === 'string' ? JSON.parse(json.content) : json.content;\n SFItem.deepMerge(this.contentObject, parsedContent);\n } catch (e) {\n console.log(\"Error while updating item from json\", e);\n }\n } // Manually merge top level data instead of wholesale merge\n\n\n if (json.created_at) {\n this.created_at = json.created_at;\n } // Could be null if we're mapping from an extension bridge, where we remove this as its a private property.\n\n\n if (json.updated_at) {\n this.updated_at = json.updated_at;\n }\n\n if (this.created_at) {\n this.created_at = new Date(this.created_at);\n } else {\n this.created_at = new Date();\n }\n\n if (this.updated_at) {\n this.updated_at = new Date(this.updated_at);\n } else {\n this.updated_at = new Date(0);\n } // Epoch\n // Allows the getter to be re-invoked\n\n\n this._client_updated_at = null;\n\n if (json.content) {\n this.mapContentToLocalProperties(this.contentObject);\n } else if (json.deleted == true) {\n this.handleDeletedContent();\n }\n }\n }, {\n key: \"mapContentToLocalProperties\",\n value: function mapContentToLocalProperties(contentObj) {}\n }, {\n key: \"createContentJSONFromProperties\",\n value: function createContentJSONFromProperties() {\n /*\n NOTE: This function does have side effects and WILL modify our content.\n Subclasses will override structureParams, and add their own custom content and properties to the object returned from structureParams\n These are properties that this superclass will not be aware of, like 'title' or 'text'\n When we call createContentJSONFromProperties, we want to update our own inherit 'content' field with the values returned from structureParams,\n so that our content field is up to date.\n Each subclass will call super.structureParams and merge it with its own custom result object.\n Since our own structureParams gets a real-time copy of our content, it should be safe to merge the aggregate value back into our own content field.\n */\n var content = this.structureParams();\n SFItem.deepMerge(this.contentObject, content); // Return the content item copy and not our actual value, as we don't want it to be mutated outside our control.\n\n return content;\n }\n }, {\n key: \"structureParams\",\n value: function structureParams() {\n return this.getContentCopy();\n }\n /* Allows the item to handle the case where the item is deleted and the content is null */\n\n }, {\n key: \"handleDeletedContent\",\n value: function handleDeletedContent() {// Subclasses can override\n }\n }, {\n key: \"setDirty\",\n value: function setDirty(dirty, updateClientDate) {\n this.dirty = dirty; // Allows the syncManager to check if an item has been marked dirty after a sync has been started\n // This prevents it from clearing it as a dirty item after sync completion, if someone else has marked it dirty\n // again after an ongoing sync.\n\n if (!this.dirtyCount) {\n this.dirtyCount = 0;\n }\n\n if (dirty) {\n this.dirtyCount++;\n } else {\n this.dirtyCount = 0;\n } // Used internally by syncManager to determine if a dirted item needs to be saved offline.\n // You want to set this in both cases, when dirty is true and false. If it's false, we still need\n // to save it to disk as an update.\n\n\n this.dirtiedDate = new Date();\n\n if (dirty && updateClientDate) {\n // Set the client modified date to now if marking the item as dirty\n this.client_updated_at = new Date();\n } else if (!this.hasRawClientUpdatedAtValue()) {\n // if we don't have an explcit raw value, we initialize client_updated_at.\n this.client_updated_at = new Date(this.updated_at);\n }\n }\n }, {\n key: \"updateLocalRelationships\",\n value: function updateLocalRelationships() {// optional override\n }\n }, {\n key: \"addItemAsRelationship\",\n value: function addItemAsRelationship(item) {\n item.setIsBeingReferencedBy(this);\n\n if (this.hasRelationshipWithItem(item)) {\n return;\n }\n\n var references = this.content.references || [];\n references.push({\n uuid: item.uuid,\n content_type: item.content_type\n });\n this.content.references = references;\n }\n }, {\n key: \"removeItemAsRelationship\",\n value: function removeItemAsRelationship(item) {\n item.setIsNoLongerBeingReferencedBy(this);\n this.removeReferenceWithUuid(item.uuid);\n } // When another object has a relationship with us, we push that object into memory here.\n // We use this so that when `this` is deleted, we're able to update the references of those other objects.\n\n }, {\n key: \"setIsBeingReferencedBy\",\n value: function setIsBeingReferencedBy(item) {\n if (!_.find(this.referencingObjects, {\n uuid: item.uuid\n })) {\n this.referencingObjects.push(item);\n }\n }\n }, {\n key: \"setIsNoLongerBeingReferencedBy\",\n value: function setIsNoLongerBeingReferencedBy(item) {\n _.remove(this.referencingObjects, {\n uuid: item.uuid\n }); // Legacy two-way relationships should be handled here\n\n\n if (this.hasRelationshipWithItem(item)) {\n this.removeReferenceWithUuid(item.uuid); // We really shouldn't have the authority to set this item as dirty, but it's the only way to save this change.\n\n this.setDirty(true);\n }\n }\n }, {\n key: \"removeReferenceWithUuid\",\n value: function removeReferenceWithUuid(uuid) {\n var references = this.content.references || [];\n references = references.filter(function (r) {\n return r.uuid != uuid;\n });\n this.content.references = references;\n }\n }, {\n key: \"hasRelationshipWithItem\",\n value: function hasRelationshipWithItem(item) {\n var target = this.content.references.find(function (r) {\n return r.uuid == item.uuid;\n });\n return target != null;\n }\n }, {\n key: \"isBeingRemovedLocally\",\n value: function isBeingRemovedLocally() {}\n }, {\n key: \"didFinishSyncing\",\n value: function didFinishSyncing() {}\n }, {\n key: \"informReferencesOfUUIDChange\",\n value: function informReferencesOfUUIDChange(oldUUID, newUUID) {// optional override\n }\n }, {\n key: \"potentialItemOfInterestHasChangedItsUUID\",\n value: function potentialItemOfInterestHasChangedItsUUID(newItem, oldUUID, newUUID) {\n if (this.errorDecrypting) {\n return;\n }\n\n var _iteratorNormalCompletion48 = true;\n var _didIteratorError48 = false;\n var _iteratorError48 = undefined;\n\n try {\n for (var _iterator48 = this.content.references[Symbol.iterator](), _step48; !(_iteratorNormalCompletion48 = (_step48 = _iterator48.next()).done); _iteratorNormalCompletion48 = true) {\n var reference = _step48.value;\n\n if (reference.uuid == oldUUID) {\n reference.uuid = newUUID;\n this.setDirty(true);\n }\n }\n } catch (err) {\n _didIteratorError48 = true;\n _iteratorError48 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion48 && _iterator48[\"return\"] != null) {\n _iterator48[\"return\"]();\n }\n } finally {\n if (_didIteratorError48) {\n throw _iteratorError48;\n }\n }\n }\n }\n }, {\n key: \"doNotEncrypt\",\n value: function doNotEncrypt() {\n return false;\n }\n /*\n App Data\n */\n\n }, {\n key: \"setDomainDataItem\",\n value: function setDomainDataItem(key, value, domain) {\n if (!domain) {\n console.error(\"SFItem.AppDomain needs to be set.\");\n return;\n }\n\n if (this.errorDecrypting) {\n return;\n }\n\n if (!this.content.appData) {\n this.content.appData = {};\n }\n\n var data = this.content.appData[domain];\n\n if (!data) {\n data = {};\n }\n\n data[key] = value;\n this.content.appData[domain] = data;\n }\n }, {\n key: \"getDomainDataItem\",\n value: function getDomainDataItem(key, domain) {\n if (!domain) {\n console.error(\"SFItem.AppDomain needs to be set.\");\n return;\n }\n\n if (this.errorDecrypting) {\n return;\n }\n\n if (!this.content.appData) {\n this.content.appData = {};\n }\n\n var data = this.content.appData[domain];\n\n if (data) {\n return data[key];\n } else {\n return null;\n }\n }\n }, {\n key: \"setAppDataItem\",\n value: function setAppDataItem(key, value) {\n this.setDomainDataItem(key, value, SFItem.AppDomain);\n }\n }, {\n key: \"getAppDataItem\",\n value: function getAppDataItem(key) {\n return this.getDomainDataItem(key, SFItem.AppDomain);\n }\n }, {\n key: \"hasRawClientUpdatedAtValue\",\n value: function hasRawClientUpdatedAtValue() {\n return this.getAppDataItem(\"client_updated_at\") != null;\n }\n }, {\n key: \"keysToIgnoreWhenCheckingContentEquality\",\n\n /*\n During sync conflicts, when determing whether to create a duplicate for an item, we can omit keys that have no\n meaningful weight and can be ignored. For example, if one component has active = true and another component has active = false,\n it would be silly to duplicate them, so instead we ignore this.\n */\n value: function keysToIgnoreWhenCheckingContentEquality() {\n return [];\n } // Same as above, but keys inside appData[Item.AppDomain]\n\n }, {\n key: \"appDataKeysToIgnoreWhenCheckingContentEquality\",\n value: function appDataKeysToIgnoreWhenCheckingContentEquality() {\n return [\"client_updated_at\"];\n }\n }, {\n key: \"getContentCopy\",\n value: function getContentCopy() {\n var contentCopy = JSON.parse(JSON.stringify(this.content));\n return contentCopy;\n }\n }, {\n key: \"isItemContentEqualWith\",\n value: function isItemContentEqualWith(otherItem) {\n return SFItem.AreItemContentsEqual({\n leftContent: this.content,\n rightContent: otherItem.content,\n keysToIgnore: this.keysToIgnoreWhenCheckingContentEquality(),\n appDataKeysToIgnore: this.appDataKeysToIgnoreWhenCheckingContentEquality()\n });\n }\n }, {\n key: \"satisfiesPredicate\",\n value: function satisfiesPredicate(predicate) {\n /*\n Predicate is an SFPredicate having properties:\n {\n keypath: String,\n operator: String,\n value: object\n }\n */\n return SFPredicate.ItemSatisfiesPredicate(this, predicate);\n }\n /*\n Dates\n */\n\n }, {\n key: \"createdAtString\",\n value: function createdAtString() {\n return this.dateToLocalizedString(this.created_at);\n }\n }, {\n key: \"updatedAtString\",\n value: function updatedAtString() {\n return this.dateToLocalizedString(this.client_updated_at);\n }\n }, {\n key: \"updatedAtTimestamp\",\n value: function updatedAtTimestamp() {\n return this.updated_at.getTime();\n }\n }, {\n key: \"dateToLocalizedString\",\n value: function dateToLocalizedString(date) {\n if (typeof Intl !== 'undefined' && Intl.DateTimeFormat) {\n if (!dateFormatter) {\n var locale = navigator.languages && navigator.languages.length ? navigator.languages[0] : navigator.language;\n dateFormatter = new Intl.DateTimeFormat(locale, {\n year: 'numeric',\n month: 'short',\n day: '2-digit',\n weekday: 'long',\n hour: '2-digit',\n minute: '2-digit'\n });\n }\n\n return dateFormatter.format(date);\n } else {\n // IE < 11, Safari <= 9.0.\n // In English, this generates the string most similar to\n // the toLocaleDateString() result above.\n return date.toDateString() + ' ' + date.toLocaleTimeString();\n }\n }\n }, {\n key: \"contentObject\",\n get: function get() {\n if (this.errorDecrypting) {\n return this.content;\n }\n\n if (!this.content) {\n this.content = {};\n return this.content;\n }\n\n if (this.content !== null && _typeof(this.content) === 'object') {\n // this is the case when mapping localStorage content, in which case the content is already parsed\n return this.content;\n }\n\n try {\n var content = JSON.parse(this.content);\n this.content = content;\n return this.content;\n } catch (e) {\n console.log(\"Error parsing json\", e, this);\n this.content = {};\n return this.content;\n }\n }\n }, {\n key: \"pinned\",\n get: function get() {\n return this.getAppDataItem(\"pinned\");\n }\n }, {\n key: \"archived\",\n get: function get() {\n return this.getAppDataItem(\"archived\");\n }\n }, {\n key: \"locked\",\n get: function get() {\n return this.getAppDataItem(\"locked\");\n } // May be used by clients to display the human readable type for this item. Should be overriden by subclasses.\n\n }, {\n key: \"displayName\",\n get: function get() {\n return \"Item\";\n }\n }, {\n key: \"client_updated_at\",\n get: function get() {\n if (!this._client_updated_at) {\n var saved = this.getAppDataItem(\"client_updated_at\");\n\n if (saved) {\n this._client_updated_at = new Date(saved);\n } else {\n this._client_updated_at = new Date(this.updated_at);\n }\n }\n\n return this._client_updated_at;\n },\n set: function set(date) {\n this._client_updated_at = date;\n this.setAppDataItem(\"client_updated_at\", date);\n }\n }], [{\n key: \"deepMerge\",\n value: function deepMerge(a, b) {\n // By default _.merge will not merge a full array with an empty one.\n // We want to replace arrays wholesale\n function mergeCopyArrays(objValue, srcValue) {\n if (_.isArray(objValue)) {\n return srcValue;\n }\n }\n\n _.mergeWith(a, b, mergeCopyArrays);\n\n return a;\n }\n }, {\n key: \"AreItemContentsEqual\",\n value: function AreItemContentsEqual(_ref26) {\n var leftContent = _ref26.leftContent,\n rightContent = _ref26.rightContent,\n keysToIgnore = _ref26.keysToIgnore,\n appDataKeysToIgnore = _ref26.appDataKeysToIgnore;\n\n var omit = function omit(obj, keys) {\n if (!obj) {\n return obj;\n }\n\n var _iteratorNormalCompletion49 = true;\n var _didIteratorError49 = false;\n var _iteratorError49 = undefined;\n\n try {\n for (var _iterator49 = keys[Symbol.iterator](), _step49; !(_iteratorNormalCompletion49 = (_step49 = _iterator49.next()).done); _iteratorNormalCompletion49 = true) {\n var key = _step49.value;\n delete obj[key];\n }\n } catch (err) {\n _didIteratorError49 = true;\n _iteratorError49 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion49 && _iterator49[\"return\"] != null) {\n _iterator49[\"return\"]();\n }\n } finally {\n if (_didIteratorError49) {\n throw _iteratorError49;\n }\n }\n }\n\n return obj;\n }; // Create copies of objects before running omit as not to modify source values directly.\n\n\n leftContent = JSON.parse(JSON.stringify(leftContent));\n\n if (leftContent.appData) {\n omit(leftContent.appData[SFItem.AppDomain], appDataKeysToIgnore);\n }\n\n leftContent = omit(leftContent, keysToIgnore);\n rightContent = JSON.parse(JSON.stringify(rightContent));\n\n if (rightContent.appData) {\n omit(rightContent.appData[SFItem.AppDomain], appDataKeysToIgnore);\n }\n\n rightContent = omit(rightContent, keysToIgnore);\n return JSON.stringify(leftContent) === JSON.stringify(rightContent);\n }\n }]);\n\n return SFItem;\n }();\n\n exports.SFItem = SFItem;\n ;\n\n var SFItemParams =\n /*#__PURE__*/\n function () {\n function SFItemParams(item, keys, auth_params) {\n _classCallCheck(this, SFItemParams);\n\n this.item = item;\n this.keys = keys;\n this.auth_params = auth_params;\n\n if (this.keys && !this.auth_params) {\n throw \"SFItemParams.auth_params must be supplied if supplying keys.\";\n }\n\n if (this.auth_params && !this.auth_params.version) {\n throw \"SFItemParams.auth_params is missing version\";\n }\n }\n\n _createClass(SFItemParams, [{\n key: \"paramsForExportFile\",\n value: function () {\n var _paramsForExportFile = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee111(includeDeleted) {\n var result;\n return regeneratorRuntime.wrap(function _callee111$(_context112) {\n while (1) {\n switch (_context112.prev = _context112.next) {\n case 0:\n this.forExportFile = true;\n\n if (!includeDeleted) {\n _context112.next = 5;\n break;\n }\n\n return _context112.abrupt(\"return\", this.__params());\n\n case 5:\n _context112.next = 7;\n return this.__params();\n\n case 7:\n result = _context112.sent;\n return _context112.abrupt(\"return\", _.omit(result, [\"deleted\"]));\n\n case 9:\n case \"end\":\n return _context112.stop();\n }\n }\n }, _callee111, this);\n }));\n\n function paramsForExportFile(_x142) {\n return _paramsForExportFile.apply(this, arguments);\n }\n\n return paramsForExportFile;\n }()\n }, {\n key: \"paramsForExtension\",\n value: function () {\n var _paramsForExtension = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee112() {\n return regeneratorRuntime.wrap(function _callee112$(_context113) {\n while (1) {\n switch (_context113.prev = _context113.next) {\n case 0:\n return _context113.abrupt(\"return\", this.paramsForExportFile());\n\n case 1:\n case \"end\":\n return _context113.stop();\n }\n }\n }, _callee112, this);\n }));\n\n function paramsForExtension() {\n return _paramsForExtension.apply(this, arguments);\n }\n\n return paramsForExtension;\n }()\n }, {\n key: \"paramsForLocalStorage\",\n value: function () {\n var _paramsForLocalStorage = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee113() {\n return regeneratorRuntime.wrap(function _callee113$(_context114) {\n while (1) {\n switch (_context114.prev = _context114.next) {\n case 0:\n this.additionalFields = [\"dirty\", \"dirtiedDate\", \"errorDecrypting\"];\n this.forExportFile = true;\n return _context114.abrupt(\"return\", this.__params());\n\n case 3:\n case \"end\":\n return _context114.stop();\n }\n }\n }, _callee113, this);\n }));\n\n function paramsForLocalStorage() {\n return _paramsForLocalStorage.apply(this, arguments);\n }\n\n return paramsForLocalStorage;\n }()\n }, {\n key: \"paramsForSync\",\n value: function () {\n var _paramsForSync = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee114() {\n return regeneratorRuntime.wrap(function _callee114$(_context115) {\n while (1) {\n switch (_context115.prev = _context115.next) {\n case 0:\n return _context115.abrupt(\"return\", this.__params());\n\n case 1:\n case \"end\":\n return _context115.stop();\n }\n }\n }, _callee114, this);\n }));\n\n function paramsForSync() {\n return _paramsForSync.apply(this, arguments);\n }\n\n return paramsForSync;\n }()\n }, {\n key: \"__params\",\n value: function () {\n var _params = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee115() {\n var params, doNotEncrypt, encryptedParams;\n return regeneratorRuntime.wrap(function _callee115$(_context116) {\n while (1) {\n switch (_context116.prev = _context116.next) {\n case 0:\n params = {\n uuid: this.item.uuid,\n content_type: this.item.content_type,\n deleted: this.item.deleted,\n created_at: this.item.created_at,\n updated_at: this.item.updated_at\n };\n\n if (this.item.errorDecrypting) {\n _context116.next = 23;\n break;\n } // Items should always be encrypted for export files. Only respect item.doNotEncrypt for remote sync params.\n\n\n doNotEncrypt = this.item.doNotEncrypt() && !this.forExportFile;\n\n if (!(this.keys && !doNotEncrypt)) {\n _context116.next = 11;\n break;\n }\n\n _context116.next = 6;\n return SFJS.itemTransformer.encryptItem(this.item, this.keys, this.auth_params);\n\n case 6:\n encryptedParams = _context116.sent;\n\n _.merge(params, encryptedParams);\n\n if (this.auth_params.version !== \"001\") {\n params.auth_hash = null;\n }\n\n _context116.next = 21;\n break;\n\n case 11:\n if (!this.forExportFile) {\n _context116.next = 15;\n break;\n }\n\n _context116.t0 = this.item.createContentJSONFromProperties();\n _context116.next = 19;\n break;\n\n case 15:\n _context116.next = 17;\n return SFJS.crypto.base64(JSON.stringify(this.item.createContentJSONFromProperties()));\n\n case 17:\n _context116.t1 = _context116.sent;\n _context116.t0 = \"000\" + _context116.t1;\n\n case 19:\n params.content = _context116.t0;\n\n if (!this.forExportFile) {\n params.enc_item_key = null;\n params.auth_hash = null;\n }\n\n case 21:\n _context116.next = 26;\n break;\n\n case 23:\n // Error decrypting, keep \"content\" and related fields as is (and do not try to encrypt, otherwise that would be undefined behavior)\n params.content = this.item.content;\n params.enc_item_key = this.item.enc_item_key;\n params.auth_hash = this.item.auth_hash;\n\n case 26:\n if (this.additionalFields) {\n _.merge(params, _.pick(this.item, this.additionalFields));\n }\n\n return _context116.abrupt(\"return\", params);\n\n case 28:\n case \"end\":\n return _context116.stop();\n }\n }\n }, _callee115, this);\n }));\n\n function __params() {\n return _params.apply(this, arguments);\n }\n\n return __params;\n }()\n }]);\n\n return SFItemParams;\n }();\n\n exports.SFItemParams = SFItemParams;\n ;\n\n var SFPredicate =\n /*#__PURE__*/\n function () {\n function SFPredicate(keypath, operator, value) {\n _classCallCheck(this, SFPredicate);\n\n this.keypath = keypath;\n this.operator = operator;\n this.value = value; // Preprocessing to make predicate evaluation faster.\n // Won't recurse forever, but with arbitrarily large input could get stuck. Hope there are input size limits\n // somewhere else.\n\n if (SFPredicate.IsRecursiveOperator(this.operator)) {\n this.value = this.value.map(SFPredicate.fromArray);\n }\n }\n\n _createClass(SFPredicate, null, [{\n key: \"fromArray\",\n value: function fromArray(array) {\n return new SFPredicate(array[0], array[1], array[2]);\n }\n }, {\n key: \"ObjectSatisfiesPredicate\",\n value: function ObjectSatisfiesPredicate(object, predicate) {\n // Predicates may not always be created using the official constructor\n // so if it's still an array here, convert to object\n if (Array.isArray(predicate)) {\n predicate = this.fromArray(predicate);\n }\n\n if (SFPredicate.IsRecursiveOperator(predicate.operator)) {\n if (predicate.operator === \"and\") {\n var _iteratorNormalCompletion50 = true;\n var _didIteratorError50 = false;\n var _iteratorError50 = undefined;\n\n try {\n for (var _iterator50 = predicate.value[Symbol.iterator](), _step50; !(_iteratorNormalCompletion50 = (_step50 = _iterator50.next()).done); _iteratorNormalCompletion50 = true) {\n var subPredicate = _step50.value;\n\n if (!this.ObjectSatisfiesPredicate(object, subPredicate)) {\n return false;\n }\n }\n } catch (err) {\n _didIteratorError50 = true;\n _iteratorError50 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion50 && _iterator50[\"return\"] != null) {\n _iterator50[\"return\"]();\n }\n } finally {\n if (_didIteratorError50) {\n throw _iteratorError50;\n }\n }\n }\n\n return true;\n }\n\n if (predicate.operator === \"or\") {\n var _iteratorNormalCompletion51 = true;\n var _didIteratorError51 = false;\n var _iteratorError51 = undefined;\n\n try {\n for (var _iterator51 = predicate.value[Symbol.iterator](), _step51; !(_iteratorNormalCompletion51 = (_step51 = _iterator51.next()).done); _iteratorNormalCompletion51 = true) {\n var subPredicate = _step51.value;\n\n if (this.ObjectSatisfiesPredicate(object, subPredicate)) {\n return true;\n }\n }\n } catch (err) {\n _didIteratorError51 = true;\n _iteratorError51 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion51 && _iterator51[\"return\"] != null) {\n _iterator51[\"return\"]();\n }\n } finally {\n if (_didIteratorError51) {\n throw _iteratorError51;\n }\n }\n }\n\n return false;\n }\n }\n\n var predicateValue = predicate.value;\n\n if (typeof predicateValue == 'string' && predicateValue.includes(\".ago\")) {\n predicateValue = this.DateFromString(predicateValue);\n }\n\n var valueAtKeyPath = predicate.keypath.split('.').reduce(function (previous, current) {\n return previous && previous[current];\n }, object);\n var falseyValues = [false, \"\", null, undefined, NaN]; // If the value at keyPath is undefined, either because the property is nonexistent or the value is null.\n\n if (valueAtKeyPath == undefined) {\n if (predicate.operator == \"!=\") {\n return !falseyValues.includes(predicate.value);\n } else {\n return falseyValues.includes(predicate.value);\n }\n }\n\n if (predicate.operator == \"=\") {\n // Use array comparison\n if (Array.isArray(valueAtKeyPath)) {\n return JSON.stringify(valueAtKeyPath) == JSON.stringify(predicateValue);\n } else {\n return valueAtKeyPath == predicateValue;\n }\n } else if (predicate.operator == \"!=\") {\n // Use array comparison\n if (Array.isArray(valueAtKeyPath)) {\n return JSON.stringify(valueAtKeyPath) != JSON.stringify(predicateValue);\n } else {\n return valueAtKeyPath !== predicateValue;\n }\n } else if (predicate.operator == \"<\") {\n return valueAtKeyPath < predicateValue;\n } else if (predicate.operator == \">\") {\n return valueAtKeyPath > predicateValue;\n } else if (predicate.operator == \"<=\") {\n return valueAtKeyPath <= predicateValue;\n } else if (predicate.operator == \">=\") {\n return valueAtKeyPath >= predicateValue;\n } else if (predicate.operator == \"startsWith\") {\n return valueAtKeyPath.startsWith(predicateValue);\n } else if (predicate.operator == \"in\") {\n return predicateValue.indexOf(valueAtKeyPath) != -1;\n } else if (predicate.operator == \"includes\") {\n return this.resolveIncludesPredicate(valueAtKeyPath, predicateValue);\n } else if (predicate.operator == \"matches\") {\n var regex = new RegExp(predicateValue);\n return regex.test(valueAtKeyPath);\n }\n\n return false;\n }\n }, {\n key: \"resolveIncludesPredicate\",\n value: function resolveIncludesPredicate(valueAtKeyPath, predicateValue) {\n // includes can be a string or a predicate (in array form)\n if (typeof predicateValue == 'string') {\n // if string, simply check if the valueAtKeyPath includes the predicate value\n return valueAtKeyPath.includes(predicateValue);\n } else {\n // is a predicate array or predicate object\n var innerPredicate;\n\n if (Array.isArray(predicateValue)) {\n innerPredicate = SFPredicate.fromArray(predicateValue);\n } else {\n innerPredicate = predicateValue;\n }\n\n var _iteratorNormalCompletion52 = true;\n var _didIteratorError52 = false;\n var _iteratorError52 = undefined;\n\n try {\n for (var _iterator52 = valueAtKeyPath[Symbol.iterator](), _step52; !(_iteratorNormalCompletion52 = (_step52 = _iterator52.next()).done); _iteratorNormalCompletion52 = true) {\n var obj = _step52.value;\n\n if (this.ObjectSatisfiesPredicate(obj, innerPredicate)) {\n return true;\n }\n }\n } catch (err) {\n _didIteratorError52 = true;\n _iteratorError52 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion52 && _iterator52[\"return\"] != null) {\n _iterator52[\"return\"]();\n }\n } finally {\n if (_didIteratorError52) {\n throw _iteratorError52;\n }\n }\n }\n\n return false;\n }\n }\n }, {\n key: \"ItemSatisfiesPredicate\",\n value: function ItemSatisfiesPredicate(item, predicate) {\n if (Array.isArray(predicate)) {\n predicate = SFPredicate.fromArray(predicate);\n }\n\n return this.ObjectSatisfiesPredicate(item, predicate);\n }\n }, {\n key: \"ItemSatisfiesPredicates\",\n value: function ItemSatisfiesPredicates(item, predicates) {\n var _iteratorNormalCompletion53 = true;\n var _didIteratorError53 = false;\n var _iteratorError53 = undefined;\n\n try {\n for (var _iterator53 = predicates[Symbol.iterator](), _step53; !(_iteratorNormalCompletion53 = (_step53 = _iterator53.next()).done); _iteratorNormalCompletion53 = true) {\n var predicate = _step53.value;\n\n if (!this.ItemSatisfiesPredicate(item, predicate)) {\n return false;\n }\n }\n } catch (err) {\n _didIteratorError53 = true;\n _iteratorError53 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion53 && _iterator53[\"return\"] != null) {\n _iterator53[\"return\"]();\n }\n } finally {\n if (_didIteratorError53) {\n throw _iteratorError53;\n }\n }\n }\n\n return true;\n }\n }, {\n key: \"DateFromString\",\n value: function DateFromString(string) {\n // x.days.ago, x.hours.ago\n var comps = string.split(\".\");\n var unit = comps[1];\n var date = new Date();\n var offset = parseInt(comps[0]);\n\n if (unit == \"days\") {\n date.setDate(date.getDate() - offset);\n } else if (unit == \"hours\") {\n date.setHours(date.getHours() - offset);\n }\n\n return date;\n }\n }, {\n key: \"IsRecursiveOperator\",\n value: function IsRecursiveOperator(operator) {\n return [\"and\", \"or\"].includes(operator);\n }\n }]);\n\n return SFPredicate;\n }();\n\n exports.SFPredicate = SFPredicate;\n ;\n\n var SFPrivileges =\n /*#__PURE__*/\n function (_SFItem) {\n _inherits(SFPrivileges, _SFItem);\n\n _createClass(SFPrivileges, null, [{\n key: \"contentType\",\n value: function contentType() {\n // It has prefix SN since it was originally imported from SN codebase\n return \"SN|Privileges\";\n }\n }]);\n\n function SFPrivileges(json_obj) {\n var _this28;\n\n _classCallCheck(this, SFPrivileges);\n\n _this28 = _possibleConstructorReturn(this, _getPrototypeOf(SFPrivileges).call(this, json_obj));\n\n if (!_this28.content.desktopPrivileges) {\n _this28.content.desktopPrivileges = {};\n }\n\n return _this28;\n }\n\n _createClass(SFPrivileges, [{\n key: \"setCredentialsForAction\",\n value: function setCredentialsForAction(action, credentials) {\n this.content.desktopPrivileges[action] = credentials;\n }\n }, {\n key: \"getCredentialsForAction\",\n value: function getCredentialsForAction(action) {\n return this.content.desktopPrivileges[action] || [];\n }\n }, {\n key: \"toggleCredentialForAction\",\n value: function toggleCredentialForAction(action, credential) {\n if (this.isCredentialRequiredForAction(action, credential)) {\n this.removeCredentialForAction(action, credential);\n } else {\n this.addCredentialForAction(action, credential);\n }\n }\n }, {\n key: \"removeCredentialForAction\",\n value: function removeCredentialForAction(action, credential) {\n _.pull(this.content.desktopPrivileges[action], credential);\n }\n }, {\n key: \"addCredentialForAction\",\n value: function addCredentialForAction(action, credential) {\n var credentials = this.getCredentialsForAction(action);\n credentials.push(credential);\n this.setCredentialsForAction(action, credentials);\n }\n }, {\n key: \"isCredentialRequiredForAction\",\n value: function isCredentialRequiredForAction(action, credential) {\n var credentialsRequired = this.getCredentialsForAction(action);\n return credentialsRequired.includes(credential);\n }\n }]);\n\n return SFPrivileges;\n }(SFItem);\n\n exports.SFPrivileges = SFPrivileges;\n ;\n /*\n Important: This is the only object in the session history domain that is persistable.\n A history session contains one main content object:\n the itemUUIDToItemHistoryMapping. This is a dictionary whose keys are item uuids,\n and each value is an SFItemHistory object.\n Each SFItemHistory object contains an array called `entires` which contain `SFItemHistory` entries (or subclasses, if the\n `SFItemHistory.HistoryEntryClassMapping` class property value is set.)\n */\n // See default class values at bottom of this file, including `SFHistorySession.LargeItemEntryAmountThreshold`.\n\n var SFHistorySession =\n /*#__PURE__*/\n function (_SFItem2) {\n _inherits(SFHistorySession, _SFItem2);\n\n function SFHistorySession(json_obj) {\n var _this29;\n\n _classCallCheck(this, SFHistorySession);\n\n _this29 = _possibleConstructorReturn(this, _getPrototypeOf(SFHistorySession).call(this, json_obj));\n /*\n Our .content params:\n {\n itemUUIDToItemHistoryMapping\n }\n */\n\n if (!_this29.content.itemUUIDToItemHistoryMapping) {\n _this29.content.itemUUIDToItemHistoryMapping = {};\n } // When initializing from a json_obj, we want to deserialize the item history JSON into SFItemHistory objects.\n\n\n var uuids = Object.keys(_this29.content.itemUUIDToItemHistoryMapping);\n uuids.forEach(function (itemUUID) {\n var itemHistory = _this29.content.itemUUIDToItemHistoryMapping[itemUUID];\n _this29.content.itemUUIDToItemHistoryMapping[itemUUID] = new SFItemHistory(itemHistory);\n });\n return _this29;\n }\n\n _createClass(SFHistorySession, [{\n key: \"addEntryForItem\",\n value: function addEntryForItem(item) {\n var itemHistory = this.historyForItem(item);\n var entry = itemHistory.addHistoryEntryForItem(item);\n return entry;\n }\n }, {\n key: \"historyForItem\",\n value: function historyForItem(item) {\n var history = this.content.itemUUIDToItemHistoryMapping[item.uuid];\n\n if (!history) {\n history = this.content.itemUUIDToItemHistoryMapping[item.uuid] = new SFItemHistory();\n }\n\n return history;\n }\n }, {\n key: \"clearItemHistory\",\n value: function clearItemHistory(item) {\n this.historyForItem(item).clear();\n }\n }, {\n key: \"clearAllHistory\",\n value: function clearAllHistory() {\n this.content.itemUUIDToItemHistoryMapping = {};\n }\n }, {\n key: \"optimizeHistoryForItem\",\n value: function optimizeHistoryForItem(item) {\n // Clean up if there are too many revisions. Note SFHistorySession.LargeItemEntryAmountThreshold is the amount of revisions which above, call\n // for an optimization. An optimization may not remove entries above this threshold. It will determine what it should keep and what it shouldn't.\n // So, it is possible to have a threshold of 60 but have 600 entries, if the item history deems those worth keeping.\n var itemHistory = this.historyForItem(item);\n\n if (itemHistory.entries.length > SFHistorySession.LargeItemEntryAmountThreshold) {\n itemHistory.optimize();\n }\n }\n }]);\n\n return SFHistorySession;\n }(SFItem); // See comment in `this.optimizeHistoryForItem`\n\n\n exports.SFHistorySession = SFHistorySession;\n SFHistorySession.LargeItemEntryAmountThreshold = 60;\n ; // See default class values at bottom of this file, including `SFItemHistory.LargeEntryDeltaThreshold`.\n\n var SFItemHistory =\n /*#__PURE__*/\n function () {\n function SFItemHistory() {\n var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n _classCallCheck(this, SFItemHistory);\n\n if (!this.entries) {\n this.entries = [];\n } // Deserialize the entries into entry objects.\n\n\n if (params.entries) {\n var _iteratorNormalCompletion54 = true;\n var _didIteratorError54 = false;\n var _iteratorError54 = undefined;\n\n try {\n for (var _iterator54 = params.entries[Symbol.iterator](), _step54; !(_iteratorNormalCompletion54 = (_step54 = _iterator54.next()).done); _iteratorNormalCompletion54 = true) {\n var entryParams = _step54.value;\n var entry = this.createEntryForItem(entryParams.item);\n entry.setPreviousEntry(this.getLastEntry());\n this.entries.push(entry);\n }\n } catch (err) {\n _didIteratorError54 = true;\n _iteratorError54 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion54 && _iterator54[\"return\"] != null) {\n _iterator54[\"return\"]();\n }\n } finally {\n if (_didIteratorError54) {\n throw _iteratorError54;\n }\n }\n }\n }\n }\n\n _createClass(SFItemHistory, [{\n key: \"createEntryForItem\",\n value: function createEntryForItem(item) {\n var historyItemClass = SFItemHistory.HistoryEntryClassMapping && SFItemHistory.HistoryEntryClassMapping[item.content_type];\n\n if (!historyItemClass) {\n historyItemClass = SFItemHistoryEntry;\n }\n\n var entry = new historyItemClass(item);\n return entry;\n }\n }, {\n key: \"getLastEntry\",\n value: function getLastEntry() {\n return this.entries[this.entries.length - 1];\n }\n }, {\n key: \"addHistoryEntryForItem\",\n value: function addHistoryEntryForItem(item) {\n var prospectiveEntry = this.createEntryForItem(item);\n var previousEntry = this.getLastEntry();\n prospectiveEntry.setPreviousEntry(previousEntry); // Don't add first revision if text length is 0, as this means it's a new note.\n // Actually, nevermind. If we do this, the first character added to a new note\n // will be displayed as \"1 characters loaded\".\n // if(!previousRevision && prospectiveRevision.textCharDiffLength == 0) {\n // return;\n // }\n // Don't add if text is the same\n\n if (prospectiveEntry.isSameAsEntry(previousEntry)) {\n return;\n }\n\n this.entries.push(prospectiveEntry);\n return prospectiveEntry;\n }\n }, {\n key: \"clear\",\n value: function clear() {\n this.entries.length = 0;\n }\n }, {\n key: \"optimize\",\n value: function optimize() {\n var _this30 = this;\n\n var keepEntries = [];\n\n var isEntrySignificant = function isEntrySignificant(entry) {\n return entry.deltaSize() > SFItemHistory.LargeEntryDeltaThreshold;\n };\n\n var processEntry = function processEntry(entry, index, keep) {\n // Entries may be processed retrospectively, meaning it can be decided to be deleted, then an upcoming processing can change that.\n if (keep) {\n keepEntries.push(entry);\n } else {\n // Remove if in keep\n var index = keepEntries.indexOf(entry);\n\n if (index !== -1) {\n keepEntries.splice(index, 1);\n }\n }\n\n if (keep && isEntrySignificant(entry) && entry.operationVector() == -1) {\n // This is a large negative change. Hang on to the previous entry.\n var previousEntry = _this30.entries[index - 1];\n\n if (previousEntry) {\n keepEntries.push(previousEntry);\n }\n }\n };\n\n this.entries.forEach(function (entry, index) {\n if (index == 0 || index == _this30.entries.length - 1) {\n // Keep the first and last\n processEntry(entry, index, true);\n } else {\n var significant = isEntrySignificant(entry);\n processEntry(entry, index, significant);\n }\n });\n this.entries = this.entries.filter(function (entry, index) {\n return keepEntries.indexOf(entry) !== -1;\n });\n }\n }]);\n\n return SFItemHistory;\n }(); // The amount of characters added or removed that constitute a keepable entry after optimization.\n\n\n exports.SFItemHistory = SFItemHistory;\n SFItemHistory.LargeEntryDeltaThreshold = 15;\n ;\n\n var SFItemHistoryEntry =\n /*#__PURE__*/\n function () {\n function SFItemHistoryEntry(item) {\n _classCallCheck(this, SFItemHistoryEntry); // Whatever values `item` has will be persisted, so be sure that the values are picked beforehand.\n\n\n this.item = SFItem.deepMerge({}, item); // We'll assume a `text` content value to diff on. If it doesn't exist, no problem.\n\n this.defaultContentKeyToDiffOn = \"text\"; // Default value\n\n this.textCharDiffLength = 0;\n\n if (typeof this.item.updated_at == 'string') {\n this.item.updated_at = new Date(this.item.updated_at);\n }\n }\n\n _createClass(SFItemHistoryEntry, [{\n key: \"setPreviousEntry\",\n value: function setPreviousEntry(previousEntry) {\n this.hasPreviousEntry = previousEntry != null; // we'll try to compute the delta based on an assumed content property of `text`, if it exists.\n\n if (this.item.content[this.defaultContentKeyToDiffOn]) {\n if (previousEntry) {\n this.textCharDiffLength = this.item.content[this.defaultContentKeyToDiffOn].length - previousEntry.item.content[this.defaultContentKeyToDiffOn].length;\n } else {\n this.textCharDiffLength = this.item.content[this.defaultContentKeyToDiffOn].length;\n }\n }\n }\n }, {\n key: \"operationVector\",\n value: function operationVector() {\n // We'll try to use the value of `textCharDiffLength` to help determine this, if it's set\n if (this.textCharDiffLength != undefined) {\n if (!this.hasPreviousEntry || this.textCharDiffLength == 0) {\n return 0;\n } else if (this.textCharDiffLength < 0) {\n return -1;\n } else {\n return 1;\n }\n } // Otherwise use a default value of 1\n\n\n return 1;\n }\n }, {\n key: \"deltaSize\",\n value: function deltaSize() {\n // Up to the subclass to determine how large the delta was, i.e number of characters changed.\n // But this general class won't be able to determine which property it should diff on, or even its format.\n // We can return the `textCharDiffLength` if it's set, otherwise, just return 1;\n if (this.textCharDiffLength != undefined) {\n return Math.abs(this.textCharDiffLength);\n } // Otherwise return 1 here to constitute a basic positive delta.\n // The value returned should always be positive. override `operationVector` to return the direction of the delta.\n\n\n return 1;\n }\n }, {\n key: \"isSameAsEntry\",\n value: function isSameAsEntry(entry) {\n if (!entry) {\n return false;\n }\n\n var lhs = new SFItem(this.item);\n var rhs = new SFItem(entry.item);\n return lhs.isItemContentEqualWith(rhs);\n }\n }]);\n\n return SFItemHistoryEntry;\n }();\n\n exports.SFItemHistoryEntry = SFItemHistoryEntry;\n ;\n /*\n Abstract class with default implementations of some crypto functions.\n Instantiate an instance of either SFCryptoJS (uses cryptojs) or SFCryptoWeb (uses web crypto)\n These subclasses may override some of the functions in this abstract class.\n */\n\n var globalScope = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : null;\n\n var SFAbstractCrypto =\n /*#__PURE__*/\n function () {\n function SFAbstractCrypto() {\n _classCallCheck(this, SFAbstractCrypto);\n\n this.DefaultPBKDF2Length = 768;\n }\n\n _createClass(SFAbstractCrypto, [{\n key: \"generateUUIDSync\",\n value: function generateUUIDSync() {\n var crypto = globalScope.crypto || globalScope.msCrypto;\n\n if (crypto) {\n var buf = new Uint32Array(4);\n crypto.getRandomValues(buf);\n var idx = -1;\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {\n idx++;\n var r = buf[idx >> 3] >> idx % 8 * 4 & 15;\n var v = c == 'x' ? r : r & 0x3 | 0x8;\n return v.toString(16);\n });\n } else {\n var d = new Date().getTime();\n\n if (globalScope.performance && typeof globalScope.performance.now === \"function\") {\n d += performance.now(); //use high-precision timer if available\n }\n\n var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {\n var r = (d + Math.random() * 16) % 16 | 0;\n d = Math.floor(d / 16);\n return (c == 'x' ? r : r & 0x3 | 0x8).toString(16);\n });\n return uuid;\n }\n }\n }, {\n key: \"generateUUID\",\n value: function () {\n var _generateUUID = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee116() {\n return regeneratorRuntime.wrap(function _callee116$(_context117) {\n while (1) {\n switch (_context117.prev = _context117.next) {\n case 0:\n return _context117.abrupt(\"return\", this.generateUUIDSync());\n\n case 1:\n case \"end\":\n return _context117.stop();\n }\n }\n }, _callee116, this);\n }));\n\n function generateUUID() {\n return _generateUUID.apply(this, arguments);\n }\n\n return generateUUID;\n }()\n /* Constant-time string comparison */\n\n }, {\n key: \"timingSafeEqual\",\n value: function timingSafeEqual(a, b) {\n var strA = String(a);\n var strB = String(b);\n var lenA = strA.length;\n var result = 0;\n\n if (lenA !== strB.length) {\n strB = strA;\n result = 1;\n }\n\n for (var i = 0; i < lenA; i++) {\n result |= strA.charCodeAt(i) ^ strB.charCodeAt(i);\n }\n\n return result === 0;\n }\n }, {\n key: \"decryptText\",\n value: function () {\n var _decryptText = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee117() {\n var _ref27,\n ciphertextToAuth,\n contentCiphertext,\n encryptionKey,\n iv,\n authHash,\n authKey,\n requiresAuth,\n localAuthHash,\n keyData,\n ivData,\n decrypted,\n _args118 = arguments;\n\n return regeneratorRuntime.wrap(function _callee117$(_context118) {\n while (1) {\n switch (_context118.prev = _context118.next) {\n case 0:\n _ref27 = _args118.length > 0 && _args118[0] !== undefined ? _args118[0] : {}, ciphertextToAuth = _ref27.ciphertextToAuth, contentCiphertext = _ref27.contentCiphertext, encryptionKey = _ref27.encryptionKey, iv = _ref27.iv, authHash = _ref27.authHash, authKey = _ref27.authKey;\n requiresAuth = _args118.length > 1 ? _args118[1] : undefined;\n\n if (!(requiresAuth && !authHash)) {\n _context118.next = 5;\n break;\n }\n\n console.error(\"Auth hash is required.\");\n return _context118.abrupt(\"return\");\n\n case 5:\n if (!authHash) {\n _context118.next = 12;\n break;\n }\n\n _context118.next = 8;\n return this.hmac256(ciphertextToAuth, authKey);\n\n case 8:\n localAuthHash = _context118.sent;\n\n if (!(this.timingSafeEqual(authHash, localAuthHash) === false)) {\n _context118.next = 12;\n break;\n }\n\n console.error(\"Auth hash does not match, returning null.\");\n return _context118.abrupt(\"return\", null);\n\n case 12:\n keyData = CryptoJS.enc.Hex.parse(encryptionKey);\n ivData = CryptoJS.enc.Hex.parse(iv || \"\");\n decrypted = CryptoJS.AES.decrypt(contentCiphertext, keyData, {\n iv: ivData,\n mode: CryptoJS.mode.CBC,\n padding: CryptoJS.pad.Pkcs7\n });\n return _context118.abrupt(\"return\", decrypted.toString(CryptoJS.enc.Utf8));\n\n case 16:\n case \"end\":\n return _context118.stop();\n }\n }\n }, _callee117, this);\n }));\n\n function decryptText() {\n return _decryptText.apply(this, arguments);\n }\n\n return decryptText;\n }()\n }, {\n key: \"encryptText\",\n value: function () {\n var _encryptText = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee118(text, key, iv) {\n var keyData, ivData, encrypted;\n return regeneratorRuntime.wrap(function _callee118$(_context119) {\n while (1) {\n switch (_context119.prev = _context119.next) {\n case 0:\n keyData = CryptoJS.enc.Hex.parse(key);\n ivData = CryptoJS.enc.Hex.parse(iv || \"\");\n encrypted = CryptoJS.AES.encrypt(text, keyData, {\n iv: ivData,\n mode: CryptoJS.mode.CBC,\n padding: CryptoJS.pad.Pkcs7\n });\n return _context119.abrupt(\"return\", encrypted.toString());\n\n case 4:\n case \"end\":\n return _context119.stop();\n }\n }\n }, _callee118);\n }));\n\n function encryptText(_x143, _x144, _x145) {\n return _encryptText.apply(this, arguments);\n }\n\n return encryptText;\n }()\n }, {\n key: \"generateRandomKey\",\n value: function () {\n var _generateRandomKey = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee119(bits) {\n return regeneratorRuntime.wrap(function _callee119$(_context120) {\n while (1) {\n switch (_context120.prev = _context120.next) {\n case 0:\n return _context120.abrupt(\"return\", CryptoJS.lib.WordArray.random(bits / 8).toString());\n\n case 1:\n case \"end\":\n return _context120.stop();\n }\n }\n }, _callee119);\n }));\n\n function generateRandomKey(_x146) {\n return _generateRandomKey.apply(this, arguments);\n }\n\n return generateRandomKey;\n }()\n }, {\n key: \"generateItemEncryptionKey\",\n value: function () {\n var _generateItemEncryptionKey = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee120() {\n var length, cost, salt, passphrase;\n return regeneratorRuntime.wrap(function _callee120$(_context121) {\n while (1) {\n switch (_context121.prev = _context121.next) {\n case 0:\n // Generates a key that will be split in half, each being 256 bits. So total length will need to be 512.\n length = 512;\n cost = 1;\n _context121.next = 4;\n return this.generateRandomKey(length);\n\n case 4:\n salt = _context121.sent;\n _context121.next = 7;\n return this.generateRandomKey(length);\n\n case 7:\n passphrase = _context121.sent;\n return _context121.abrupt(\"return\", this.pbkdf2(passphrase, salt, cost, length));\n\n case 9:\n case \"end\":\n return _context121.stop();\n }\n }\n }, _callee120, this);\n }));\n\n function generateItemEncryptionKey() {\n return _generateItemEncryptionKey.apply(this, arguments);\n }\n\n return generateItemEncryptionKey;\n }()\n }, {\n key: \"firstHalfOfKey\",\n value: function () {\n var _firstHalfOfKey = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee121(key) {\n return regeneratorRuntime.wrap(function _callee121$(_context122) {\n while (1) {\n switch (_context122.prev = _context122.next) {\n case 0:\n return _context122.abrupt(\"return\", key.substring(0, key.length / 2));\n\n case 1:\n case \"end\":\n return _context122.stop();\n }\n }\n }, _callee121);\n }));\n\n function firstHalfOfKey(_x147) {\n return _firstHalfOfKey.apply(this, arguments);\n }\n\n return firstHalfOfKey;\n }()\n }, {\n key: \"secondHalfOfKey\",\n value: function () {\n var _secondHalfOfKey = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee122(key) {\n return regeneratorRuntime.wrap(function _callee122$(_context123) {\n while (1) {\n switch (_context123.prev = _context123.next) {\n case 0:\n return _context123.abrupt(\"return\", key.substring(key.length / 2, key.length));\n\n case 1:\n case \"end\":\n return _context123.stop();\n }\n }\n }, _callee122);\n }));\n\n function secondHalfOfKey(_x148) {\n return _secondHalfOfKey.apply(this, arguments);\n }\n\n return secondHalfOfKey;\n }()\n }, {\n key: \"base64\",\n value: function () {\n var _base = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee123(text) {\n return regeneratorRuntime.wrap(function _callee123$(_context124) {\n while (1) {\n switch (_context124.prev = _context124.next) {\n case 0:\n return _context124.abrupt(\"return\", globalScope.btoa(encodeURIComponent(text).replace(/%([0-9A-F]{2})/g, function toSolidBytes(match, p1) {\n return String.fromCharCode('0x' + p1);\n })));\n\n case 1:\n case \"end\":\n return _context124.stop();\n }\n }\n }, _callee123);\n }));\n\n function base64(_x149) {\n return _base.apply(this, arguments);\n }\n\n return base64;\n }()\n }, {\n key: \"base64Decode\",\n value: function () {\n var _base64Decode = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee124(base64String) {\n return regeneratorRuntime.wrap(function _callee124$(_context125) {\n while (1) {\n switch (_context125.prev = _context125.next) {\n case 0:\n return _context125.abrupt(\"return\", globalScope.atob(base64String));\n\n case 1:\n case \"end\":\n return _context125.stop();\n }\n }\n }, _callee124);\n }));\n\n function base64Decode(_x150) {\n return _base64Decode.apply(this, arguments);\n }\n\n return base64Decode;\n }()\n }, {\n key: \"sha256\",\n value: function () {\n var _sha = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee125(text) {\n return regeneratorRuntime.wrap(function _callee125$(_context126) {\n while (1) {\n switch (_context126.prev = _context126.next) {\n case 0:\n return _context126.abrupt(\"return\", CryptoJS.SHA256(text).toString());\n\n case 1:\n case \"end\":\n return _context126.stop();\n }\n }\n }, _callee125);\n }));\n\n function sha256(_x151) {\n return _sha.apply(this, arguments);\n }\n\n return sha256;\n }()\n }, {\n key: \"hmac256\",\n value: function () {\n var _hmac = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee126(message, key) {\n var keyData, messageData, result;\n return regeneratorRuntime.wrap(function _callee126$(_context127) {\n while (1) {\n switch (_context127.prev = _context127.next) {\n case 0:\n keyData = CryptoJS.enc.Hex.parse(key);\n messageData = CryptoJS.enc.Utf8.parse(message);\n result = CryptoJS.HmacSHA256(messageData, keyData).toString();\n return _context127.abrupt(\"return\", result);\n\n case 4:\n case \"end\":\n return _context127.stop();\n }\n }\n }, _callee126);\n }));\n\n function hmac256(_x152, _x153) {\n return _hmac.apply(this, arguments);\n }\n\n return hmac256;\n }()\n }, {\n key: \"generateSalt\",\n value: function () {\n var _generateSalt = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee127(identifier, version, cost, nonce) {\n var result;\n return regeneratorRuntime.wrap(function _callee127$(_context128) {\n while (1) {\n switch (_context128.prev = _context128.next) {\n case 0:\n _context128.next = 2;\n return this.sha256([identifier, \"SF\", version, cost, nonce].join(\":\"));\n\n case 2:\n result = _context128.sent;\n return _context128.abrupt(\"return\", result);\n\n case 4:\n case \"end\":\n return _context128.stop();\n }\n }\n }, _callee127, this);\n }));\n\n function generateSalt(_x154, _x155, _x156, _x157) {\n return _generateSalt.apply(this, arguments);\n }\n\n return generateSalt;\n }()\n /** Generates two deterministic keys based on one input */\n\n }, {\n key: \"generateSymmetricKeyPair\",\n value: function () {\n var _generateSymmetricKeyPair = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee128() {\n var _ref28,\n password,\n pw_salt,\n pw_cost,\n output,\n outputLength,\n splitLength,\n firstThird,\n secondThird,\n thirdThird,\n _args129 = arguments;\n\n return regeneratorRuntime.wrap(function _callee128$(_context129) {\n while (1) {\n switch (_context129.prev = _context129.next) {\n case 0:\n _ref28 = _args129.length > 0 && _args129[0] !== undefined ? _args129[0] : {}, password = _ref28.password, pw_salt = _ref28.pw_salt, pw_cost = _ref28.pw_cost;\n _context129.next = 3;\n return this.pbkdf2(password, pw_salt, pw_cost, this.DefaultPBKDF2Length);\n\n case 3:\n output = _context129.sent;\n outputLength = output.length;\n splitLength = outputLength / 3;\n firstThird = output.slice(0, splitLength);\n secondThird = output.slice(splitLength, splitLength * 2);\n thirdThird = output.slice(splitLength * 2, splitLength * 3);\n return _context129.abrupt(\"return\", [firstThird, secondThird, thirdThird]);\n\n case 10:\n case \"end\":\n return _context129.stop();\n }\n }\n }, _callee128, this);\n }));\n\n function generateSymmetricKeyPair() {\n return _generateSymmetricKeyPair.apply(this, arguments);\n }\n\n return generateSymmetricKeyPair;\n }()\n }, {\n key: \"computeEncryptionKeysForUser\",\n value: function () {\n var _computeEncryptionKeysForUser = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee129(password, authParams) {\n var pw_salt;\n return regeneratorRuntime.wrap(function _callee129$(_context130) {\n while (1) {\n switch (_context130.prev = _context130.next) {\n case 0:\n if (!(authParams.version == \"003\")) {\n _context130.next = 9;\n break;\n }\n\n if (authParams.identifier) {\n _context130.next = 4;\n break;\n }\n\n console.error(\"authParams is missing identifier.\");\n return _context130.abrupt(\"return\");\n\n case 4:\n _context130.next = 6;\n return this.generateSalt(authParams.identifier, authParams.version, authParams.pw_cost, authParams.pw_nonce);\n\n case 6:\n pw_salt = _context130.sent;\n _context130.next = 10;\n break;\n\n case 9:\n // Salt is returned from server\n pw_salt = authParams.pw_salt;\n\n case 10:\n return _context130.abrupt(\"return\", this.generateSymmetricKeyPair({\n password: password,\n pw_salt: pw_salt,\n pw_cost: authParams.pw_cost\n }).then(function (keys) {\n var userKeys = {\n pw: keys[0],\n mk: keys[1],\n ak: keys[2]\n };\n return userKeys;\n }));\n\n case 11:\n case \"end\":\n return _context130.stop();\n }\n }\n }, _callee129, this);\n }));\n\n function computeEncryptionKeysForUser(_x158, _x159) {\n return _computeEncryptionKeysForUser.apply(this, arguments);\n }\n\n return computeEncryptionKeysForUser;\n }() // Unlike computeEncryptionKeysForUser, this method always uses the latest SF Version\n\n }, {\n key: \"generateInitialKeysAndAuthParamsForUser\",\n value: function () {\n var _generateInitialKeysAndAuthParamsForUser = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee130(identifier, password) {\n var version, pw_cost, pw_nonce, pw_salt;\n return regeneratorRuntime.wrap(function _callee130$(_context131) {\n while (1) {\n switch (_context131.prev = _context131.next) {\n case 0:\n version = this.SFJS.version;\n pw_cost = this.SFJS.defaultPasswordGenerationCost;\n _context131.next = 4;\n return this.generateRandomKey(256);\n\n case 4:\n pw_nonce = _context131.sent;\n _context131.next = 7;\n return this.generateSalt(identifier, version, pw_cost, pw_nonce);\n\n case 7:\n pw_salt = _context131.sent;\n return _context131.abrupt(\"return\", this.generateSymmetricKeyPair({\n password: password,\n pw_salt: pw_salt,\n pw_cost: pw_cost\n }).then(function (keys) {\n var authParams = {\n pw_nonce: pw_nonce,\n pw_cost: pw_cost,\n identifier: identifier,\n version: version\n };\n var userKeys = {\n pw: keys[0],\n mk: keys[1],\n ak: keys[2]\n };\n return {\n keys: userKeys,\n authParams: authParams\n };\n }));\n\n case 9:\n case \"end\":\n return _context131.stop();\n }\n }\n }, _callee130, this);\n }));\n\n function generateInitialKeysAndAuthParamsForUser(_x160, _x161) {\n return _generateInitialKeysAndAuthParamsForUser.apply(this, arguments);\n }\n\n return generateInitialKeysAndAuthParamsForUser;\n }()\n }]);\n\n return SFAbstractCrypto;\n }();\n\n exports.SFAbstractCrypto = SFAbstractCrypto;\n ;\n\n var SFCryptoJS =\n /*#__PURE__*/\n function (_SFAbstractCrypto) {\n _inherits(SFCryptoJS, _SFAbstractCrypto);\n\n function SFCryptoJS() {\n _classCallCheck(this, SFCryptoJS);\n\n return _possibleConstructorReturn(this, _getPrototypeOf(SFCryptoJS).apply(this, arguments));\n }\n\n _createClass(SFCryptoJS, [{\n key: \"pbkdf2\",\n value: function () {\n var _pbkdf = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee131(password, pw_salt, pw_cost, length) {\n var params;\n return regeneratorRuntime.wrap(function _callee131$(_context132) {\n while (1) {\n switch (_context132.prev = _context132.next) {\n case 0:\n params = {\n keySize: length / 32,\n hasher: CryptoJS.algo.SHA512,\n iterations: pw_cost\n };\n return _context132.abrupt(\"return\", CryptoJS.PBKDF2(password, pw_salt, params).toString());\n\n case 2:\n case \"end\":\n return _context132.stop();\n }\n }\n }, _callee131);\n }));\n\n function pbkdf2(_x162, _x163, _x164, _x165) {\n return _pbkdf.apply(this, arguments);\n }\n\n return pbkdf2;\n }()\n }]);\n\n return SFCryptoJS;\n }(SFAbstractCrypto);\n\n exports.SFCryptoJS = SFCryptoJS;\n ;\n var globalScope = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : null;\n var subtleCrypto = globalScope.crypto ? globalScope.crypto.subtle : null;\n\n var SFCryptoWeb =\n /*#__PURE__*/\n function (_SFAbstractCrypto2) {\n _inherits(SFCryptoWeb, _SFAbstractCrypto2);\n\n function SFCryptoWeb() {\n _classCallCheck(this, SFCryptoWeb);\n\n return _possibleConstructorReturn(this, _getPrototypeOf(SFCryptoWeb).apply(this, arguments));\n }\n\n _createClass(SFCryptoWeb, [{\n key: \"pbkdf2\",\n\n /**\n Public\n */\n value: function () {\n var _pbkdf2 = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee132(password, pw_salt, pw_cost, length) {\n var key;\n return regeneratorRuntime.wrap(function _callee132$(_context133) {\n while (1) {\n switch (_context133.prev = _context133.next) {\n case 0:\n _context133.next = 2;\n return this.webCryptoImportKey(password, \"PBKDF2\", [\"deriveBits\"]);\n\n case 2:\n key = _context133.sent;\n\n if (key) {\n _context133.next = 6;\n break;\n }\n\n console.log(\"Key is null, unable to continue\");\n return _context133.abrupt(\"return\", null);\n\n case 6:\n return _context133.abrupt(\"return\", this.webCryptoDeriveBits(key, pw_salt, pw_cost, length));\n\n case 7:\n case \"end\":\n return _context133.stop();\n }\n }\n }, _callee132, this);\n }));\n\n function pbkdf2(_x166, _x167, _x168, _x169) {\n return _pbkdf2.apply(this, arguments);\n }\n\n return pbkdf2;\n }()\n }, {\n key: \"generateRandomKey\",\n value: function () {\n var _generateRandomKey2 = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee134(bits) {\n var _this31 = this;\n\n var extractable;\n return regeneratorRuntime.wrap(function _callee134$(_context135) {\n while (1) {\n switch (_context135.prev = _context135.next) {\n case 0:\n extractable = true;\n return _context135.abrupt(\"return\", subtleCrypto.generateKey({\n name: \"AES-CBC\",\n length: bits\n }, extractable, [\"encrypt\", \"decrypt\"]).then(function (keyObject) {\n return subtleCrypto.exportKey(\"raw\", keyObject).then(\n /*#__PURE__*/\n function () {\n var _ref29 = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee133(keyData) {\n var key;\n return regeneratorRuntime.wrap(function _callee133$(_context134) {\n while (1) {\n switch (_context134.prev = _context134.next) {\n case 0:\n _context134.next = 2;\n return _this31.arrayBufferToHexString(new Uint8Array(keyData));\n\n case 2:\n key = _context134.sent;\n return _context134.abrupt(\"return\", key);\n\n case 4:\n case \"end\":\n return _context134.stop();\n }\n }\n }, _callee133);\n }));\n\n return function (_x171) {\n return _ref29.apply(this, arguments);\n };\n }())[\"catch\"](function (err) {\n console.error(\"Error exporting key\", err);\n });\n })[\"catch\"](function (err) {\n console.error(\"Error generating key\", err);\n }));\n\n case 2:\n case \"end\":\n return _context135.stop();\n }\n }\n }, _callee134);\n }));\n\n function generateRandomKey(_x170) {\n return _generateRandomKey2.apply(this, arguments);\n }\n\n return generateRandomKey;\n }()\n }, {\n key: \"generateItemEncryptionKey\",\n value: function () {\n var _generateItemEncryptionKey2 = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee135() {\n var length;\n return regeneratorRuntime.wrap(function _callee135$(_context136) {\n while (1) {\n switch (_context136.prev = _context136.next) {\n case 0:\n // Generates a key that will be split in half, each being 256 bits. So total length will need to be 512.\n length = 256;\n return _context136.abrupt(\"return\", Promise.all([this.generateRandomKey(length), this.generateRandomKey(length)]).then(function (values) {\n return values.join(\"\");\n }));\n\n case 2:\n case \"end\":\n return _context136.stop();\n }\n }\n }, _callee135, this);\n }));\n\n function generateItemEncryptionKey() {\n return _generateItemEncryptionKey2.apply(this, arguments);\n }\n\n return generateItemEncryptionKey;\n }()\n }, {\n key: \"encryptText\",\n value: function () {\n var _encryptText2 = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee137(text, key, iv) {\n var _this32 = this;\n\n var ivData, alg, keyBuffer, keyData, textData;\n return regeneratorRuntime.wrap(function _callee137$(_context138) {\n while (1) {\n switch (_context138.prev = _context138.next) {\n case 0:\n if (!iv) {\n _context138.next = 6;\n break;\n }\n\n _context138.next = 3;\n return this.hexStringToArrayBuffer(iv);\n\n case 3:\n _context138.t0 = _context138.sent;\n _context138.next = 7;\n break;\n\n case 6:\n _context138.t0 = new ArrayBuffer(16);\n\n case 7:\n ivData = _context138.t0;\n alg = {\n name: 'AES-CBC',\n iv: ivData\n };\n _context138.next = 11;\n return this.hexStringToArrayBuffer(key);\n\n case 11:\n keyBuffer = _context138.sent;\n _context138.next = 14;\n return this.webCryptoImportKey(keyBuffer, alg.name, [\"encrypt\"]);\n\n case 14:\n keyData = _context138.sent;\n _context138.next = 17;\n return this.stringToArrayBuffer(text);\n\n case 17:\n textData = _context138.sent;\n return _context138.abrupt(\"return\", crypto.subtle.encrypt(alg, keyData, textData).then(\n /*#__PURE__*/\n function () {\n var _ref30 = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee136(result) {\n var cipher;\n return regeneratorRuntime.wrap(function _callee136$(_context137) {\n while (1) {\n switch (_context137.prev = _context137.next) {\n case 0:\n _context137.next = 2;\n return _this32.arrayBufferToBase64(result);\n\n case 2:\n cipher = _context137.sent;\n return _context137.abrupt(\"return\", cipher);\n\n case 4:\n case \"end\":\n return _context137.stop();\n }\n }\n }, _callee136);\n }));\n\n return function (_x175) {\n return _ref30.apply(this, arguments);\n };\n }()));\n\n case 19:\n case \"end\":\n return _context138.stop();\n }\n }\n }, _callee137, this);\n }));\n\n function encryptText(_x172, _x173, _x174) {\n return _encryptText2.apply(this, arguments);\n }\n\n return encryptText;\n }()\n }, {\n key: \"decryptText\",\n value: function () {\n var _decryptText2 = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee139() {\n var _this33 = this;\n\n var _ref31,\n ciphertextToAuth,\n contentCiphertext,\n encryptionKey,\n iv,\n authHash,\n authKey,\n requiresAuth,\n localAuthHash,\n ivData,\n alg,\n keyBuffer,\n keyData,\n textData,\n _args140 = arguments;\n\n return regeneratorRuntime.wrap(function _callee139$(_context140) {\n while (1) {\n switch (_context140.prev = _context140.next) {\n case 0:\n _ref31 = _args140.length > 0 && _args140[0] !== undefined ? _args140[0] : {}, ciphertextToAuth = _ref31.ciphertextToAuth, contentCiphertext = _ref31.contentCiphertext, encryptionKey = _ref31.encryptionKey, iv = _ref31.iv, authHash = _ref31.authHash, authKey = _ref31.authKey;\n requiresAuth = _args140.length > 1 ? _args140[1] : undefined;\n\n if (!(requiresAuth && !authHash)) {\n _context140.next = 5;\n break;\n }\n\n console.error(\"Auth hash is required.\");\n return _context140.abrupt(\"return\");\n\n case 5:\n if (!authHash) {\n _context140.next = 12;\n break;\n }\n\n _context140.next = 8;\n return this.hmac256(ciphertextToAuth, authKey);\n\n case 8:\n localAuthHash = _context140.sent;\n\n if (!(this.timingSafeEqual(authHash, localAuthHash) === false)) {\n _context140.next = 12;\n break;\n }\n\n console.error(\"Auth hash does not match, returning null. \".concat(authHash, \" != \").concat(localAuthHash));\n return _context140.abrupt(\"return\", null);\n\n case 12:\n if (!iv) {\n _context140.next = 18;\n break;\n }\n\n _context140.next = 15;\n return this.hexStringToArrayBuffer(iv);\n\n case 15:\n _context140.t0 = _context140.sent;\n _context140.next = 19;\n break;\n\n case 18:\n _context140.t0 = new ArrayBuffer(16);\n\n case 19:\n ivData = _context140.t0;\n alg = {\n name: 'AES-CBC',\n iv: ivData\n };\n _context140.next = 23;\n return this.hexStringToArrayBuffer(encryptionKey);\n\n case 23:\n keyBuffer = _context140.sent;\n _context140.next = 26;\n return this.webCryptoImportKey(keyBuffer, alg.name, [\"decrypt\"]);\n\n case 26:\n keyData = _context140.sent;\n _context140.next = 29;\n return this.base64ToArrayBuffer(contentCiphertext);\n\n case 29:\n textData = _context140.sent;\n return _context140.abrupt(\"return\", crypto.subtle.decrypt(alg, keyData, textData).then(\n /*#__PURE__*/\n function () {\n var _ref32 = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee138(result) {\n var decoded;\n return regeneratorRuntime.wrap(function _callee138$(_context139) {\n while (1) {\n switch (_context139.prev = _context139.next) {\n case 0:\n _context139.next = 2;\n return _this33.arrayBufferToString(result);\n\n case 2:\n decoded = _context139.sent;\n return _context139.abrupt(\"return\", decoded);\n\n case 4:\n case \"end\":\n return _context139.stop();\n }\n }\n }, _callee138);\n }));\n\n return function (_x176) {\n return _ref32.apply(this, arguments);\n };\n }())[\"catch\"](function (error) {\n console.error(\"Error decrypting:\", error);\n }));\n\n case 31:\n case \"end\":\n return _context140.stop();\n }\n }\n }, _callee139, this);\n }));\n\n function decryptText() {\n return _decryptText2.apply(this, arguments);\n }\n\n return decryptText;\n }()\n }, {\n key: \"hmac256\",\n value: function () {\n var _hmac2 = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee141(message, key) {\n var _this34 = this;\n\n var keyHexData, keyData, messageData;\n return regeneratorRuntime.wrap(function _callee141$(_context142) {\n while (1) {\n switch (_context142.prev = _context142.next) {\n case 0:\n _context142.next = 2;\n return this.hexStringToArrayBuffer(key);\n\n case 2:\n keyHexData = _context142.sent;\n _context142.next = 5;\n return this.webCryptoImportKey(keyHexData, \"HMAC\", [\"sign\"], {\n name: \"SHA-256\"\n });\n\n case 5:\n keyData = _context142.sent;\n _context142.next = 8;\n return this.stringToArrayBuffer(message);\n\n case 8:\n messageData = _context142.sent;\n return _context142.abrupt(\"return\", crypto.subtle.sign({\n name: \"HMAC\"\n }, keyData, messageData).then(\n /*#__PURE__*/\n function () {\n var _ref33 = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee140(signature) {\n var hash;\n return regeneratorRuntime.wrap(function _callee140$(_context141) {\n while (1) {\n switch (_context141.prev = _context141.next) {\n case 0:\n _context141.next = 2;\n return _this34.arrayBufferToHexString(signature);\n\n case 2:\n hash = _context141.sent;\n return _context141.abrupt(\"return\", hash);\n\n case 4:\n case \"end\":\n return _context141.stop();\n }\n }\n }, _callee140);\n }));\n\n return function (_x179) {\n return _ref33.apply(this, arguments);\n };\n }())[\"catch\"](function (err) {\n console.error(\"Error computing hmac\", err);\n }));\n\n case 10:\n case \"end\":\n return _context142.stop();\n }\n }\n }, _callee141, this);\n }));\n\n function hmac256(_x177, _x178) {\n return _hmac2.apply(this, arguments);\n }\n\n return hmac256;\n }()\n /**\n Internal\n */\n\n }, {\n key: \"webCryptoImportKey\",\n value: function () {\n var _webCryptoImportKey = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee142(input, alg, actions, hash) {\n var text;\n return regeneratorRuntime.wrap(function _callee142$(_context143) {\n while (1) {\n switch (_context143.prev = _context143.next) {\n case 0:\n if (!(typeof input === \"string\")) {\n _context143.next = 6;\n break;\n }\n\n _context143.next = 3;\n return this.stringToArrayBuffer(input);\n\n case 3:\n _context143.t0 = _context143.sent;\n _context143.next = 7;\n break;\n\n case 6:\n _context143.t0 = input;\n\n case 7:\n text = _context143.t0;\n return _context143.abrupt(\"return\", subtleCrypto.importKey(\"raw\", text, {\n name: alg,\n hash: hash\n }, false, actions).then(function (key) {\n return key;\n })[\"catch\"](function (err) {\n console.error(err);\n return null;\n }));\n\n case 9:\n case \"end\":\n return _context143.stop();\n }\n }\n }, _callee142, this);\n }));\n\n function webCryptoImportKey(_x180, _x181, _x182, _x183) {\n return _webCryptoImportKey.apply(this, arguments);\n }\n\n return webCryptoImportKey;\n }()\n }, {\n key: \"webCryptoDeriveBits\",\n value: function () {\n var _webCryptoDeriveBits = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee144(key, pw_salt, pw_cost, length) {\n var _this35 = this;\n\n var params;\n return regeneratorRuntime.wrap(function _callee144$(_context145) {\n while (1) {\n switch (_context145.prev = _context145.next) {\n case 0:\n _context145.next = 2;\n return this.stringToArrayBuffer(pw_salt);\n\n case 2:\n _context145.t0 = _context145.sent;\n _context145.t1 = pw_cost;\n _context145.t2 = {\n name: \"SHA-512\"\n };\n params = {\n \"name\": \"PBKDF2\",\n salt: _context145.t0,\n iterations: _context145.t1,\n hash: _context145.t2\n };\n return _context145.abrupt(\"return\", subtleCrypto.deriveBits(params, key, length).then(\n /*#__PURE__*/\n function () {\n var _ref34 = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee143(bits) {\n var key;\n return regeneratorRuntime.wrap(function _callee143$(_context144) {\n while (1) {\n switch (_context144.prev = _context144.next) {\n case 0:\n _context144.next = 2;\n return _this35.arrayBufferToHexString(new Uint8Array(bits));\n\n case 2:\n key = _context144.sent;\n return _context144.abrupt(\"return\", key);\n\n case 4:\n case \"end\":\n return _context144.stop();\n }\n }\n }, _callee143);\n }));\n\n return function (_x188) {\n return _ref34.apply(this, arguments);\n };\n }())[\"catch\"](function (err) {\n console.error(err);\n return null;\n }));\n\n case 7:\n case \"end\":\n return _context145.stop();\n }\n }\n }, _callee144, this);\n }));\n\n function webCryptoDeriveBits(_x184, _x185, _x186, _x187) {\n return _webCryptoDeriveBits.apply(this, arguments);\n }\n\n return webCryptoDeriveBits;\n }()\n }, {\n key: \"stringToArrayBuffer\",\n value: function () {\n var _stringToArrayBuffer = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee145(string) {\n return regeneratorRuntime.wrap(function _callee145$(_context146) {\n while (1) {\n switch (_context146.prev = _context146.next) {\n case 0:\n return _context146.abrupt(\"return\", new Promise(function (resolve, reject) {\n var blob = new Blob([string]);\n var f = new FileReader();\n\n f.onload = function (e) {\n resolve(e.target.result);\n };\n\n f.readAsArrayBuffer(blob);\n }));\n\n case 1:\n case \"end\":\n return _context146.stop();\n }\n }\n }, _callee145);\n }));\n\n function stringToArrayBuffer(_x189) {\n return _stringToArrayBuffer.apply(this, arguments);\n }\n\n return stringToArrayBuffer;\n }()\n }, {\n key: \"arrayBufferToString\",\n value: function () {\n var _arrayBufferToString = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee146(arrayBuffer) {\n return regeneratorRuntime.wrap(function _callee146$(_context147) {\n while (1) {\n switch (_context147.prev = _context147.next) {\n case 0:\n return _context147.abrupt(\"return\", new Promise(function (resolve, reject) {\n var blob = new Blob([arrayBuffer]);\n var f = new FileReader();\n\n f.onload = function (e) {\n resolve(e.target.result);\n };\n\n f.readAsText(blob);\n }));\n\n case 1:\n case \"end\":\n return _context147.stop();\n }\n }\n }, _callee146);\n }));\n\n function arrayBufferToString(_x190) {\n return _arrayBufferToString.apply(this, arguments);\n }\n\n return arrayBufferToString;\n }()\n }, {\n key: \"arrayBufferToHexString\",\n value: function () {\n var _arrayBufferToHexString = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee147(arrayBuffer) {\n var byteArray, hexString, nextHexByte, i;\n return regeneratorRuntime.wrap(function _callee147$(_context148) {\n while (1) {\n switch (_context148.prev = _context148.next) {\n case 0:\n byteArray = new Uint8Array(arrayBuffer);\n hexString = \"\";\n\n for (i = 0; i < byteArray.byteLength; i++) {\n nextHexByte = byteArray[i].toString(16);\n\n if (nextHexByte.length < 2) {\n nextHexByte = \"0\" + nextHexByte;\n }\n\n hexString += nextHexByte;\n }\n\n return _context148.abrupt(\"return\", hexString);\n\n case 4:\n case \"end\":\n return _context148.stop();\n }\n }\n }, _callee147);\n }));\n\n function arrayBufferToHexString(_x191) {\n return _arrayBufferToHexString.apply(this, arguments);\n }\n\n return arrayBufferToHexString;\n }()\n }, {\n key: \"hexStringToArrayBuffer\",\n value: function () {\n var _hexStringToArrayBuffer = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee148(hex) {\n var bytes, c;\n return regeneratorRuntime.wrap(function _callee148$(_context149) {\n while (1) {\n switch (_context149.prev = _context149.next) {\n case 0:\n for (bytes = [], c = 0; c < hex.length; c += 2) {\n bytes.push(parseInt(hex.substr(c, 2), 16));\n }\n\n return _context149.abrupt(\"return\", new Uint8Array(bytes));\n\n case 2:\n case \"end\":\n return _context149.stop();\n }\n }\n }, _callee148);\n }));\n\n function hexStringToArrayBuffer(_x192) {\n return _hexStringToArrayBuffer.apply(this, arguments);\n }\n\n return hexStringToArrayBuffer;\n }()\n }, {\n key: \"base64ToArrayBuffer\",\n value: function () {\n var _base64ToArrayBuffer = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee149(base64) {\n var binary_string, len, bytes, i;\n return regeneratorRuntime.wrap(function _callee149$(_context150) {\n while (1) {\n switch (_context150.prev = _context150.next) {\n case 0:\n _context150.next = 2;\n return this.base64Decode(base64);\n\n case 2:\n binary_string = _context150.sent;\n len = binary_string.length;\n bytes = new Uint8Array(len);\n\n for (i = 0; i < len; i++) {\n bytes[i] = binary_string.charCodeAt(i);\n }\n\n return _context150.abrupt(\"return\", bytes.buffer);\n\n case 7:\n case \"end\":\n return _context150.stop();\n }\n }\n }, _callee149, this);\n }));\n\n function base64ToArrayBuffer(_x193) {\n return _base64ToArrayBuffer.apply(this, arguments);\n }\n\n return base64ToArrayBuffer;\n }()\n }, {\n key: \"arrayBufferToBase64\",\n value: function () {\n var _arrayBufferToBase = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee150(buffer) {\n return regeneratorRuntime.wrap(function _callee150$(_context151) {\n while (1) {\n switch (_context151.prev = _context151.next) {\n case 0:\n return _context151.abrupt(\"return\", new Promise(function (resolve, reject) {\n var blob = new Blob([buffer], {\n type: 'application/octet-binary'\n });\n var reader = new FileReader();\n\n reader.onload = function (evt) {\n var dataurl = evt.target.result;\n resolve(dataurl.substr(dataurl.indexOf(',') + 1));\n };\n\n reader.readAsDataURL(blob);\n }));\n\n case 1:\n case \"end\":\n return _context151.stop();\n }\n }\n }, _callee150);\n }));\n\n function arrayBufferToBase64(_x194) {\n return _arrayBufferToBase.apply(this, arguments);\n }\n\n return arrayBufferToBase64;\n }()\n }]);\n\n return SFCryptoWeb;\n }(SFAbstractCrypto);\n\n exports.SFCryptoWeb = SFCryptoWeb;\n ;\n\n var SFItemTransformer =\n /*#__PURE__*/\n function () {\n function SFItemTransformer(crypto) {\n _classCallCheck(this, SFItemTransformer);\n\n this.crypto = crypto;\n }\n\n _createClass(SFItemTransformer, [{\n key: \"_private_encryptString\",\n value: function () {\n var _private_encryptString2 = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee151(string, encryptionKey, authKey, uuid, auth_params) {\n var fullCiphertext, contentCiphertext, iv, ciphertextToAuth, authHash, authParamsString;\n return regeneratorRuntime.wrap(function _callee151$(_context152) {\n while (1) {\n switch (_context152.prev = _context152.next) {\n case 0:\n if (!(auth_params.version === \"001\")) {\n _context152.next = 7;\n break;\n }\n\n _context152.next = 3;\n return this.crypto.encryptText(string, encryptionKey, null);\n\n case 3:\n contentCiphertext = _context152.sent;\n fullCiphertext = auth_params.version + contentCiphertext;\n _context152.next = 21;\n break;\n\n case 7:\n _context152.next = 9;\n return this.crypto.generateRandomKey(128);\n\n case 9:\n iv = _context152.sent;\n _context152.next = 12;\n return this.crypto.encryptText(string, encryptionKey, iv);\n\n case 12:\n contentCiphertext = _context152.sent;\n ciphertextToAuth = [auth_params.version, uuid, iv, contentCiphertext].join(\":\");\n _context152.next = 16;\n return this.crypto.hmac256(ciphertextToAuth, authKey);\n\n case 16:\n authHash = _context152.sent;\n _context152.next = 19;\n return this.crypto.base64(JSON.stringify(auth_params));\n\n case 19:\n authParamsString = _context152.sent;\n fullCiphertext = [auth_params.version, authHash, uuid, iv, contentCiphertext, authParamsString].join(\":\");\n\n case 21:\n return _context152.abrupt(\"return\", fullCiphertext);\n\n case 22:\n case \"end\":\n return _context152.stop();\n }\n }\n }, _callee151, this);\n }));\n\n function _private_encryptString(_x195, _x196, _x197, _x198, _x199) {\n return _private_encryptString2.apply(this, arguments);\n }\n\n return _private_encryptString;\n }()\n }, {\n key: \"encryptItem\",\n value: function () {\n var _encryptItem = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee152(item, keys, auth_params) {\n var params, item_key, ek, ak, ciphertext, authHash;\n return regeneratorRuntime.wrap(function _callee152$(_context153) {\n while (1) {\n switch (_context153.prev = _context153.next) {\n case 0:\n params = {}; // encrypt item key\n\n _context153.next = 3;\n return this.crypto.generateItemEncryptionKey();\n\n case 3:\n item_key = _context153.sent;\n\n if (!(auth_params.version === \"001\")) {\n _context153.next = 10;\n break;\n }\n\n _context153.next = 7;\n return this.crypto.encryptText(item_key, keys.mk, null);\n\n case 7:\n params.enc_item_key = _context153.sent;\n _context153.next = 13;\n break;\n\n case 10:\n _context153.next = 12;\n return this._private_encryptString(item_key, keys.mk, keys.ak, item.uuid, auth_params);\n\n case 12:\n params.enc_item_key = _context153.sent;\n\n case 13:\n _context153.next = 15;\n return this.crypto.firstHalfOfKey(item_key);\n\n case 15:\n ek = _context153.sent;\n _context153.next = 18;\n return this.crypto.secondHalfOfKey(item_key);\n\n case 18:\n ak = _context153.sent;\n _context153.next = 21;\n return this._private_encryptString(JSON.stringify(item.createContentJSONFromProperties()), ek, ak, item.uuid, auth_params);\n\n case 21:\n ciphertext = _context153.sent;\n\n if (!(auth_params.version === \"001\")) {\n _context153.next = 27;\n break;\n }\n\n _context153.next = 25;\n return this.crypto.hmac256(ciphertext, ak);\n\n case 25:\n authHash = _context153.sent;\n params.auth_hash = authHash;\n\n case 27:\n params.content = ciphertext;\n return _context153.abrupt(\"return\", params);\n\n case 29:\n case \"end\":\n return _context153.stop();\n }\n }\n }, _callee152, this);\n }));\n\n function encryptItem(_x200, _x201, _x202) {\n return _encryptItem.apply(this, arguments);\n }\n\n return encryptItem;\n }()\n }, {\n key: \"encryptionComponentsFromString\",\n value: function encryptionComponentsFromString(string, encryptionKey, authKey) {\n var encryptionVersion = string.substring(0, 3);\n\n if (encryptionVersion === \"001\") {\n return {\n contentCiphertext: string.substring(3, string.length),\n encryptionVersion: encryptionVersion,\n ciphertextToAuth: string,\n iv: null,\n authHash: null,\n encryptionKey: encryptionKey,\n authKey: authKey\n };\n } else {\n var components = string.split(\":\");\n return {\n encryptionVersion: components[0],\n authHash: components[1],\n uuid: components[2],\n iv: components[3],\n contentCiphertext: components[4],\n authParams: components[5],\n ciphertextToAuth: [components[0], components[2], components[3], components[4]].join(\":\"),\n encryptionKey: encryptionKey,\n authKey: authKey\n };\n }\n }\n }, {\n key: \"decryptItem\",\n value: function () {\n var _decryptItem = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee153(item, keys) {\n var encryptedItemKey, requiresAuth, keyParams, item_key, ek, ak, itemParams, content;\n return regeneratorRuntime.wrap(function _callee153$(_context154) {\n while (1) {\n switch (_context154.prev = _context154.next) {\n case 0:\n if (!(typeof item.content != \"string\")) {\n _context154.next = 2;\n break;\n }\n\n return _context154.abrupt(\"return\");\n\n case 2:\n if (!item.content.startsWith(\"000\")) {\n _context154.next = 14;\n break;\n }\n\n _context154.prev = 3;\n _context154.t0 = JSON;\n _context154.next = 7;\n return this.crypto.base64Decode(item.content.substring(3, item.content.length));\n\n case 7:\n _context154.t1 = _context154.sent;\n item.content = _context154.t0.parse.call(_context154.t0, _context154.t1);\n _context154.next = 13;\n break;\n\n case 11:\n _context154.prev = 11;\n _context154.t2 = _context154[\"catch\"](3);\n\n case 13:\n return _context154.abrupt(\"return\");\n\n case 14:\n if (item.enc_item_key) {\n _context154.next = 17;\n break;\n } // This needs to be here to continue, return otherwise\n\n\n console.log(\"Missing item encryption key, skipping decryption.\");\n return _context154.abrupt(\"return\");\n\n case 17:\n // decrypt encrypted key\n encryptedItemKey = item.enc_item_key;\n requiresAuth = true;\n\n if (!encryptedItemKey.startsWith(\"002\") && !encryptedItemKey.startsWith(\"003\")) {\n // legacy encryption type, has no prefix\n encryptedItemKey = \"001\" + encryptedItemKey;\n requiresAuth = false;\n }\n\n keyParams = this.encryptionComponentsFromString(encryptedItemKey, keys.mk, keys.ak); // return if uuid in auth hash does not match item uuid. Signs of tampering.\n\n if (!(keyParams.uuid && keyParams.uuid !== item.uuid)) {\n _context154.next = 26;\n break;\n }\n\n console.error(\"Item key params UUID does not match item UUID\");\n\n if (!item.errorDecrypting) {\n item.errorDecryptingValueChanged = true;\n }\n\n item.errorDecrypting = true;\n return _context154.abrupt(\"return\");\n\n case 26:\n _context154.next = 28;\n return this.crypto.decryptText(keyParams, requiresAuth);\n\n case 28:\n item_key = _context154.sent;\n\n if (item_key) {\n _context154.next = 34;\n break;\n }\n\n console.log(\"Error decrypting item\", item);\n\n if (!item.errorDecrypting) {\n item.errorDecryptingValueChanged = true;\n }\n\n item.errorDecrypting = true;\n return _context154.abrupt(\"return\");\n\n case 34:\n _context154.next = 36;\n return this.crypto.firstHalfOfKey(item_key);\n\n case 36:\n ek = _context154.sent;\n _context154.next = 39;\n return this.crypto.secondHalfOfKey(item_key);\n\n case 39:\n ak = _context154.sent;\n itemParams = this.encryptionComponentsFromString(item.content, ek, ak);\n _context154.prev = 41;\n _context154.t3 = JSON;\n _context154.next = 45;\n return this.crypto.base64Decode(itemParams.authParams);\n\n case 45:\n _context154.t4 = _context154.sent;\n item.auth_params = _context154.t3.parse.call(_context154.t3, _context154.t4);\n _context154.next = 51;\n break;\n\n case 49:\n _context154.prev = 49;\n _context154.t5 = _context154[\"catch\"](41);\n\n case 51:\n if (!(itemParams.uuid && itemParams.uuid !== item.uuid)) {\n _context154.next = 55;\n break;\n }\n\n if (!item.errorDecrypting) {\n item.errorDecryptingValueChanged = true;\n }\n\n item.errorDecrypting = true;\n return _context154.abrupt(\"return\");\n\n case 55:\n if (!itemParams.authHash) {\n // legacy 001\n itemParams.authHash = item.auth_hash;\n }\n\n _context154.next = 58;\n return this.crypto.decryptText(itemParams, true);\n\n case 58:\n content = _context154.sent;\n\n if (!content) {\n if (!item.errorDecrypting) {\n item.errorDecryptingValueChanged = true;\n }\n\n item.errorDecrypting = true;\n } else {\n if (item.errorDecrypting == true) {\n item.errorDecryptingValueChanged = true;\n } // Content should only be set if it was successfully decrypted, and should otherwise remain unchanged.\n\n\n item.errorDecrypting = false;\n item.content = content;\n }\n\n case 60:\n case \"end\":\n return _context154.stop();\n }\n }\n }, _callee153, this, [[3, 11], [41, 49]]);\n }));\n\n function decryptItem(_x203, _x204) {\n return _decryptItem.apply(this, arguments);\n }\n\n return decryptItem;\n }()\n }, {\n key: \"decryptMultipleItems\",\n value: function () {\n var _decryptMultipleItems = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee155(items, keys, _throws) {\n var _this36 = this;\n\n var decrypt;\n return regeneratorRuntime.wrap(function _callee155$(_context156) {\n while (1) {\n switch (_context156.prev = _context156.next) {\n case 0:\n decrypt =\n /*#__PURE__*/\n function () {\n var _ref35 = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee154(item) {\n var isString;\n return regeneratorRuntime.wrap(function _callee154$(_context155) {\n while (1) {\n switch (_context155.prev = _context155.next) {\n case 0:\n if (item) {\n _context155.next = 2;\n break;\n }\n\n return _context155.abrupt(\"return\");\n\n case 2:\n if (!(item.deleted == true && item.content == null)) {\n _context155.next = 4;\n break;\n }\n\n return _context155.abrupt(\"return\");\n\n case 4:\n isString = typeof item.content === 'string' || item.content instanceof String;\n\n if (!isString) {\n _context155.next = 19;\n break;\n }\n\n _context155.prev = 6;\n _context155.next = 9;\n return _this36.decryptItem(item, keys);\n\n case 9:\n _context155.next = 19;\n break;\n\n case 11:\n _context155.prev = 11;\n _context155.t0 = _context155[\"catch\"](6);\n\n if (!item.errorDecrypting) {\n item.errorDecryptingValueChanged = true;\n }\n\n item.errorDecrypting = true;\n\n if (!_throws) {\n _context155.next = 17;\n break;\n }\n\n throw _context155.t0;\n\n case 17:\n console.error(\"Error decrypting item\", item, _context155.t0);\n return _context155.abrupt(\"return\");\n\n case 19:\n case \"end\":\n return _context155.stop();\n }\n }\n }, _callee154, null, [[6, 11]]);\n }));\n\n return function decrypt(_x208) {\n return _ref35.apply(this, arguments);\n };\n }();\n\n return _context156.abrupt(\"return\", Promise.all(items.map(function (item) {\n return decrypt(item);\n })));\n\n case 2:\n case \"end\":\n return _context156.stop();\n }\n }\n }, _callee155);\n }));\n\n function decryptMultipleItems(_x205, _x206, _x207) {\n return _decryptMultipleItems.apply(this, arguments);\n }\n\n return decryptMultipleItems;\n }()\n }]);\n\n return SFItemTransformer;\n }();\n\n exports.SFItemTransformer = SFItemTransformer;\n ;\n var globalScope = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : null;\n\n var StandardFile =\n /*#__PURE__*/\n function () {\n function StandardFile(cryptoInstance) {\n _classCallCheck(this, StandardFile); // This library runs in native environments as well (react native)\n\n\n if (globalScope) {\n // detect IE8 and above, and edge.\n // IE and Edge do not support pbkdf2 in WebCrypto, therefore we need to use CryptoJS\n var IEOrEdge = typeof document !== 'undefined' && document.documentMode || /Edge/.test(navigator.userAgent);\n\n if (!IEOrEdge && globalScope.crypto && globalScope.crypto.subtle) {\n this.crypto = new SFCryptoWeb();\n } else {\n this.crypto = new SFCryptoJS();\n }\n } // This must be placed outside window check, as it's used in native.\n\n\n if (cryptoInstance) {\n this.crypto = cryptoInstance;\n }\n\n this.itemTransformer = new SFItemTransformer(this.crypto);\n this.crypto.SFJS = {\n version: this.version(),\n defaultPasswordGenerationCost: this.defaultPasswordGenerationCost()\n };\n }\n\n _createClass(StandardFile, [{\n key: \"version\",\n value: function version() {\n return \"003\";\n }\n }, {\n key: \"supportsPasswordDerivationCost\",\n value: function supportsPasswordDerivationCost(cost) {\n // some passwords are created on platforms with stronger pbkdf2 capabilities, like iOS,\n // which CryptoJS can't handle here (WebCrypto can however).\n // if user has high password cost and is using browser that doesn't support WebCrypto,\n // we want to tell them that they can't login with this browser.\n if (cost > 5000) {\n return this.crypto instanceof SFCryptoWeb;\n } else {\n return true;\n }\n } // Returns the versions that this library supports technically.\n\n }, {\n key: \"supportedVersions\",\n value: function supportedVersions() {\n return [\"001\", \"002\", \"003\"];\n }\n }, {\n key: \"isVersionNewerThanLibraryVersion\",\n value: function isVersionNewerThanLibraryVersion(version) {\n var libraryVersion = this.version();\n return parseInt(version) > parseInt(libraryVersion);\n }\n }, {\n key: \"isProtocolVersionOutdated\",\n value: function isProtocolVersionOutdated(version) {\n // YYYY-MM-DD\n var expirationDates = {\n \"001\": Date.parse(\"2018-01-01\"),\n \"002\": Date.parse(\"2020-01-01\")\n };\n var date = expirationDates[version];\n\n if (!date) {\n // No expiration date, is active version\n return false;\n }\n\n var expired = new Date() > date;\n return expired;\n }\n }, {\n key: \"costMinimumForVersion\",\n value: function costMinimumForVersion(version) {\n return {\n \"001\": 3000,\n \"002\": 3000,\n \"003\": 110000\n }[version];\n }\n }, {\n key: \"defaultPasswordGenerationCost\",\n value: function defaultPasswordGenerationCost() {\n return this.costMinimumForVersion(this.version());\n }\n }]);\n\n return StandardFile;\n }();\n\n exports.StandardFile = StandardFile;\n\n if (globalScope) {\n // window is for some reason defined in React Native, but throws an exception when you try to set to it\n try {\n globalScope.StandardFile = StandardFile;\n globalScope.SFJS = new StandardFile();\n globalScope.SFCryptoWeb = SFCryptoWeb;\n globalScope.SFCryptoJS = SFCryptoJS;\n globalScope.SFItemTransformer = SFItemTransformer;\n globalScope.SFModelManager = SFModelManager;\n globalScope.SFItem = SFItem;\n globalScope.SFItemParams = SFItemParams;\n globalScope.SFHttpManager = SFHttpManager;\n globalScope.SFStorageManager = SFStorageManager;\n globalScope.SFSyncManager = SFSyncManager;\n globalScope.SFAuthManager = SFAuthManager;\n globalScope.SFMigrationManager = SFMigrationManager;\n globalScope.SFAlertManager = SFAlertManager;\n globalScope.SFPredicate = SFPredicate;\n globalScope.SFHistorySession = SFHistorySession;\n globalScope.SFSessionHistoryManager = SFSessionHistoryManager;\n globalScope.SFItemHistory = SFItemHistory;\n globalScope.SFItemHistoryEntry = SFItemHistoryEntry;\n globalScope.SFPrivilegesManager = SFPrivilegesManager;\n globalScope.SFPrivileges = SFPrivileges;\n globalScope.SFSingletonManager = SFSingletonManager;\n } catch (e) {\n console.log(\"Exception while exporting window variables\", e);\n }\n }\n }).call(this, typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {});\n }, {}]\n }, {}, [1])(1);\n});\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))\n\n/***/ }),\n/* 1 */\n/***/ (function(module, exports) {\n\n/**\n * Copyright (c) 2014-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n!function (global) {\n \"use strict\";\n\n var Op = Object.prototype;\n var hasOwn = Op.hasOwnProperty;\n var undefined; // More compressible than void 0.\n\n var $Symbol = typeof Symbol === \"function\" ? Symbol : {};\n var iteratorSymbol = $Symbol.iterator || \"@@iterator\";\n var asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\";\n var toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\";\n var inModule = typeof module === \"object\";\n var runtime = global.regeneratorRuntime;\n\n if (runtime) {\n if (inModule) {\n // If regeneratorRuntime is defined globally and we're in a module,\n // make the exports object identical to regeneratorRuntime.\n module.exports = runtime;\n } // Don't bother evaluating the rest of this file if the runtime was\n // already defined globally.\n\n\n return;\n } // Define the runtime globally (as expected by generated code) as either\n // module.exports (if we're in a module) or a new, empty object.\n\n\n runtime = global.regeneratorRuntime = inModule ? module.exports : {};\n\n function wrap(innerFn, outerFn, self, tryLocsList) {\n // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.\n var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;\n var generator = Object.create(protoGenerator.prototype);\n var context = new Context(tryLocsList || []); // The ._invoke method unifies the implementations of the .next,\n // .throw, and .return methods.\n\n generator._invoke = makeInvokeMethod(innerFn, self, context);\n return generator;\n }\n\n runtime.wrap = wrap; // Try/catch helper to minimize deoptimizations. Returns a completion\n // record like context.tryEntries[i].completion. This interface could\n // have been (and was previously) designed to take a closure to be\n // invoked without arguments, but in all the cases we care about we\n // already have an existing method we want to call, so there's no need\n // to create a new function object. We can even get away with assuming\n // the method takes exactly one argument, since that happens to be true\n // in every case, so we don't have to touch the arguments object. The\n // only additional allocation required is the completion record, which\n // has a stable shape and so hopefully should be cheap to allocate.\n\n function tryCatch(fn, obj, arg) {\n try {\n return {\n type: \"normal\",\n arg: fn.call(obj, arg)\n };\n } catch (err) {\n return {\n type: \"throw\",\n arg: err\n };\n }\n }\n\n var GenStateSuspendedStart = \"suspendedStart\";\n var GenStateSuspendedYield = \"suspendedYield\";\n var GenStateExecuting = \"executing\";\n var GenStateCompleted = \"completed\"; // Returning this object from the innerFn has the same effect as\n // breaking out of the dispatch switch statement.\n\n var ContinueSentinel = {}; // Dummy constructor functions that we use as the .constructor and\n // .constructor.prototype properties for functions that return Generator\n // objects. For full spec compliance, you may wish to configure your\n // minifier not to mangle the names of these two functions.\n\n function Generator() {}\n\n function GeneratorFunction() {}\n\n function GeneratorFunctionPrototype() {} // This is a polyfill for %IteratorPrototype% for environments that\n // don't natively support it.\n\n\n var IteratorPrototype = {};\n\n IteratorPrototype[iteratorSymbol] = function () {\n return this;\n };\n\n var getProto = Object.getPrototypeOf;\n var NativeIteratorPrototype = getProto && getProto(getProto(values([])));\n\n if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {\n // This environment has a native %IteratorPrototype%; use it instead\n // of the polyfill.\n IteratorPrototype = NativeIteratorPrototype;\n }\n\n var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);\n GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;\n GeneratorFunctionPrototype.constructor = GeneratorFunction;\n GeneratorFunctionPrototype[toStringTagSymbol] = GeneratorFunction.displayName = \"GeneratorFunction\"; // Helper for defining the .next, .throw, and .return methods of the\n // Iterator interface in terms of a single ._invoke method.\n\n function defineIteratorMethods(prototype) {\n [\"next\", \"throw\", \"return\"].forEach(function (method) {\n prototype[method] = function (arg) {\n return this._invoke(method, arg);\n };\n });\n }\n\n runtime.isGeneratorFunction = function (genFun) {\n var ctor = typeof genFun === \"function\" && genFun.constructor;\n return ctor ? ctor === GeneratorFunction || // For the native GeneratorFunction constructor, the best we can\n // do is to check its .name property.\n (ctor.displayName || ctor.name) === \"GeneratorFunction\" : false;\n };\n\n runtime.mark = function (genFun) {\n if (Object.setPrototypeOf) {\n Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);\n } else {\n genFun.__proto__ = GeneratorFunctionPrototype;\n\n if (!(toStringTagSymbol in genFun)) {\n genFun[toStringTagSymbol] = \"GeneratorFunction\";\n }\n }\n\n genFun.prototype = Object.create(Gp);\n return genFun;\n }; // Within the body of any async function, `await x` is transformed to\n // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test\n // `hasOwn.call(value, \"__await\")` to determine if the yielded value is\n // meant to be awaited.\n\n\n runtime.awrap = function (arg) {\n return {\n __await: arg\n };\n };\n\n function AsyncIterator(generator) {\n function invoke(method, arg, resolve, reject) {\n var record = tryCatch(generator[method], generator, arg);\n\n if (record.type === \"throw\") {\n reject(record.arg);\n } else {\n var result = record.arg;\n var value = result.value;\n\n if (value && typeof value === \"object\" && hasOwn.call(value, \"__await\")) {\n return Promise.resolve(value.__await).then(function (value) {\n invoke(\"next\", value, resolve, reject);\n }, function (err) {\n invoke(\"throw\", err, resolve, reject);\n });\n }\n\n return Promise.resolve(value).then(function (unwrapped) {\n // When a yielded Promise is resolved, its final value becomes\n // the .value of the Promise<{value,done}> result for the\n // current iteration. If the Promise is rejected, however, the\n // result for this iteration will be rejected with the same\n // reason. Note that rejections of yielded Promises are not\n // thrown back into the generator function, as is the case\n // when an awaited Promise is rejected. This difference in\n // behavior between yield and await is important, because it\n // allows the consumer to decide what to do with the yielded\n // rejection (swallow it and continue, manually .throw it back\n // into the generator, abandon iteration, whatever). With\n // await, by contrast, there is no opportunity to examine the\n // rejection reason outside the generator function, so the\n // only option is to throw it from the await expression, and\n // let the generator function handle the exception.\n result.value = unwrapped;\n resolve(result);\n }, reject);\n }\n }\n\n var previousPromise;\n\n function enqueue(method, arg) {\n function callInvokeWithMethodAndArg() {\n return new Promise(function (resolve, reject) {\n invoke(method, arg, resolve, reject);\n });\n }\n\n return previousPromise = // If enqueue has been called before, then we want to wait until\n // all previous Promises have been resolved before calling invoke,\n // so that results are always delivered in the correct order. If\n // enqueue has not been called before, then it is important to\n // call invoke immediately, without waiting on a callback to fire,\n // so that the async generator function has the opportunity to do\n // any necessary setup in a predictable way. This predictability\n // is why the Promise constructor synchronously invokes its\n // executor callback, and why async functions synchronously\n // execute code before the first await. Since we implement simple\n // async functions in terms of async generators, it is especially\n // important to get this right, even though it requires care.\n previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, // Avoid propagating failures to Promises returned by later\n // invocations of the iterator.\n callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();\n } // Define the unified helper method that is used to implement .next,\n // .throw, and .return (see defineIteratorMethods).\n\n\n this._invoke = enqueue;\n }\n\n defineIteratorMethods(AsyncIterator.prototype);\n\n AsyncIterator.prototype[asyncIteratorSymbol] = function () {\n return this;\n };\n\n runtime.AsyncIterator = AsyncIterator; // Note that simple async functions are implemented on top of\n // AsyncIterator objects; they just return a Promise for the value of\n // the final result produced by the iterator.\n\n runtime.async = function (innerFn, outerFn, self, tryLocsList) {\n var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList));\n return runtime.isGeneratorFunction(outerFn) ? iter // If outerFn is a generator, return the full iterator.\n : iter.next().then(function (result) {\n return result.done ? result.value : iter.next();\n });\n };\n\n function makeInvokeMethod(innerFn, self, context) {\n var state = GenStateSuspendedStart;\n return function invoke(method, arg) {\n if (state === GenStateExecuting) {\n throw new Error(\"Generator is already running\");\n }\n\n if (state === GenStateCompleted) {\n if (method === \"throw\") {\n throw arg;\n } // Be forgiving, per 25.3.3.3.3 of the spec:\n // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume\n\n\n return doneResult();\n }\n\n context.method = method;\n context.arg = arg;\n\n while (true) {\n var delegate = context.delegate;\n\n if (delegate) {\n var delegateResult = maybeInvokeDelegate(delegate, context);\n\n if (delegateResult) {\n if (delegateResult === ContinueSentinel) continue;\n return delegateResult;\n }\n }\n\n if (context.method === \"next\") {\n // Setting context._sent for legacy support of Babel's\n // function.sent implementation.\n context.sent = context._sent = context.arg;\n } else if (context.method === \"throw\") {\n if (state === GenStateSuspendedStart) {\n state = GenStateCompleted;\n throw context.arg;\n }\n\n context.dispatchException(context.arg);\n } else if (context.method === \"return\") {\n context.abrupt(\"return\", context.arg);\n }\n\n state = GenStateExecuting;\n var record = tryCatch(innerFn, self, context);\n\n if (record.type === \"normal\") {\n // If an exception is thrown from innerFn, we leave state ===\n // GenStateExecuting and loop back for another invocation.\n state = context.done ? GenStateCompleted : GenStateSuspendedYield;\n\n if (record.arg === ContinueSentinel) {\n continue;\n }\n\n return {\n value: record.arg,\n done: context.done\n };\n } else if (record.type === \"throw\") {\n state = GenStateCompleted; // Dispatch the exception by looping back around to the\n // context.dispatchException(context.arg) call above.\n\n context.method = \"throw\";\n context.arg = record.arg;\n }\n }\n };\n } // Call delegate.iterator[context.method](context.arg) and handle the\n // result, either by returning a { value, done } result from the\n // delegate iterator, or by modifying context.method and context.arg,\n // setting context.delegate to null, and returning the ContinueSentinel.\n\n\n function maybeInvokeDelegate(delegate, context) {\n var method = delegate.iterator[context.method];\n\n if (method === undefined) {\n // A .throw or .return when the delegate iterator has no .throw\n // method always terminates the yield* loop.\n context.delegate = null;\n\n if (context.method === \"throw\") {\n if (delegate.iterator.return) {\n // If the delegate iterator has a return method, give it a\n // chance to clean up.\n context.method = \"return\";\n context.arg = undefined;\n maybeInvokeDelegate(delegate, context);\n\n if (context.method === \"throw\") {\n // If maybeInvokeDelegate(context) changed context.method from\n // \"return\" to \"throw\", let that override the TypeError below.\n return ContinueSentinel;\n }\n }\n\n context.method = \"throw\";\n context.arg = new TypeError(\"The iterator does not provide a 'throw' method\");\n }\n\n return ContinueSentinel;\n }\n\n var record = tryCatch(method, delegate.iterator, context.arg);\n\n if (record.type === \"throw\") {\n context.method = \"throw\";\n context.arg = record.arg;\n context.delegate = null;\n return ContinueSentinel;\n }\n\n var info = record.arg;\n\n if (!info) {\n context.method = \"throw\";\n context.arg = new TypeError(\"iterator result is not an object\");\n context.delegate = null;\n return ContinueSentinel;\n }\n\n if (info.done) {\n // Assign the result of the finished delegate to the temporary\n // variable specified by delegate.resultName (see delegateYield).\n context[delegate.resultName] = info.value; // Resume execution at the desired location (see delegateYield).\n\n context.next = delegate.nextLoc; // If context.method was \"throw\" but the delegate handled the\n // exception, let the outer generator proceed normally. If\n // context.method was \"next\", forget context.arg since it has been\n // \"consumed\" by the delegate iterator. If context.method was\n // \"return\", allow the original .return call to continue in the\n // outer generator.\n\n if (context.method !== \"return\") {\n context.method = \"next\";\n context.arg = undefined;\n }\n } else {\n // Re-yield the result returned by the delegate method.\n return info;\n } // The delegate iterator is finished, so forget it and continue with\n // the outer generator.\n\n\n context.delegate = null;\n return ContinueSentinel;\n } // Define Generator.prototype.{next,throw,return} in terms of the\n // unified ._invoke helper method.\n\n\n defineIteratorMethods(Gp);\n Gp[toStringTagSymbol] = \"Generator\"; // A Generator should always return itself as the iterator object when the\n // @@iterator function is called on it. Some browsers' implementations of the\n // iterator prototype chain incorrectly implement this, causing the Generator\n // object to not be returned from this call. This ensures that doesn't happen.\n // See https://github.com/facebook/regenerator/issues/274 for more details.\n\n Gp[iteratorSymbol] = function () {\n return this;\n };\n\n Gp.toString = function () {\n return \"[object Generator]\";\n };\n\n function pushTryEntry(locs) {\n var entry = {\n tryLoc: locs[0]\n };\n\n if (1 in locs) {\n entry.catchLoc = locs[1];\n }\n\n if (2 in locs) {\n entry.finallyLoc = locs[2];\n entry.afterLoc = locs[3];\n }\n\n this.tryEntries.push(entry);\n }\n\n function resetTryEntry(entry) {\n var record = entry.completion || {};\n record.type = \"normal\";\n delete record.arg;\n entry.completion = record;\n }\n\n function Context(tryLocsList) {\n // The root entry object (effectively a try statement without a catch\n // or a finally block) gives us a place to store values thrown from\n // locations where there is no enclosing try statement.\n this.tryEntries = [{\n tryLoc: \"root\"\n }];\n tryLocsList.forEach(pushTryEntry, this);\n this.reset(true);\n }\n\n runtime.keys = function (object) {\n var keys = [];\n\n for (var key in object) {\n keys.push(key);\n }\n\n keys.reverse(); // Rather than returning an object with a next method, we keep\n // things simple and return the next function itself.\n\n return function next() {\n while (keys.length) {\n var key = keys.pop();\n\n if (key in object) {\n next.value = key;\n next.done = false;\n return next;\n }\n } // To avoid creating an additional object, we just hang the .value\n // and .done properties off the next function object itself. This\n // also ensures that the minifier will not anonymize the function.\n\n\n next.done = true;\n return next;\n };\n };\n\n function values(iterable) {\n if (iterable) {\n var iteratorMethod = iterable[iteratorSymbol];\n\n if (iteratorMethod) {\n return iteratorMethod.call(iterable);\n }\n\n if (typeof iterable.next === \"function\") {\n return iterable;\n }\n\n if (!isNaN(iterable.length)) {\n var i = -1,\n next = function next() {\n while (++i < iterable.length) {\n if (hasOwn.call(iterable, i)) {\n next.value = iterable[i];\n next.done = false;\n return next;\n }\n }\n\n next.value = undefined;\n next.done = true;\n return next;\n };\n\n return next.next = next;\n }\n } // Return an iterator with no values.\n\n\n return {\n next: doneResult\n };\n }\n\n runtime.values = values;\n\n function doneResult() {\n return {\n value: undefined,\n done: true\n };\n }\n\n Context.prototype = {\n constructor: Context,\n reset: function (skipTempReset) {\n this.prev = 0;\n this.next = 0; // Resetting context._sent for legacy support of Babel's\n // function.sent implementation.\n\n this.sent = this._sent = undefined;\n this.done = false;\n this.delegate = null;\n this.method = \"next\";\n this.arg = undefined;\n this.tryEntries.forEach(resetTryEntry);\n\n if (!skipTempReset) {\n for (var name in this) {\n // Not sure about the optimal order of these conditions:\n if (name.charAt(0) === \"t\" && hasOwn.call(this, name) && !isNaN(+name.slice(1))) {\n this[name] = undefined;\n }\n }\n }\n },\n stop: function () {\n this.done = true;\n var rootEntry = this.tryEntries[0];\n var rootRecord = rootEntry.completion;\n\n if (rootRecord.type === \"throw\") {\n throw rootRecord.arg;\n }\n\n return this.rval;\n },\n dispatchException: function (exception) {\n if (this.done) {\n throw exception;\n }\n\n var context = this;\n\n function handle(loc, caught) {\n record.type = \"throw\";\n record.arg = exception;\n context.next = loc;\n\n if (caught) {\n // If the dispatched exception was caught by a catch block,\n // then let that catch block handle the exception normally.\n context.method = \"next\";\n context.arg = undefined;\n }\n\n return !!caught;\n }\n\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n var record = entry.completion;\n\n if (entry.tryLoc === \"root\") {\n // Exception thrown outside of any try block that could handle\n // it, so set the completion value of the entire function to\n // throw the exception.\n return handle(\"end\");\n }\n\n if (entry.tryLoc <= this.prev) {\n var hasCatch = hasOwn.call(entry, \"catchLoc\");\n var hasFinally = hasOwn.call(entry, \"finallyLoc\");\n\n if (hasCatch && hasFinally) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n } else if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n } else if (hasCatch) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n }\n } else if (hasFinally) {\n if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n } else {\n throw new Error(\"try statement without catch or finally\");\n }\n }\n }\n },\n abrupt: function (type, arg) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n\n if (entry.tryLoc <= this.prev && hasOwn.call(entry, \"finallyLoc\") && this.prev < entry.finallyLoc) {\n var finallyEntry = entry;\n break;\n }\n }\n\n if (finallyEntry && (type === \"break\" || type === \"continue\") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) {\n // Ignore the finally entry if control is not jumping to a\n // location outside the try/catch block.\n finallyEntry = null;\n }\n\n var record = finallyEntry ? finallyEntry.completion : {};\n record.type = type;\n record.arg = arg;\n\n if (finallyEntry) {\n this.method = \"next\";\n this.next = finallyEntry.finallyLoc;\n return ContinueSentinel;\n }\n\n return this.complete(record);\n },\n complete: function (record, afterLoc) {\n if (record.type === \"throw\") {\n throw record.arg;\n }\n\n if (record.type === \"break\" || record.type === \"continue\") {\n this.next = record.arg;\n } else if (record.type === \"return\") {\n this.rval = this.arg = record.arg;\n this.method = \"return\";\n this.next = \"end\";\n } else if (record.type === \"normal\" && afterLoc) {\n this.next = afterLoc;\n }\n\n return ContinueSentinel;\n },\n finish: function (finallyLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n\n if (entry.finallyLoc === finallyLoc) {\n this.complete(entry.completion, entry.afterLoc);\n resetTryEntry(entry);\n return ContinueSentinel;\n }\n }\n },\n \"catch\": function (tryLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n\n if (entry.tryLoc === tryLoc) {\n var record = entry.completion;\n\n if (record.type === \"throw\") {\n var thrown = record.arg;\n resetTryEntry(entry);\n }\n\n return thrown;\n }\n } // The context.catch method must only be called with a location\n // argument that corresponds to a known catch block.\n\n\n throw new Error(\"illegal catch attempt\");\n },\n delegateYield: function (iterable, resultName, nextLoc) {\n this.delegate = {\n iterator: values(iterable),\n resultName: resultName,\n nextLoc: nextLoc\n };\n\n if (this.method === \"next\") {\n // Deliberately forget the last sent value so that we don't\n // accidentally pass it on to the delegate.\n this.arg = undefined;\n }\n\n return ContinueSentinel;\n }\n };\n}( // In sloppy mode, unbound `this` refers to the global object, fallback to\n// Function constructor if we're in global strict mode. That is sadly a form\n// of indirect eval which violates Content Security Policy.\nfunction () {\n return this;\n}() || Function(\"return this\")());\n\n/***/ }),\n/* 2 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"a\", function() { return ExtensionBridge; });\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_standard_file_js_dist_regenerator_js__ = __webpack_require__(1);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_standard_file_js_dist_regenerator_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_standard_file_js_dist_regenerator_js__);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_standard_file_js_dist_lodash_min_js__ = __webpack_require__(5);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_standard_file_js_dist_lodash_min_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_standard_file_js_dist_lodash_min_js__);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_standard_file_js__ = __webpack_require__(0);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_standard_file_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_standard_file_js__);\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\n\n\n\n\nvar ExtensionBridge =\n/*#__PURE__*/\nfunction () {\n function ExtensionBridge(componentManager) {\n _classCallCheck(this, ExtensionBridge);\n\n this.componentManager = componentManager;\n this.updateObservers = [];\n this.items = [];\n }\n\n _createClass(ExtensionBridge, [{\n key: \"getPlatform\",\n value: function getPlatform() {\n return this.componentManager.platform;\n }\n }, {\n key: \"getEnvironment\",\n value: function getEnvironment() {\n return this.componentManager.environment;\n }\n }, {\n key: \"isMobile\",\n value: function isMobile() {\n return this.getEnvironment() == \"mobile\";\n }\n }, {\n key: \"addEventHandler\",\n value: function addEventHandler(callback) {\n var observer = {\n id: Math.random,\n callback: callback\n };\n this.updateObservers.push(observer);\n return observer;\n }\n }, {\n key: \"removeUpdateObserver\",\n value: function removeUpdateObserver(observer) {\n this.updateObservers.splice(this.updateObservers.indexOf(observer), 1);\n }\n }, {\n key: \"notifyObserversOfEvent\",\n value: function notifyObserversOfEvent(event) {\n var _iteratorNormalCompletion = true;\n var _didIteratorError = false;\n var _iteratorError = undefined;\n\n try {\n for (var _iterator = this.updateObservers[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var observer = _step.value;\n observer.callback(event);\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator[\"return\"] != null) {\n _iterator[\"return\"]();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n }\n }, {\n key: \"filterItems\",\n value: function filterItems(contentType) {\n return this.items.filter(function (item) {\n return item.content_type == contentType;\n });\n }\n }, {\n key: \"getFileDescriptors\",\n value: function getFileDescriptors() {\n return this.filterItems(ExtensionBridge.FileDescriptorContentTypeKey);\n }\n }, {\n key: \"beginStreamingFiles\",\n value: function beginStreamingFiles() {\n var _this = this;\n\n var contentTypes = [ExtensionBridge.FileDescriptorContentTypeKey, ExtensionBridge.FileSafeCredentialsContentType, ExtensionBridge.FileSafeIntegrationContentTypeKey];\n this.componentManager.streamItems(contentTypes, function (items) {\n _this.handleStreamItemsMessage(items);\n });\n }\n }, {\n key: \"handleStreamItemsMessage\",\n value: function handleStreamItemsMessage(items) {\n var _iteratorNormalCompletion2, _didIteratorError2, _iteratorError2, _iterator2, _step2, item, index;\n\n return regeneratorRuntime.async(function handleStreamItemsMessage$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n _iteratorNormalCompletion2 = true;\n _didIteratorError2 = false;\n _iteratorError2 = undefined;\n _context.prev = 3;\n _iterator2 = items[Symbol.iterator]();\n\n case 5:\n if (_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done) {\n _context.next = 18;\n break;\n }\n\n item = _step2.value;\n item = new __WEBPACK_IMPORTED_MODULE_2_standard_file_js__[\"SFItem\"](item);\n\n if (!item.deleted) {\n _context.next = 11;\n break;\n }\n\n this.removeItemFromItems(item);\n return _context.abrupt(\"continue\", 15);\n\n case 11:\n if (!item.isMetadataUpdate) {\n _context.next = 13;\n break;\n }\n\n return _context.abrupt(\"continue\", 15);\n\n case 13:\n index = this.indexOfItem(item);\n\n if (index >= 0) {\n this.items[index] = item;\n } else {\n this.items.push(item);\n }\n\n case 15:\n _iteratorNormalCompletion2 = true;\n _context.next = 5;\n break;\n\n case 18:\n _context.next = 24;\n break;\n\n case 20:\n _context.prev = 20;\n _context.t0 = _context[\"catch\"](3);\n _didIteratorError2 = true;\n _iteratorError2 = _context.t0;\n\n case 24:\n _context.prev = 24;\n _context.prev = 25;\n\n if (!_iteratorNormalCompletion2 && _iterator2[\"return\"] != null) {\n _iterator2[\"return\"]();\n }\n\n case 27:\n _context.prev = 27;\n\n if (!_didIteratorError2) {\n _context.next = 30;\n break;\n }\n\n throw _iteratorError2;\n\n case 30:\n return _context.finish(27);\n\n case 31:\n return _context.finish(24);\n\n case 32:\n this.notifyObserversOfEvent(ExtensionBridge.BridgeEventReceivedItems);\n\n case 33:\n case \"end\":\n return _context.stop();\n }\n }\n }, null, this, [[3, 20, 24, 32], [25,, 27, 31]]);\n }\n }, {\n key: \"indexOfItem\",\n value: function indexOfItem(item) {\n for (var index in this.items) {\n if (this.items[index].uuid == item.uuid) {\n return index;\n }\n }\n\n return -1;\n }\n }, {\n key: \"removeItemFromItems\",\n value: function removeItemFromItems(item) {\n this.items = this.items.filter(function (candidate) {\n return candidate.uuid !== item.uuid;\n });\n }\n }, {\n key: \"createItem\",\n value: function createItem(item, callback) {\n this.createItems([item], callback);\n }\n }, {\n key: \"createItems\",\n value: function createItems(items, callback) {\n // Not sure why we're nulling UUIDs here. If this was neccessary, componentManager should be the one to do it.\n // for(var item of items) { item.uuid = null; }\n this.componentManager.createItems(items, function (createdItems) {\n callback && callback(createdItems.map(function (item) {\n return new __WEBPACK_IMPORTED_MODULE_2_standard_file_js__[\"SFItem\"](item);\n }));\n });\n }\n }, {\n key: \"saveItem\",\n value: function saveItem(item) {\n return regeneratorRuntime.async(function saveItem$(_context2) {\n while (1) {\n switch (_context2.prev = _context2.next) {\n case 0:\n return _context2.abrupt(\"return\", this.saveItems([item]));\n\n case 1:\n case \"end\":\n return _context2.stop();\n }\n }\n }, null, this);\n }\n }, {\n key: \"saveItems\",\n value: function saveItems(items) {\n var _this2 = this;\n\n return regeneratorRuntime.async(function saveItems$(_context3) {\n while (1) {\n switch (_context3.prev = _context3.next) {\n case 0:\n return _context3.abrupt(\"return\", new Promise(function (resolve, reject) {\n _this2.componentManager.saveItems(items, function (response) {\n resolve(response);\n\n _this2.notifyObserversOfEvent(ExtensionBridge.BridgeEventSavedItem);\n });\n }));\n\n case 1:\n case \"end\":\n return _context3.stop();\n }\n }\n });\n }\n }, {\n key: \"indexOfItem\",\n value: function indexOfItem(item) {\n for (var index in this.items) {\n if (this.items[index].uuid == item.uuid) {\n return index;\n }\n }\n\n return -1;\n }\n }, {\n key: \"deleteItem\",\n value: function deleteItem(item, callback) {\n this.deleteItems([item], callback);\n }\n }, {\n key: \"deleteItems\",\n value: function deleteItems(items, callback) {\n this.componentManager.deleteItems(items, callback);\n }\n }, {\n key: \"removeItemFromItems\",\n value: function removeItemFromItems(item) {\n this.items = this.items.filter(function (candidate) {\n return candidate.uuid !== item.uuid;\n });\n }\n }]);\n\n return ExtensionBridge;\n}();\n\n_defineProperty(ExtensionBridge, \"FileItemContentTypeKey\", \"SN|FileSafe|File\");\n\n_defineProperty(ExtensionBridge, \"FileSafeCredentialsContentType\", \"SN|FileSafe|Credentials\");\n\n_defineProperty(ExtensionBridge, \"FileDescriptorContentTypeKey\", \"SN|FileSafe|FileMetadata\");\n\n_defineProperty(ExtensionBridge, \"FileSafeIntegrationContentTypeKey\", \"SN|FileSafe|Integration\");\n\n_defineProperty(ExtensionBridge, \"BridgeEventLoadedCredentials\", \"BridgeEventLoadedCredentials\");\n\n_defineProperty(ExtensionBridge, \"BridgeEventReceivedItems\", \"BridgeEventReceivedItems\");\n\n_defineProperty(ExtensionBridge, \"BridgeEventSavedItem\", \"BridgeEventSavedItem\");\n\n\n\n/***/ }),\n/* 3 */\n/***/ (function(module, exports) {\n\nvar g; // This works in non-strict mode\n\ng = function () {\n return this;\n}();\n\ntry {\n // This works if eval is allowed (see CSP)\n g = g || Function(\"return this\")() || (1, eval)(\"this\");\n} catch (e) {\n // This works if the window reference is available\n if (typeof window === \"object\") g = window;\n} // g can still be undefined, but nothing to do about it...\n// We return undefined, instead of nothing here, so it's\n// easier to handle this case. if(!global) { ...}\n\n\nmodule.exports = g;\n\n/***/ }),\n/* 4 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\nObject.defineProperty(__webpack_exports__, \"__esModule\", { value: true });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return Filesafe; });\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__lib_ExtensionBridge__ = __webpack_require__(2);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__lib_RelayManager__ = __webpack_require__(7);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__lib_IntegrationManager__ = __webpack_require__(8);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__lib_CredentialManager__ = __webpack_require__(9);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__lib_FileManager__ = __webpack_require__(10);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__lib_util_Utils__ = __webpack_require__(12);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_standard_file_js__ = __webpack_require__(0);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_standard_file_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_6_standard_file_js__);\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\n\n\n\n\n\n\n\n\nvar Filesafe =\n/*#__PURE__*/\nfunction () {\n _createClass(Filesafe, null, [{\n key: \"getSFItemClass\",\n // Allow consumers to construct these objects without including entire standard-file-js lib\n value: function getSFItemClass() {\n return __WEBPACK_IMPORTED_MODULE_6_standard_file_js__[\"SFItem\"];\n }\n }]);\n\n function Filesafe(_ref) {\n var _this = this;\n\n var componentManager = _ref.componentManager;\n\n _classCallCheck(this, Filesafe);\n\n this.dataChangeObservers = [];\n this.newFileDescriptorHandlers = [];\n this.extensionBridge = new __WEBPACK_IMPORTED_MODULE_0__lib_ExtensionBridge__[\"a\" /* default */](componentManager);\n this.extensionBridge.addEventHandler(function (eventName) {\n _this.notifyObservers();\n });\n this.relayManager = new __WEBPACK_IMPORTED_MODULE_1__lib_RelayManager__[\"a\" /* default */]();\n this.integrationManager = new __WEBPACK_IMPORTED_MODULE_2__lib_IntegrationManager__[\"a\" /* default */](this.extensionBridge);\n this.credentialManager = new __WEBPACK_IMPORTED_MODULE_3__lib_CredentialManager__[\"a\" /* default */]({\n extensionBridge: this.extensionBridge,\n onCredentialLoad: function onCredentialLoad() {\n _this.relayManager.setCredentials(_this.credentialManager.getDefaultCredentials());\n }\n });\n this.fileManager = new __WEBPACK_IMPORTED_MODULE_4__lib_FileManager__[\"a\" /* default */](this.extensionBridge, this.relayManager, this.integrationManager, this.credentialManager);\n this.extensionBridge.beginStreamingFiles();\n }\n /*\n Observe changes\n */\n\n\n _createClass(Filesafe, [{\n key: \"addNewFileDescriptorHandler\",\n value: function addNewFileDescriptorHandler(handler) {\n this.newFileDescriptorHandlers.push(handler);\n }\n }, {\n key: \"notifyObservers\",\n value: function notifyObservers() {\n var _iteratorNormalCompletion = true;\n var _didIteratorError = false;\n var _iteratorError = undefined;\n\n try {\n for (var _iterator = this.dataChangeObservers[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var observer = _step.value;\n observer();\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator[\"return\"] != null) {\n _iterator[\"return\"]();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n }\n }, {\n key: \"addDataChangeObserver\",\n value: function addDataChangeObserver(observer) {\n this.dataChangeObservers.push(observer);\n return observer;\n }\n }, {\n key: \"removeDataChangeObserver\",\n value: function removeDataChangeObserver(observer) {\n this.dataChangeObservers = this.dataChangeObservers.filter(function (candidate) {\n return candidate != observer;\n });\n }\n /* Set current note. Used by filesafe-embed to show files for current note. */\n\n }, {\n key: \"setCurrentNote\",\n value: function setCurrentNote(note) {\n this.currentNote = note;\n this.notifyObservers();\n }\n /* Files */\n\n }, {\n key: \"getAllFileDescriptors\",\n value: function getAllFileDescriptors() {\n return this.fileManager.getAllFileDescriptors();\n }\n }, {\n key: \"findFileDescriptor\",\n value: function findFileDescriptor(uuid) {\n return this.fileManager.findFileDescriptor(uuid);\n }\n }, {\n key: \"fileDescriptorsForCurrentNote\",\n value: function fileDescriptorsForCurrentNote() {\n return this.fileManager.fileDescriptorsForNote(this.currentNote);\n }\n }, {\n key: \"fileDescriptorsForNote\",\n value: function fileDescriptorsForNote(note) {\n return this.fileManager.fileDescriptorsForNote(note);\n }\n }, {\n key: \"fileDescriptorsEncryptedWithCredential\",\n value: function fileDescriptorsEncryptedWithCredential(credential) {\n return this.fileManager.fileDescriptorsEncryptedWithCredential(credential);\n }\n }, {\n key: \"deleteFileFromDescriptor\",\n value: function deleteFileFromDescriptor(fileDescriptor) {\n return regeneratorRuntime.async(function deleteFileFromDescriptor$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n return _context.abrupt(\"return\", this.fileManager.deleteFileFromDescriptor(fileDescriptor));\n\n case 1:\n case \"end\":\n return _context.stop();\n }\n }\n }, null, this);\n }\n }, {\n key: \"uploadFile\",\n value: function uploadFile(_ref2) {\n var fileItem, inputFileName, fileType, credential, note, descriptor, _iteratorNormalCompletion2, _didIteratorError2, _iteratorError2, _iterator2, _step2, observer;\n\n return regeneratorRuntime.async(function uploadFile$(_context2) {\n while (1) {\n switch (_context2.prev = _context2.next) {\n case 0:\n fileItem = _ref2.fileItem, inputFileName = _ref2.inputFileName, fileType = _ref2.fileType, credential = _ref2.credential, note = _ref2.note;\n\n if (!note) {\n note = this.currentNote;\n }\n\n _context2.next = 4;\n return regeneratorRuntime.awrap(this.fileManager.uploadFile({\n fileItem: fileItem,\n inputFileName: inputFileName,\n fileType: fileType,\n credential: credential,\n note: note\n }));\n\n case 4:\n descriptor = _context2.sent;\n\n if (!descriptor) {\n _context2.next = 25;\n break;\n }\n\n _iteratorNormalCompletion2 = true;\n _didIteratorError2 = false;\n _iteratorError2 = undefined;\n _context2.prev = 9;\n\n for (_iterator2 = this.newFileDescriptorHandlers[Symbol.iterator](); !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {\n observer = _step2.value;\n observer(descriptor);\n }\n\n _context2.next = 17;\n break;\n\n case 13:\n _context2.prev = 13;\n _context2.t0 = _context2[\"catch\"](9);\n _didIteratorError2 = true;\n _iteratorError2 = _context2.t0;\n\n case 17:\n _context2.prev = 17;\n _context2.prev = 18;\n\n if (!_iteratorNormalCompletion2 && _iterator2[\"return\"] != null) {\n _iterator2[\"return\"]();\n }\n\n case 20:\n _context2.prev = 20;\n\n if (!_didIteratorError2) {\n _context2.next = 23;\n break;\n }\n\n throw _iteratorError2;\n\n case 23:\n return _context2.finish(20);\n\n case 24:\n return _context2.finish(17);\n\n case 25:\n return _context2.abrupt(\"return\", descriptor);\n\n case 26:\n case \"end\":\n return _context2.stop();\n }\n }\n }, null, this, [[9, 13, 17, 25], [18,, 20, 24]]);\n }\n }, {\n key: \"encryptAndUploadJavaScriptFileObject\",\n value: function encryptAndUploadJavaScriptFileObject(jsFile) {\n var _this2 = this;\n\n return regeneratorRuntime.async(function encryptAndUploadJavaScriptFileObject$(_context4) {\n while (1) {\n switch (_context4.prev = _context4.next) {\n case 0:\n return _context4.abrupt(\"return\", new Promise(function (resolve, reject) {\n var reader = new FileReader();\n\n reader.onload = function _callee(e) {\n var data, arrayBuffer, base64Data, result;\n return regeneratorRuntime.async(function _callee$(_context3) {\n while (1) {\n switch (_context3.prev = _context3.next) {\n case 0:\n data = e.target.result;\n arrayBuffer = data;\n _context3.next = 4;\n return regeneratorRuntime.awrap(SFJS.crypto.arrayBufferToBase64(arrayBuffer));\n\n case 4:\n base64Data = _context3.sent;\n _context3.next = 7;\n return regeneratorRuntime.awrap(_this2.encryptAndUploadData({\n base64Data: base64Data,\n inputFileName: jsFile.name,\n fileType: jsFile.type\n }));\n\n case 7:\n result = _context3.sent;\n resolve(result);\n\n case 9:\n case \"end\":\n return _context3.stop();\n }\n }\n });\n };\n\n reader.readAsArrayBuffer(jsFile);\n }));\n\n case 1:\n case \"end\":\n return _context4.stop();\n }\n }\n });\n }\n }, {\n key: \"encryptAndUploadData\",\n value: function encryptAndUploadData(_ref3) {\n var _this3 = this;\n\n var base64Data, inputFileName, fileType, credential;\n return regeneratorRuntime.async(function encryptAndUploadData$(_context6) {\n while (1) {\n switch (_context6.prev = _context6.next) {\n case 0:\n base64Data = _ref3.base64Data, inputFileName = _ref3.inputFileName, fileType = _ref3.fileType;\n credential = this.getDefaultCredentials();\n return _context6.abrupt(\"return\", this.encryptFile({\n data: base64Data,\n inputFileName: inputFileName,\n fileType: fileType,\n credential: credential\n }).then(function _callee2(fileItem) {\n return regeneratorRuntime.async(function _callee2$(_context5) {\n while (1) {\n switch (_context5.prev = _context5.next) {\n case 0:\n return _context5.abrupt(\"return\", _this3.uploadFile({\n fileItem: fileItem,\n inputFileName: inputFileName,\n fileType: fileType,\n credential: credential\n })[\"catch\"](function (uploadError) {\n console.error(\"filesafe-js | error uploading file:\", uploadError);\n }));\n\n case 1:\n case \"end\":\n return _context5.stop();\n }\n }\n });\n }));\n\n case 3:\n case \"end\":\n return _context6.stop();\n }\n }\n }, null, this);\n }\n }, {\n key: \"downloadFileFromDescriptor\",\n value: function downloadFileFromDescriptor(fileDescriptor) {\n return regeneratorRuntime.async(function downloadFileFromDescriptor$(_context7) {\n while (1) {\n switch (_context7.prev = _context7.next) {\n case 0:\n return _context7.abrupt(\"return\", this.fileManager.downloadFileFromDescriptor(fileDescriptor));\n\n case 1:\n case \"end\":\n return _context7.stop();\n }\n }\n }, null, this);\n }\n }, {\n key: \"encryptFile\",\n value: function encryptFile(_ref4) {\n var data, inputFileName, fileType, credential;\n return regeneratorRuntime.async(function encryptFile$(_context8) {\n while (1) {\n switch (_context8.prev = _context8.next) {\n case 0:\n data = _ref4.data, inputFileName = _ref4.inputFileName, fileType = _ref4.fileType, credential = _ref4.credential;\n return _context8.abrupt(\"return\", this.fileManager.encryptFile({\n data: data,\n inputFileName: inputFileName,\n fileType: fileType,\n credential: credential\n }));\n\n case 2:\n case \"end\":\n return _context8.stop();\n }\n }\n }, null, this);\n }\n /*\n if fileDescriptor is available, we'll use that to determine credentials\n otherwise, passed in credential will be used\n */\n\n }, {\n key: \"decryptFile\",\n value: function decryptFile(_ref5) {\n var fileDescriptor, fileItem, credential;\n return regeneratorRuntime.async(function decryptFile$(_context9) {\n while (1) {\n switch (_context9.prev = _context9.next) {\n case 0:\n fileDescriptor = _ref5.fileDescriptor, fileItem = _ref5.fileItem, credential = _ref5.credential;\n return _context9.abrupt(\"return\", this.fileManager.decryptFile({\n fileDescriptor: fileDescriptor,\n fileItem: fileItem,\n credential: credential\n }));\n\n case 2:\n case \"end\":\n return _context9.stop();\n }\n }\n }, null, this);\n }\n }, {\n key: \"downloadBase64Data\",\n value: function downloadBase64Data(_ref6) {\n var base64Data = _ref6.base64Data,\n fileName = _ref6.fileName,\n fileType = _ref6.fileType;\n __WEBPACK_IMPORTED_MODULE_5__lib_util_Utils__[\"a\" /* default */].downloadData(__WEBPACK_IMPORTED_MODULE_5__lib_util_Utils__[\"a\" /* default */].base64toBinary(base64Data), fileName, fileType);\n }\n }, {\n key: \"createTemporaryFileUrl\",\n value: function createTemporaryFileUrl(_ref7) {\n var base64Data = _ref7.base64Data,\n dataType = _ref7.dataType;\n return __WEBPACK_IMPORTED_MODULE_5__lib_util_Utils__[\"a\" /* default */].tempUrlForData(__WEBPACK_IMPORTED_MODULE_5__lib_util_Utils__[\"a\" /* default */].base64toBinary(base64Data), dataType);\n }\n }, {\n key: \"revokeTempUrl\",\n value: function revokeTempUrl(url) {\n __WEBPACK_IMPORTED_MODULE_5__lib_util_Utils__[\"a\" /* default */].revokeTempUrl(url);\n }\n /* Credentials */\n\n }, {\n key: \"createNewCredentials\",\n value: function createNewCredentials() {\n return regeneratorRuntime.async(function createNewCredentials$(_context10) {\n while (1) {\n switch (_context10.prev = _context10.next) {\n case 0:\n return _context10.abrupt(\"return\", this.credentialManager.createNewCredentials());\n\n case 1:\n case \"end\":\n return _context10.stop();\n }\n }\n }, null, this);\n }\n }, {\n key: \"numberOfFilesEncryptedWithCredential\",\n value: function numberOfFilesEncryptedWithCredential(credential) {\n return this.fileManager.fileDescriptorsEncryptedWithCredential(credential).length;\n }\n }, {\n key: \"credentialForFileDescriptor\",\n value: function credentialForFileDescriptor(fileDescriptor) {\n return this.credentialManager.credentialForFileDescriptor(fileDescriptor);\n }\n }, {\n key: \"getAllCredentials\",\n value: function getAllCredentials() {\n return this.credentialManager.getAllCredentials();\n }\n }, {\n key: \"getDefaultCredentials\",\n value: function getDefaultCredentials() {\n return this.credentialManager.getDefaultCredentials();\n }\n }, {\n key: \"setCredentialAsDefault\",\n value: function setCredentialAsDefault(credential) {\n return this.credentialManager.setCredentialAsDefault(credential);\n }\n }, {\n key: \"deleteCredential\",\n value: function deleteCredential(credential) {\n return this.credentialManager.deleteCredential(credential);\n }\n }, {\n key: \"saveCredential\",\n value: function saveCredential(credential) {\n return this.credentialManager.saveCredential(credential);\n }\n /* Integrations */\n\n }, {\n key: \"getAllIntegrations\",\n value: function getAllIntegrations() {\n return this.integrationManager.integrations;\n }\n }, {\n key: \"integrationForFileDescriptor\",\n value: function integrationForFileDescriptor(fileDescriptor) {\n return this.integrationManager.integrationForFileDescriptor(fileDescriptor);\n }\n }, {\n key: \"saveIntegrationFromCode\",\n value: function saveIntegrationFromCode(code) {\n return this.integrationManager.saveIntegrationFromCode(code);\n }\n }, {\n key: \"getDefaultIntegration\",\n value: function getDefaultIntegration() {\n return this.integrationManager.getDefaultIntegration();\n }\n }, {\n key: \"setIntegrationAsDefault\",\n value: function setIntegrationAsDefault(integration) {\n return this.integrationManager.setIntegrationAsDefault(integration);\n }\n }, {\n key: \"deleteIntegration\",\n value: function deleteIntegration(integration) {\n return this.integrationManager.deleteIntegration(integration);\n }\n }, {\n key: \"displayStringForIntegration\",\n value: function displayStringForIntegration(integration) {\n return this.integrationManager.displayStringForIntegration(integration);\n }\n /*\n Misc\n */\n\n }, {\n key: \"base64toBinary\",\n value: function base64toBinary(base64String) {\n return __WEBPACK_IMPORTED_MODULE_5__lib_util_Utils__[\"a\" /* default */].base64toBinary(base64String);\n }\n }, {\n key: \"isMobile\",\n value: function isMobile() {\n return this.extensionBridge.isMobile();\n }\n /* desktop, web, mobile */\n\n }, {\n key: \"getEnvironment\",\n value: function getEnvironment() {\n return this.extensionBridge.getEnvironment();\n }\n /* desktop-{os}, web-{os}, ios, android */\n\n }, {\n key: \"getPlatform\",\n value: function getPlatform() {\n return this.extensionBridge.getPlatform();\n }\n }, {\n key: \"copyTextToClipboard\",\n value: function copyTextToClipboard(text) {\n return __WEBPACK_IMPORTED_MODULE_5__lib_util_Utils__[\"a\" /* default */].copyTextToClipboard(text);\n }\n }]);\n\n return Filesafe;\n}();\n\n\n\n/***/ }),\n/* 5 */\n/***/ (function(module, exports, __webpack_require__) {\n\n/* WEBPACK VAR INJECTION */(function(global, module) {var __WEBPACK_AMD_DEFINE_RESULT__;/**\n * @license\n * Lodash (Custom Build) lodash.com/license | Underscore.js 1.8.3 underscorejs.org/LICENSE\n * Build: `lodash include=\"includes,merge,filter,map,remove,find,omit,pull,cloneDeep,pick,uniq,sortedIndexBy,mergeWith\"`\n */\n;\n(function () {\n function t(t, e) {\n return t.set(e[0], e[1]), t;\n }\n\n function e(t, e) {\n return t.add(e), t;\n }\n\n function n(t, e, n) {\n switch (n.length) {\n case 0:\n return t.call(e);\n\n case 1:\n return t.call(e, n[0]);\n\n case 2:\n return t.call(e, n[0], n[1]);\n\n case 3:\n return t.call(e, n[0], n[1], n[2]);\n }\n\n return t.apply(e, n);\n }\n\n function r(t, e) {\n for (var n = -1, r = null == t ? 0 : t.length; ++n < r && false !== e(t[n], n, t););\n }\n\n function o(t, e) {\n for (var n = -1, r = null == t ? 0 : t.length, o = 0, u = []; ++n < r;) {\n var c = t[n];\n e(c, n, t) && (u[o++] = c);\n }\n\n return u;\n }\n\n function u(t, e) {\n return !(null == t || !t.length) && -1 < s(t, e, 0);\n }\n\n function c(t, e) {\n for (var n = -1, r = null == t ? 0 : t.length, o = Array(r); ++n < r;) o[n] = e(t[n], n, t);\n\n return o;\n }\n\n function i(t, e) {\n for (var n = -1, r = e.length, o = t.length; ++n < r;) t[o + n] = e[n];\n\n return t;\n }\n\n function a(t, e, n) {\n for (var r = -1, o = null == t ? 0 : t.length; ++r < o;) n = e(n, t[r], r, t);\n\n return n;\n }\n\n function f(t, e) {\n for (var n = -1, r = null == t ? 0 : t.length; ++n < r;) if (e(t[n], n, t)) return true;\n\n return false;\n }\n\n function l(t, e, n) {\n var r = t.length;\n\n for (n += -1; ++n < r;) if (e(t[n], n, t)) return n;\n\n return -1;\n }\n\n function s(t, e, n) {\n if (e === e) t: {\n --n;\n\n for (var r = t.length; ++n < r;) if (t[n] === e) {\n t = n;\n break t;\n }\n\n t = -1;\n } else t = l(t, b, n);\n return t;\n }\n\n function b(t) {\n return t !== t;\n }\n\n function h(t) {\n return function (e) {\n return null == e ? ae : e[t];\n };\n }\n\n function p(t) {\n return function (e) {\n return t(e);\n };\n }\n\n function y(t, e) {\n return c(e, function (e) {\n return t[e];\n });\n }\n\n function j(t, e) {\n return t.has(e);\n }\n\n function v(t) {\n var e = -1,\n n = Array(t.size);\n return t.forEach(function (t, r) {\n n[++e] = [r, t];\n }), n;\n }\n\n function g(t) {\n var e = Object;\n return function (n) {\n return t(e(n));\n };\n }\n\n function _(t) {\n var e = -1,\n n = Array(t.size);\n return t.forEach(function (t) {\n n[++e] = t;\n }), n;\n }\n\n function d() {}\n\n function A(t) {\n var e = -1,\n n = null == t ? 0 : t.length;\n\n for (this.clear(); ++e < n;) {\n var r = t[e];\n this.set(r[0], r[1]);\n }\n }\n\n function w(t) {\n var e = -1,\n n = null == t ? 0 : t.length;\n\n for (this.clear(); ++e < n;) {\n var r = t[e];\n this.set(r[0], r[1]);\n }\n }\n\n function m(t) {\n var e = -1,\n n = null == t ? 0 : t.length;\n\n for (this.clear(); ++e < n;) {\n var r = t[e];\n this.set(r[0], r[1]);\n }\n }\n\n function O(t) {\n var e = -1,\n n = null == t ? 0 : t.length;\n\n for (this.__data__ = new m(); ++e < n;) this.add(t[e]);\n }\n\n function S(t) {\n this.size = (this.__data__ = new w(t)).size;\n }\n\n function k(t, e) {\n var n = Dn(t),\n r = !n && Bn(t),\n o = !n && !r && Pn(t),\n u = !n && !r && !o && Ln(t);\n\n if (n = n || r || o || u) {\n for (var r = t.length, c = String, i = -1, a = Array(r); ++i < r;) a[i] = c(i);\n\n r = a;\n } else r = [];\n\n var f,\n c = r.length;\n\n for (f in t) !e && !Ne.call(t, f) || n && (\"length\" == f || o && (\"offset\" == f || \"parent\" == f) || u && (\"buffer\" == f || \"byteLength\" == f || \"byteOffset\" == f) || mt(f, c)) || r.push(f);\n\n return r;\n }\n\n function z(t, e, n) {\n (n === ae || Bt(t[e], n)) && (n !== ae || e in t) || M(t, e, n);\n }\n\n function x(t, e, n) {\n var r = t[e];\n Ne.call(t, e) && Bt(r, n) && (n !== ae || e in t) || M(t, e, n);\n }\n\n function I(t, e) {\n for (var n = t.length; n--;) if (Bt(t[n][0], e)) return n;\n\n return -1;\n }\n\n function F(t, e) {\n return t && ut(e, Yt(e), t);\n }\n\n function E(t, e) {\n return t && ut(e, Zt(e), t);\n }\n\n function M(t, e, n) {\n \"__proto__\" == e && tn ? tn(t, e, {\n configurable: true,\n enumerable: true,\n value: n,\n writable: true\n }) : t[e] = n;\n }\n\n function $(t, e, n, o, u, c) {\n var i,\n a = 1 & e,\n f = 2 & e,\n l = 4 & e;\n if (n && (i = u ? n(t, o, u, c) : n(t)), i !== ae) return i;\n if (!Vt(t)) return t;\n\n if (o = Dn(t)) {\n if (i = _t(t), !a) return ot(t, i);\n } else {\n var s = Fn(t),\n b = \"[object Function]\" == s || \"[object GeneratorFunction]\" == s;\n if (Pn(t)) return et(t, a);\n\n if (\"[object Object]\" == s || \"[object Arguments]\" == s || b && !u) {\n if (i = f || b ? {} : dt(t), !a) return f ? it(t, E(i, t)) : ct(t, F(i, t));\n } else {\n if (!Oe[s]) return u ? t : {};\n i = At(t, s, $, a);\n }\n }\n\n if (c || (c = new S()), u = c.get(t)) return u;\n c.set(t, i);\n var f = l ? f ? pt : ht : f ? Zt : Yt,\n h = o ? ae : f(t);\n return r(h || t, function (r, o) {\n h && (o = r, r = t[o]), x(i, o, $(r, e, n, o, t, c));\n }), i;\n }\n\n function U(t, e) {\n var n = [];\n return On(t, function (t, r, o) {\n e(t, r, o) && n.push(t);\n }), n;\n }\n\n function B(t, e, n, r, o) {\n var u = -1,\n c = t.length;\n\n for (n || (n = wt), o || (o = []); ++u < c;) {\n var a = t[u];\n 0 < e && n(a) ? 1 < e ? B(a, e - 1, n, r, o) : i(o, a) : r || (o[o.length] = a);\n }\n\n return o;\n }\n\n function D(t, e) {\n e = tt(e, t);\n\n for (var n = 0, r = e.length; null != t && n < r;) t = t[xt(e[n++])];\n\n return n && n == r ? t : ae;\n }\n\n function P(t, e, n) {\n return e = e(t), Dn(t) ? e : i(e, n(t));\n }\n\n function L(t) {\n if (null == t) t = t === ae ? \"[object Undefined]\" : \"[object Null]\";else if (Ze && Ze in Object(t)) {\n var e = Ne.call(t, Ze),\n n = t[Ze];\n\n try {\n t[Ze] = ae;\n var r = true;\n } catch (t) {}\n\n var o = Ce.call(t);\n r && (e ? t[Ze] = n : delete t[Ze]), t = o;\n } else t = Ce.call(t);\n return t;\n }\n\n function N(t) {\n return Ct(t) && \"[object Arguments]\" == L(t);\n }\n\n function V(t, e, n, r, o) {\n if (t === e) e = true;else if (null == t || null == e || !Ct(t) && !Ct(e)) e = t !== t && e !== e;else t: {\n var u = Dn(t),\n c = Dn(e),\n i = u ? \"[object Array]\" : Fn(t),\n a = c ? \"[object Array]\" : Fn(e),\n i = \"[object Arguments]\" == i ? \"[object Object]\" : i,\n a = \"[object Arguments]\" == a ? \"[object Object]\" : a,\n f = \"[object Object]\" == i,\n c = \"[object Object]\" == a;\n\n if ((a = i == a) && Pn(t)) {\n if (!Pn(e)) {\n e = false;\n break t;\n }\n\n u = true, f = false;\n }\n\n if (a && !f) o || (o = new S()), e = u || Ln(t) ? lt(t, e, n, r, V, o) : st(t, e, i, n, r, V, o);else {\n if (!(1 & n) && (u = f && Ne.call(t, \"__wrapped__\"), i = c && Ne.call(e, \"__wrapped__\"), u || i)) {\n t = u ? t.value() : t, e = i ? e.value() : e, o || (o = new S()), e = V(t, e, n, r, o);\n break t;\n }\n\n if (a) {\n e: if (o || (o = new S()), u = 1 & n, i = ht(t), c = i.length, a = ht(e).length, c == a || u) {\n for (f = c; f--;) {\n var l = i[f];\n\n if (!(u ? l in e : Ne.call(e, l))) {\n e = false;\n break e;\n }\n }\n\n if ((a = o.get(t)) && o.get(e)) e = a == e;else {\n a = true, o.set(t, e), o.set(e, t);\n\n for (var s = u; ++f < c;) {\n var l = i[f],\n b = t[l],\n h = e[l];\n if (r) var p = u ? r(h, b, l, e, t, o) : r(b, h, l, t, e, o);\n\n if (p === ae ? b !== h && !V(b, h, n, r, o) : !p) {\n a = false;\n break;\n }\n\n s || (s = \"constructor\" == l);\n }\n\n a && !s && (n = t.constructor, r = e.constructor, n != r && \"constructor\" in t && \"constructor\" in e && !(typeof n == \"function\" && n instanceof n && typeof r == \"function\" && r instanceof r) && (a = false)), o.delete(t), o.delete(e), e = a;\n }\n } else e = false;\n } else e = false;\n }\n }\n return e;\n }\n\n function C(t, e) {\n var n = e.length,\n r = n;\n if (null == t) return !r;\n\n for (t = Object(t); n--;) {\n var o = e[n];\n if (o[2] ? o[1] !== t[o[0]] : !(o[0] in t)) return false;\n }\n\n for (; ++n < r;) {\n var o = e[n],\n u = o[0],\n c = t[u],\n i = o[1];\n\n if (o[2]) {\n if (c === ae && !(u in t)) return false;\n } else if (o = new S(), void 0 === ae ? !V(i, c, 3, void 0, o) : 1) return false;\n }\n\n return true;\n }\n\n function R(t) {\n return Ct(t) && Nt(t.length) && !!me[L(t)];\n }\n\n function T(t) {\n return typeof t == \"function\" ? t : null == t ? ne : typeof t == \"object\" ? Dn(t) ? G(t[0], t[1]) : q(t) : ue(t);\n }\n\n function W(t, e) {\n var n = -1,\n r = Dt(t) ? Array(t.length) : [];\n return On(t, function (t, o, u) {\n r[++n] = e(t, o, u);\n }), r;\n }\n\n function q(t) {\n var e = vt(t);\n return 1 == e.length && e[0][2] ? kt(e[0][0], e[0][1]) : function (n) {\n return n === t || C(n, e);\n };\n }\n\n function G(t, e) {\n return Ot(t) && e === e && !Vt(e) ? kt(xt(t), e) : function (n) {\n var r = Qt(n, t);\n return r === ae && r === e ? Xt(n, t) : V(e, r, 3);\n };\n }\n\n function H(t, e, n, r, o) {\n t !== e && Sn(e, function (u, c) {\n if (Vt(u)) {\n o || (o = new S());\n var i = o,\n a = t[c],\n f = e[c],\n l = i.get(f);\n if (l) z(t, c, l);else {\n var l = r ? r(a, f, c + \"\", t, e, i) : ae,\n s = l === ae;\n\n if (s) {\n var b = Dn(f),\n h = !b && Pn(f),\n p = !b && !h && Ln(f),\n l = f;\n b || h || p ? Dn(a) ? l = a : Pt(a) ? l = ot(a) : h ? (s = false, l = et(f, true)) : p ? (s = false, l = rt(f, true)) : l = [] : Rt(f) || Bn(f) ? (l = a, Bn(a) ? l = Jt(a) : (!Vt(a) || n && Lt(a)) && (l = dt(f))) : s = false;\n }\n\n s && (i.set(f, l), H(l, f, n, r, i), i.delete(f)), z(t, c, l);\n }\n } else i = r ? r(t[c], u, c + \"\", t, e, o) : ae, i === ae && (i = u), z(t, c, i);\n }, Zt);\n }\n\n function J(t, e) {\n return K(t, e, function (e, n) {\n return Xt(t, n);\n });\n }\n\n function K(t, e, n) {\n for (var r = -1, o = e.length, u = {}; ++r < o;) {\n var c = e[r],\n i = D(t, c);\n\n if (n(i, c)) {\n var a = u,\n c = tt(c, t);\n if (Vt(a)) for (var c = tt(c, a), f = -1, l = c.length, s = l - 1; null != a && ++f < l;) {\n var b = xt(c[f]),\n h = i;\n\n if (f != s) {\n var p = a[b],\n h = ae;\n h === ae && (h = Vt(p) ? p : mt(c[f + 1]) ? [] : {});\n }\n\n x(a, b, h), a = a[b];\n }\n }\n }\n\n return u;\n }\n\n function Q(t) {\n return function (e) {\n return D(e, t);\n };\n }\n\n function X(t) {\n return En(zt(t, void 0, ne), t + \"\");\n }\n\n function Y(t) {\n if (typeof t == \"string\") return t;\n if (Dn(t)) return c(t, Y) + \"\";\n if (Wt(t)) return wn ? wn.call(t) : \"\";\n var e = t + \"\";\n return \"0\" == e && 1 / t == -fe ? \"-0\" : e;\n }\n\n function Z(t, e) {\n e = tt(e, t);\n var n;\n if (2 > e.length) n = t;else {\n n = e;\n var r = 0,\n o = -1,\n u = -1,\n c = n.length;\n\n for (0 > r && (r = -r > c ? 0 : c + r), o = o > c ? c : o, 0 > o && (o += c), c = r > o ? 0 : o - r >>> 0, r >>>= 0, o = Array(c); ++u < c;) o[u] = n[u + r];\n\n n = D(t, o);\n }\n t = n, null == t || delete t[xt(Mt(e))];\n }\n\n function tt(t, e) {\n return Dn(t) ? t : Ot(t, e) ? [t] : Mn(Kt(t));\n }\n\n function et(t, e) {\n if (e) return t.slice();\n var n = t.length,\n n = He ? He(n) : new t.constructor(n);\n return t.copy(n), n;\n }\n\n function nt(t) {\n var e = new t.constructor(t.byteLength);\n return new Ge(e).set(new Ge(t)), e;\n }\n\n function rt(t, e) {\n return new t.constructor(e ? nt(t.buffer) : t.buffer, t.byteOffset, t.length);\n }\n\n function ot(t, e) {\n var n = -1,\n r = t.length;\n\n for (e || (e = Array(r)); ++n < r;) e[n] = t[n];\n\n return e;\n }\n\n function ut(t, e, n) {\n var r = !n;\n n || (n = {});\n\n for (var o = -1, u = e.length; ++o < u;) {\n var c = e[o],\n i = ae;\n i === ae && (i = t[c]), r ? M(n, c, i) : x(n, c, i);\n }\n\n return n;\n }\n\n function ct(t, e) {\n return ut(t, xn(t), e);\n }\n\n function it(t, e) {\n return ut(t, In(t), e);\n }\n\n function at(t) {\n return X(function (e, n) {\n var r,\n o = -1,\n u = n.length,\n c = 1 < u ? n[u - 1] : ae,\n i = 2 < u ? n[2] : ae,\n c = 3 < t.length && typeof c == \"function\" ? (u--, c) : ae;\n\n if (r = i) {\n r = n[0];\n var a = n[1];\n\n if (Vt(i)) {\n var f = typeof a;\n r = !!(\"number\" == f ? Dt(i) && mt(a, i.length) : \"string\" == f && a in i) && Bt(i[a], r);\n } else r = false;\n }\n\n for (r && (c = 3 > u ? ae : c, u = 1), e = Object(e); ++o < u;) (i = n[o]) && t(e, i, o, c);\n\n return e;\n });\n }\n\n function ft(t) {\n return Rt(t) ? ae : t;\n }\n\n function lt(t, e, n, r, o, u) {\n var c = 1 & n,\n i = t.length,\n a = e.length;\n if (i != a && !(c && a > i)) return false;\n if ((a = u.get(t)) && u.get(e)) return a == e;\n var a = -1,\n l = true,\n s = 2 & n ? new O() : ae;\n\n for (u.set(t, e), u.set(e, t); ++a < i;) {\n var b = t[a],\n h = e[a];\n if (r) var p = c ? r(h, b, a, e, t, u) : r(b, h, a, t, e, u);\n\n if (p !== ae) {\n if (p) continue;\n l = false;\n break;\n }\n\n if (s) {\n if (!f(e, function (t, e) {\n if (!j(s, e) && (b === t || o(b, t, n, r, u))) return s.push(e);\n })) {\n l = false;\n break;\n }\n } else if (b !== h && !o(b, h, n, r, u)) {\n l = false;\n break;\n }\n }\n\n return u.delete(t), u.delete(e), l;\n }\n\n function st(t, e, n, r, o, u, c) {\n switch (n) {\n case \"[object DataView]\":\n if (t.byteLength != e.byteLength || t.byteOffset != e.byteOffset) break;\n t = t.buffer, e = e.buffer;\n\n case \"[object ArrayBuffer]\":\n if (t.byteLength != e.byteLength || !u(new Ge(t), new Ge(e))) break;\n return true;\n\n case \"[object Boolean]\":\n case \"[object Date]\":\n case \"[object Number]\":\n return Bt(+t, +e);\n\n case \"[object Error]\":\n return t.name == e.name && t.message == e.message;\n\n case \"[object RegExp]\":\n case \"[object String]\":\n return t == e + \"\";\n\n case \"[object Map]\":\n var i = v;\n\n case \"[object Set]\":\n if (i || (i = _), t.size != e.size && !(1 & r)) break;\n return (n = c.get(t)) ? n == e : (r |= 2, c.set(t, e), e = lt(i(t), i(e), r, o, u, c), c.delete(t), e);\n\n case \"[object Symbol]\":\n if (An) return An.call(t) == An.call(e);\n }\n\n return false;\n }\n\n function bt(t) {\n return En(zt(t, ae, Et), t + \"\");\n }\n\n function ht(t) {\n return P(t, Yt, xn);\n }\n\n function pt(t) {\n return P(t, Zt, In);\n }\n\n function yt() {\n var t = d.iteratee || re,\n t = t === re ? T : t;\n return arguments.length ? t(arguments[0], arguments[1]) : t;\n }\n\n function jt(t, e) {\n var n = t.__data__,\n r = typeof e;\n return (\"string\" == r || \"number\" == r || \"symbol\" == r || \"boolean\" == r ? \"__proto__\" !== e : null === e) ? n[typeof e == \"string\" ? \"string\" : \"hash\"] : n.map;\n }\n\n function vt(t) {\n for (var e = Yt(t), n = e.length; n--;) {\n var r = e[n],\n o = t[r];\n e[n] = [r, o, o === o && !Vt(o)];\n }\n\n return e;\n }\n\n function gt(t, e) {\n var n = null == t ? ae : t[e];\n return (!Vt(n) || Ve && Ve in n ? 0 : (Lt(n) ? Te : de).test(It(n))) ? n : ae;\n }\n\n function _t(t) {\n var e = t.length,\n n = t.constructor(e);\n return e && \"string\" == typeof t[0] && Ne.call(t, \"index\") && (n.index = t.index, n.input = t.input), n;\n }\n\n function dt(t) {\n return typeof t.constructor != \"function\" || St(t) ? {} : mn(Je(t));\n }\n\n function At(n, r, o, u) {\n var c = n.constructor;\n\n switch (r) {\n case \"[object ArrayBuffer]\":\n return nt(n);\n\n case \"[object Boolean]\":\n case \"[object Date]\":\n return new c(+n);\n\n case \"[object DataView]\":\n return r = u ? nt(n.buffer) : n.buffer, new n.constructor(r, n.byteOffset, n.byteLength);\n\n case \"[object Float32Array]\":\n case \"[object Float64Array]\":\n case \"[object Int8Array]\":\n case \"[object Int16Array]\":\n case \"[object Int32Array]\":\n case \"[object Uint8Array]\":\n case \"[object Uint8ClampedArray]\":\n case \"[object Uint16Array]\":\n case \"[object Uint32Array]\":\n return rt(n, u);\n\n case \"[object Map]\":\n return r = u ? o(v(n), 1) : v(n), a(r, t, new n.constructor());\n\n case \"[object Number]\":\n case \"[object String]\":\n return new c(n);\n\n case \"[object RegExp]\":\n return r = new n.constructor(n.source, ve.exec(n)), r.lastIndex = n.lastIndex, r;\n\n case \"[object Set]\":\n return r = u ? o(_(n), 1) : _(n), a(r, e, new n.constructor());\n\n case \"[object Symbol]\":\n return An ? Object(An.call(n)) : {};\n }\n }\n\n function wt(t) {\n return Dn(t) || Bn(t) || !!(Ye && t && t[Ye]);\n }\n\n function mt(t, e) {\n return e = null == e ? 9007199254740991 : e, !!e && (typeof t == \"number\" || we.test(t)) && -1 < t && 0 == t % 1 && t < e;\n }\n\n function Ot(t, e) {\n if (Dn(t)) return false;\n var n = typeof t;\n return !(\"number\" != n && \"symbol\" != n && \"boolean\" != n && null != t && !Wt(t)) || be.test(t) || !se.test(t) || null != e && t in Object(e);\n }\n\n function St(t) {\n var e = t && t.constructor;\n return t === (typeof e == \"function\" && e.prototype || De);\n }\n\n function kt(t, e) {\n return function (n) {\n return null != n && n[t] === e && (e !== ae || t in Object(n));\n };\n }\n\n function zt(t, e, r) {\n return e = un(e === ae ? t.length - 1 : e, 0), function () {\n for (var o = arguments, u = -1, c = un(o.length - e, 0), i = Array(c); ++u < c;) i[u] = o[e + u];\n\n for (u = -1, c = Array(e + 1); ++u < e;) c[u] = o[u];\n\n return c[e] = r(i), n(t, this, c);\n };\n }\n\n function xt(t) {\n if (typeof t == \"string\" || Wt(t)) return t;\n var e = t + \"\";\n return \"0\" == e && 1 / t == -fe ? \"-0\" : e;\n }\n\n function It(t) {\n if (null != t) {\n try {\n return Le.call(t);\n } catch (t) {}\n\n return t + \"\";\n }\n\n return \"\";\n }\n\n function Ft(t, e, n) {\n var r = null == t ? 0 : t.length;\n return r ? (n = null == n ? 0 : Gt(n), 0 > n && (n = un(r + n, 0)), l(t, yt(e, 3), n)) : -1;\n }\n\n function Et(t) {\n return (null == t ? 0 : t.length) ? B(t, 1) : [];\n }\n\n function Mt(t) {\n var e = null == t ? 0 : t.length;\n return e ? t[e - 1] : ae;\n }\n\n function $t(t, e) {\n var n;\n\n if (t && t.length && e && e.length) {\n n = e;\n var r = s,\n o = -1,\n u = n.length;\n\n for (t === n && (n = ot(n)); ++o < u;) for (var c = 0, i = n[o]; -1 < (c = r(t, i, c, void 0));) t !== t && Xe.call(t, c, 1), Xe.call(t, c, 1);\n\n n = t;\n } else n = t;\n\n return n;\n }\n\n function Ut(t, e) {\n function n() {\n var r = arguments,\n o = e ? e.apply(this, r) : r[0],\n u = n.cache;\n return u.has(o) ? u.get(o) : (r = t.apply(this, r), n.cache = u.set(o, r) || u, r);\n }\n\n if (typeof t != \"function\" || null != e && typeof e != \"function\") throw new TypeError(\"Expected a function\");\n return n.cache = new (Ut.Cache || m)(), n;\n }\n\n function Bt(t, e) {\n return t === e || t !== t && e !== e;\n }\n\n function Dt(t) {\n return null != t && Nt(t.length) && !Lt(t);\n }\n\n function Pt(t) {\n return Ct(t) && Dt(t);\n }\n\n function Lt(t) {\n return !!Vt(t) && (t = L(t), \"[object Function]\" == t || \"[object GeneratorFunction]\" == t || \"[object AsyncFunction]\" == t || \"[object Proxy]\" == t);\n }\n\n function Nt(t) {\n return typeof t == \"number\" && -1 < t && 0 == t % 1 && 9007199254740991 >= t;\n }\n\n function Vt(t) {\n var e = typeof t;\n return null != t && (\"object\" == e || \"function\" == e);\n }\n\n function Ct(t) {\n return null != t && typeof t == \"object\";\n }\n\n function Rt(t) {\n return !(!Ct(t) || \"[object Object]\" != L(t)) && (t = Je(t), null === t || (t = Ne.call(t, \"constructor\") && t.constructor, typeof t == \"function\" && t instanceof t && Le.call(t) == Re));\n }\n\n function Tt(t) {\n return typeof t == \"string\" || !Dn(t) && Ct(t) && \"[object String]\" == L(t);\n }\n\n function Wt(t) {\n return typeof t == \"symbol\" || Ct(t) && \"[object Symbol]\" == L(t);\n }\n\n function qt(t) {\n return t ? (t = Ht(t), t === fe || t === -fe ? 1.7976931348623157e308 * (0 > t ? -1 : 1) : t === t ? t : 0) : 0 === t ? t : 0;\n }\n\n function Gt(t) {\n t = qt(t);\n var e = t % 1;\n return t === t ? e ? t - e : t : 0;\n }\n\n function Ht(t) {\n if (typeof t == \"number\") return t;\n if (Wt(t)) return le;\n if (Vt(t) && (t = typeof t.valueOf == \"function\" ? t.valueOf() : t, t = Vt(t) ? t + \"\" : t), typeof t != \"string\") return 0 === t ? t : +t;\n t = t.replace(ye, \"\");\n\n var e = _e.test(t);\n\n return e || Ae.test(t) ? ke(t.slice(2), e ? 2 : 8) : ge.test(t) ? le : +t;\n }\n\n function Jt(t) {\n return ut(t, Zt(t));\n }\n\n function Kt(t) {\n return null == t ? \"\" : Y(t);\n }\n\n function Qt(t, e, n) {\n return t = null == t ? ae : D(t, e), t === ae ? n : t;\n }\n\n function Xt(t, e) {\n var n;\n\n if (n = null != t) {\n n = t;\n var r;\n r = tt(e, n);\n\n for (var o = -1, u = r.length, c = false; ++o < u;) {\n var i = xt(r[o]);\n if (!(c = null != n && null != n && i in Object(n))) break;\n n = n[i];\n }\n\n c || ++o != u ? n = c : (u = null == n ? 0 : n.length, n = !!u && Nt(u) && mt(i, u) && (Dn(n) || Bn(n)));\n }\n\n return n;\n }\n\n function Yt(t) {\n if (Dt(t)) t = k(t);else if (St(t)) {\n var e,\n n = [];\n\n for (e in Object(t)) Ne.call(t, e) && \"constructor\" != e && n.push(e);\n\n t = n;\n } else t = on(t);\n return t;\n }\n\n function Zt(t) {\n if (Dt(t)) t = k(t, true);else if (Vt(t)) {\n var e,\n n = St(t),\n r = [];\n\n for (e in t) (\"constructor\" != e || !n && Ne.call(t, e)) && r.push(e);\n\n t = r;\n } else {\n if (e = [], null != t) for (n in Object(t)) e.push(n);\n t = e;\n }\n return t;\n }\n\n function te(t) {\n return null == t ? [] : y(t, Yt(t));\n }\n\n function ee(t) {\n return function () {\n return t;\n };\n }\n\n function ne(t) {\n return t;\n }\n\n function re(t) {\n return T(typeof t == \"function\" ? t : $(t, 1));\n }\n\n function oe() {}\n\n function ue(t) {\n return Ot(t) ? h(xt(t)) : Q(t);\n }\n\n function ce() {\n return [];\n }\n\n function ie() {\n return false;\n }\n\n var ae,\n fe = 1 / 0,\n le = NaN,\n se = /\\.|\\[(?:[^[\\]]*|([\"'])(?:(?!\\1)[^\\\\]|\\\\.)*?\\1)\\]/,\n be = /^\\w*$/,\n he = /^\\./,\n pe = /[^.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|([\"'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))/g,\n ye = /^\\s+|\\s+$/g,\n je = /\\\\(\\\\)?/g,\n ve = /\\w*$/,\n ge = /^[-+]0x[0-9a-f]+$/i,\n _e = /^0b[01]+$/i,\n de = /^\\[object .+?Constructor\\]$/,\n Ae = /^0o[0-7]+$/i,\n we = /^(?:0|[1-9]\\d*)$/,\n me = {};\n me[\"[object Float32Array]\"] = me[\"[object Float64Array]\"] = me[\"[object Int8Array]\"] = me[\"[object Int16Array]\"] = me[\"[object Int32Array]\"] = me[\"[object Uint8Array]\"] = me[\"[object Uint8ClampedArray]\"] = me[\"[object Uint16Array]\"] = me[\"[object Uint32Array]\"] = true, me[\"[object Arguments]\"] = me[\"[object Array]\"] = me[\"[object ArrayBuffer]\"] = me[\"[object Boolean]\"] = me[\"[object DataView]\"] = me[\"[object Date]\"] = me[\"[object Error]\"] = me[\"[object Function]\"] = me[\"[object Map]\"] = me[\"[object Number]\"] = me[\"[object Object]\"] = me[\"[object RegExp]\"] = me[\"[object Set]\"] = me[\"[object String]\"] = me[\"[object WeakMap]\"] = false;\n var Oe = {};\n Oe[\"[object Arguments]\"] = Oe[\"[object Array]\"] = Oe[\"[object ArrayBuffer]\"] = Oe[\"[object DataView]\"] = Oe[\"[object Boolean]\"] = Oe[\"[object Date]\"] = Oe[\"[object Float32Array]\"] = Oe[\"[object Float64Array]\"] = Oe[\"[object Int8Array]\"] = Oe[\"[object Int16Array]\"] = Oe[\"[object Int32Array]\"] = Oe[\"[object Map]\"] = Oe[\"[object Number]\"] = Oe[\"[object Object]\"] = Oe[\"[object RegExp]\"] = Oe[\"[object Set]\"] = Oe[\"[object String]\"] = Oe[\"[object Symbol]\"] = Oe[\"[object Uint8Array]\"] = Oe[\"[object Uint8ClampedArray]\"] = Oe[\"[object Uint16Array]\"] = Oe[\"[object Uint32Array]\"] = true, Oe[\"[object Error]\"] = Oe[\"[object Function]\"] = Oe[\"[object WeakMap]\"] = false;\n var Se,\n ke = parseInt,\n ze = typeof global == \"object\" && global && global.Object === Object && global,\n xe = typeof self == \"object\" && self && self.Object === Object && self,\n Ie = ze || xe || Function(\"return this\")(),\n Fe = typeof exports == \"object\" && exports && !exports.nodeType && exports,\n Ee = Fe && typeof module == \"object\" && module && !module.nodeType && module,\n Me = Ee && Ee.exports === Fe,\n $e = Me && ze.process;\n\n t: {\n try {\n Se = $e && $e.binding && $e.binding(\"util\");\n break t;\n } catch (t) {}\n\n Se = void 0;\n }\n\n var Ue = Se && Se.isTypedArray,\n Be = Array.prototype,\n De = Object.prototype,\n Pe = Ie[\"__core-js_shared__\"],\n Le = Function.prototype.toString,\n Ne = De.hasOwnProperty,\n Ve = function () {\n var t = /[^.]+$/.exec(Pe && Pe.keys && Pe.keys.IE_PROTO || \"\");\n return t ? \"Symbol(src)_1.\" + t : \"\";\n }(),\n Ce = De.toString,\n Re = Le.call(Object),\n Te = RegExp(\"^\" + Le.call(Ne).replace(/[\\\\^$.*+?()[\\]{}|]/g, \"\\\\$&\").replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g, \"$1.*?\") + \"$\"),\n We = Me ? Ie.Buffer : ae,\n qe = Ie.Symbol,\n Ge = Ie.Uint8Array,\n He = We ? We.a : ae,\n Je = g(Object.getPrototypeOf),\n Ke = Object.create,\n Qe = De.propertyIsEnumerable,\n Xe = Be.splice,\n Ye = qe ? qe.isConcatSpreadable : ae,\n Ze = qe ? qe.toStringTag : ae,\n tn = function () {\n try {\n var t = gt(Object, \"defineProperty\");\n return t({}, \"\", {}), t;\n } catch (t) {}\n }(),\n en = Math.floor,\n nn = Object.getOwnPropertySymbols,\n rn = We ? We.isBuffer : ae,\n on = g(Object.keys),\n un = Math.max,\n cn = Math.min,\n an = Date.now,\n fn = gt(Ie, \"DataView\"),\n ln = gt(Ie, \"Map\"),\n sn = gt(Ie, \"Promise\"),\n bn = gt(Ie, \"Set\"),\n hn = gt(Ie, \"WeakMap\"),\n pn = gt(Object, \"create\"),\n yn = It(fn),\n jn = It(ln),\n vn = It(sn),\n gn = It(bn),\n _n = It(hn),\n dn = qe ? qe.prototype : ae,\n An = dn ? dn.valueOf : ae,\n wn = dn ? dn.toString : ae,\n mn = function () {\n function t() {}\n\n return function (e) {\n return Vt(e) ? Ke ? Ke(e) : (t.prototype = e, e = new t(), t.prototype = ae, e) : {};\n };\n }();\n\n A.prototype.clear = function () {\n this.__data__ = pn ? pn(null) : {}, this.size = 0;\n }, A.prototype.delete = function (t) {\n return t = this.has(t) && delete this.__data__[t], this.size -= t ? 1 : 0, t;\n }, A.prototype.get = function (t) {\n var e = this.__data__;\n return pn ? (t = e[t], \"__lodash_hash_undefined__\" === t ? ae : t) : Ne.call(e, t) ? e[t] : ae;\n }, A.prototype.has = function (t) {\n var e = this.__data__;\n return pn ? e[t] !== ae : Ne.call(e, t);\n }, A.prototype.set = function (t, e) {\n var n = this.__data__;\n return this.size += this.has(t) ? 0 : 1, n[t] = pn && e === ae ? \"__lodash_hash_undefined__\" : e, this;\n }, w.prototype.clear = function () {\n this.__data__ = [], this.size = 0;\n }, w.prototype.delete = function (t) {\n var e = this.__data__;\n return t = I(e, t), !(0 > t) && (t == e.length - 1 ? e.pop() : Xe.call(e, t, 1), --this.size, true);\n }, w.prototype.get = function (t) {\n var e = this.__data__;\n return t = I(e, t), 0 > t ? ae : e[t][1];\n }, w.prototype.has = function (t) {\n return -1 < I(this.__data__, t);\n }, w.prototype.set = function (t, e) {\n var n = this.__data__,\n r = I(n, t);\n return 0 > r ? (++this.size, n.push([t, e])) : n[r][1] = e, this;\n }, m.prototype.clear = function () {\n this.size = 0, this.__data__ = {\n hash: new A(),\n map: new (ln || w)(),\n string: new A()\n };\n }, m.prototype.delete = function (t) {\n return t = jt(this, t).delete(t), this.size -= t ? 1 : 0, t;\n }, m.prototype.get = function (t) {\n return jt(this, t).get(t);\n }, m.prototype.has = function (t) {\n return jt(this, t).has(t);\n }, m.prototype.set = function (t, e) {\n var n = jt(this, t),\n r = n.size;\n return n.set(t, e), this.size += n.size == r ? 0 : 1, this;\n }, O.prototype.add = O.prototype.push = function (t) {\n return this.__data__.set(t, \"__lodash_hash_undefined__\"), this;\n }, O.prototype.has = function (t) {\n return this.__data__.has(t);\n }, S.prototype.clear = function () {\n this.__data__ = new w(), this.size = 0;\n }, S.prototype.delete = function (t) {\n var e = this.__data__;\n return t = e.delete(t), this.size = e.size, t;\n }, S.prototype.get = function (t) {\n return this.__data__.get(t);\n }, S.prototype.has = function (t) {\n return this.__data__.has(t);\n }, S.prototype.set = function (t, e) {\n var n = this.__data__;\n\n if (n instanceof w) {\n var r = n.__data__;\n if (!ln || 199 > r.length) return r.push([t, e]), this.size = ++n.size, this;\n n = this.__data__ = new m(r);\n }\n\n return n.set(t, e), this.size = n.size, this;\n };\n\n var On = function (t, e) {\n return function (n, r) {\n if (null == n) return n;\n if (!Dt(n)) return t(n, r);\n\n for (var o = n.length, u = e ? o : -1, c = Object(n); (e ? u-- : ++u < o) && false !== r(c[u], u, c););\n\n return n;\n };\n }(function (t, e) {\n return t && Sn(t, e, Yt);\n }),\n Sn = function (t) {\n return function (e, n, r) {\n var o = -1,\n u = Object(e);\n r = r(e);\n\n for (var c = r.length; c--;) {\n var i = r[t ? c : ++o];\n if (false === n(u[i], i, u)) break;\n }\n\n return e;\n };\n }(),\n kn = tn ? function (t, e) {\n return tn(t, \"toString\", {\n configurable: true,\n enumerable: false,\n value: ee(e),\n writable: true\n });\n } : ne,\n zn = bn && 1 / _(new bn([, -0]))[1] == fe ? function (t) {\n return new bn(t);\n } : oe,\n xn = nn ? function (t) {\n return null == t ? [] : (t = Object(t), o(nn(t), function (e) {\n return Qe.call(t, e);\n }));\n } : ce,\n In = nn ? function (t) {\n for (var e = []; t;) i(e, xn(t)), t = Je(t);\n\n return e;\n } : ce,\n Fn = L;\n\n (fn && \"[object DataView]\" != Fn(new fn(new ArrayBuffer(1))) || ln && \"[object Map]\" != Fn(new ln()) || sn && \"[object Promise]\" != Fn(sn.resolve()) || bn && \"[object Set]\" != Fn(new bn()) || hn && \"[object WeakMap]\" != Fn(new hn())) && (Fn = function (t) {\n var e = L(t);\n if (t = (t = \"[object Object]\" == e ? t.constructor : ae) ? It(t) : \"\") switch (t) {\n case yn:\n return \"[object DataView]\";\n\n case jn:\n return \"[object Map]\";\n\n case vn:\n return \"[object Promise]\";\n\n case gn:\n return \"[object Set]\";\n\n case _n:\n return \"[object WeakMap]\";\n }\n return e;\n });\n\n var En = function (t) {\n var e = 0,\n n = 0;\n return function () {\n var r = an(),\n o = 16 - (r - n);\n\n if (n = r, 0 < o) {\n if (800 <= ++e) return arguments[0];\n } else e = 0;\n\n return t.apply(ae, arguments);\n };\n }(kn),\n Mn = function (t) {\n t = Ut(t, function (t) {\n return 500 === e.size && e.clear(), t;\n });\n var e = t.cache;\n return t;\n }(function (t) {\n var e = [];\n return he.test(t) && e.push(\"\"), t.replace(pe, function (t, n, r, o) {\n e.push(r ? o.replace(je, \"$1\") : n || t);\n }), e;\n }),\n $n = X($t),\n Un = function (t) {\n return function (e, n, r) {\n var o = Object(e);\n\n if (!Dt(e)) {\n var u = yt(n, 3);\n e = Yt(e), n = function (t) {\n return u(o[t], t, o);\n };\n }\n\n return n = t(e, n, r), -1 < n ? o[u ? e[n] : n] : ae;\n };\n }(Ft);\n\n Ut.Cache = m;\n var Bn = N(function () {\n return arguments;\n }()) ? N : function (t) {\n return Ct(t) && Ne.call(t, \"callee\") && !Qe.call(t, \"callee\");\n },\n Dn = Array.isArray,\n Pn = rn || ie,\n Ln = Ue ? p(Ue) : R,\n Nn = at(function (t, e, n) {\n H(t, e, n);\n }),\n Vn = at(function (t, e, n, r) {\n H(t, e, n, r);\n }),\n Cn = bt(function (t, e) {\n var n = {};\n if (null == t) return n;\n var r = false;\n e = c(e, function (e) {\n return e = tt(e, t), r || (r = 1 < e.length), e;\n }), ut(t, pt(t), n), r && (n = $(n, 7, ft));\n\n for (var o = e.length; o--;) Z(n, e[o]);\n\n return n;\n }),\n Rn = bt(function (t, e) {\n return null == t ? {} : J(t, e);\n });\n d.constant = ee, d.filter = function (t, e) {\n return (Dn(t) ? o : U)(t, yt(e, 3));\n }, d.flatten = Et, d.iteratee = re, d.keys = Yt, d.keysIn = Zt, d.map = function (t, e) {\n return (Dn(t) ? c : W)(t, yt(e, 3));\n }, d.memoize = Ut, d.merge = Nn, d.mergeWith = Vn, d.omit = Cn, d.pick = Rn, d.property = ue, d.pull = $n, d.pullAll = $t, d.remove = function (t, e) {\n var n = [];\n if (!t || !t.length) return n;\n var r = -1,\n o = [],\n u = t.length;\n\n for (e = yt(e, 3); ++r < u;) {\n var c = t[r];\n e(c, r, t) && (n.push(c), o.push(r));\n }\n\n for (r = t ? o.length : 0, u = r - 1; r--;) if (c = o[r], r == u || c !== i) {\n var i = c;\n mt(c) ? Xe.call(t, c, 1) : Z(t, c);\n }\n\n return n;\n }, d.toPlainObject = Jt, d.uniq = function (t) {\n if (t && t.length) t: {\n var e = -1,\n n = u,\n r = t.length,\n o = true,\n c = [],\n i = c;\n\n if (200 <= r) {\n if (n = zn(t)) {\n t = _(n);\n break t;\n }\n\n o = false, n = j, i = new O();\n } else i = c;\n\n e: for (; ++e < r;) {\n var a = t[e],\n f = a,\n a = 0 !== a ? a : 0;\n\n if (o && f === f) {\n for (var l = i.length; l--;) if (i[l] === f) continue e;\n\n c.push(a);\n } else n(i, f, void 0) || (i !== c && i.push(f), c.push(a));\n }\n\n t = c;\n } else t = [];\n return t;\n }, d.values = te, d.cloneDeep = function (t) {\n return $(t, 5);\n }, d.eq = Bt, d.find = Un, d.findIndex = Ft, d.get = Qt, d.hasIn = Xt, d.identity = ne, d.includes = function (t, e, n, r) {\n return t = Dt(t) ? t : te(t), n = n && !r ? Gt(n) : 0, r = t.length, 0 > n && (n = un(r + n, 0)), Tt(t) ? n <= r && -1 < t.indexOf(e, n) : !!r && -1 < s(t, e, n);\n }, d.isArguments = Bn, d.isArray = Dn, d.isArrayLike = Dt, d.isArrayLikeObject = Pt, d.isBuffer = Pn, d.isFunction = Lt, d.isLength = Nt, d.isObject = Vt, d.isObjectLike = Ct, d.isPlainObject = Rt, d.isString = Tt, d.isSymbol = Wt, d.isTypedArray = Ln, d.last = Mt, d.stubArray = ce, d.stubFalse = ie, d.noop = oe, d.sortedIndexBy = function (t, e, n) {\n n = yt(n, 2), e = n(e);\n\n for (var r = 0, o = null == t ? 0 : t.length, u = e !== e, c = null === e, i = Wt(e), a = e === ae; r < o;) {\n var f = en((r + o) / 2),\n l = n(t[f]),\n s = l !== ae,\n b = null === l,\n h = l === l,\n p = Wt(l);\n (u ? h : a ? h && s : c ? h && s && !b : i ? h && s && !b && !p : b || p ? 0 : l < e) ? r = f + 1 : o = f;\n }\n\n return cn(o, 4294967294);\n }, d.toFinite = qt, d.toInteger = Gt, d.toNumber = Ht, d.toString = Kt, d.VERSION = \"4.17.4\", true ? (Ie._ = d, !(__WEBPACK_AMD_DEFINE_RESULT__ = (function () {\n return d;\n }).call(exports, __webpack_require__, exports, module),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))) : Ee ? ((Ee.exports = d)._ = d, Fe._ = d) : Ie._ = d;\n}).call(this);\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3), __webpack_require__(6)(module)))\n\n/***/ }),\n/* 6 */\n/***/ (function(module, exports) {\n\nmodule.exports = function (module) {\n if (!module.webpackPolyfill) {\n module.deprecate = function () {};\n\n module.paths = []; // module.parent = undefined by default\n\n if (!module.children) module.children = [];\n Object.defineProperty(module, \"loaded\", {\n enumerable: true,\n get: function () {\n return module.l;\n }\n });\n Object.defineProperty(module, \"id\", {\n enumerable: true,\n get: function () {\n return module.i;\n }\n });\n module.webpackPolyfill = 1;\n }\n\n return module;\n};\n\n/***/ }),\n/* 7 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"a\", function() { return RelayManager; });\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_standard_file_js_dist_regenerator_js__ = __webpack_require__(1);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_standard_file_js_dist_regenerator_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_standard_file_js_dist_regenerator_js__);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_standard_file_js__ = __webpack_require__(0);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_standard_file_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_standard_file_js__);\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\n\n\n\nvar RelayManager =\n/*#__PURE__*/\nfunction () {\n function RelayManager() {\n _classCallCheck(this, RelayManager);\n\n this.httpManger = new __WEBPACK_IMPORTED_MODULE_1_standard_file_js__[\"SFHttpManager\"]();\n this.httpManger.setJWTRequestHandler(function () {});\n }\n\n _createClass(RelayManager, [{\n key: \"setCredentials\",\n value: function setCredentials(credentials) {\n this.credentials = credentials;\n }\n }, {\n key: \"uploadFile\",\n value: function uploadFile(name, item, integration) {\n var _this = this;\n\n var url, params;\n return regeneratorRuntime.async(function uploadFile$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n url = \"\".concat(integration.content.relayUrl, \"/integrations/save-item\");\n params = {\n file: {\n name: name,\n item: item // base64 string of file\n\n },\n source: integration.content.source,\n authorization: integration.content.authorization\n };\n return _context.abrupt(\"return\", new Promise(function (resolve, reject) {\n _this.httpManger.postAbsolute(url, params, function (response) {\n resolve(response.metadata);\n }, function (errorResponse) {\n var error = errorResponse.error;\n\n if (!error) {\n error = {\n message: \"File upload failed.\"\n };\n }\n\n console.log(\"Upload error response\", error);\n reject(error);\n });\n }));\n\n case 3:\n case \"end\":\n return _context.stop();\n }\n }\n });\n }\n }, {\n key: \"downloadFile\",\n value: function downloadFile(fileDescriptor, integration) {\n var _this2 = this;\n\n var url, params;\n return regeneratorRuntime.async(function downloadFile$(_context2) {\n while (1) {\n switch (_context2.prev = _context2.next) {\n case 0:\n url = \"\".concat(integration.content.relayUrl, \"/integrations/download-item\");\n params = {\n metadata: fileDescriptor.content.serverMetadata,\n authorization: integration.content.authorization\n };\n return _context2.abrupt(\"return\", new Promise(function (resolve, reject) {\n _this2.httpManger.postAbsolute(url, params, function (response) {\n resolve(response);\n }, function (errorResponse) {\n var error = errorResponse.error;\n console.log(\"Download error response\", errorResponse);\n reject(error);\n });\n }));\n\n case 3:\n case \"end\":\n return _context2.stop();\n }\n }\n });\n }\n }, {\n key: \"deleteFile\",\n value: function deleteFile(fileDescriptor, integration) {\n var _this3 = this;\n\n var url, params;\n return regeneratorRuntime.async(function deleteFile$(_context3) {\n while (1) {\n switch (_context3.prev = _context3.next) {\n case 0:\n url = \"\".concat(integration.content.relayUrl, \"/integrations/delete-item\");\n params = {\n metadata: fileDescriptor.content.serverMetadata,\n authorization: integration.content.authorization\n };\n return _context3.abrupt(\"return\", new Promise(function (resolve, reject) {\n _this3.httpManger.postAbsolute(url, params, function (response) {\n resolve(response);\n }, function (errorResponse) {\n var error = errorResponse.error;\n console.log(\"Download error response\", errorResponse);\n reject(error);\n });\n }));\n\n case 3:\n case \"end\":\n return _context3.stop();\n }\n }\n });\n }\n }]);\n\n return RelayManager;\n}();\n\n\n\n/***/ }),\n/* 8 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"a\", function() { return IntegrationManager; });\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_standard_file_js_dist_regenerator_js__ = __webpack_require__(1);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_standard_file_js_dist_regenerator_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_standard_file_js_dist_regenerator_js__);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_standard_file_js__ = __webpack_require__(0);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_standard_file_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_standard_file_js__);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__ExtensionBridge__ = __webpack_require__(2);\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\n\n\n\n\nvar IntegrationManager =\n/*#__PURE__*/\nfunction () {\n function IntegrationManager(extensionBridge) {\n _classCallCheck(this, IntegrationManager);\n\n this.extensionBridge = extensionBridge;\n }\n\n _createClass(IntegrationManager, [{\n key: \"integrationForFileDescriptor\",\n value: function integrationForFileDescriptor(descriptor) {\n return this.integrations.find(function (integration) {\n return descriptor.content.serverMetadata && integration.content.source == descriptor.content.serverMetadata.source;\n });\n }\n }, {\n key: \"parseIntegrationCode\",\n value: function parseIntegrationCode(code) {\n var jsonString = atob(code);\n var integration = JSON.parse(jsonString);\n integration.rawCode = code;\n return integration;\n }\n }, {\n key: \"saveIntegrationFromCode\",\n value: function saveIntegrationFromCode(code) {\n var content, integration;\n return regeneratorRuntime.async(function saveIntegrationFromCode$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n content = this.parseIntegrationCode(code);\n\n if (this.integrations.length == 0) {\n content.isDefaultUploadSource = true;\n }\n\n integration = this.createAndSaveIntegrationObject(content);\n return _context.abrupt(\"return\", integration);\n\n case 4:\n case \"end\":\n return _context.stop();\n }\n }\n }, null, this);\n }\n }, {\n key: \"createAndSaveIntegrationObject\",\n value: function createAndSaveIntegrationObject(content) {\n var integration = new __WEBPACK_IMPORTED_MODULE_1_standard_file_js__[\"SFItem\"]({\n content_type: __WEBPACK_IMPORTED_MODULE_2__ExtensionBridge__[\"a\" /* default */].FileSafeIntegrationContentTypeKey,\n content: content\n });\n this.extensionBridge.createItems([integration]);\n return integration;\n }\n }, {\n key: \"getDefaultIntegration\",\n value: function getDefaultIntegration() {\n return this.integrations.find(function (integration) {\n return integration.content.isDefaultUploadSource;\n });\n }\n }, {\n key: \"setIntegrationAsDefault\",\n value: function setIntegrationAsDefault(integration) {\n var saveItems = [integration];\n var currentDefault = this.getDefaultIntegration();\n\n if (currentDefault) {\n currentDefault.content.isDefaultUploadSource = false;\n saveItems.push(currentDefault);\n }\n\n integration.content.isDefaultUploadSource = true;\n this.extensionBridge.saveItems(saveItems);\n }\n }, {\n key: \"displayStringForIntegration\",\n value: function displayStringForIntegration(integration) {\n var capitalizeFirstLetter = function capitalizeFirstLetter(string) {\n return string.charAt(0).toUpperCase() + string.slice(1);\n };\n\n var comps = integration.content.source.split(\"_\");\n var result = \"\";\n var index = 0;\n var _iteratorNormalCompletion = true;\n var _didIteratorError = false;\n var _iteratorError = undefined;\n\n try {\n for (var _iterator = comps[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var comp = _step.value;\n result += capitalizeFirstLetter(comp);\n\n if (index < comps.length - 1) {\n result += \" \";\n }\n\n index++;\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator[\"return\"] != null) {\n _iterator[\"return\"]();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n\n return result;\n }\n }, {\n key: \"deleteIntegration\",\n value: function deleteIntegration(integrationObject) {\n var _this = this;\n\n var isDefault = integrationObject.content.isDefaultUploadSource;\n this.extensionBridge.deleteItem(integrationObject, function (response) {\n if (response.deleted && isDefault) {\n if (_this.integrations.length > 0) {\n var _iteratorNormalCompletion2 = true;\n var _didIteratorError2 = false;\n var _iteratorError2 = undefined;\n\n try {\n for (var _iterator2 = _this.integrations[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {\n var currentIntegration = _step2.value;\n\n if (currentIntegration != integrationObject) {\n _this.setIntegrationAsDefault(currentIntegration);\n\n break;\n }\n }\n } catch (err) {\n _didIteratorError2 = true;\n _iteratorError2 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion2 && _iterator2[\"return\"] != null) {\n _iterator2[\"return\"]();\n }\n } finally {\n if (_didIteratorError2) {\n throw _iteratorError2;\n }\n }\n }\n }\n }\n });\n }\n }, {\n key: \"integrations\",\n get: function get() {\n return this.extensionBridge.filterItems(__WEBPACK_IMPORTED_MODULE_2__ExtensionBridge__[\"a\" /* default */].FileSafeIntegrationContentTypeKey);\n }\n }]);\n\n return IntegrationManager;\n}();\n\n\n\n/***/ }),\n/* 9 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"a\", function() { return CredentialManager; });\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_standard_file_js_dist_regenerator_js__ = __webpack_require__(1);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_standard_file_js_dist_regenerator_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_standard_file_js_dist_regenerator_js__);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_standard_file_js__ = __webpack_require__(0);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_standard_file_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_standard_file_js__);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__ExtensionBridge__ = __webpack_require__(2);\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\n\n\n\n\nvar CredentialManager =\n/*#__PURE__*/\nfunction () {\n function CredentialManager(_ref) {\n var _this = this;\n\n var extensionBridge = _ref.extensionBridge,\n onCredentialLoad = _ref.onCredentialLoad;\n\n _classCallCheck(this, CredentialManager);\n\n _defineProperty(this, \"getDefaultCredentials\", function () {\n var defaultCredentials = _this.credentials.find(function (candidate) {\n return candidate.content.isDefault;\n });\n\n if (!defaultCredentials && _this.credentials.length > 0) {\n defaultCredentials = _this.credentials[0];\n }\n\n return defaultCredentials;\n });\n\n _defineProperty(this, \"setCredentialAsDefault\", function (credential) {\n var currentDefault = _this.getDefaultCredentials();\n\n if (currentDefault) {\n currentDefault.content.isDefault = false;\n }\n\n credential.content.isDefault = true;\n\n _this.extensionBridge.saveItems([currentDefault, credential]);\n });\n\n _defineProperty(this, \"deleteCredential\", function (credential) {\n _this.extensionBridge.deleteItem(credential);\n });\n\n this.extensionBridge = extensionBridge;\n this.onCredentialLoad = onCredentialLoad;\n this.credentials = [];\n this.extensionBridge.addEventHandler(function (event) {\n if (event == __WEBPACK_IMPORTED_MODULE_2__ExtensionBridge__[\"a\" /* default */].BridgeEventReceivedItems) {\n _this.reloadCredentials();\n }\n });\n }\n\n _createClass(CredentialManager, [{\n key: \"reloadCredentials\",\n value: function reloadCredentials() {\n // clear current credentials, search results should contain all items and not just new incoming stuff.\n this.credentials = [];\n var searchResults = this.extensionBridge.filterItems(__WEBPACK_IMPORTED_MODULE_2__ExtensionBridge__[\"a\" /* default */].FileSafeCredentialsContentType);\n\n if (searchResults.length == 0) {\n return;\n }\n\n var _iteratorNormalCompletion = true;\n var _didIteratorError = false;\n var _iteratorError = undefined;\n\n try {\n for (var _iterator = searchResults[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var incomingCredentials = _step.value;\n\n if (!this.credentials.find(function (candidate) {\n return candidate.uuid == incomingCredentials.uuid;\n })) {\n this.credentials.push(incomingCredentials);\n }\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator[\"return\"] != null) {\n _iterator[\"return\"]();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n\n this.onCredentialLoad();\n\n if (this.credentials.length > 0) {\n this.didLoadCredentials();\n }\n }\n }, {\n key: \"createNewCredentials\",\n value: function createNewCredentials() {\n var bits, identifer, password, credentialParams, credentials;\n return regeneratorRuntime.async(function createNewCredentials$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n bits = 256;\n _context.next = 3;\n return regeneratorRuntime.awrap(SFJS.crypto.generateRandomKey(bits));\n\n case 3:\n identifer = _context.sent;\n _context.next = 6;\n return regeneratorRuntime.awrap(SFJS.crypto.generateRandomKey(bits));\n\n case 6:\n password = _context.sent;\n _context.next = 9;\n return regeneratorRuntime.awrap(SFJS.crypto.generateInitialKeysAndAuthParamsForUser(identifer, password));\n\n case 9:\n credentialParams = _context.sent;\n credentialParams.isDefault = this.credentials.length == 0;\n credentials = new __WEBPACK_IMPORTED_MODULE_1_standard_file_js__[\"SFItem\"]({\n content_type: __WEBPACK_IMPORTED_MODULE_2__ExtensionBridge__[\"a\" /* default */].FileSafeCredentialsContentType,\n content: credentialParams\n });\n this.extensionBridge.saveItem(credentials);\n this.didLoadCredentials();\n return _context.abrupt(\"return\", credentials);\n\n case 15:\n case \"end\":\n return _context.stop();\n }\n }\n }, null, this);\n }\n }, {\n key: \"didLoadCredentials\",\n value: function didLoadCredentials() {\n this.extensionBridge.notifyObserversOfEvent(__WEBPACK_IMPORTED_MODULE_2__ExtensionBridge__[\"a\" /* default */].BridgeEventLoadedCredentials);\n }\n }, {\n key: \"credentialForFileDescriptor\",\n value: function credentialForFileDescriptor(fileDescriptor) {\n return this.credentials.find(function (candidate) {\n return fileDescriptor.content.references.find(function (ref) {\n return ref.uuid == candidate.uuid;\n });\n });\n }\n }, {\n key: \"getAllCredentials\",\n value: function getAllCredentials() {\n return this.credentials;\n }\n }, {\n key: \"saveCredential\",\n value: function saveCredential(credentials) {\n this.extensionBridge.saveItem(credentials);\n }\n }]);\n\n return CredentialManager;\n}();\n\n\n\n/***/ }),\n/* 10 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"a\", function() { return FileManager; });\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_standard_file_js_dist_regenerator_js__ = __webpack_require__(1);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_standard_file_js_dist_regenerator_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_standard_file_js_dist_regenerator_js__);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_standard_file_js__ = __webpack_require__(0);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_standard_file_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_standard_file_js__);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util_encryption_worker_js__ = __webpack_require__(11);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util_encryption_worker_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2__util_encryption_worker_js__);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__ExtensionBridge__ = __webpack_require__(2);\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\n\n\n\n\n\nvar FileManager =\n/*#__PURE__*/\nfunction () {\n function FileManager(extensionBridge, relayManager, integrationManager, credentialManager) {\n _classCallCheck(this, FileManager);\n\n this.extensionBridge = extensionBridge;\n this.relayManager = relayManager;\n this.integrationManager = integrationManager;\n this.credentialManager = credentialManager;\n }\n\n _createClass(FileManager, [{\n key: \"getAllFileDescriptors\",\n value: function getAllFileDescriptors() {\n return this.extensionBridge.getFileDescriptors();\n }\n }, {\n key: \"fileDescriptorsForNote\",\n value: function fileDescriptorsForNote(note) {\n if (!note) {\n return [];\n }\n\n return this.extensionBridge.getFileDescriptors().filter(function (fileDescriptor) {\n return fileDescriptor.hasRelationshipWithItem(note);\n });\n }\n }, {\n key: \"findFileDescriptor\",\n value: function findFileDescriptor(uuid) {\n return this.extensionBridge.getFileDescriptors().find(function (fileDescriptor) {\n return fileDescriptor.uuid == uuid;\n });\n }\n }, {\n key: \"fileDescriptorsEncryptedWithCredential\",\n value: function fileDescriptorsEncryptedWithCredential(credential) {\n var descriptors = this.extensionBridge.getFileDescriptors();\n return descriptors.filter(function (descriptor) {\n return descriptor.content.references.find(function (ref) {\n return ref.uuid == credential.uuid;\n });\n });\n }\n }, {\n key: \"deleteFileFromDescriptor\",\n value: function deleteFileFromDescriptor(fileDescriptor) {\n var _this = this;\n\n return regeneratorRuntime.async(function deleteFileFromDescriptor$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n return _context.abrupt(\"return\", new Promise(function (resolve, reject) {\n _this.extensionBridge.deleteItems([fileDescriptor], function (response) {\n if (response.deleted) {\n var integration = _this.integrationManager.integrationForFileDescriptor(fileDescriptor);\n\n if (integration) {\n _this.relayManager.deleteFile(fileDescriptor, integration).then(function (relayResponse) {\n resolve();\n });\n }\n } else {\n resolve(response);\n }\n });\n }));\n\n case 1:\n case \"end\":\n return _context.stop();\n }\n }\n });\n }\n }, {\n key: \"uploadFile\",\n value: function uploadFile(_ref) {\n var _this2 = this;\n\n var fileItem, inputFileName, fileType, credential, note, integration, fileExt, outputFileName;\n return regeneratorRuntime.async(function uploadFile$(_context2) {\n while (1) {\n switch (_context2.prev = _context2.next) {\n case 0:\n fileItem = _ref.fileItem, inputFileName = _ref.inputFileName, fileType = _ref.fileType, credential = _ref.credential, note = _ref.note;\n integration = this.integrationManager.getDefaultIntegration();\n fileExt = inputFileName.split(\".\")[1];\n outputFileName = \"\".concat(fileItem.uuid, \".sf.json\");\n return _context2.abrupt(\"return\", new Promise(function (resolve, reject) {\n var worker = new __WEBPACK_IMPORTED_MODULE_2__util_encryption_worker_js___default.a();\n worker.addEventListener(\"message\", function (event) {\n var data = event.data;\n\n if (data.error) {\n console.log(\"Error uploading file\", data.error);\n reject(data.error);\n return;\n }\n\n var fileDescriptor = new __WEBPACK_IMPORTED_MODULE_1_standard_file_js__[\"SFItem\"]({\n content_type: __WEBPACK_IMPORTED_MODULE_3__ExtensionBridge__[\"a\" /* default */].FileDescriptorContentTypeKey,\n content: {\n serverMetadata: event.data.metadata,\n fileName: inputFileName,\n fileType: fileType\n }\n });\n\n if (note) {\n fileDescriptor.addItemAsRelationship(note);\n }\n\n fileDescriptor.addItemAsRelationship(credential);\n\n _this2.extensionBridge.createItem(fileDescriptor, function (createdItems) {\n resolve(createdItems[0]);\n });\n });\n var operation = \"upload\";\n var params = {\n outputFileName: outputFileName,\n fileItem: fileItem,\n integration: integration,\n operation: operation,\n credentials: _this2.credentialManager.getDefaultCredentials()\n };\n worker.postMessage(params);\n }));\n\n case 5:\n case \"end\":\n return _context2.stop();\n }\n }\n }, null, this);\n }\n }, {\n key: \"downloadFileFromDescriptor\",\n value: function downloadFileFromDescriptor(fileDescriptor) {\n var integration, serverMetadata;\n return regeneratorRuntime.async(function downloadFileFromDescriptor$(_context3) {\n while (1) {\n switch (_context3.prev = _context3.next) {\n case 0:\n integration = this.integrationManager.integrationForFileDescriptor(fileDescriptor);\n\n if (integration) {\n _context3.next = 6;\n break;\n }\n\n serverMetadata = fileDescriptor.content.serverMetadata;\n\n if (serverMetadata) {\n alert(\"Unable to find integration named '\".concat(serverMetadata.source, \"'.\"));\n } else {\n alert(\"Unable to find integration for this file.\");\n }\n\n throw \"Unable to find integration\";\n\n case 6:\n return _context3.abrupt(\"return\", this.relayManager.downloadFile(fileDescriptor, integration).then(function (data) {\n var item = data.items[0];\n return item;\n }));\n\n case 7:\n case \"end\":\n return _context3.stop();\n }\n }\n }, null, this);\n }\n }, {\n key: \"encryptFile\",\n value: function encryptFile(_ref2) {\n var data, inputFileName, fileType, credential;\n return regeneratorRuntime.async(function encryptFile$(_context4) {\n while (1) {\n switch (_context4.prev = _context4.next) {\n case 0:\n data = _ref2.data, inputFileName = _ref2.inputFileName, fileType = _ref2.fileType, credential = _ref2.credential;\n return _context4.abrupt(\"return\", new Promise(function (resolve, reject) {\n var worker = new __WEBPACK_IMPORTED_MODULE_2__util_encryption_worker_js___default.a();\n worker.addEventListener(\"message\", function (event) {\n resolve(event.data.fileItem);\n });\n worker.postMessage({\n operation: \"encrypt\",\n keys: credential.content.keys,\n authParams: credential.content.authParams,\n contentType: __WEBPACK_IMPORTED_MODULE_3__ExtensionBridge__[\"a\" /* default */].FileItemContentTypeKey,\n fileData: data,\n fileName: inputFileName,\n fileType: fileType\n });\n }));\n\n case 2:\n case \"end\":\n return _context4.stop();\n }\n }\n });\n }\n }, {\n key: \"decryptFile\",\n value: function decryptFile(_ref3) {\n var fileDescriptor, fileItem, credential;\n return regeneratorRuntime.async(function decryptFile$(_context5) {\n while (1) {\n switch (_context5.prev = _context5.next) {\n case 0:\n fileDescriptor = _ref3.fileDescriptor, fileItem = _ref3.fileItem, credential = _ref3.credential;\n\n if (!credential) {\n credential = this.credentialManager.credentialForFileDescriptor(fileDescriptor);\n }\n\n return _context5.abrupt(\"return\", new Promise(function (resolve, reject) {\n var worker = new __WEBPACK_IMPORTED_MODULE_2__util_encryption_worker_js___default.a();\n worker.addEventListener(\"message\", function (event) {\n var data = event.data;\n\n if (data.error) {\n reject(data.error);\n return;\n }\n\n resolve(data);\n });\n worker.postMessage({\n operation: \"decrypt\",\n keys: credential.content.keys,\n item: fileItem\n });\n }));\n\n case 3:\n case \"end\":\n return _context5.stop();\n }\n }\n }, null, this);\n }\n }]);\n\n return FileManager;\n}();\n\n_defineProperty(FileManager, \"FileItemContentTypeKey\", \"SN|FileSafe|File\");\n\n_defineProperty(FileManager, \"FileDescriptorContentTypeKey\", \"SN|FileSafe|FileMetadata\");\n\n\n\n/***/ }),\n/* 11 */\n/***/ (function(module, exports, __webpack_require__) {\n\nmodule.exports = function () {\n return new Worker(__webpack_require__.p + \"filesafe-js/EncryptionWorker.js\");\n};\n\n/***/ }),\n/* 12 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"a\", function() { return Utils; });\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nvar Utils =\n/*#__PURE__*/\nfunction () {\n function Utils() {\n _classCallCheck(this, Utils);\n }\n\n _createClass(Utils, null, [{\n key: \"base64toBinary\",\n value: function base64toBinary(dataURI) {\n var binary = atob(dataURI);\n var array = [];\n\n for (var i = 0; i < binary.length; i++) {\n array.push(binary.charCodeAt(i));\n }\n\n return new Uint8Array(array);\n }\n }, {\n key: \"downloadData\",\n value: function downloadData(data, fileName, fileType) {\n var _this = this;\n\n var useNavigation = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;\n var link = document.createElement('a');\n link.setAttribute('download', fileName);\n var tempUrl = this.tempUrlForData(data, fileType);\n link.href = tempUrl;\n link.setAttribute(\"target\", \"_blank\");\n\n if (useNavigation) {\n window.location.href = link.href;\n } else {\n document.body.appendChild(link);\n link.click();\n link.remove();\n }\n\n setTimeout(function () {\n _this.revokeTempUrl(tempUrl);\n }, 500);\n }\n }, {\n key: \"tempUrlForData\",\n value: function tempUrlForData(data, fileType) {\n return window.URL.createObjectURL(new Blob([data], {\n type: fileType ? fileType : 'text/json'\n }));\n }\n }, {\n key: \"revokeTempUrl\",\n value: function revokeTempUrl(url) {\n window.URL.revokeObjectURL(url);\n }\n }, {\n key: \"copyTextToClipboard\",\n value: function copyTextToClipboard(text) {\n if (window.clipboardData && window.clipboardData.setData) {\n // IE specific code path to prevent textarea being shown while dialog is visible.\n return clipboardData.setData(\"Text\", text);\n } else if (document.queryCommandSupported && document.queryCommandSupported(\"copy\")) {\n var textarea;\n var result;\n\n try {\n textarea = document.createElement('textarea');\n textarea.setAttribute('readonly', true);\n textarea.setAttribute('contenteditable', true);\n textarea.style.position = 'fixed'; // prevent scroll from jumping to the bottom when focus is set.\n\n textarea.value = text;\n document.body.appendChild(textarea);\n textarea.focus();\n textarea.select();\n var range = document.createRange();\n range.selectNodeContents(textarea);\n var sel = window.getSelection();\n sel.removeAllRanges();\n sel.addRange(range);\n textarea.setSelectionRange(0, textarea.value.length);\n result = document.execCommand('copy');\n } catch (err) {\n console.error(err);\n result = null;\n } finally {\n document.body.removeChild(textarea);\n }\n }\n }\n }]);\n\n return Utils;\n}();\n\n\n\n/***/ })\n/******/ ]);\n//# sourceMappingURL=filesafe.js.map","var superPropBase = require(\"./superPropBase\");\n\nfunction _get(target, property, receiver) {\n if (typeof Reflect !== \"undefined\" && Reflect.get) {\n module.exports = _get = Reflect.get;\n } else {\n module.exports = _get = function _get(target, property, receiver) {\n var base = superPropBase(target, property);\n if (!base) return;\n var desc = Object.getOwnPropertyDescriptor(base, property);\n\n if (desc.get) {\n return desc.get.call(receiver);\n }\n\n return desc.value;\n };\n }\n\n return _get(target, property, receiver || target);\n}\n\nmodule.exports = _get;","var getPrototypeOf = require(\"./getPrototypeOf\");\n\nfunction _superPropBase(object, property) {\n while (!Object.prototype.hasOwnProperty.call(object, property)) {\n object = getPrototypeOf(object);\n if (object === null) break;\n }\n\n return object;\n}\n\nmodule.exports = _superPropBase;","var arrayWithoutHoles = require(\"./arrayWithoutHoles\");\n\nvar iterableToArray = require(\"./iterableToArray\");\n\nvar unsupportedIterableToArray = require(\"./unsupportedIterableToArray\");\n\nvar nonIterableSpread = require(\"./nonIterableSpread\");\n\nfunction _toConsumableArray(arr) {\n return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread();\n}\n\nmodule.exports = _toConsumableArray;","var arrayLikeToArray = require(\"./arrayLikeToArray\");\n\nfunction _arrayWithoutHoles(arr) {\n if (Array.isArray(arr)) return arrayLikeToArray(arr);\n}\n\nmodule.exports = _arrayWithoutHoles;","function _iterableToArray(iter) {\n if (typeof Symbol !== \"undefined\" && Symbol.iterator in Object(iter)) return Array.from(iter);\n}\n\nmodule.exports = _iterableToArray;","function _nonIterableSpread() {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\n\nmodule.exports = _nonIterableSpread;","function _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n module.exports = _typeof = function _typeof(obj) {\n return typeof obj;\n };\n } else {\n module.exports = _typeof = function _typeof(obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n }\n\n return _typeof(obj);\n}\n\nmodule.exports = _typeof;","var arrayWithHoles = require(\"./arrayWithHoles\");\n\nvar iterableToArrayLimit = require(\"./iterableToArrayLimit\");\n\nvar unsupportedIterableToArray = require(\"./unsupportedIterableToArray\");\n\nvar nonIterableRest = require(\"./nonIterableRest\");\n\nfunction _slicedToArray(arr, i) {\n return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest();\n}\n\nmodule.exports = _slicedToArray;","function _arrayWithHoles(arr) {\n if (Array.isArray(arr)) return arr;\n}\n\nmodule.exports = _arrayWithHoles;","function _iterableToArrayLimit(arr, i) {\n if (typeof Symbol === \"undefined\" || !(Symbol.iterator in Object(arr))) return;\n var _arr = [];\n var _n = true;\n var _d = false;\n var _e = undefined;\n\n try {\n for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {\n _arr.push(_s.value);\n\n if (i && _arr.length === i) break;\n }\n } catch (err) {\n _d = true;\n _e = err;\n } finally {\n try {\n if (!_n && _i[\"return\"] != null) _i[\"return\"]();\n } finally {\n if (_d) throw _e;\n }\n }\n\n return _arr;\n}\n\nmodule.exports = _iterableToArrayLimit;","function _nonIterableRest() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\n\nmodule.exports = _nonIterableRest;","var defineProperty = require(\"./defineProperty\");\n\nfunction ownKeys(object, enumerableOnly) {\n var keys = Object.keys(object);\n\n if (Object.getOwnPropertySymbols) {\n var symbols = Object.getOwnPropertySymbols(object);\n if (enumerableOnly) symbols = symbols.filter(function (sym) {\n return Object.getOwnPropertyDescriptor(object, sym).enumerable;\n });\n keys.push.apply(keys, symbols);\n }\n\n return keys;\n}\n\nfunction _objectSpread2(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i] != null ? arguments[i] : {};\n\n if (i % 2) {\n ownKeys(Object(source), true).forEach(function (key) {\n defineProperty(target, key, source[key]);\n });\n } else if (Object.getOwnPropertyDescriptors) {\n Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));\n } else {\n ownKeys(Object(source)).forEach(function (key) {\n Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));\n });\n }\n }\n\n return target;\n}\n\nmodule.exports = _objectSpread2;","function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}\n\nmodule.exports = _createClass;","function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nmodule.exports = _classCallCheck;","var setPrototypeOf = require(\"./setPrototypeOf\");\n\nfunction _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n });\n if (superClass) setPrototypeOf(subClass, superClass);\n}\n\nmodule.exports = _inherits;","var getPrototypeOf = require(\"./getPrototypeOf\");\n\nvar isNativeReflectConstruct = require(\"./isNativeReflectConstruct\");\n\nvar possibleConstructorReturn = require(\"./possibleConstructorReturn\");\n\nfunction _createSuper(Derived) {\n var hasNativeReflectConstruct = isNativeReflectConstruct();\n return function _createSuperInternal() {\n var Super = getPrototypeOf(Derived),\n result;\n\n if (hasNativeReflectConstruct) {\n var NewTarget = getPrototypeOf(this).constructor;\n result = Reflect.construct(Super, arguments, NewTarget);\n } else {\n result = Super.apply(this, arguments);\n }\n\n return possibleConstructorReturn(this, result);\n };\n}\n\nmodule.exports = _createSuper;","var getPrototypeOf = require(\"./getPrototypeOf\");\n\nvar setPrototypeOf = require(\"./setPrototypeOf\");\n\nvar isNativeFunction = require(\"./isNativeFunction\");\n\nvar construct = require(\"./construct\");\n\nfunction _wrapNativeSuper(Class) {\n var _cache = typeof Map === \"function\" ? new Map() : undefined;\n\n module.exports = _wrapNativeSuper = function _wrapNativeSuper(Class) {\n if (Class === null || !isNativeFunction(Class)) return Class;\n\n if (typeof Class !== \"function\") {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n if (typeof _cache !== \"undefined\") {\n if (_cache.has(Class)) return _cache.get(Class);\n\n _cache.set(Class, Wrapper);\n }\n\n function Wrapper() {\n return construct(Class, arguments, getPrototypeOf(this).constructor);\n }\n\n Wrapper.prototype = Object.create(Class.prototype, {\n constructor: {\n value: Wrapper,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n return setPrototypeOf(Wrapper, Class);\n };\n\n return _wrapNativeSuper(Class);\n}\n\nmodule.exports = _wrapNativeSuper;","function _isNativeFunction(fn) {\n return Function.toString.call(fn).indexOf(\"[native code]\") !== -1;\n}\n\nmodule.exports = _isNativeFunction;","var setPrototypeOf = require(\"./setPrototypeOf\");\n\nvar isNativeReflectConstruct = require(\"./isNativeReflectConstruct\");\n\nfunction _construct(Parent, args, Class) {\n if (isNativeReflectConstruct()) {\n module.exports = _construct = Reflect.construct;\n } else {\n module.exports = _construct = function _construct(Parent, args, Class) {\n var a = [null];\n a.push.apply(a, args);\n var Constructor = Function.bind.apply(Parent, a);\n var instance = new Constructor();\n if (Class) setPrototypeOf(instance, Class.prototype);\n return instance;\n };\n }\n\n return _construct.apply(null, arguments);\n}\n\nmodule.exports = _construct;"],"sourceRoot":""} \ No newline at end of file diff --git a/build/static/js/3.343c64f0.chunk.js b/build/static/js/3.343c64f0.chunk.js new file mode 100644 index 0000000..0408cf6 --- /dev/null +++ b/build/static/js/3.343c64f0.chunk.js @@ -0,0 +1,2 @@ +(this["webpackJsonpmusic-editor"]=this["webpackJsonpmusic-editor"]||[]).push([[3],{49:function(t,n,e){"use strict";e.r(n),e.d(n,"getCLS",(function(){return m})),e.d(n,"getFCP",(function(){return g})),e.d(n,"getFID",(function(){return h})),e.d(n,"getLCP",(function(){return y})),e.d(n,"getTTFB",(function(){return F}));var i,a,r=function(){return"".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12)},o=function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;return{name:t,value:n,delta:0,entries:[],id:r(),isFinal:!1}},u=function(t,n){try{if(PerformanceObserver.supportedEntryTypes.includes(t)){var e=new PerformanceObserver((function(t){return t.getEntries().map(n)}));return e.observe({type:t,buffered:!0}),e}}catch(t){}},s=!1,c=!1,d=function(t){s=!t.persisted},f=function(){addEventListener("pagehide",d),addEventListener("beforeunload",(function(){}))},p=function(t){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];c||(f(),c=!0),addEventListener("visibilitychange",(function(n){var e=n.timeStamp;"hidden"===document.visibilityState&&t({timeStamp:e,isUnloading:s})}),{capture:!0,once:n})},l=function(t,n,e,i){var a;return function(){e&&n.isFinal&&e.disconnect(),n.value>=0&&(i||n.isFinal||"hidden"===document.visibilityState)&&(n.delta=n.value-(a||0),(n.delta||n.isFinal||void 0===a)&&(t(n),a=n.value))}},m=function(t){var n,e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=o("CLS",0),a=function(t){t.hadRecentInput||(i.value+=t.value,i.entries.push(t),n())},r=u("layout-shift",a);r&&(n=l(t,i,r,e),p((function(t){var e=t.isUnloading;r.takeRecords().map(a),e&&(i.isFinal=!0),n()})))},v=function(){return void 0===i&&(i="hidden"===document.visibilityState?0:1/0,p((function(t){var n=t.timeStamp;return i=n}),!0)),{get timeStamp(){return i}}},g=function(t){var n,e=o("FCP"),i=v(),a=u("paint",(function(t){"first-contentful-paint"===t.name&&t.startTime1&&void 0!==arguments[1]&&arguments[1],i=o("LCP"),a=v(),r=function(t){var e=t.startTime;e1&&void 0!==arguments[1]?arguments[1]:-1;return{name:t,value:n,delta:0,entries:[],id:e(),isFinal:!1}},a=function(t,n){try{if(PerformanceObserver.supportedEntryTypes.includes(t)){var e=new PerformanceObserver((function(t){return t.getEntries().map(n)}));return e.observe({type:t,buffered:!0}),e}}catch(t){}},r=!1,o=!1,s=function(t){r=!t.persisted},u=function(){addEventListener(\"pagehide\",s),addEventListener(\"beforeunload\",(function(){}))},c=function(t){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];o||(u(),o=!0),addEventListener(\"visibilitychange\",(function(n){var e=n.timeStamp;\"hidden\"===document.visibilityState&&t({timeStamp:e,isUnloading:r})}),{capture:!0,once:n})},l=function(t,n,e,i){var a;return function(){e&&n.isFinal&&e.disconnect(),n.value>=0&&(i||n.isFinal||\"hidden\"===document.visibilityState)&&(n.delta=n.value-(a||0),(n.delta||n.isFinal||void 0===a)&&(t(n),a=n.value))}},p=function(t){var n,e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=i(\"CLS\",0),o=function(t){t.hadRecentInput||(r.value+=t.value,r.entries.push(t),n())},s=a(\"layout-shift\",o);s&&(n=l(t,r,s,e),c((function(t){var e=t.isUnloading;s.takeRecords().map(o),e&&(r.isFinal=!0),n()})))},d=function(){return void 0===t&&(t=\"hidden\"===document.visibilityState?0:1/0,c((function(n){var e=n.timeStamp;return t=e}),!0)),{get timeStamp(){return t}}},v=function(t){var n,e=i(\"FCP\"),r=d(),o=a(\"paint\",(function(t){\"first-contentful-paint\"===t.name&&t.startTime1&&void 0!==arguments[1]&&arguments[1],r=i(\"LCP\"),o=d(),s=function(t){var e=t.startTime;e


Need help? Check out the VexTab Tutorial.'}j}},o.loadSavedMode=function(){try{var e=o.editorKit.internal.componentManager.componentDataValueForKey(r.Mode);j,e&&o.setModeFromModeType(e),o.setState({platform:o.editorKit.internal.componentManager.platform},(function(){j}))}catch(t){j}},o.setModeFromModeType=function(e){var t,n=Object(p.a)(M);try{for(n.s();!(t=n.n()).done;){var i=t.value;if(i.type===e)return o.logDebugMessage("setModeFromModeType mode: ",i.type),void o.setState({mode:i},(function(){o.renderMusic()}))}}catch(s){n.e(s)}finally{n.f()}},o.changeMode=function(e){o.setState({mode:e},(function(){o.renderMusic()})),o.logDebugMessage("changeMode mode: ",e.type);try{o.editorKit.internal.componentManager.setComponentDataValueForKey(r.Mode,e.type)}catch(t){j}},o.removeSelection=function(){var e=window.getSelection();e&&e.removeAllRanges()},o.configureResizer=function(){var e=document.getElementById(s.MusicEditor),t=document.getElementById(s.Editor),n=document.getElementById(s.ColumnResizer),r=!1,c=0;n&&(c=n.offsetWidth),t&&n&&n.addEventListener(i.Down,(function(e){r=!0,n.classList.add(a.Dragging),t.classList.add(a.NoSelection)})),document.addEventListener(i.Move,(function(i){if(r){var s=i.clientX;e&&(se.offsetWidth-c-15&&(s=e.offsetWidth-c-15));var a=s-c/2;n&&(n.style.left=a+"px"),t&&(t.style.width=a-15+"px"),o.removeSelection()}})),document.addEventListener(i.Up,(function(e){r&&(r=!1,n&&n.classList.remove(a.Dragging),t&&t.classList.remove(a.NoSelection))}))},o.onKeyDown=function(e){w.set(e.key,!0),!w.get("Shift")&&w.get("Tab")?(e.preventDefault(),document.execCommand("insertText",!1,"\t")):w.get("Control")&&w.get("s")&&e.preventDefault()},o.onKeyUp=function(e){w.delete(e.key)},o.onBlur=function(){w.clear()},o.logDebugMessage=function(e,t){j},o.print=function(){o.renderMusic(),window.print()},o.state=E,o}return Object(h.a)(n,[{key:"configureEditorKit",value:function(){var e=this,t=new y.EditorKitDelegate({setEditorRawText:function(t){e.setState({text:t},(function(){e.state.text||e.setState({text:E.text}),e.renderMusic(),e.loadSavedMode()}))},clearUndoHistory:function(){},getElementsBySelector:function(){return[]}});this.editorKit=new y.EditorKit({delegate:t,mode:"plaintext",supportsFilesafe:!1})}},{key:"render",value:function(){var e=this;return Object(c.jsxs)("div",{className:"sn-component "+this.state.platform,id:s.MusicEditor,tabIndex:0,children:[Object(c.jsxs)("div",{id:s.Header,children:[Object(c.jsx)("div",{className:"segmented-buttons-container sk-segmented-buttons",children:Object(c.jsx)("div",{className:"buttons",children:M.map((function(t){return Object(c.jsx)("button",{onClick:function(){return e.changeMode(t)},className:"sk-button button "+(e.state.mode===t?"selected info":"sk-secondary-contrast"),children:Object(c.jsx)("div",{className:"sk-label",children:t.label})})}))})}),Object(c.jsx)("button",{className:"sk-button button sk-secondary-contrast",id:s.PrintButton,onClick:function(){return e.print()},children:Object(c.jsx)("div",{className:"sk-label",children:"Print"})})]}),Object(c.jsxs)("main",{id:s.EditorContainer,className:this.state.mode.css,children:[Object(c.jsx)("textarea",{autoCapitalize:"false",autoComplete:"false",className:this.state.mode.css,dir:"auto",id:s.Editor,onBlur:this.onBlur,onChange:this.handleInputChange,onKeyDown:this.onKeyDown,onKeyUp:this.onKeyUp,spellCheck:"false",value:this.state.text}),Object(c.jsx)("div",{className:this.state.mode.css,id:s.ColumnResizer}),Object(c.jsx)("section",{className:this.state.mode.css,id:s.View})]})]})}}]),n}(d.Component);n(47);f.a.render(Object(c.jsx)(l.a.StrictMode,{children:Object(c.jsx)(S,{})}),document.getElementById("root")),m()}},[[48,1,2]]]); +//# sourceMappingURL=main.7e51c466.chunk.js.map \ No newline at end of file diff --git a/build/static/js/main.7e51c466.chunk.js.map b/build/static/js/main.7e51c466.chunk.js.map new file mode 100644 index 0000000..1631af2 --- /dev/null +++ b/build/static/js/main.7e51c466.chunk.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["components/MusicEditor.tsx","reportWebVitals.ts","index.tsx"],"names":["ModeType","MouseEvent","HtmlElementId","CssClassList","ComponentDataKey","reportWebVitals","onPerfEntry","Function","then","getCLS","getFID","getFCP","getLCP","getTTFB","modes","type","Edit","label","css","Split","View","debugMode","keyMap","Map","initialState","mode","text","MusicEditor","props","editorKit","note","componentDidMount","configureEditorKit","configureResizer","saveNote","onEditorValueChanged","state","handleInputChange","event","value","target","setState","renderMusic","view","document","getElementById","innerHTML","Renderer","Vex","Flow","renderer","Backends","SVG","artist","Artist","scale","tab","VexTab","parse","render","e","loadSavedMode","savedMode","internal","componentManager","componentDataValueForKey","Mode","setModeFromModeType","platform","logDebugMessage","changeMode","setComponentDataValueForKey","removeSelection","selection","window","getSelection","removeAllRanges","musicEditor","editor","Editor","columnResizer","ColumnResizer","pressed","resizerWidth","offsetWidth","addEventListener","Down","classList","add","Dragging","NoSelection","Move","x","clientX","colLeft","style","left","width","Up","remove","onKeyDown","set","key","get","preventDefault","execCommand","onKeyUp","delete","onBlur","clear","message","object","print","delegate","EditorKitDelegate","setEditorRawText","clearUndoHistory","getElementsBySelector","this","EditorKit","supportsFilesafe","className","id","tabIndex","Header","map","onClick","PrintButton","EditorContainer","autoCapitalize","autoComplete","dir","onChange","spellCheck","React","ReactDOM","StrictMode"],"mappings":"wKAUKA,EAMAC,EAMAC,EAUAC,EAKAC,E,wCCvBUC,G,MAZS,SAACC,GACnBA,GAAeA,aAAuBC,UACxC,6BAAqBC,MAAK,YAAkD,IAA/CC,EAA8C,EAA9CA,OAAQC,EAAsC,EAAtCA,OAAQC,EAA8B,EAA9BA,OAAQC,EAAsB,EAAtBA,OAAQC,EAAc,EAAdA,QAC3DJ,EAAOH,GACPI,EAAOJ,GACPK,EAAOL,GACPM,EAAON,GACPO,EAAQP,Q,gEDCTN,O,eAAAA,I,iBAAAA,I,gBAAAA,M,cAMAC,K,iBAAAA,E,iBAAAA,E,cAAAA,M,cAMAC,K,+BAAAA,E,gBAAAA,E,mCAAAA,E,gBAAAA,E,2BAAAA,E,YAAAA,E,4BAAAA,M,cAUAC,K,oBAAAA,E,4BAAAA,M,cAKAC,K,aAAAA,M,KAIL,IAAMU,EAAQ,CACZ,CAAEC,KAAMf,EAASgB,KAAMC,MAAO,OAAQC,IAAK,QAC3C,CAAEH,KAAMf,EAASmB,MAAOF,MAAO,QAASC,IAAK,SAC7C,CAAEH,KAAMf,EAASoB,KAAMH,MAAO,OAAQC,IAAK,SASvCG,GAAY,EAEZC,EAAS,IAAIC,IAEbC,EAAe,CACnBC,KAAMX,EAAM,GACZY,KAAM,uEAGaC,E,kDAInB,WAAYC,GAAa,IAAD,8BACtB,cAAMA,IAJRC,eAGwB,IAFxBC,UAEwB,IAKxBC,kBAAoB,WAClB,EAAKC,qBACL,EAAKC,oBAPiB,EAuCxBC,SAAW,WACT,EAAKL,UAAUM,qBAAqB,EAAKC,MAAMV,OAxCzB,EA2CxBW,kBAAoB,SAACC,GACnB,IACMC,EADSD,EAAME,OACAD,MAErB,EAAKE,SACH,CACEf,KAAMa,IAER,WACE,EAAKL,WACL,EAAKQ,kBArDa,EA0DxBA,YAAc,WACZ,IAAMC,EAAOC,SAASC,eAAe3C,EAAckB,MAC/CuB,IACFA,EAAKG,UAAY,IAGnB,IAAMC,EAAWC,MAAIC,KAAKF,SACpBG,EAAW,IAAIH,EAASJ,EAAMI,EAASI,SAASC,KAGhDC,EAAS,IAAIC,SAAO,GAAI,GAAI,IAAK,CAAEC,MAAO,KAC1CC,EAAM,IAAIC,SAAOJ,GACvB,IACEG,EAAIE,MAAM,EAAKtB,MAAMV,MACrB2B,EAAOM,OAAOT,GACd,MAAOU,GACP,GAAIjB,EAAM,CAERA,EAAKG,UAAYc,EADA,0KAGfvC,IA9EgB,EAoFxBwC,cAAgB,WACd,IACE,IAAMC,EAAY,EAAKjC,UAAUkC,SAASC,iBAAiBC,yBACzD7D,EAAiB8D,MAEf7C,EAGAyC,GACF,EAAKK,oBAAoBL,GAE3B,EAAKrB,SACH,CACE2B,SAAU,EAAKvC,UAAUkC,SAASC,iBAAiBI,WAErD,WACM/C,KAKR,MAAOuC,GACHvC,IA1GgB,EAgHxB8C,oBAAsB,SAAC5B,GAAqB,IAAD,gBACtBzB,GADsB,IACzC,2BAA0B,CAAC,IAAhBW,EAAe,QACxB,GAAIA,EAAKV,OAASwB,EAUhB,OATA,EAAK8B,gBAAgB,6BAA8B5C,EAAKV,WACxD,EAAK0B,SACH,CACEhB,SAEF,WACE,EAAKiB,kBAT4B,gCAhHnB,EAiIxB4B,WAAa,SAAC7C,GACZ,EAAKgB,SACH,CACEhB,SAEF,WACE,EAAKiB,iBAGT,EAAK2B,gBAAgB,oBAAqB5C,EAAKV,MAC/C,IACE,EAAKc,UAAUkC,SAASC,iBAAiBO,4BACvCnE,EAAiB8D,KACjBzC,EAAKV,MAEP,MAAO6C,GACHvC,IAjJgB,EAuJxBmD,gBAAkB,WAChB,IAAIC,EAAYC,OAAOC,eACnBF,GACFA,EAAUG,mBA1JU,EA8JxB3C,iBAAmB,WACjB,IAAM4C,EAAcjC,SAASC,eAAe3C,EAAcyB,aACpDmD,EAASlC,SAASC,eAAe3C,EAAc6E,QAC/CC,EAAgBpC,SAASC,eAAe3C,EAAc+E,eACxDC,GAAU,EAEVC,EAAe,EACfH,IACFG,EAAeH,EAAcI,aAG3BN,GAAUE,GACZA,EAAcK,iBAAiBpF,EAAWqF,MAAM,SAAChD,GAC/C4C,GAAU,EACVF,EAAcO,UAAUC,IAAIrF,EAAasF,UACzCX,EAAOS,UAAUC,IAAIrF,EAAauF,gBAItC9C,SAASyC,iBAAiBpF,EAAW0F,MAAM,SAACrD,GAC1C,GAAK4C,EAAL,CAGA,IAAIU,EAAItD,EAAMuD,QACVhB,IACEe,EAAIT,EAAe,EApBR,GAqBbS,EAAIT,EAAe,EArBN,GAsBJS,EAAIf,EAAYO,YAAcD,EAtB1B,KAuBbS,EAAIf,EAAYO,YAAcD,EAvBjB,KA2BjB,IAAMW,EAAUF,EAAIT,EAAe,EAC/BH,IACFA,EAAce,MAAMC,KAAOF,EAAU,MAEnChB,IACFA,EAAOiB,MAAME,MAAQH,EAhCN,GAgC+B,MAGhD,EAAKtB,sBAGP5B,SAASyC,iBAAiBpF,EAAWiG,IAAI,SAAC5D,GACpC4C,IACFA,GAAU,EACNF,GACFA,EAAcO,UAAUY,OAAOhG,EAAasF,UAE1CX,GACFA,EAAOS,UAAUY,OAAOhG,EAAauF,kBAhNrB,EAsNxBU,UAAY,SAAC9D,GACXhB,EAAO+E,IAAI/D,EAAMgE,KAAK,IACjBhF,EAAOiF,IAAI,UAAYjF,EAAOiF,IAAI,QACrCjE,EAAMkE,iBACN5D,SAAS6D,YAAY,cAAc,EAAO,OACjCnF,EAAOiF,IAAI,YAAcjF,EAAOiF,IAAI,MAC7CjE,EAAMkE,kBA5Nc,EAgOxBE,QAAU,SAACpE,GACThB,EAAOqF,OAAOrE,EAAMgE,MAjOE,EAoOxBM,OAAS,WACPtF,EAAOuF,SArOe,EAwOxBxC,gBAAkB,SAACyC,EAAiBC,GAC9B1F,GAzOkB,EA8OxB2F,MAAQ,WACN,EAAKtE,cACLgC,OAAOsC,SA9OP,EAAK5E,MAAQZ,EAFS,E,iEAUF,IAAD,OACbyF,EAAW,IAAIC,oBAAkB,CACrCC,iBAAkB,SAACzF,GACjB,EAAKe,SACH,CACEf,SAEF,WACO,EAAKU,MAAMV,MACd,EAAKe,SAAS,CACZf,KAAMF,EAAaE,OAGvB,EAAKgB,cACL,EAAKmB,oBAIXuD,iBAAkB,aAClBC,sBAAuB,iBAAM,MAG/BC,KAAKzF,UAAY,IAAI0F,YAAU,CAC7BN,SAAUA,EACVxF,KAAM,YACN+F,kBAAkB,M,+BAgNZ,IAAD,OACP,OACE,sBACEC,UAAW,gBAAkBH,KAAKlF,MAAMgC,SACxCsD,GAAIxH,EAAcyB,YAClBgG,SAAU,EAHZ,UAKE,sBAAKD,GAAIxH,EAAc0H,OAAvB,UACE,qBAAKH,UAAU,mDAAf,SACE,qBAAKA,UAAU,UAAf,SACG3G,EAAM+G,KAAI,SAACpG,GAAD,OACT,wBACEqG,QAAS,kBAAM,EAAKxD,WAAW7C,IAC/BgG,UACE,qBACC,EAAKrF,MAAMX,OAASA,EACjB,gBACA,yBANR,SASE,qBAAKgG,UAAU,WAAf,SAA2BhG,EAAKR,iBAKxC,wBACEwG,UAAW,yCACXC,GAAIxH,EAAc6H,YAClBD,QAAS,kBAAM,EAAKd,SAHtB,SAKE,qBAAKS,UAAU,WAAf,SAA2B,eAG/B,uBACEC,GAAIxH,EAAc8H,gBAClBP,UAAWH,KAAKlF,MAAMX,KAAKP,IAF7B,UAIE,0BACE+G,eAAe,QACfC,aAAa,QACbT,UAAWH,KAAKlF,MAAMX,KAAKP,IAC3BiH,IAAI,OACJT,GAAIxH,EAAc6E,OAClB6B,OAAQU,KAAKV,OACbwB,SAAUd,KAAKjF,kBACf+D,UAAWkB,KAAKlB,UAChBM,QAASY,KAAKZ,QACd2B,WAAW,QACX9F,MAAO+E,KAAKlF,MAAMV,OAEpB,qBACE+F,UAAWH,KAAKlF,MAAMX,KAAKP,IAC3BwG,GAAIxH,EAAc+E,gBAEpB,yBACEwC,UAAWH,KAAKlF,MAAMX,KAAKP,IAC3BwG,GAAIxH,EAAckB,iB,GA/SWkH,a,MEtDzCC,IAAS5E,OACP,cAAC,IAAM6E,WAAP,UACE,cAAC,EAAD,MAEF5F,SAASC,eAAe,SAM1BxC,M","file":"static/js/main.7e51c466.chunk.js","sourcesContent":["import * as React from 'react';\nimport { EditorKit, EditorKitDelegate } from 'sn-editor-kit';\nimport { Vex, VexTab, Artist } from 'vextab';\n\ntype Mode = {\n type: ModeType;\n label: string;\n css: string;\n};\n\nenum ModeType {\n Edit = 0,\n Split = 1,\n View = 2,\n}\n\nenum MouseEvent {\n Down = 'mousedown',\n Move = 'mousemove',\n Up = 'mouseup',\n}\n\nenum HtmlElementId {\n ColumnResizer = 'column-resizer',\n Editor = 'editor',\n EditorContainer = 'editor-container',\n Header = 'header',\n MusicEditor = 'music-editor',\n View = 'view',\n PrintButton = 'print-button',\n}\n\nenum CssClassList {\n Dragging = 'dragging',\n NoSelection = 'no-selection',\n}\n\nenum ComponentDataKey {\n Mode = 'mode',\n}\n\nconst modes = [\n { type: ModeType.Edit, label: 'Edit', css: 'edit' } as Mode,\n { type: ModeType.Split, label: 'Split', css: 'split' } as Mode,\n { type: ModeType.View, label: 'View', css: 'view' } as Mode,\n];\n\ntype MusicEditorState = {\n text: string;\n mode: Mode;\n platform?: string;\n};\n\nconst debugMode = false;\n\nconst keyMap = new Map();\n\nconst initialState = {\n mode: modes[1],\n text: 'options scale=1.0\\n\\ntabstave notation=true tablature=false\\nnotes ',\n};\n\nexport default class MusicEditor extends React.Component<{}, MusicEditorState> {\n editorKit: any;\n note: any;\n\n constructor(props: any) {\n super(props);\n this.state = initialState;\n }\n\n componentDidMount = () => {\n this.configureEditorKit();\n this.configureResizer();\n };\n\n configureEditorKit() {\n const delegate = new EditorKitDelegate({\n setEditorRawText: (text: string) => {\n this.setState(\n {\n text,\n },\n () => {\n if (!this.state.text) {\n this.setState({\n text: initialState.text,\n });\n }\n this.renderMusic();\n this.loadSavedMode();\n }\n );\n },\n clearUndoHistory: () => {},\n getElementsBySelector: () => [],\n });\n\n this.editorKit = new EditorKit({\n delegate: delegate,\n mode: 'plaintext',\n supportsFilesafe: false,\n });\n }\n\n saveNote = () => {\n this.editorKit.onEditorValueChanged(this.state.text);\n };\n\n handleInputChange = (event: React.ChangeEvent) => {\n const target = event.target;\n const value = target.value;\n\n this.setState(\n {\n text: value,\n },\n () => {\n this.saveNote();\n this.renderMusic();\n }\n );\n };\n\n renderMusic = () => {\n const view = document.getElementById(HtmlElementId.View);\n if (view) {\n view.innerHTML = '';\n }\n // Create VexFlow Renderer from canvas element with id #view\n const Renderer = Vex.Flow.Renderer;\n const renderer = new Renderer(view, Renderer.Backends.SVG);\n\n // Initialize VexTab artist and parser.\n const artist = new Artist(10, 10, 600, { scale: 0.8 });\n const tab = new VexTab(artist);\n try {\n tab.parse(this.state.text);\n artist.render(renderer);\n } catch (e) {\n if (view) {\n const helpMessage = `



Need help? Check out the VexTab Tutorial.`;\n view.innerHTML = e + helpMessage;\n }\n if (debugMode) {\n console.log(e);\n }\n }\n };\n\n loadSavedMode = () => {\n try {\n const savedMode = this.editorKit.internal.componentManager.componentDataValueForKey(\n ComponentDataKey.Mode\n ) as ModeType;\n if (debugMode) {\n console.log('loaded savedMode: ' + savedMode);\n }\n if (savedMode) {\n this.setModeFromModeType(savedMode);\n }\n this.setState(\n {\n platform: this.editorKit.internal.componentManager.platform,\n },\n () => {\n if (debugMode) {\n console.log(this.state.platform);\n }\n }\n );\n } catch (e) {\n if (debugMode) {\n console.log('Error when loading saved mode: ' + e);\n }\n }\n };\n\n setModeFromModeType = (value: ModeType) => {\n for (const mode of modes) {\n if (mode.type === value) {\n this.logDebugMessage('setModeFromModeType mode: ', mode.type);\n this.setState(\n {\n mode,\n },\n () => {\n this.renderMusic();\n }\n );\n return;\n }\n }\n };\n\n changeMode = (mode: Mode) => {\n this.setState(\n {\n mode,\n },\n () => {\n this.renderMusic();\n }\n );\n this.logDebugMessage('changeMode mode: ', mode.type);\n try {\n this.editorKit.internal.componentManager.setComponentDataValueForKey(\n ComponentDataKey.Mode,\n mode.type\n );\n } catch (e) {\n if (debugMode) {\n console.log('Error saving mode: ' + e);\n }\n }\n };\n\n removeSelection = () => {\n let selection = window.getSelection();\n if (selection) {\n selection.removeAllRanges();\n }\n };\n\n configureResizer = () => {\n const musicEditor = document.getElementById(HtmlElementId.MusicEditor);\n const editor = document.getElementById(HtmlElementId.Editor);\n const columnResizer = document.getElementById(HtmlElementId.ColumnResizer);\n let pressed = false;\n let safetyOffset = 15;\n let resizerWidth = 0;\n if (columnResizer) {\n resizerWidth = columnResizer.offsetWidth;\n }\n\n if (editor && columnResizer) {\n columnResizer.addEventListener(MouseEvent.Down, (event) => {\n pressed = true;\n columnResizer.classList.add(CssClassList.Dragging);\n editor.classList.add(CssClassList.NoSelection);\n });\n }\n\n document.addEventListener(MouseEvent.Move, (event) => {\n if (!pressed) {\n return;\n }\n let x = event.clientX;\n if (musicEditor) {\n if (x < resizerWidth / 2 + safetyOffset) {\n x = resizerWidth / 2 + safetyOffset;\n } else if (x > musicEditor.offsetWidth - resizerWidth - safetyOffset) {\n x = musicEditor.offsetWidth - resizerWidth - safetyOffset;\n }\n }\n\n const colLeft = x - resizerWidth / 2;\n if (columnResizer) {\n columnResizer.style.left = colLeft + 'px';\n }\n if (editor) {\n editor.style.width = colLeft - safetyOffset + 'px';\n }\n\n this.removeSelection();\n });\n\n document.addEventListener(MouseEvent.Up, (event) => {\n if (pressed) {\n pressed = false;\n if (columnResizer) {\n columnResizer.classList.remove(CssClassList.Dragging);\n }\n if (editor) {\n editor.classList.remove(CssClassList.NoSelection);\n }\n }\n });\n };\n\n onKeyDown = (event: React.KeyboardEvent) => {\n keyMap.set(event.key, true);\n if (!keyMap.get('Shift') && keyMap.get('Tab')) {\n event.preventDefault();\n document.execCommand('insertText', false, '\\t');\n } else if (keyMap.get('Control') && keyMap.get('s')) {\n event.preventDefault();\n }\n };\n\n onKeyUp = (event: React.KeyboardEvent) => {\n keyMap.delete(event.key);\n };\n\n onBlur = () => {\n keyMap.clear();\n };\n\n logDebugMessage = (message: string, object: any) => {\n if (debugMode) {\n console.log(message, object);\n }\n };\n\n print = () => {\n this.renderMusic();\n window.print();\n };\n\n render() {\n return (\n \n
\n
\n
\n {modes.map((mode) => (\n this.changeMode(mode)}\n className={\n 'sk-button button ' +\n (this.state.mode === mode\n ? 'selected info'\n : 'sk-secondary-contrast')\n }\n >\n
{mode.label}
\n \n ))}\n
\n
\n this.print()}\n >\n
{'Print'}
\n \n
\n \n \n
\n \n \n
\n );\n }\n}\n","import { ReportHandler } from 'web-vitals';\n\nconst reportWebVitals = (onPerfEntry?: ReportHandler) => {\n if (onPerfEntry && onPerfEntry instanceof Function) {\n import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {\n getCLS(onPerfEntry);\n getFID(onPerfEntry);\n getFCP(onPerfEntry);\n getLCP(onPerfEntry);\n getTTFB(onPerfEntry);\n });\n }\n};\n\nexport default reportWebVitals;\n","import React from 'react';\nimport ReactDOM from 'react-dom';\nimport './index.css';\nimport reportWebVitals from './reportWebVitals';\n\nimport MusicEditor from './components/MusicEditor';\nimport './stylesheets/main.scss';\n\nReactDOM.render(\n \n \n ,\n document.getElementById('root')\n);\n\n// If you want to start measuring performance in your app, pass a function\n// to log results (for example: reportWebVitals(console.log))\n// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals\nreportWebVitals();\n"],"sourceRoot":""} \ No newline at end of file diff --git a/build/static/js/runtime-main.63a93a4c.js b/build/static/js/runtime-main.63a93a4c.js new file mode 100644 index 0000000..2f10c0c --- /dev/null +++ b/build/static/js/runtime-main.63a93a4c.js @@ -0,0 +1,2 @@ +!function(e){function r(r){for(var n,i,a=r[0],c=r[1],l=r[2],s=0,p=[];s0.2%", + "not dead", + "not op_mini all" + ], + "development": [ + "last 1 chrome version", + "last 1 firefox version", + "last 1 safari version" + ] + } +} diff --git a/public/CNAME b/public/CNAME new file mode 100644 index 0000000..299928b --- /dev/null +++ b/public/CNAME @@ -0,0 +1 @@ +demo.musiceditor.net \ No newline at end of file diff --git a/public/LICENSE.txt b/public/LICENSE.txt new file mode 100644 index 0000000..34e2bcf --- /dev/null +++ b/public/LICENSE.txt @@ -0,0 +1,664 @@ +Music Editor +Copyright (C) 2020, Theodore Chu. All Rights Reserved. + + GNU AFFERO GENERAL PUBLIC LICENSE + Version 3, 19 November 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU Affero General Public License is a free, copyleft license for +software and other kinds of works, specifically designed to ensure +cooperation with the community in the case of network server software. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +our General Public Licenses are intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + Developers that use our General Public Licenses protect your rights +with two steps: (1) assert copyright on the software, and (2) offer +you this License which gives you legal permission to copy, distribute +and/or modify the software. + + A secondary benefit of defending all users' freedom is that +improvements made in alternate versions of the program, if they +receive widespread use, become available for other developers to +incorporate. Many developers of free software are heartened and +encouraged by the resulting cooperation. However, in the case of +software used on network servers, this result may fail to come about. +The GNU General Public License permits making a modified version and +letting the public access it on a server without ever releasing its +source code to the public. + + The GNU Affero General Public License is designed specifically to +ensure that, in such cases, the modified source code becomes available +to the community. It requires the operator of a network server to +provide the source code of the modified version running there to the +users of that server. Therefore, public use of a modified version, on +a publicly accessible server, gives the public access to the source +code of the modified version. + + An older license, called the Affero General Public License and +published by Affero, was designed to accomplish similar goals. This is +a different license, not a version of the Affero GPL, but Affero has +released a new version of the Affero GPL which permits relicensing under +this license. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU Affero General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Remote Network Interaction; Use with the GNU General Public License. + + Notwithstanding any other provision of this License, if you modify the +Program, your modified version must prominently offer all users +interacting with it remotely through a computer network (if your version +supports such interaction) an opportunity to receive the Corresponding +Source of your version by providing access to the Corresponding Source +from a network server at no charge, through some standard or customary +means of facilitating copying of software. This Corresponding Source +shall include the Corresponding Source for any work covered by version 3 +of the GNU General Public License that is incorporated pursuant to the +following paragraph. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the work with which it is combined will remain governed by version +3 of the GNU General Public License. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU Affero General Public License from time to time. Such new versions +will be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU Affero General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU Affero General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU Affero General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If your software can interact with users remotely through a computer +network, you should also make sure that it provides a way for users to +get its source. For example, if your program is a web application, its +interface could display a "Source" link that leads users to an archive +of the code. There are many ways you could offer source, and different +solutions will be better for different programs; see section 13 for the +specific requirements. + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU AGPL, see +. diff --git a/public/README.txt b/public/README.txt new file mode 100644 index 0000000..6f23902 --- /dev/null +++ b/public/README.txt @@ -0,0 +1,107 @@ +# Music Editor + +
+ +[![Release](https://img.shields.io/github/release/theodorechu/music-editor.svg)](https://github.com/theodorechu/music-editor/releases) +[![License](https://img.shields.io/github/license/theodorechu/music-editor?color=blue)](https://github.com/theodorechu/music-editor/blob/main/LICENSE) +[![Status](https://img.shields.io/badge/status-open%20beta-orange.svg)](https://musiceditor.net/#installation) +[![Cost](https://img.shields.io/badge/cost-free-darkgreen.svg)](https://musiceditor.net/#installation) +[![GitHub issues](https://img.shields.io/github/issues/theodorechu/music-editor.svg)](https://github.com/theodorechu/music-editor/issues/) +[![Slack](https://img.shields.io/badge/slack-standardnotes-CC2B5E.svg?style=flat&logo=slack)](https://standardnotes.org/slack) +[![Downloads](https://img.shields.io/github/downloads/theodorechu/music-editor/total.svg?style=flat)](https://github.com/theodorechu/music-editor/releases) +[![GitHub Stars](https://img.shields.io/github/stars/theodorechu/music-editor?style=social)](https://github.com/theodorechu/music-editor) + +
+ +## Introduction + +The Music Editor is an **unofficial** [editor](https://standardnotes.org/help/77/what-are-editors) for [Standard Notes](https://standardnotes.org), a free, [open-source](https://standardnotes.org/knowledge/5/what-is-free-and-open-source-software), and [end-to-end encrypted](https://standardnotes.org/knowledge/2/what-is-end-to-end-encryption) notes app. + +You can find the demo at [demo.musiceditor.net](https://demo.musiceditor.net). + +The Music Editor is powered by [VexTab](https://github.com/0xfe/vextab) and [VexFlow](https://github.com/0xfe/vexflow). A tutorial on how to use VexTab is available [here](https://vexflow.com/vextab/tutorial.html). + +## Installation + +1. Register for an account at Standard Notes using the [Desktop App](https://standardnotes.org/download) or [Web app](https://app.standardnotes.org). Remember to use a strong and memorable password. +2. In the bottom left corner of the app, click **Extensions**. +3. Click **Import Extension**. +4. Paste this into the input box: + ``` + https://notes.theochu.com/p/Sfq1jJV0X2 + ``` + or paste this into the input box on **desktop**: + ``` + https://raw.githubusercontent.com/TheodoreChu/music-editor/main/public/demo.ext.json + ``` +5. Press Enter or Return on your keyboard. +6. Click **Install**. +7. At the top of your note, click **Editor**, then click **Music Editor**. +8. When prompted to activate the extension, click **Continue**. + +After you have installed the editor on the web or desktop app, it will automatically sync to your [mobile app](https://standardnotes.org/download) after you sign in. + +## Development + +This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). + +### Available Scripts + +In the project directory, you can run: + +#### `yarn start` + +Runs the app in the development mode.
+Open [http://localhost:3000](http://localhost:3000) to view it in the browser. + +The page will reload if you make edits.
+You will also see any lint errors in the console. + +#### `yarn test` + +Launches the test runner in the interactive watch mode.
+See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. + +#### `yarn build` + +Builds the app for production to the `build` folder.
+It correctly bundles React in production mode and optimizes the build for the best performance. + +The build is minified and the filenames include the hashes.
+Your app is ready to be deployed! + +See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. + +#### `yarn eject` + +**Note: this is a one-way operation. Once you `eject`, you can't go back!** + +If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. + +Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own. + +You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it. + +#### Learn More + +You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). + +To learn React, check out the [React documentation](https://reactjs.org/). + +## License + +Copyright (c) Theodore Chu. All Rights Reserved. Licensed under [AGPL-3.0](https://github.com/TheodoreChu/music-editor/blob/main/LICENSE) or later. + +## Acknowledgements + +Early stages of this editor were based heavily on the Standard Notes [Markdown Basic Editor](https://github.com/standardnotes/markdown-basic). The Markdown Basic Editor is licensed under AGPL-3.0 and is available for use through [Standard Notes Extended](https://standardnotes.org/extensions). + +## Further Resources + +- [GitHub](https://github.com/TheodoreChu/music-editor) for the source code of the Music Editor +- [GitHub Issues](https://github.com/TheodoreChu/music-editor/issues) for reporting issues concerning the Music Editor +- [Docs](https://docs.theochu.com/music-editor) for how to use the Music Editor +- [Contact](https://theochu.com/contact) for how to contact the developer of the Music Editor +- [Music Editor To do List](https://github.com/TheodoreChu/music-editor/projects/1) for the roadmap of the Music Editor +- [Standard Notes Slack](https://standardnotes.org/slack) for connecting with the Standard Notes Community +- [Standard Notes Help](https://standardnotes.org/help) for help with issues related to Standard Notes but unrelated to this editor diff --git a/public/demo.ext.json b/public/demo.ext.json new file mode 100644 index 0000000..2c81055 --- /dev/null +++ b/public/demo.ext.json @@ -0,0 +1,13 @@ +{ + "identifier": "net.musiceditor.demo", + "name": "Music Editor", + "content_type": "SN|Component", + "area": "editor-editor", + "version": "0.1.0", + "description": "Music Editor for Standard Notes. Write music with VexTab and VexFlow", + "url": "https://demo.musiceditor.net", + "download_url": "https://github.com/TheodoreChu/music-editor/releases/download/v0.1.0/music-editor-build-v0.1.0.zip", + "latest_url": "https://raw.githubusercontent.com/TheodoreChu/music-editor/main/public/demo.ext.json", + "marketing_url": "https://musiceditor.net", + "thumbnail_url": "" +} diff --git a/public/icon-16x16.png b/public/icon-16x16.png new file mode 100644 index 0000000000000000000000000000000000000000..5436527d72389a79b850f1aba4fd9d797f0dce91 GIT binary patch literal 303 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`oCO|{#S9GG!XV7ZFl&wkP>``W z$lZxy-8q?;Kn_c~qpu?a!^VE@KZ&eB{t-_X$B+ufwUh1&HW>)CoS)C6(wsXSqFo+Q81g!C!R!k{t}` z1?>I{pERW&3F){P=(MpR=4|C^(+meynKcc5)>ZR2nq_6=t&t6W7IMH}O87zM5ANFH zQhuWieKU4$T-vkbm|eqJ@x1~kJkPf8Qhw4l^XuA~y?h(a=sj!y85}Sb4q9e0BS^W3jhEB literal 0 HcmV?d00001 diff --git a/public/icon-32x32.png b/public/icon-32x32.png new file mode 100644 index 0000000000000000000000000000000000000000..c7aef9e9c80018e1105f3882e35e87d6e03f4b9b GIT binary patch literal 431 zcmV;g0Z{&lP)%MEm$1vT>Cn4$_H`EAjo0b;Fin+x=4aE>Ezi$A5wfNa?um+Y2yiZBc! z6VW{a!u<-wkT=(r&~azn9hf8Sb15{m4owCKSD#8Pv9aS^1F1*^`+~`$3bQN*r1;F! zKYG+jsBXPaWB8e{_Rc){@4ciePw_qCFlxqxP7sGB(pH}g;ePwdT*cp>^ch@&WQ&1J ZoB+K5P^FW&)YSk0002ovPDHLkV1iH@wf6u3 literal 0 HcmV?d00001 diff --git a/public/icon-64x64.png b/public/icon-64x64.png new file mode 100644 index 0000000000000000000000000000000000000000..651424979a54db901ac6c9b0d8b9e832ad81ec84 GIT binary patch literal 732 zcmV<20wev2P)@~0drDELIAGL9O(c600d`2O+f$vv5yPNy^h(5NdWDn4rhTL2ql0{RusxQtewNzhQ0(4I5=FO zr`hd-4*|R+D_?L6Fo)cOli?b?2!w^Iz0%}?)C-{s(&4STZq)sK*B?kp0GeHLP&-?y zdrrhGK!xVnWhEv7$icO`mXHE?CzJp>S!stiU>~^6q0qzkg+;u>5WC1X6 zvH%!3SpW>2EC2>hiv0j;ug!31s0wvozf-&;AWIyMqK=IVIw#n*jB(BykH%730@Q2# z0CR&i6#>ZkIXsYp00lfbPq+v$LO=cf1w3LZKmoZ9cSlAEhR)(=wT;0`fk;k~XuJ7> zUG{a^1r`otcG?BH)B%qO_i2go2M?y4TLQH2E)fm^&s?7w{0(98o@7r6Kzpx1SiHB& zPYF;UJe;RN+oqds0?^tQ2+taPG>X|KfcNa%krF&qZNJqffIu9S;1S^!hAhEXfVdPw zgn<1ku&z>D>EmU{HIrAhJ;9F3_St9f&Hf5Jm^MSGbQiE>0U O0000KU2Qrx_tTKk^24hJ@sE>ksK!fmh0e>L%xWXTfgm*-AO zZF|W*%cZw&ckA-~4d1%2&1=+U`lu^#Mv3c*#Jcpg^*nE%=&J`U+ta;~>C(fFeP6A2 zte<;fl62>m2C0ALmfs44&MO?>;#OE%k#4jr?cBkj17g85xpuTga2d}$7=BJEv1pwv zE6W>|CC106>)k&xY0r@!l_lD3H{%|>uVlVGD{SNCz)35Bp}^qj>gTe~DWM4fmLiR{ literal 0 HcmV?d00001 diff --git a/public/icon192.png b/public/icon192.png new file mode 100644 index 0000000000000000000000000000000000000000..7f05f8ddd78f44c5a492c970c4c563d6205d917d GIT binary patch literal 1906 zcmb_dc{mh$7yiu{j6sczXb>qeQ`c6uvW%sf5Lsqil*#gy!iNwVjV7*3YG|>1%7iR~ zxw0ojbF+0N%e|Il%hp(Cn6ixB<^Fg7|IYKAbDsA-=Q-zj|9bD++YuxYXaoR2((1gW z<8Ei~C0t~;Iu7}Z?l!TY^R6KPh)eG!1U$=-+a)0(js$b?szYIB7r=bXY|Q{DOA_Do z6b3+4)XLI~7y;o8({Byxp?)3HG*)EGqtcbEWt zIbOQ;zJEG zk4nVpj7?Fx;!d!@uNw&_k4fChYn(ouEC*q``5&v68paFoVt4@t4pI*+1QY4g}m1sKSLPV?!A!^2Ev&>$01 z_6z~xtExBVebAMnQ52Kr`^HKp{X;XOK~K)?gI*#WS5xGga9J9nZgH^lQ%^jY#7t|| zUb)|Gd;A57HwP{aS zL6XHVZ#!~%P6tXO{`T};e|CkS4GF!VXDL+|y>z zJJ&THgrPtN$#R0Qy>|8&sgBZ^?-Pr>7D@Zq=29q3|%gpdCqjLn%YK zqM-cXq3cBeV$eyK8)lhBGoMzklI&e$>UD3wU?qdOfAXN(4k z@Ohea*_?ozBK(h3jy{a7c4lWEgx~sYv-qnWGbL?Erwcne)lNzj^8u#OEd;5cU%={E zFk{CM#*TBIc>3JH49v=&Ca;d4faA8Jx*G|PZsz8m{ase=DuphuIUie67UmmEm_pMg z7zBEY6t__P&DMO**1p_gcx;)Tgt^pjF+2GYoi7LHDhVZ{=ORA+**@G%GMDK*v%PGe znVf&GHooM_flJG4+^mF@+KI?OZZ($aUa#;}6WyHtr0a9iqSh9M_rJ}~fY!7gwyNH1 zhP#b#e{bR+PguAOVoxO)TU@v;X3f4NvPcGmMr z52V!aE;6;nyHh$(f?Z`GQxXdEMC+6LkCP&so&S8oyIhfIl^}#BF1*bIlRkag zR@%blg%^>1J>pNB_TiA7ncjx=*Af(Ien&*fE9ULnhTbB|@!h7fN>dij5Rau!f~L|n zQR8a>eMC0=hbJrDOPE&AygkqsM?TezU|%%1TTvppRgk4RLd&3C@R~KktwC(G9Hf*( zjehhzyy#Lgtrd<#23L~m1wxc_h=_;awE3%TBI9*iyzy%4Aby5OLPwsg&8=pnyO}+1 zG7#c(Z#VcOh=a|1y3VDsSz_O`Hq#nK>~~dGSJ8-`>u0_2yC;7&;%-iEw|78FTYe#< z&3Epv+2k3IOV&ay1y6Lbtm2C-QoglslVNY+9r={rZyR6Ky?3|T)A~ev$DAuSWVJP- z2dKoAHjuJ zmo&nP+OjW+TX+9xYdRmk^TPJ_YphGo9sC?>is$|+rsakM^E7YmhG3m!d&2L|{7_rt z5(iT}9u-kTm7}EeJIPNC-sccc$jw!*tmubjQ&=2Pqm8Zob*7`(zwDG2c@2V#3Vq4* z1O>YSbBD|3(NzX7ojaFqZ6 literal 0 HcmV?d00001 diff --git a/public/icon512.png b/public/icon512.png new file mode 100644 index 0000000000000000000000000000000000000000..716028f187a6b1efca09041ab08dc5ef70b326fa GIT binary patch literal 5483 zcmeHLXIN8Nw_Ya+h7t&NKnXGh8-g@JClrkiR&b=F7*Js-f+G}F-fLy;cfD)v+&FGw zE-$Mh3jp$m4(>kzKthiskY0hrM9|wgBxE=T9WDXLtzQ0Okd&f?USgL{nD2w!*Bb}W zfb!$sV|xLf#K|qVNCB*cL;Lqy2VsAA8Q=bq)EofBchnpt1n)?@RA_8Z@uB3N>i%$(Zxa^xyU+8bD3=9Anh9yR7W!CuF-Q zhc=pZiax_q`5Hh}(sglhb0T#yp@U~|3?R+0(mL<2(V;Lk6vrLg^=7-W7n}TaOM0RJ z%#K9rw`2!uqM7H#yGyj^r?c*LjVv!(=d^236&VtqFyO8kNkK;9g+q&fAo<$m&q=)e zX1nB-48X=@w^FH907lQ$V?XRjMf#U=bm?QRLT$sL#4bBC076H9&|n{uNWtJRfb);7 z*@a$j^-3<>L%!yzCruWAi_W#;2WGcAz%!5Q?Z$LPfOlyQapo%l#JyV>jT!)&J-24B zstPVEd=FqBpWG0_s~$@I8Y#T?y6$HD8W}QDHUDBy!+;3VAADj@0^xh3o8|@-z%z78 zGCa{ZEE0tX{XVPRNNHC?h`uENXHA@f44B2)CQ@g0iG&SP^}_?P$PEhtqZ7f$5m_HX z(zC#;rNcm+*j1TIfiw-4{$RykX%w5?H>u{|036ZzV~AmaJbQgWz)1N8Am!?Vp!}UA z;Luo~KB zAWh9}T6mHK&%FK}Y-3IYfVU`{%Df5Sukv9FW0XdMw=Q>sZ)uamUbr+4F@n}%5N|GE zaQsM+!g~-TMCZeCEO9G!dXU;~%vnc*jjhP2kc3_v#eTq=6@eItyw^p(y9%7SNt3vn zG;j>fzu@UIuycbhJO69|-ES|XnHwfgn#8mli_|fkL3@);9aX^a7NeWgd@6>&^JpOl zk&r}V4ocD^ZUJ=8H%RJ!3=y)ch8To9<)5esm1Q91uRX}F=2Z}G4OND9@B1()Mu0Vo zLa6G$h4M!gAt{Z8!02}n07nM{$SA-b6ykrB;y*N4b5q5IR+5XEuTDHfqR#d z`43uACFF6_LWGafHQw%Rm9h;0Dr`JqmY8an-bA(oRWy- zzl@rZdr?)2fU`Ob2LJYH)+>oZS&a9oAiP_f128HNd?%7d==@VjaM}Gfz|g%emN^Cb z?UXy~nnnW*2R&LMVx>VuU;j5;kO7efl5_-Hc?8=B(r{c2jZxYP$6{Wbe%*tz!w3*M ztA1b--%!9PPe?V*%c)e95>Za1Gsl4F(D|KQPl&NWhGV4!|>IAYV;z zIc+NmI`iuL(J@|5+l!tr6xP#4DLg9lqip?Oar1uy*Z(X1&q+8D4WbB_%!H2Cxb%=G zlJV$iu~x5YUe5*gkk6 zM6+|2g?Ww2Lp*WSRL>9M=)W7Q`MVOy6&j?9-=zU2w?_Q!BV_k6$%`hD^-E=wQzOaz zvPAKqG+A_4ZF^Rh@M(7XT(33P(uwz|M4XoxQE_YDNsH*2ZF9_6Ws9m*PW`YcPi*tq zfxEqSWbD&aV}h0B+i_WJ^9Q9(LfstQ#;LsY;)5q6mgZZmN?$LOM@N}AJ4=$aYzMdI~RlIk;1&v4Hrv|g})%hK7(_o#oV<L*ss%%0zoR>0g zIMYPI5Z!;e%~Kbllyo-z6v8%Kc(Y7Ml_os#S0Y995T8H{cbV!#3S-+%5&7fYiIS#oG3amK7K1w%L+vh*LLF*`c(F1tsgxe_A}6jO@6(Uk7mZ3b z9T(4U;4Z3*QX5ICt06uMHAsAu_A5u^9DkE^>rlfIwo| zG~C^LYj@ik1WxriDSPB4hvZ5uh0Zx$yz<+i(5kLH*v{_00ZSZ0&z$r8?XW#&l&U+* zHECY&V9V;^=M+4bN$J@pw4~sbdZRtwYmLeqNelbIC|h@w{fCf#M1Q~HwL&y$@7mqR zma@;Z!O^I%-C!nkrSpJ^{AfIk`eoIdcSnLjkTS6&jvSU`>Softi}JW)_`QQLel1?3 zoIbbBZPoE)8$8e+YhwqSHL}l+MyZ6ZB2-Dju)`17iL>8zQ~g(UzBeuahV6=lr#`)jkHupcY(zFwi`IOdC=q~L*fAN}jE0aJ>5 zl_Dx;gro98T|GO)^w|MApyunIyl*|-QJ+%uD>yf*IqsqqS&d-M%d6dN=)-R=!4@`c z1=qbpk+3kPLfqK3DF+O{JfQ-$U5k07XFk%L3j)k0&g5ftuz`m-?bmAbOT@;~qy)XfTZm~Mp&r$K|XAG#d5|&9r zN;RFoe-I+kdYr(AftWdg))~P;fh}s6)vpCbJ;LQ3iNa!pCMu-3bF@*lg>z z#Dd}UmA9<6M3k?^SI=w0^agT`os%fr7`eJcXP#eeR3I%+`0ZD4BLp9tE;Ki+@|$4v9{bbKfugEBkM zWE#NB>uZ7VEtA<;qp@~*NE7y+Cq>!K9jUf{+ycaq>8Sl27)5$o-g~P8CNjd_I}H37 zk*{UNS0S6VFBM7w^O^}LcpR-VKk7w;6j%~IufutC`rTi7V7BjxYEpSjTq+X;sPKjz}b>)FGYM=y#4*#Hi|T7OT(4K zORLVR6d$c!2O>e8zNo(HmHu<@<*uwrPH0lCA8^<2*m5*Dv;>cb{OAXsT3gWl_0;Jdz3(xOWwHHS5Ax|}%qZvS*i5p0 z_|RVE1?{Gl+Y!y{>@25Gke}sbkDYp`7lKwSN!K4X#cNg+dK`TaDB<#>}LNJ1={R z2F{=+JpN8&kjLDHru**-;EMXC!)FPnL3i2nhZ1Mw2CTg?XIjc@rJ|e;<+EpNo74;k z?7cB!9--RzgO-!_2E*ScF6oChE}3K_XEi4;@^to@<mb1cpn{Fg{m*!Re>Kw?Q-xZDWr{ez|WZyK38~zlKu9 zZK0JtPM$AiXF7ymV!~^-MjVsDQa2UR&VIg|SjWjwA>%(aJh`iVaYQdw99^_)rn9zh zy7kNMFw`p-2FHClwSHhB{)OJQR)fJ;ZLAo~d9~`hjS1cw3ip|2f13I2aXq!AA#70T z>!}liy?BGjDE%0*vzi~Ke3DeN%T3{Al7w-;1)L+Rb-YPY{wuSvniEM{zX^k`I+BGN zoQ=ss-}4{t2-RZ}SvDTU&p!4fmRn9fI6=)Fb0yVGUChjSJK1i3!s+PbSAK)K{-rK9 zsy1c!-di6gULJPh{c@>gkRK^3^%sZqW`1h5Atoa4iLN|e+|#@*-zJ`Wp8S{a>5@h>#w zX}VoqR%`fNwyq^!8x}0j6X-T+^Pcisci_$)*jR^?S}K zqgz|TY{kJ(nWqh>b{yP}IU6@8gx74)GtHKAd@6^ba^1ZsX%h_Vw2~K-l}6X+-G$@b zZFWzx|L8?sLiCtqW~{U|?xLi0_Z4Ev)QurJ63Xozx$r^VJf;1BxQ%L6$A7wcHzker z9MwCmN6OU~SI7M@^=%FK_4EFUUHVPTd!T$vBGK6QwTK^Y3$j@-G^p#gWLD$oh;7Lx z8Jn)9EP8_9{JLTDnn3Km4-06mRRCiNzD7(jheX! zlqmfc15);Lr4!2CTT)EPjX6vQZP(1zBxYXX~n(VBM*7X>^A+n$9UOF^SzG7Bqh?#tBwq{>j7vtNZ zCZtZjC3Bj3bfb7S?yv667MS))Fq5=aIDY>3t@+=&ik7B}{-)!`cXRNhslw*2=d!@u zw_AC%^{qi0KhR4Rf=KFV-Nn+ttW*r7C@o<9e<^OqR&b&C+;`5i$oY+XWiSh>W?rp) z>>vn#aeA1GJ^fUiBz6U(>#5qLcQqP5v{P4g#^t$OIY<$0vye{7($c%|3WN@{l_U!% z#(mD;LifAVcXz99SmvnsC+@L&ko&Ar0aKRk6 Y!noCN>CFc8Cl$b<0~Y&p_c>qvFBU5L{Qv*} literal 0 HcmV?d00001 diff --git a/public/index.html b/public/index.html new file mode 100644 index 0000000..04f058d --- /dev/null +++ b/public/index.html @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + Music Editor + + + + +
+ + + + \ No newline at end of file diff --git a/public/manifest.json b/public/manifest.json new file mode 100644 index 0000000..abf86e9 --- /dev/null +++ b/public/manifest.json @@ -0,0 +1,40 @@ +{ + "short_name": "Music Editor", + "name": "Music Editor for Standard Notes", + "icons": [ + { + "src": "icon-16x16.png", + "sizes": "16x16", + "type": "image/png" + }, + { + "src": "icon-32x32.png", + "sizes": "32x32", + "type": "image/png" + }, + { + "src": "icon.png", + "sizes": "24x24", + "type": "image/png" + }, + { + "src": "icon-64x64.png", + "sizes": "64x64", + "type": "image/png" + }, + { + "src": "icon192.png", + "type": "image/png", + "sizes": "192x192" + }, + { + "src": "icon512.png", + "type": "image/png", + "sizes": "512x512" + } + ], + "start_url": ".", + "display": "standalone", + "theme_color": "#000000", + "background_color": "#ffffff" +} diff --git a/public/package.json b/public/package.json new file mode 100644 index 0000000..c502d0f --- /dev/null +++ b/public/package.json @@ -0,0 +1,24 @@ +{ + "name": "music-editor", + "version": "0.1.0", + "description": "Music Editor for Standard Notes. Write music with VexTab and VexFlow", + "keywords": [ + "Music Editor", + "Standard Notes", + "VexTab", + "VexFlow" + ], + "private": true, + "author": "Theodore Chu", + "license": "AGPL-3.0-or-later", + "repository": { + "type": "git", + "url": "https://github.com/TheodoreChu/music-editor.git" + }, + "bugs": { + "url": "https://github.com/TheodoreChu/music-editor/issues" + }, + "sn": { + "main": "build/index.html" + } +} diff --git a/public/robots.txt b/public/robots.txt new file mode 100644 index 0000000..e9e57dc --- /dev/null +++ b/public/robots.txt @@ -0,0 +1,3 @@ +# https://www.robotstxt.org/robotstxt.html +User-agent: * +Disallow: diff --git a/public/sample.ext.json b/public/sample.ext.json new file mode 100644 index 0000000..3189f53 --- /dev/null +++ b/public/sample.ext.json @@ -0,0 +1,13 @@ +{ + "identifier": "net.musiceditor.develop-local", + "name": "Music Editor - Develop Local", + "content_type": "SN|Component", + "area": "editor-editor", + "version": "0.1.0", + "description": "Music Editor for Standard Notes. Write music with VexTab and VexFlow", + "url": "http://localhost:3000", + "download_url": "", + "latest_url": "", + "marketing_url": "https://musiceditor.net", + "thumbnail_url": "" +} diff --git a/src/App.scss b/src/App.scss new file mode 100644 index 0000000..74b5e05 --- /dev/null +++ b/src/App.scss @@ -0,0 +1,38 @@ +.App { + text-align: center; +} + +.App-logo { + height: 40vmin; + pointer-events: none; +} + +@media (prefers-reduced-motion: no-preference) { + .App-logo { + animation: App-logo-spin infinite 20s linear; + } +} + +.App-header { + background-color: #282c34; + min-height: 100vh; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + font-size: calc(10px + 2vmin); + color: white; +} + +.App-link { + color: #61dafb; +} + +@keyframes App-logo-spin { + from { + transform: rotate(0deg); + } + to { + transform: rotate(360deg); + } +} diff --git a/src/App.test.tsx b/src/App.test.tsx new file mode 100644 index 0000000..2a68616 --- /dev/null +++ b/src/App.test.tsx @@ -0,0 +1,9 @@ +import React from 'react'; +import { render, screen } from '@testing-library/react'; +import App from './App'; + +test('renders learn react link', () => { + render(); + const linkElement = screen.getByText(/learn react/i); + expect(linkElement).toBeInTheDocument(); +}); diff --git a/src/App.tsx b/src/App.tsx new file mode 100644 index 0000000..5bedb7f --- /dev/null +++ b/src/App.tsx @@ -0,0 +1,26 @@ +import React from 'react'; +import logo from './logo.svg'; +import './App.scss'; + +function App() { + return ( +
+
+ logo +

+ Edit src/App.tsx and save to reload. +

+ + Learn React + +
+
+ ); +} + +export default App; diff --git a/src/components/MusicEditor.tsx b/src/components/MusicEditor.tsx new file mode 100644 index 0000000..7895522 --- /dev/null +++ b/src/components/MusicEditor.tsx @@ -0,0 +1,372 @@ +import * as React from 'react'; +import { EditorKit, EditorKitDelegate } from 'sn-editor-kit'; +import { Vex, VexTab, Artist } from 'vextab'; + +type Mode = { + type: ModeType; + label: string; + css: string; +}; + +enum ModeType { + Edit = 0, + Split = 1, + View = 2, +} + +enum MouseEvent { + Down = 'mousedown', + Move = 'mousemove', + Up = 'mouseup', +} + +enum HtmlElementId { + ColumnResizer = 'column-resizer', + Editor = 'editor', + EditorContainer = 'editor-container', + Header = 'header', + MusicEditor = 'music-editor', + View = 'view', + PrintButton = 'print-button', +} + +enum CssClassList { + Dragging = 'dragging', + NoSelection = 'no-selection', +} + +enum ComponentDataKey { + Mode = 'mode', +} + +const modes = [ + { type: ModeType.Edit, label: 'Edit', css: 'edit' } as Mode, + { type: ModeType.Split, label: 'Split', css: 'split' } as Mode, + { type: ModeType.View, label: 'View', css: 'view' } as Mode, +]; + +type MusicEditorState = { + text: string; + mode: Mode; + platform?: string; +}; + +const debugMode = false; + +const keyMap = new Map(); + +const initialState = { + mode: modes[1], + text: 'options scale=1.0\n\ntabstave notation=true tablature=false\nnotes ', +}; + +export default class MusicEditor extends React.Component<{}, MusicEditorState> { + editorKit: any; + note: any; + + constructor(props: any) { + super(props); + this.state = initialState; + } + + componentDidMount = () => { + this.configureEditorKit(); + this.configureResizer(); + }; + + configureEditorKit() { + const delegate = new EditorKitDelegate({ + setEditorRawText: (text: string) => { + this.setState( + { + text, + }, + () => { + if (!this.state.text) { + this.setState({ + text: initialState.text, + }); + } + this.renderMusic(); + this.loadSavedMode(); + } + ); + }, + clearUndoHistory: () => {}, + getElementsBySelector: () => [], + }); + + this.editorKit = new EditorKit({ + delegate: delegate, + mode: 'plaintext', + supportsFilesafe: false, + }); + } + + saveNote = () => { + this.editorKit.onEditorValueChanged(this.state.text); + }; + + handleInputChange = (event: React.ChangeEvent) => { + const target = event.target; + const value = target.value; + + this.setState( + { + text: value, + }, + () => { + this.saveNote(); + this.renderMusic(); + } + ); + }; + + renderMusic = () => { + const view = document.getElementById(HtmlElementId.View); + if (view) { + view.innerHTML = ''; + } + // Create VexFlow Renderer from canvas element with id #view + const Renderer = Vex.Flow.Renderer; + const renderer = new Renderer(view, Renderer.Backends.SVG); + + // Initialize VexTab artist and parser. + const artist = new Artist(10, 10, 600, { scale: 0.8 }); + const tab = new VexTab(artist); + try { + tab.parse(this.state.text); + artist.render(renderer); + } catch (e) { + if (view) { + const helpMessage = `



Need help? Check out the VexTab Tutorial.`; + view.innerHTML = e + helpMessage; + } + if (debugMode) { + console.log(e); + } + } + }; + + loadSavedMode = () => { + try { + const savedMode = this.editorKit.internal.componentManager.componentDataValueForKey( + ComponentDataKey.Mode + ) as ModeType; + if (debugMode) { + console.log('loaded savedMode: ' + savedMode); + } + if (savedMode) { + this.setModeFromModeType(savedMode); + } + this.setState( + { + platform: this.editorKit.internal.componentManager.platform, + }, + () => { + if (debugMode) { + console.log(this.state.platform); + } + } + ); + } catch (e) { + if (debugMode) { + console.log('Error when loading saved mode: ' + e); + } + } + }; + + setModeFromModeType = (value: ModeType) => { + for (const mode of modes) { + if (mode.type === value) { + this.logDebugMessage('setModeFromModeType mode: ', mode.type); + this.setState( + { + mode, + }, + () => { + this.renderMusic(); + } + ); + return; + } + } + }; + + changeMode = (mode: Mode) => { + this.setState( + { + mode, + }, + () => { + this.renderMusic(); + } + ); + this.logDebugMessage('changeMode mode: ', mode.type); + try { + this.editorKit.internal.componentManager.setComponentDataValueForKey( + ComponentDataKey.Mode, + mode.type + ); + } catch (e) { + if (debugMode) { + console.log('Error saving mode: ' + e); + } + } + }; + + removeSelection = () => { + let selection = window.getSelection(); + if (selection) { + selection.removeAllRanges(); + } + }; + + configureResizer = () => { + const musicEditor = document.getElementById(HtmlElementId.MusicEditor); + const editor = document.getElementById(HtmlElementId.Editor); + const columnResizer = document.getElementById(HtmlElementId.ColumnResizer); + let pressed = false; + let safetyOffset = 15; + let resizerWidth = 0; + if (columnResizer) { + resizerWidth = columnResizer.offsetWidth; + } + + if (editor && columnResizer) { + columnResizer.addEventListener(MouseEvent.Down, (event) => { + pressed = true; + columnResizer.classList.add(CssClassList.Dragging); + editor.classList.add(CssClassList.NoSelection); + }); + } + + document.addEventListener(MouseEvent.Move, (event) => { + if (!pressed) { + return; + } + let x = event.clientX; + if (musicEditor) { + if (x < resizerWidth / 2 + safetyOffset) { + x = resizerWidth / 2 + safetyOffset; + } else if (x > musicEditor.offsetWidth - resizerWidth - safetyOffset) { + x = musicEditor.offsetWidth - resizerWidth - safetyOffset; + } + } + + const colLeft = x - resizerWidth / 2; + if (columnResizer) { + columnResizer.style.left = colLeft + 'px'; + } + if (editor) { + editor.style.width = colLeft - safetyOffset + 'px'; + } + + this.removeSelection(); + }); + + document.addEventListener(MouseEvent.Up, (event) => { + if (pressed) { + pressed = false; + if (columnResizer) { + columnResizer.classList.remove(CssClassList.Dragging); + } + if (editor) { + editor.classList.remove(CssClassList.NoSelection); + } + } + }); + }; + + onKeyDown = (event: React.KeyboardEvent) => { + keyMap.set(event.key, true); + if (!keyMap.get('Shift') && keyMap.get('Tab')) { + event.preventDefault(); + document.execCommand('insertText', false, '\t'); + } else if (keyMap.get('Control') && keyMap.get('s')) { + event.preventDefault(); + } + }; + + onKeyUp = (event: React.KeyboardEvent) => { + keyMap.delete(event.key); + }; + + onBlur = () => { + keyMap.clear(); + }; + + logDebugMessage = (message: string, object: any) => { + if (debugMode) { + console.log(message, object); + } + }; + + print = () => { + this.renderMusic(); + window.print(); + }; + + render() { + return ( +
+
+
+
+ {modes.map((mode) => ( + + ))} +
+
+ +
+
+